TimefoldAI / TimefoldAI/timefold-solver
perf: Node unlinking in Constraint Streams when it can be determined a constraint can never fire.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.8k
- Forks
- 228
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 46
Description
Consider the following constraint:
constraintFactory.forEach(Rule.class)
.join(Shift.class, Joiners.equal(Shift::getRuleProperty, Rule::getProperty))
.penalize(HardSoftScore.ONE_HARD)
.asConstraint("Rule violated");
Assume Shift::getRuleProperty is an expensive method to evaluate.
If a problem has no Rule instances, this constraint can never fire, since one side of the join is empty.
However, Shift::getRuleProperty is pointless re-evaluated whenever a Shift changes.
If we can detect if a root node (precompute and forEach variants) is empty, we can disable all constraints (set their weight to 0) that can never fire.
When a constraint is disabled this way, it should be reported somewhere, potentially in the logs.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files or tests. Start by tracing the Constraint Streams implementation for root-node emptiness and constraint weighting; done means impossible constraints stop evaluating expensive joins and the disabled constraints are reported, potentially through logs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100