Commit d316b05b authored by Tong Li's avatar Tong Li

bug

parent f322e462
......@@ -366,7 +366,7 @@ public class GeneticAlgorithm {
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))
......
......@@ -102,7 +102,7 @@ public class GeneticDecoder {
{
FileHelper.writeLogFile("解码---------------"+population.size() );
boolean ismore=true;
boolean ismore=false;
if(ismore) {
CompletableFuture.allOf(population.stream()
.map(chromosome -> CompletableFuture.runAsync(() -> decodeChromosomeWithCache(chromosome,false), decodeExecutor))
......@@ -505,6 +505,8 @@ public class GeneticDecoder {
long decodeStart = System.nanoTime();
chromosome.setScenarioID(sceneId);
boolean isJit=_globalParam.isJit();
if (rebuildStructureForCurrentDecode) {
long t1 = System.nanoTime();
//创建半成品订单
......@@ -558,6 +560,7 @@ public class GeneticDecoder {
}
}
if(rebuildStructureForCurrentDecode && _globalParam.isIsCheckSf()) {
long t1 = System.nanoTime();
int isnew= generateGlobalOpList(chromosome);
......@@ -677,12 +680,13 @@ public class GeneticDecoder {
int opCount = 0;
long slowOpThresholdNs = 500_000_000L; // 500ms
for (int groupId : chromosome.getOperationSequencing()) {
int scheduledCount = orderProcessCounter.get(groupId);
if(groupId==7)
{
int i=0;
}
List<Entry> orderOps=new ArrayList<>();
boolean orderIsJit=orderDueDate.get(groupId)>0;
......@@ -770,6 +774,9 @@ if(groupId==7)
}
Entry currentOp = orderOps.get(scheduledCount);
int opSequence = currentOp.getSequence();
GAScheduleResult existingResult = chromosome.getResultOld().stream()
......@@ -792,7 +799,7 @@ if(groupId==7)
boolean opIsJit = orderIsJit
||( Entry.SchedulingMode.BACKWARD.name().equals(
currentOp.getSchedulingMode())&&orderAnchor>=0);
currentOp.getSchedulingMode())&&orderAnchor>0);
int dueDateForOp = opIsJit ? orderAnchor
: (schedInfo != null ? schedInfo.getValue() : 0);
......@@ -800,6 +807,7 @@ if(groupId==7)
machineOption, chromosome, machineIdMap, machineTasksCache, entryIndexById,
scheduleIndexById, dueDateForOp, 0,true, opIsJit);
if (operationResult.isForwardFallbackRequired()) {
// 倒排失败时只修复当前工序及其后道已排工序。
// 例如倒排顺序 3->2->1,2 放不下时撤回 2、3,再按 2->3 放到各自设备最后任务之后。
List<Integer> removeOp = clearOrderSchedulingFromSequence(chromosome, groupId, opSequence,
......@@ -841,6 +849,7 @@ if(groupId==7)
orderProcessCounter.put(groupId, orderProcessCounter.get(groupId) + 1);
orderLastEndTime.put(groupId, actualEndTime);
if (orderProcessCounter.get(groupId) >= entrysBygroupId.get(groupId).size()) {
// if (jitDeferredBomOrderIds.remove(groupId)) {
// entrysBygroupId.get(groupId).stream()
......@@ -869,6 +878,10 @@ if(groupId==7)
}
}
}
}
if(chromosome.getReOrderids()!=null&&chromosome.getReOrderids().size()>0) {
chromosome.getOperationSequencing().removeIf(t -> chromosome.getReOrderids().contains(t));
......@@ -876,6 +889,14 @@ if(groupId==7)
long calcStart = System.nanoTime();
calculateScheduleResult(chromosome);
// FileHelper.writeLogFile("[PERF] serialDecode calculateScheduleResult 耗时=" + fmtMs(System.nanoTime() - calcStart));
// FileHelper.writeLogFile("[PERF] serialDecode 总耗时=" + fmtMs(System.nanoTime() - decodeStart) + ", 工序数=" + opCount + ", 全局工序数=" + globalOpList.size());
}
......
......@@ -460,7 +460,7 @@ public class HybridAlgorithm {
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(sharedDecoder, chromosome, param, allOperations, globalOpList), decodeExecutor))
......
......@@ -295,7 +295,7 @@ public class PlanResultService {
throw new BusinessException("排产计算结果保存失败,请稍后重试或联系管理员");
}
WriteScheduleSummary(chromosome);
// WriteScheduleSummary(chromosome);
return chromosome;
......
......@@ -44,6 +44,8 @@ public class PlanResultServiceTest {
// planResultService.execute2("64E64F6B68094AF38CEDC418630C3CC2");//2000
// planResultService.execute2("E1448B3C9C8743DEAB39708F2CFE348A");//倒排bomces
planResultService.execute2("197083D0D26A449EB179AC103C753FD3");
// planResultService.execute2("9FEDFD92BB6A4675BF9B1CC64505D1AB");
// planResultService.execute2("15210B13B88A453F8B84AAC7F16C7541");//2000
// planResultService.execute2("E29F2B3ADA8149F6B916B5119296A92B");//2000
......
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