Commit e56eef9d authored by Tong Li's avatar Tong Li

解码优化

parent 103266f2
......@@ -22,7 +22,7 @@ public class FileHelper {
String filePath = LOG_FILE_PATH + date + LOG_FILE;
try (PrintWriter writer = new PrintWriter(new FileWriter(filePath, true))) {
String timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
String timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"));
writer.println("[" + timestamp + "] " + message);
System.out.println("[" + timestamp + "] " + message);
......
......@@ -118,11 +118,11 @@ public class GeneticAlgorithm {
FileHelper.writeLogFile("初始化种群-----------开始-------");
// 步骤1:初始化种群
// List<Chromosome> population = initialization.generateInitialPopulation(param, globalOpList);
List<Chromosome> population = initialization.generateInitialPopulation(param, globalOpList);
// 步骤1:使用构造启发式算法生成初始种群
FileHelper.writeLogFile("构造启发式初始化-----------开始-------");
List<Chromosome> population = initialization.generateHeuristicInitialPopulation(param, globalOpList);
// List<Chromosome> population = initialization.generateHeuristicInitialPopulation(param, globalOpList);
FileHelper.writeLogFile("构造启发式初始化-----------结束-------");
......@@ -477,7 +477,7 @@ return population;
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))
......
......@@ -1140,7 +1140,7 @@ if(headers1==null)
* @return 包含物料需求列表和子订单列表的结果对象(替代C#的out参数)
*/
public void EditOperationBOM(Entry operation,Chromosome chromosome,LocalDateTime earliestStartTime,GeneticDecoder coder) {
public void EditOperationBOM(Entry operation,Chromosome chromosome,LocalDateTime earliestStartTime,GeneticDecoder coder,Map<Long, CopyOnWriteArrayList<GAScheduleResult>> machineTasksCache) {
List<OrderMaterialRequirement> materialRequirements = new ArrayList<>();
String sceneId=chromosome.getScenarioID();
......@@ -1319,7 +1319,7 @@ if(headers1==null)
for (Integer orderid : orderids) {
coder.ClearorderOperationResult(chromosome, orderid);
coder.EditorderOperation(chromosome, orderid, needed);
coder.EditorderOperation(chromosome, orderid, needed,machineTasksCache);
}
}else {
......
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