TimefoldAI / TimefoldAI/timefold-solver
Allow to disable value range check on ConstraintVerifier for Unit Test
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.8k
- Forks
- 228
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 46
Description
There was a change around ~v1.30 which added a assertValueRangeForBasicVariables check that throws if the assigned variable is not within the specified values provided by @ValueRangeProvider.
When I use the ConstraintVerifier to unit test a constraint, it can be cumbersome to recreate the full range of possible values.
Basically when you unit test a constraint, you are giving a solution and expecting some weight/scoring for this constraint. The assertValueRange check forces you to recreate a full fledged solution including the possible values, which may add noise and may not be relevant to the unit test. It adds complexity to the test.
The bypass I have is to pin the variable and customize the @ValueRangeProvider to return the pinned variable when pinned = true. It is not ideal. Related issue: #2143
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
Start by locating ConstraintVerifier and the assertValueRangeForBasicVariables check, then review related tests and issue #2143 for the intended opt-out behavior. Add a way for unit tests to disable the range validation without reconstructing the full value range, and verify both enabled and disabled behavior in ConstraintVerifier tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100