Commit a87e54e4 authored by Tong Li's avatar Tong Li

半成品

parent 30b5a49e
......@@ -88,7 +88,7 @@ public class GeneticAlgorithm {
List<Chromosome> population = initialization.generateInitialPopulation(param, globalOpList);
population= chromosomeDistinct(population);
population= chromosomeDistinct(population);
......@@ -217,6 +217,10 @@ public class GeneticAlgorithm {
FileHelper.writeLogFile("迭代进化-----------结束-------");
best.setBaseTime(param.getBaseTime());
if(best.getInitMachines()==null)
{
best.setInitMachines(machines);
}
best.setOrderMaterials(orderMaterials);
best.setOperatRel(_entryRel);
......@@ -288,6 +292,7 @@ public class GeneticAlgorithm {
chromosome.setResult(new ArrayList<>());
// 假设Machine类有拷贝方法,或使用MapStruct等工具进行映射
chromosome.setInitMachines(ProductionDeepCopyUtil.deepCopyList(machines)); // 简单拷贝,实际可能需要深拷贝
chromosome.setMachines(ProductionDeepCopyUtil.deepCopyList(machines)); // 简单拷贝,实际可能需要深拷贝
chromosome.setAllOperations(allOperations); // 简单拷贝,实际可能需要深拷贝
chromosome.setGlobalOpList(globalOpList); // 简单拷贝,实际可能需要深拷贝
......
......@@ -290,6 +290,7 @@ if(finishedOrder==null||finishedOrder.size()==0)
int scheduledCount = orderProcessCounter.get(groupId);
List<Entry> orderOps = allOperations.stream()
.filter(t -> t.getGroupId() == groupId)
.sorted(Comparator.comparing(Entry::getSequence))
.collect(Collectors.toList());
if (scheduledCount >= orderOps.size()) {
......
......@@ -425,7 +425,7 @@ Integer newMachineId1=newMachineId.intValue();
od.setPrevOperationId(id);
OperationDependency.add(od);
}
entry.setPrevEntryIds(OperationDependency);
newOp.setPrevEntryIds(OperationDependency);
}
if(nodeInfo.getNewChildIds()!=null)
{
......@@ -435,7 +435,7 @@ Integer newMachineId1=newMachineId.intValue();
od.setNextOperationId(id);
OperationDependency.add(od);
}
entry.setNextEntryIds(OperationDependency);
newOp.setNextEntryIds(OperationDependency);
}
newOp.setQuantity(newids.get(nodeInfo.getOriginalId()));
newOp.setMainId(MainId);
......
......@@ -429,6 +429,16 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
_sceneService.saveChromosomeToFile(chromosome, SceneId);
return chromosome;
}
public void Redecode(String SceneId)
{
Chromosome chromosome= _sceneService.loadChromosomeFromFile(SceneId);
ScheduleOperationService ScheduleOperation=new ScheduleOperationService();
GlobalParam globalParam=new GlobalParam();
ScheduleOperation.redecode(chromosome, chromosome.getBaseTime(), globalParam);
WriteScheduleSummary(chromosome);
}
public Chromosome SpiltOperation(String SceneId,int opId,Double[] splitCounts) {
......
......@@ -37,14 +37,15 @@ public class PlanResultServiceTest {
// nsgaiiUtils.Test();
// planResultService.execute2("31EC5BAF7F6B41DFB79AB031D81C53C0");
planResultService.execute2("4072BCD6A43B468F96489211AD041A26");
planResultService.execute2("8B13052B347B4FC4B21D59E685B06642");
// LocalDateTime t= LocalDateTime.of(2025, 11, 15, 6, 51, 11);
// List<Integer> opids=new ArrayList<>();
// opids.add(1);
// planResultService.Move("B571EF6682DB463AB2977B1055A74112",opids,t,3403L);
// planResultService.Redecode("B6AE363FF5044DDF8DECE32D5FE0F7EA");
// planResultService.Move("B571EF6682DB463AB2977B1055A74112",2,t,3243L);
//planResultService.SpiltOperation("B6AE363FF5044DDF8DECE32D5FE0F7EA",5,new Double[]{6d, 5d});
}
@Test
......
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