I'm using OptaPlanner to solve a variant of a Vehicle routing problem in which the requirements of the customers to be served by vehicles vary significantly. I have a few most common customer types and want to model them using different entity classes. As it's possible for a single driver to attend different types, they should be able to form heterogeneous chains with instances of all classes on them.
I tried to do a proof of concept by modifying the VRP example. I extracted ICustomer, an interface for all my customers and changed the Standstill so that getNextCustomer returns an ICustomer.
When I try to run it with Customer and Customer2 (a copy of the customer class), both implementing ICustomer, I get this error:
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.
In the worst case, I'll just model different customer types with enums and "ifs" in a single planning entity to get the same behaviour. Still, would be great to know if I encountered an API limitation or someone knows a better way to achieve this. Thanks :)