当前位置: 首页>>代码示例>>Java>>正文


Java Solver.terminateEarly方法代码示例

本文整理汇总了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.");
    }
}
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:11,代码来源:WannabeSolverManager.java

示例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();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:OptaPlannerEndpoint.java

示例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();
}
 
开发者ID:ge0ffrey,项目名称:santas-stolen-sleigh,代码行数:32,代码来源:ReindeerRoutingHelloWorld.java

示例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();
    }
}
 
开发者ID:vlsi,项目名称:confplanner,代码行数:7,代码来源:SolverAction.java


注:本文中的org.optaplanner.core.api.solver.Solver.terminateEarly方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。