【发布时间】:2018-02-27 11:55:45
【问题描述】:
我正在使用 OptaPlanner 解决车辆路线问题的变体,其中车辆服务的客户要求差异很大。我有一些最常见的客户类型,并希望使用不同的实体类对它们进行建模。由于单个司机可以参加不同的类型,他们应该能够形成异构链,其中包含所有类的实例。
我尝试通过修改 VRP 示例来进行概念验证。我提取了ICustomer,这是我所有客户的接口,并更改了Standstill,以便getNextCustomer 返回ICustomer。
当我尝试使用实现 ICustomer 的 Customer 和 Customer2(客户类的副本)运行它时,我收到此错误:
Exception in thread "main" java.lang.IllegalArgumentException: The entityClass
(interface org.optaplanner.examples.vehiclerouting.domain.Standstill) has a
InverseRelationShadowVariable annotated property (nextCustomer) with a masterClass
(interface org.optaplanner.examples.vehiclerouting.domain.ICustomer) which is not a
valid planning entity.
在最坏的情况下,我将在单个计划实体中使用枚举和“ifs”对不同的客户类型进行建模,以获得相同的行为。不过,很高兴知道我是否遇到了 API 限制,或者有人知道实现此目的的更好方法。谢谢:)
【问题讨论】:
标签: java optimization optaplanner