本文整理汇总了Java中org.optaplanner.core.api.solver.Solver.terminateEarly方法的典型用法代码示例。如果您正苦于以下问题:Java Solver.terminateEarly方法的具体用法?Java Solver.terminateEarly怎么用?Java Solver.terminateEarly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.optaplanner.core.api.solver.Solver
的用法示例。
在下文中一共展示了Solver.terminateEarly方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: terminate
import org.optaplanner.core.api.solver.Solver; //导入方法依赖的package包/类
public void terminate(Integer tenantId) {
Solver<Roster> solver = tenantIdToSolverMap.get(tenantId);
if (null != solver) {
solver.terminateEarly();
}
else {
throw new IllegalStateException("The roster with tenantId (" + tenantId
+ ") is not being solved currently.");
}
}
示例2: doStop
import org.optaplanner.core.api.solver.Solver; //导入方法依赖的package包/类
@Override
protected void doStop() throws Exception {
synchronized (SOLVERS) {
for (Solver solver : SOLVERS.values()) {
solver.terminateEarly();
SOLVERS.remove(solver);
}
}
super.doStop();
}
示例3: main
import org.optaplanner.core.api.solver.Solver; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
System.setProperty("logback.level.org.optaplanner", "info"); // don't waste time logging too much
// Build the Solver
// TODO cli arg
SolverFactory<ReindeerRoutingSolution> solverFactory = SolverFactory.createFromXmlResource(SOLVER_CONFIG);
final Solver<ReindeerRoutingSolution> solver = solverFactory.buildSolver();
// Load the problem
final ReindeerRoutingSolution unsolvedReindeerRoutingSolution = (ReindeerRoutingSolution) (new ReindeerRoutingImporter().readSolution(new File("data/sss/import/gifts.csv")));
// Solve the problem in the background
System.out.println("OptaPlanner is working hard on your problem. Press any key to stop.");
Runnable solving = new Runnable() {
@Override
public void run() {
solver.solve(unsolvedReindeerRoutingSolution);
}
};
E.submit(solving);
// wait for the user to terminate
System.in.read();
System.out.println("OptaPlanner will now terminate.");
// terminate on keypress and write the solution
new ReindeerRoutingExporter().writeSolution(solver.getBestSolution(), new File("data/sss/solved/solution.csv")); // TODO cli arg
System.out.println("Solution safely stored.");
solver.terminateEarly();
E.shutdownNow();
}
示例4: cancel
import org.optaplanner.core.api.solver.Solver; //导入方法依赖的package包/类
public void cancel() {
Solver<ConferenceData> solver = this.solver;
if (solver != null && !solver.isSolving()) {
solver.terminateEarly();
}
}