TimefoldAI / TimefoldAI/timefold-solver

Shadow variable or predicate Pinning

Open
#2,471 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

process/needs triage
Dominant language
Java
Stars
1.8k
Forks
228
Avg merge
1d 13h
Merged PRs (30d)
46

Description

Is your feature request related to a problem? Please describe.
In our internal field service routing model, we allow users to pin a start service time of a certain visit on an itinerary. This is implemented on a constraint level and allows changes in the planning list variable before the pinned item on the itinerary (provided the pinned start service time still holds), contrary to the pinning the solver currently supports.

Describe the solution you'd like
Some way (maybe an annotation) to specify that a shadow variable on a planning entity is considered pinned and must not change during solving. After evaluation of the shadow variables, the solver could check whether a pinned shadow variable has changed and reject a move before evaluating any constraint.

Alternatively, we could provide a way to specify a predicate as pinned. The value of that predicate would need to stay true after every move.

Considerations (partially discussed with @triceo)

  • We could save two constraints in our internal field service routing model by having solver support for this
  • other uses cases may be opened up by this
    • Example: Reject moves that create unreachable routes in our internal FSR/PDR models
  • This will blur the lines between "real" pinning, where the solver doesn't even touch entities that are pinned and constraints, where the solver would need to evaluate all constraints before making a decision on whether it accepts or rejects a move
  • what happens if the value of the shadow variable is already different from its pinned value in the initial solution?
    • The solver would need to make sure that no moves are rejected that didn't have any influence one the pinned predicate/shadow variable

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Start by reviewing the solver's existing entity pinning and move-evaluation behavior, then compare the proposed shadow-variable and predicate approaches; done requires an agreed API and defined handling for initial mismatches, unaffected moves, and rejected moves.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kotlin
Domain
ai
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.