Commit 587dadb1 authored by Tong Li's avatar Tong Li

bug

parent 6fefd6ad
...@@ -58,7 +58,7 @@ public class GeneticDecoder { ...@@ -58,7 +58,7 @@ public class GeneticDecoder {
private DiscreteParameterMatrixService discreteParameterMatrixService; private DiscreteParameterMatrixService discreteParameterMatrixService;
private String sceneId; private String sceneId;
private boolean rebuildStructureForCurrentDecode = false; private boolean rebuildStructureForCurrentDecode = true;
...@@ -405,6 +405,7 @@ public class GeneticDecoder { ...@@ -405,6 +405,7 @@ public class GeneticDecoder {
chromosome.setScenarioID(sceneId); chromosome.setScenarioID(sceneId);
if (rebuildStructureForCurrentDecode) { if (rebuildStructureForCurrentDecode) {
//创建半成品订单
materialRequirementService.buildMultiLevelRequirementNetwork(chromosome, sceneId, baseTime,_globalParam); materialRequirementService.buildMultiLevelRequirementNetwork(chromosome, sceneId, baseTime,_globalParam);
} }
......
...@@ -456,7 +456,7 @@ int opcount=allOperations.size(); ...@@ -456,7 +456,7 @@ int opcount=allOperations.size();
FileHelper.writeLogFile("解码---------------"+population.size() ); FileHelper.writeLogFile("解码---------------"+population.size() );
GeneticDecoder decoder = new GeneticDecoder(_GlobalParam, param.getBaseTime(), machines, orders, materials, machineScheduler,materialRequirementService, sceneId); GeneticDecoder decoder = new GeneticDecoder(_GlobalParam, param.getBaseTime(), machines, orders, materials, machineScheduler,materialRequirementService, sceneId);
boolean ismore=true; boolean ismore=false;
if(ismore) { if(ismore) {
CompletableFuture.allOf(population.stream() CompletableFuture.allOf(population.stream()
.map(chromosome -> CompletableFuture.runAsync(() -> decode(decoder, chromosome, param, allOperations, globalOpList), decodeExecutor)) .map(chromosome -> CompletableFuture.runAsync(() -> decode(decoder, chromosome, param, allOperations, globalOpList), decodeExecutor))
......
...@@ -1700,7 +1700,7 @@ public class VariableNeighborhoodSearch { ...@@ -1700,7 +1700,7 @@ public class VariableNeighborhoodSearch {
private Chromosome generateReverseNeighbor(Chromosome chromosome,Map<Integer, Entry> positionIndex,List<List<Integer>> positionByPriority) { private Chromosome generateReverseNeighbor(Chromosome chromosome,Map<Integer, Entry> positionIndex,List<List<Integer>> positionByPriority) {
Chromosome neighbor = copyChromosome(chromosome); //ProductionDeepCopyUtil.deepCopy(chromosome, Chromosome.class); Chromosome neighbor = copyChromosome(chromosome); //ProductionDeepCopyUtil.deepCopy(chromosome, Chromosome.class);
List<Integer> os = neighbor.getOperationSequencing(); List<Integer> os = neighbor.getOperationSequencing();
if (os.size() >= 2) { if (os.size() >= 2&&positionByPriority.size()>0) {
// Map<Integer, Entry> positionIndex = buildPositionToEntryIndex(neighbor); // Map<Integer, Entry> positionIndex = buildPositionToEntryIndex(neighbor);
int maxAttempts = 50; int maxAttempts = 50;
...@@ -1771,7 +1771,7 @@ public class VariableNeighborhoodSearch { ...@@ -1771,7 +1771,7 @@ public class VariableNeighborhoodSearch {
private Chromosome generateInsertNeighbor(Chromosome chromosome,Map<Integer, Entry> positionIndex,List<List<Integer>> positionByPriority) { private Chromosome generateInsertNeighbor(Chromosome chromosome,Map<Integer, Entry> positionIndex,List<List<Integer>> positionByPriority) {
Chromosome neighbor=copyChromosome(chromosome);// ProductionDeepCopyUtil.deepCopy(chromosome, Chromosome.class); Chromosome neighbor=copyChromosome(chromosome);// ProductionDeepCopyUtil.deepCopy(chromosome, Chromosome.class);
List<Integer> os = neighbor.getOperationSequencing(); List<Integer> os = neighbor.getOperationSequencing();
if (os.size() >= 2) { if (os.size() >= 2&&positionByPriority.size()>0) {
// Map<Integer, Entry> positionIndex = buildPositionToEntryIndex(neighbor); // Map<Integer, Entry> positionIndex = buildPositionToEntryIndex(neighbor);
int maxAttempts = 50; int maxAttempts = 50;
...@@ -2167,15 +2167,20 @@ public class VariableNeighborhoodSearch { ...@@ -2167,15 +2167,20 @@ public class VariableNeighborhoodSearch {
} }
groupidByPriority.entrySet().removeIf(entry -> entry.getValue().size() == 1); groupidByPriority.entrySet().removeIf(entry -> entry.getValue().size() == 1);
// if(groupidByPriority.size()!=0)
// {
indexByPriorityMap.keySet().removeIf(key -> !groupidByPriority.containsKey(key)); indexByPriorityMap.keySet().removeIf(key -> !groupidByPriority.containsKey(key));
//}
List<Map.Entry<Double, List<Integer>>> sortedEntries = new ArrayList<>(indexByPriorityMap.entrySet()); List<Map.Entry<Double, List<Integer>>> sortedEntries = new ArrayList<>(indexByPriorityMap.entrySet());
// if(groupidByPriority.size()!=0) {
sortedEntries.sort((e1, e2) -> { sortedEntries.sort((e1, e2) -> {
int size1 = groupidByPriority.get(e1.getKey()).size(); int size1 = groupidByPriority.get(e1.getKey()).size();
int size2 = groupidByPriority.get(e2.getKey()).size(); int size2 = groupidByPriority.get(e2.getKey()).size();
return Integer.compare(size2, size1); // 降序:订单数多的排前面 return Integer.compare(size2, size1); // 降序:订单数多的排前面
}); });
// }
List<List<Integer>> indexByPriority = new ArrayList<>(); List<List<Integer>> indexByPriority = new ArrayList<>();
for (Map.Entry<Double, List<Integer>> entry : sortedEntries) { for (Map.Entry<Double, List<Integer>> entry : sortedEntries) {
......
...@@ -42,7 +42,7 @@ public class PlanResultServiceTest { ...@@ -42,7 +42,7 @@ public class PlanResultServiceTest {
// planResultService.execute2("E29F2B3ADA8149F6B916B5119296A92B");//2000 // planResultService.execute2("E29F2B3ADA8149F6B916B5119296A92B");//2000
planResultService.execute2("E2CD1FC6FF9B4B19A59FEC7F846D4952");//600 planResultService.execute2("E2CD1FC6FF9B4B19A59FEC7F846D4952");//600
// planResultService.execute2("EAA0E2D70BC94EEDA2E5A4597BE69523");//bom
// planResultService.execute2("08B1D87FE1B84ECDBAC2E546DDB6FB81");//2000 // planResultService.execute2("08B1D87FE1B84ECDBAC2E546DDB6FB81");//2000
// planResultService.execute2("0428340BB4F540938F1FB5599F03E8A4");//5000 // planResultService.execute2("0428340BB4F540938F1FB5599F03E8A4");//5000
// planResultService.execute2("C8B533BD8944405B9A2F8823C575C204");//500 // planResultService.execute2("C8B533BD8944405B9A2F8823C575C204");//500
......
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