timefold-solver
timefold-solver copied to clipboard
Declarative Shadow Variables: Struggles with overridden entities
Consider a situation which occurs in the old implementation of CVRPTW:
Customerdoes not havearrivalTime. It doesn't need it, because it doesn't understand time windows.TimeWindowedCustomerextendsCustomerand bringsarrivalTimevariable.CustomerhaspreviousCustomershadow, whichTimeWindowedCustomerneeds to compute itsarrivalTime. Therefore this needs to be a source.
This currently results in an exception, because TimeWindowedCustomer doesn't see previousCustomer.arrivalTime, because previousCustomer is Customer and not TimeWindowedCustomer.
Attempts to solve this by overriding getter/setter for previousCustomer on TimeWindowedCustomer to provide TimeWindowedCustomer only results in a different runtime exception.
The issue will be resolved when the following code can be migrated to DSV, without changing the data model:
- https://github.com/TimefoldAI/timefold-solver-benchmarks/tree/main/src/main/java/ai/timefold/solver/benchmarks/examples/vehiclerouting
- https://github.com/TimefoldAI/timefold-solver-benchmarks/tree/main/src/main/java/ai/timefold/solver/benchmarks/examples/examination