简体   繁体   English

如何从 OptaPlanner 中的先前解决方案中获取 ScoreDirectorFactory

[英]How do you get the ScoreDirectorFactory from a previous solution in OptaPlanner

I have a previously solved solution in OptaPlanner and I want to retrieve the ScoreDirectorFactory from that solution without running the solver.我在 OptaPlanner 中有一个以前解决的解决方案,我想从该解决方案中检索 ScoreDirectorFactory 而不运行求解器。 Is it achievable through the current API?通过当前的 API 是否可以实现?

Here is an example of what I want to achieve:这是我想要实现的示例:

MyPlanningSolution mpe = getMySolution();
SolverFactory<MyPlanningSolution> solverFactory = SolverFactory.createFromXmlResource(CONFIG);
Solver<MyPlanningSolution> solver = solverFactory.buildSolver();
solver.setSolution(mpe);
ScoreDirectorFactory factory = solver.getScoreDirectorFactory();

I succeeded into getting the ScoreDirectorFactory by pinning all my planning entities and setting the termination to 0 seconds.通过固定我所有的计划实体并将终止设置为 0 秒,我成功获得了 ScoreDirectorFactory。 It seems like a detour to me since I have to start the solver for nothing.这对我来说似乎是绕道而行,因为我必须白白启动求解器。 Is there another way?还有其他方法吗?

See https://issues.jboss.org/browse/PLANNER-1686https://issues.jboss.org/browse/PLANNER-1686

We're adding SolverFactory.getScoreDirectorFactory() and deprecating Solver.getScoreDirectorFactory() .我们正在添加SolverFactory.getScoreDirectorFactory()并弃用Solver.getScoreDirectorFactory()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM