Cross-entity shadow variable dependency in FJSSP — what's the recommended approach as VariableListener gets deprecated? #2196
electrosilvia
started this conversation in
General
Replies: 1 comment 3 replies
-
|
Declarative shadow variables should solve that problem; take a look at |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Context
I'm modelling a Flexible Job Shop Scheduling Problem (FJSSP) using
@PlanningListVariableonMachine. The domain is:Machine(@PlanningEntity): holds@PlanningListVariable List<Operation> assignedOperationsOperation(@PlanningEntity + @ValueRangeProvider): hasstartTimeas a shadow variableJob(@ProblemFact): fixed sequence of operationsThe
startTimeof each operation depends on two independent sources:previousOperationOnMachine— the operation preceding it in the same machine's list (@PreviousElementShadowVariable)previousOperation— the preceding operation in the same job, which may be assigned to a completely different machineFormally:
startTime(op) = max(endTime(prevOnMachine), endTime(prevInJob))Current implementation
I'm using a
VariableListenerthat listens on bothchosenMachineandpreviousOperationOnMachine, propagates iteratively along the machine chain, and handles the cross-machine job dependency:The listener propagates iteratively (not recursively) along
assignedOperations:This works correctly, but the problem is: when
previousOperation.startTimechanges (because that operation moved to a different machine), nothing triggers a recomputation on the downstream operation in the job chain.The core issue
The cross-entity dependency is essentially:
startTimeof operation N depends onstartTimeof operation N-1, which lives in a differentMachine's list. This makes it a dependency across two separate@PlanningListVariablelists.I explored the possibility of also declaring
startTimeas a source of itself (to propagate along the job chain when it changes), but this would introduce a cycle in the shadow variable dependency graph, which Timefold would reject at initialization.@CascadingUpdateShadowVariableseems to handle intra-list propagation well, but I don't see a clean way to also react to cross-list changes from a different entity's shadow variable.Question
As
VariableListenermoves toward deprecation (and presumably removal in 2.0), what is the recommended approach to model this pattern?Is there a planned primitive or API for shadow variables with cross-entity, cross-list dependencies? Or is
@CascadingUpdateShadowVariableexpected to cover this somehow in 2.0?Happy to share more context if useful. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions