如何在VehicleRouting示例中实现约束匹配总计

问题描述 投票:0回答:1

我试图用GUI解释VehicleRouting示例的分数,但我不明白这一点:“不要尝试解析此字符串或在UI或暴露的服务中使用它。而是使用下面的ConstraintMatch API并执行它正确的“。什么是ConstraintMatch API,如何使用GUI示例实现它?

我只尝试打印solver.explainBestScore(),但它说“不要尝试解析此字符串或在您的UI或公开的服务中使用它”。

optaplanner
1个回答
0
投票

看看其余的javadoc:

 * Do not parse this string.
 * Instead, to provide this information in a UI or a service, use {@link #getScoreDirectorFactory()}
 * to retrieve {@link ScoreDirector#getConstraintMatchTotals()} and {@link ScoreDirector#getIndictmentMap()}
 * and convert those into a domain specific API.

在文档中,执行ctrl -f“getConstraintMatchTotals()”,最后您将在“解释分数”部分结束,该部分记录了如何执行此操作。

© www.soinside.com 2019 - 2024. All rights reserved.