Commit a46c938c authored by DESKTOP-VKRD9QF\Administration's avatar DESKTOP-VKRD9QF\Administration
parents afa564a9 82288acd
......@@ -58,7 +58,7 @@ public class GeneticDecoder {
private DiscreteParameterMatrixService discreteParameterMatrixService;
private String sceneId;
private boolean rebuildStructureForCurrentDecode = false;
private boolean rebuildStructureForCurrentDecode = true;
......@@ -405,6 +405,7 @@ public class GeneticDecoder {
chromosome.setScenarioID(sceneId);
if (rebuildStructureForCurrentDecode) {
//创建半成品订单
materialRequirementService.buildMultiLevelRequirementNetwork(chromosome, sceneId, baseTime,_globalParam);
}
......@@ -588,6 +589,19 @@ public class GeneticDecoder {
public void parallelDecodeByMachine(Chromosome chromosome) {
if (rebuildStructureForCurrentDecode) {
//创建半成品订单
materialRequirementService.buildMultiLevelRequirementNetwork(chromosome, sceneId, baseTime,_globalParam);
}
if(rebuildStructureForCurrentDecode && _globalParam.isIsCheckSf()) {
int isnew= generateGlobalOpList(chromosome);
if(isnew==1) {
CreateNewOpSequence(chromosome);
}
}
// 1. 获取工序处理顺序
List<Integer> operationSequencing = chromosome.getOperationSequencing();
......
......@@ -456,7 +456,7 @@ int opcount=allOperations.size();
FileHelper.writeLogFile("解码---------------"+population.size() );
GeneticDecoder decoder = new GeneticDecoder(_GlobalParam, param.getBaseTime(), machines, orders, materials, machineScheduler,materialRequirementService, sceneId);
boolean ismore=true;
boolean ismore=false;
if(ismore) {
CompletableFuture.allOf(population.stream()
.map(chromosome -> CompletableFuture.runAsync(() -> decode(decoder, chromosome, param, allOperations, globalOpList), decodeExecutor))
......
......@@ -259,7 +259,15 @@ public class RoutingDataService {
List<MachineOption> mos = new ArrayList<>();
for (ProdEquipment e : Equipments) {
Double totalprocessTime=e.getSpeed()/e.getSingleOut().doubleValue()*entry.getQuantity();
Double totalprocessTime=0d;
if(op.getConstTime()==1)//常数时间
{
totalprocessTime=e.getSpeed();
}else {
totalprocessTime=e.getSpeed()/e.getSingleOut().doubleValue()*entry.getQuantity();
}
if(machineIds.containsKey(e.getEquipId()))
{
if( machineIds.get(e.getEquipId())<totalprocessTime)
......
......@@ -646,9 +646,15 @@ public class VariableNeighborhoodSearch {
Entry entry1 = entrybyids.get(op1.getOperationId());
Entry entry2 = entrybyids.get(op2.getOperationId());
if (entry1 == null || entry2 == null) {
if (entry1 == null && entry2 == null) {
return 0;
}
if (entry1 == null) {
return 1;
}
if (entry2 == null) {
return -1;
}
int size1 = priorityToGroupIds.getOrDefault(entry1.getPriority(), new HashSet<>()).size();
int size2 = priorityToGroupIds.getOrDefault(entry2.getPriority(), new HashSet<>()).size();
......@@ -1700,7 +1706,7 @@ public class VariableNeighborhoodSearch {
private Chromosome generateReverseNeighbor(Chromosome chromosome,Map<Integer, Entry> positionIndex,List<List<Integer>> positionByPriority) {
Chromosome neighbor = copyChromosome(chromosome); //ProductionDeepCopyUtil.deepCopy(chromosome, Chromosome.class);
List<Integer> os = neighbor.getOperationSequencing();
if (os.size() >= 2) {
if (os.size() >= 2&&positionByPriority.size()>0) {
// Map<Integer, Entry> positionIndex = buildPositionToEntryIndex(neighbor);
int maxAttempts = 50;
......@@ -1771,7 +1777,7 @@ public class VariableNeighborhoodSearch {
private Chromosome generateInsertNeighbor(Chromosome chromosome,Map<Integer, Entry> positionIndex,List<List<Integer>> positionByPriority) {
Chromosome neighbor=copyChromosome(chromosome);// ProductionDeepCopyUtil.deepCopy(chromosome, Chromosome.class);
List<Integer> os = neighbor.getOperationSequencing();
if (os.size() >= 2) {
if (os.size() >= 2&&positionByPriority.size()>0) {
// Map<Integer, Entry> positionIndex = buildPositionToEntryIndex(neighbor);
int maxAttempts = 50;
......@@ -1840,7 +1846,7 @@ public class VariableNeighborhoodSearch {
for (int i = 1; i <= op.getMachineOptions().size(); i++) {
if (i != currentMachineSeq) {
availableMachines.add(i);
machineOptions.add(op.getMachineOptions().get(i));
machineOptions.add(op.getMachineOptions().get(i-1));
}
}
......@@ -2167,15 +2173,20 @@ public class VariableNeighborhoodSearch {
}
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());
sortedEntries.sort((e1, e2) -> {
int size1 = groupidByPriority.get(e1.getKey()).size();
int size2 = groupidByPriority.get(e2.getKey()).size();
return Integer.compare(size2, size1); // 降序:订单数多的排前面
});
// if(groupidByPriority.size()!=0) {
sortedEntries.sort((e1, e2) -> {
int size1 = groupidByPriority.get(e1.getKey()).size();
int size2 = groupidByPriority.get(e2.getKey()).size();
return Integer.compare(size2, size1); // 降序:订单数多的排前面
});
// }
List<List<Integer>> indexByPriority = new ArrayList<>();
for (Map.Entry<Double, List<Integer>> entry : sortedEntries) {
......
......@@ -42,7 +42,7 @@ public class PlanResultServiceTest {
// planResultService.execute2("E29F2B3ADA8149F6B916B5119296A92B");//2000
planResultService.execute2("E2CD1FC6FF9B4B19A59FEC7F846D4952");//600
// planResultService.execute2("EAA0E2D70BC94EEDA2E5A4597BE69523");//bom
// planResultService.execute2("08B1D87FE1B84ECDBAC2E546DDB6FB81");//2000
// planResultService.execute2("0428340BB4F540938F1FB5599F03E8A4");//5000
// 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