Commit 4eb6f017 authored by Tong Li's avatar Tong Li

优化速度

parent 23cc3c4a
...@@ -327,7 +327,7 @@ public class GeneticAlgorithm { ...@@ -327,7 +327,7 @@ public class GeneticAlgorithm {
{ {
FileHelper.writeLogFile("解码---------------"+population.size() ); FileHelper.writeLogFile("解码---------------"+population.size() );
GeneticDecoder decoder = new GeneticDecoder(_GlobalParam, param.getBaseTime(), machines, orders, materials, machineScheduler, orderMaterials); GeneticDecoder decoder = new GeneticDecoder(_GlobalParam, param.getBaseTime(), machines, orders, materials, machineScheduler,orderMaterials);
if(1==2) { if(1==2) {
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))
...@@ -337,11 +337,13 @@ public class GeneticAlgorithm { ...@@ -337,11 +337,13 @@ public class GeneticAlgorithm {
if (population != null && population.size() > 0) { if (population != null && population.size() > 0) {
population.forEach(chromosome -> { population.parallelStream().forEach(chromosome -> {
decode(decoder, chromosome, param, allOperations, globalOpList); decode(decoder, chromosome, param, allOperations, globalOpList);
}); });
} }
//}
} }
private void decode(GeneticDecoder decoder,Chromosome chromosome,ScheduleParams param, List<Entry> allOperations,List<GlobalOperationInfo> globalOpList) { private void decode(GeneticDecoder decoder,Chromosome chromosome,ScheduleParams param, List<Entry> allOperations,List<GlobalOperationInfo> globalOpList) {
......
...@@ -379,8 +379,8 @@ if(finishedOrder==null||finishedOrder.size()==0) ...@@ -379,8 +379,8 @@ if(finishedOrder==null||finishedOrder.size()==0)
// FileHelper.writeLogFile(" 开始 "+operation.getGroupId()+" : "+operation.getId()+",处理时间: " + processingTime + ", 后处理: " + teardownTime + FileHelper.writeLogFile(" 开始 "+operation.getGroupId()+" : "+operation.getId()+",处理时间: " + processingTime + ", 后处理: " + teardownTime +
// ", 前处理: " + preTime + ", 换型: " + setupTime+ ", 数量: " + operation.getQuantity()+ ", 设备: "+machine.getId()+ ", 是否可中断: "+operation.getIsInterrupt()); ", 前处理: " + preTime + ", 换型: " + setupTime+ ", 数量: " + operation.getQuantity()+ ", 设备: "+machine.getId()+ ", 是否可中断: "+operation.getIsInterrupt());
// 确定任务的最早开始时间(基于前一道工序的完整结束时间,包含后处理) // 确定任务的最早开始时间(基于前一道工序的完整结束时间,包含后处理)
......
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