Commit 4e64e02a by chamberone

feat: 提交测试代码

1 parent 68e3475f
package com.dituhui.pea.dispatch.test;
import java.io.FileNotFoundException;
import java.io.UncheckedIOException;
import org.optaplanner.core.api.solver.Solver;
import org.optaplanner.core.api.solver.SolverFactory;
import org.optaplanner.core.impl.solver.DefaultSolverFactory;
import com.dituhui.pea.dispatch.eventListener.DispatchSolverEventListener;
import com.dituhui.pea.dispatch.pojo.DispatchSolution;
import com.dituhui.pea.dispatch.utils.DataUtils;
import com.dituhui.pea.dispatch.utils.DispatchSolutionUtils;
public class Test {
public static void main(String[] args) throws UncheckedIOException, FileNotFoundException {
// 创建解决方案对象
DispatchSolution problem = DataUtils.getInitialProblem();
// 创建求解器
DefaultSolverFactory<DispatchSolution> solverFactory = DispatchSolutionUtils.getSolverFactory(3, 30);
Solver<DispatchSolution> solver = solverFactory.buildSolver();
// 得分监听器
solver.addEventListener(new DispatchSolverEventListener());
// 求解
DispatchSolution solution = solver.solve(problem);
// 打印和输出solution
DispatchSolutionUtils.printSolution(solution);
// DispatchSolutionUtils.explainSolutionConstraintDetail(solution);
// DispatchSolutionUtils.exportSolutionJson(solution, "dispatchSolution.json");
// DispatchSolutionUtils.exportMapHtml(solution, "dispatchMap" +
// System.currentTimeMillis());
// FIXME
DispatchSolution movedSolution = DispatchSolutionUtils.moveCustomer(solverFactory, solution,
solution.getTechnicianList().get(0), 0, 1);
DispatchSolutionUtils.printSolution(movedSolution);
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!