title: OptaPlanner: Chained Through Timing, Automatic Delay Until Last Paradigm
body: <p>The OptaPlanner docs suggest using a custom variable listener to implement an automatic delay when, for example, more than one person must be at a job site at the same time:</p>
  <p><a href="https://www.optaplanner.org/docs/optaplanner/latest/design-patterns/design-patterns.html#chainedThroughTimeAutomaticDelayUntilLast" rel="nofollow noreferrer">https://www.optaplanner.org/docs/optaplanner/latest/design-patterns/design-patterns.html#chainedThroughTimeAutomaticDelayUntilLast</a></p>
  <p>This requires that the planning entities must know about each other regardless of anchor, however, and in a chained timing scenario, the entities in a chain only know about <code>previous</code>, <code>next</code>, and the <code>anchor</code>.  At least by default.</p>
  <p>This means that the shadow variables that are being updated depend on the planning <em>and shadow</em> variables of entities in chains other than their own.</p>
  <p>So, is there a standard to handling this?  I could have the entities hold references to the other entities, but that doesn't explain how one can prevent variable listener or score corruption.</p>
  <p>I'd imagine that this requires specifying sources on other chains, but I'm not sure how to go about that.</p>