Commit cb20ded9 authored by Tong Li's avatar Tong Li

优化

parent a94f7c82
...@@ -788,7 +788,7 @@ public class GeneticDecoder { ...@@ -788,7 +788,7 @@ public class GeneticDecoder {
Entry currentOp = orderOps.get(scheduledCount); Entry currentOp = orderOps.get(scheduledCount);
FileHelper.writeLogFile("工序:"+currentOp.getId());
int opSequence = currentOp.getSequence(); int opSequence = currentOp.getSequence();
...@@ -863,7 +863,8 @@ public class GeneticDecoder { ...@@ -863,7 +863,8 @@ public class GeneticDecoder {
orderProcessCounter.put(groupId, orderProcessCounter.get(groupId) + 1); orderProcessCounter.put(groupId, orderProcessCounter.get(groupId) + 1);
orderLastEndTime.put(groupId, actualEndTime); orderLastEndTime.put(groupId, actualEndTime);
if (isJit&& orderProcessCounter.get(groupId) >= entrysBygroupId.get(groupId).size()) { if(false){
// if (isJit&& orderProcessCounter.get(groupId) >= entrysBygroupId.get(groupId).size()) {
List<Entry> orderOpsBySeq = entrysBygroupId.get(groupId).stream() List<Entry> orderOpsBySeq = entrysBygroupId.get(groupId).stream()
.sorted(Comparator.comparingInt(Entry::getSequence)) .sorted(Comparator.comparingInt(Entry::getSequence))
...@@ -1503,10 +1504,10 @@ public class GeneticDecoder { ...@@ -1503,10 +1504,10 @@ public class GeneticDecoder {
Entry op= entryIndexById.get(result.getOperationId()); Entry op= entryIndexById.get(result.getOperationId());
Map<String, MaterialDeduction> deductions = readOperationStockDeductions(op); // Map<String, MaterialDeduction> deductions = readOperationStockDeductions(op);
if (deductions != null && !deductions.isEmpty()) { // if (deductions != null && !deductions.isEmpty()) {
rollbackOperationStockDeduction(chromosome, deductions); // rollbackOperationStockDeduction(chromosome, deductions);
} // }
} }
machineTasksCache.clear(); machineTasksCache.clear();
...@@ -1540,10 +1541,10 @@ public class GeneticDecoder { ...@@ -1540,10 +1541,10 @@ public class GeneticDecoder {
Entry op= entryIndexById.get(result.getOperationId()); Entry op= entryIndexById.get(result.getOperationId());
Map<String, MaterialDeduction> deductions = readOperationStockDeductions(op); // Map<String, MaterialDeduction> deductions = readOperationStockDeductions(op);
if (deductions != null && !deductions.isEmpty()) { // if (deductions != null && !deductions.isEmpty()) {
rollbackOperationStockDeduction(chromosome, deductions); // rollbackOperationStockDeduction(chromosome, deductions);
} // }
Machine machine = getMachineById(chromosome, result.getMachineId()); Machine machine = getMachineById(chromosome, result.getMachineId());
if (machine != null) { if (machine != null) {
AddMachineAvailable(machine, result.getGeneDetails()); AddMachineAvailable(machine, result.getGeneDetails());
......
...@@ -115,6 +115,7 @@ public class HybridAlgorithm { ...@@ -115,6 +115,7 @@ public class HybridAlgorithm {
List<GlobalOperationInfo> globalOpList =new ArrayList<>();// initialization.generateGlobalOpList(); List<GlobalOperationInfo> globalOpList =new ArrayList<>();// initialization.generateGlobalOpList();
// 初始化变邻域搜索 // 初始化变邻域搜索
_vns = new VariableNeighborhoodSearch( allOperations,orders,materials,_entryRel, _fitnessCalculator ); _vns = new VariableNeighborhoodSearch( allOperations,orders,materials,_entryRel, _fitnessCalculator );
_vns.initMachineSelectFrequency();
_hillClimbing = new HillClimbing(allOperations,orders,materials,_entryRel, _fitnessCalculator); _hillClimbing = new HillClimbing(allOperations,orders,materials,_entryRel, _fitnessCalculator);
_simulatedAnnealing = new SimulatedAnnealing( allOperations,orders,materials,_entryRel, _fitnessCalculator); _simulatedAnnealing = new SimulatedAnnealing( allOperations,orders,materials,_entryRel, _fitnessCalculator);
_tabuSearch = new TabuSearch(allOperations,orders,materials,_entryRel, _fitnessCalculator); _tabuSearch = new TabuSearch(allOperations,orders,materials,_entryRel, _fitnessCalculator);
...@@ -464,7 +465,7 @@ public class HybridAlgorithm { ...@@ -464,7 +465,7 @@ public class HybridAlgorithm {
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(sharedDecoder, chromosome, param, allOperations, globalOpList), decodeExecutor)) .map(chromosome -> CompletableFuture.runAsync(() -> decode(sharedDecoder, chromosome, param, allOperations, globalOpList), decodeExecutor))
......
...@@ -177,8 +177,8 @@ public class PlanResultService { ...@@ -177,8 +177,8 @@ public class PlanResultService {
* 后续会按场景创建人自动回退到可用的策略配置。 * 后续会按场景创建人自动回退到可用的策略配置。
*/ */
public Chromosome execute2(String SceneId) { public Chromosome execute2(String SceneId) {
return execute2(SceneId, 2361l, 241l, null); // return execute2(SceneId, 2361l, 241l, null);
// return execute2(SceneId, 2321l, 207l, null); return execute2(SceneId, 2321l, 207l, null);
} }
......
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