Commit e647dc92 authored by Tong Li's avatar Tong Li

遗传算法-策略

parent a9f7d0cc
package com.aps.entity;
import lombok.Data;
/**
* 作者:佟礼
* 时间:2025-12-10
*/
@Data
public class ConfigSetting {
private int id;
private String title;
private boolean value;
private String content;
}
package com.aps.entity;
/**
* 作者:佟礼
* 时间:2025-12-10
*/
public class StrategyScheduling {
private String name;
private String title;
private String content;
private int amplitude;
private boolean value;
}
......@@ -70,6 +70,16 @@ public class PlanResultService {
@Autowired
private RoutingDataService _routingDataService;
@Autowired
private ConfigService _configService;
@Autowired
private StrategyRuleService _strategyRuleService;
private LocalDateTime baseTime = LocalDateTime.of(2025, 11, 1, 0, 0, 0);
public List<ScheduleChromosome> execute() {
......@@ -302,11 +312,23 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
List<Entry> entrys=(List<Entry>)list.get(1);
List<GroupResult> entryRel=(List<GroupResult>)list.get(2);
Config config= _configService.lambdaQuery()
.eq(Config::getComponent,"setting")
.one();
StrategyRule strategyRules= _strategyRuleService.lambdaQuery()
.eq(StrategyRule::getIsDeleted,0)
.eq(StrategyRule::getIsGlobal,1)
.one();
GlobalParam globalParam=new GlobalParam();
// 5. 执行调度算法
GeneticAlgorithm scheduler =new GeneticAlgorithm(globalParam,machines,orders,null,machineScheduler,entryRel); //new GeneticAlgorithm(products, machines, orders, machineScheduler);
param.initAdaptiveParams(entrys.size());
double[] customWeights = new double[] { 0.2, 0.1, 0.1, 0.1, 0.5 }; // 延迟时间权重提升到0.5
scheduler.Init(null,false);
Chromosome chromosome =scheduler.Run(param,entrys);
KpiCalculator kpiCalculator=new KpiCalculator(chromosome);
......@@ -523,6 +545,9 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
// 5. 执行调度算法
GeneticAlgorithm scheduler =new GeneticAlgorithm(globalParam,machines,orders,null,machineScheduler,entryRel); //new GeneticAlgorithm(products, machines, orders, machineScheduler);
param.initAdaptiveParams(entrys.size());
// double[] customWeights = new double[] { 0.2, 0.1, 0.1, 0.1, 0.5 }; // 延迟时间权重提升到0.5
scheduler.Init(null,true);
Chromosome chromosomes =scheduler.Run(param,entrys);
KpiCalculator kpiCalculator=new KpiCalculator(chromosomes);
kpiCalculator.calculatekpi();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment