-
Story
-
Resolution: Done
-
Critical
-
None
-
None
-
2021 Week 46-48 (from Nov 15), 2022 Week 05-07 (from Jan 31), 2022 Week 08-10 (from Feb 21), 2022 Week 11-13 (from Mar 14), 2022 Week 14-16 (from Apr 4), 2022 Week 17-19 (from Apr 25)
-
13
-
NEW
-
NEW
The index and inverseRelation shadow variables need to be updated when the list variable is changed by a move, including change, swap, assign and unassign moves.
For example, in order to avoid score corruption during unassign move, the removed element's shadow variables need to be unset.
Currently, the before/afterVariableChanged methods only receive the entity instance, whose list variable is being changed. The information about which element is being moved is missing. Therefore we unset index and inverse relation shadow variables of all elements in the list before variable changes and then reset them after the change is done. This is highly inefficient.
Performance discussions:
- https://github.com/kiegroup/optaplanner/pull/1494#discussion_r695186996
- https://github.com/kiegroup/optaplanner/pull/1645#discussion_r742860038
If the index at which the change occurs was part of the before/afterVariableChanged notification method, then we'd be able to eliminate a lot of unnecessary shadow variable updates on elements that are not affected by the change.
The new ListVariableListener API should also work for custom shadow variables that have a genuine list variable as a source. Example: StartTimeUpdatingVariableListener implements ListVariableListener.
- relates to
-
PLANNER-2579 Apply list variable to the VRP example to evaluate performance and detect API gaps
-
- Resolved
-