Commit 539b80b3 authored by Tong Li's avatar Tong Li

Merge remote-tracking branch 'origin/tl'

parents 73a7b529 b9dc6d43
......@@ -58,7 +58,7 @@ public class GeneticDecoder {
private DiscreteParameterMatrixService discreteParameterMatrixService;
private String sceneId;
private boolean rebuildStructureForCurrentDecode = true;
private boolean rebuildStructureForCurrentDecode = false;
......@@ -1107,6 +1107,7 @@ public class GeneticDecoder {
int setupTime=0;
long machineId = machine.getId();
boolean needMaterialCheck = (operation.getMaterialRequirements()!=null&&operation.getMaterialRequirements().size()>0&&operation.getTargetFinishedOperationId()==null)||calbom;
needMaterialCheck=false;
boolean commitMaterialCheck = needMaterialCheck;
int baseEarliestStartTime = earliestStartTime;
int candidateStartTime = earliestStartTime;
......
......@@ -86,7 +86,7 @@ public class HillClimbing {
// 构建位置到Entry的映射:position -> Entry
Map<Integer, Entry> entryIndex = buildEntryIndex(current, entrys);
boolean improved = true;
boolean improved = false;
for (Double priority : sortedPriorities) {
List<Entry> priorityOps = priorityGroups.get(priority);
if (priorityOps.isEmpty()) {
......@@ -107,6 +107,7 @@ public class HillClimbing {
Chromosome machineChange = generateMachineChange(current, op.getMachineOptions(), maPos);
if (machineChange != null) {
decode(decoder, machineChange,machines);
writeKpi(machineChange);
if (isBetter(machineChange, current)) {
current = machineChange;
if (isBetter(current, best)) {
......@@ -125,7 +126,7 @@ public class HillClimbing {
if (improved) break;
}
if (improved) continue;
// 2. 检查是否是单一订单(如果只有一个订单,不需要交换位置
Set<Integer> groupIds = priorityOps.stream()
......@@ -312,6 +313,8 @@ public class HillClimbing {
// 根据当前优先级的工序数确定迭代次数和step
int priorityIterations = Math.max(5, priorityOps.size() / 2);
priorityIterations = Math.min(priorityIterations, priorityOps.size());
// 200/10 =20
// 1
int step = Math.max(1, (int) Math.ceil(priorityOps.size() / 10.0));
......@@ -422,6 +425,7 @@ public class HillClimbing {
}
for (int i = 0; i < candidates.size(); i++) {
Chromosome candidate = candidates.get(i);
writeKpi(candidate);
if (isBetter(candidate, best)) {
bestidx = i;
}
......@@ -439,7 +443,7 @@ public class HillClimbing {
fitness += fitness1[i] + ",";
}
FileHelper.writeLogFile(String.format("爬山法 - kpi:%s", fitness));
FileHelper.writeLogFile(String.format("爬山法%s - kpi:%s",chromosome.getGeneStr(), fitness));
}
/**
......
......@@ -119,7 +119,7 @@ int opcount=allOperations.size();
FileHelper.writeLogFile("构造启发式初始化-----------结束-------");
population= chromosomeDistinct(population);
population= chromosomeDistinct(population).subList(0,1);
......@@ -457,7 +457,7 @@ int opcount=allOperations.size();
FileHelper.writeLogFile("解码---------------"+population.size() );
GeneticDecoder decoder = new GeneticDecoder(_GlobalParam, param.getBaseTime(), machines, orders, materials, machineScheduler,materialRequirementService, sceneId);
boolean ismore=false;
boolean ismore=true;
if(ismore) {
CompletableFuture.allOf(population.stream()
.map(chromosome -> CompletableFuture.runAsync(() -> decode(decoder, chromosome, param, allOperations, globalOpList), decodeExecutor))
......
......@@ -42,9 +42,9 @@ public class PlanResultServiceTest {
// planResultService.execute2("E29F2B3ADA8149F6B916B5119296A92B");//2000
// planResultService.execute2("E2CD1FC6FF9B4B19A59FEC7F846D4952");//600
planResultService.execute2("EAF3C94B8F3345278F226C94FB0FED86");//bom
// planResultService.execute2("08B1D87FE1B84ECDBAC2E546DDB6FB81");//2000
// planResultService.execute2("0428340BB4F540938F1FB5599F03E8A4");//5000
// planResultService.execute2("EAF3C94B8F3345278F226C94FB0FED86");//bom
planResultService.execute2("6D63146BE5C84A78B5AB044327BA55BD");//2000
// planResultService.execute2("6D63146BE5C84A78B5AB044327BA55BD");//5000
// planResultService.execute2("C8B533BD8944405B9A2F8823C575C204");//500
// planResultService.execute2("EFDD34E4B5BC434BAEAE6A84DFCD4E7B");//20
// planResultService.execute2("00E0C5D3E4AD4F36B56C39395906618D");
......
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