|
@@ -57,6 +57,8 @@ public class ProductionScheduleServiceImpl implements ProductionScheduleService
|
|
|
if(productionScheduleVo.getEnvironmentMode() != null && productionScheduleVo.getEnvironmentMode() == 1){
|
|
|
mode = EnvironmentMode.FULL_ASSERT;
|
|
|
}
|
|
|
+ // CPU核数
|
|
|
+ String cores = Runtime.getRuntime().availableProcessors() + "";
|
|
|
// optaplanner 求解器配置实例化
|
|
|
SolverFactory<ApsSolution> solverFactory = SolverFactory.create(new SolverConfig()
|
|
|
.withEnvironmentMode(mode)
|
|
@@ -65,7 +67,7 @@ public class ProductionScheduleServiceImpl implements ProductionScheduleService
|
|
|
.withConstraintProviderClass(ApsConstraintProvider.class)
|
|
|
// .withTerminationConfig(new TerminationConfig().withUnimprovedSecondsSpentLimit(10L))
|
|
|
.withTerminationSpentLimit(Duration.ofSeconds(planSeconds))
|
|
|
- .withMoveThreadCount("4")
|
|
|
+ .withMoveThreadCount(cores)
|
|
|
);
|
|
|
Solver<ApsSolution> solver = solverFactory.buildSolver();
|
|
|
solver.addEventListener(new SolverEventListener<ApsSolution>() {
|