简体   繁体   English

如何通过 optaplanner 引擎获得没有任何硬分的解决方案

[英]How to get a solution without any hard score by optaplanner engine

We want to find a way how to avoid hard scores for the optaplanner solutions.我们希望找到一种方法来避免 optaplanner 解决方案的硬分。

In our enterprise optimization project, it's not allowed to generate a solution with hard constraint scores.在我们的企业优化项目中,不允许生成具有硬约束分数的解决方案。 But actually the generated results by Optaplanner engine always have some allocations with hard constraint scores.但实际上 Optaplanner 引擎生成的结果总是有一些具有硬约束分数的分配。 when this situation happens, we will try to move the entity to the null allocation currently instead to clean the hard scores.当这种情况发生时,我们将尝试将实体移动到当前的 null 分配中以清理硬分数。

The above solution seems not the right way to avoid hard scores.上述解决方案似乎不是避免硬分的正确方法。 Are there other methods to achieve that goal?还有其他方法可以实现这一目标吗?

It is hard to know what is the issue without having any example of the algorithm configuration and examples of the problem, but hope this helps.如果没有任何算法配置示例和问题示例,很难知道问题是什么,但希望这会有所帮助。

If you get constraint violations (as that is what hard scores are) in your solution it means no feasible solution is being found.如果您在解决方案中遇到约束违规(因为这是硬分数),则意味着找不到可行的解决方案。 This can have a couple of reasons: * There is no feasible solution to begin with * The optimisation algorithm doesn't step fast enough or the termination makes it terminate too early.这可能有几个原因: * 开始时没有可行的解决方案 * 优化算法的步骤不够快,或者终止使其过早终止。

Depending on the problem at hand it can be hard to verify whether a feasible solution exists, but one could draft a simple problem that is to be solved by Optaplanner to verify whether it can find it (it should be able to).根据手头的问题,可能很难验证是否存在可行的解决方案,但可以起草一个由 Optaplanner 解决的简单问题,以验证它是否可以找到它(它应该能够)。 If it doesn't then something is wrong with the modelling or objective function.如果不是,则建模或物镜 function 有问题。

For the second point the best way to go forward is to keep track of the score calculation speed, it should preferably be in the thousands of steps per second ( > 1000/sec).对于第二点,go 前进的最佳方法是跟踪分数计算速度,最好是每秒数千步(> 1000/秒)。 If it isn't investigate using Drools or IncrementalScoreCalculator for fasting computation.如果不使用DroolsIncrementalScoreCalculator进行快速计算。 Also, use the benchmarker module to see if your algorithm is appropriately configured.此外,使用 benchmarker 模块查看您的算法是否配置正确。

Lastly, do you have a local search phase?最后,您有本地搜索阶段吗? A construction phase alone is way more likely to return an infeasible solution as opposed to one with a local search phase.与具有本地搜索阶段的解决方案相比,单独的构建阶段更有可能返回不可行的解决方案。

In the user guide, see overconstrained planning .在用户指南中,请参阅过度约束的计划 An approach of nullable=true and a medium score penalty on every null assignment should do what you want. nullable=true的方法和对每个 null 分配的中等分数惩罚应该可以满足您的要求。 See K88's answer too.也请参阅 K88 的答案。

暂无
暂无

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

相关问题 使用 Optaplanner 进行员工排班。 硬约束被打破但硬分数不被扣除 - Employee rostering with Optaplanner. Hard constraint is broken but hard score is not deducted 如何使用 Optaplanner 仅对现有解决方案(有序数据集)进行评分,而不是寻找新的解决方案? - How to use Optaplanner to score only an existing solution (ordered data set) instead of looking for a new solution? 我如何才能避免在 Optaplanner 中反复打破相同硬约束的局部最优分数? - How can I escape local optima score that repeatedly breaks the same hard constraint in Optaplanner? Optaplanner 约束流:动态定义它是硬分数还是软分数 - Optaplanner Constraint streams: Dynamically define if its a hard or a soft score 如何从 OptaPlanner 中的先前解决方案中获取 ScoreDirectorFactory - How do you get the ScoreDirectorFactory from a previous solution in OptaPlanner 如何从OptaPlanner中的解决方案访问汇总结果 - How to access an aggregate result from a solution in OptaPlanner 是否可以通过 OptaPlanner 验证现有解决方案以检查规则如何被破坏? - Is it possible to verify already existing solution by OptaPlanner to check how may rules get broken? OptaPlanner 返回空解决方案 - OptaPlanner returning empty solution Optaplanner:评估解决方案 - Optaplanner: Evaluate solution Optaplanner-HardMediumSoftScoreHolder-如何强制求解器先将中等分数减至最小,然后将软分数减至最小? - Optaplanner - HardMediumSoftScoreHolder - How do I force the solver to minimize medium score first then soft score?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM