-
Notifications
You must be signed in to change notification settings - Fork 159
Description
Describe the bug
I'm trying out the latest (extremely cool!) 1.24.0 release features, namely mixing list+basic variables and declarative shadow variables, and hit a strange edge case when adding more than one declarative shadow variable.
This occurred in a simple Job Shop Scheduling encoding where machines have a list of assigned jobs, and jobs have a long delay
basic variable that allows them to wait to execute. I could be doing something wrong, but the behavior is very surprising to me.
Expected behavior
I don't expect a score corruption to occur when a declarative shadow variable is added if it is not used.
Actual behavior
When adding (a second) declarative shadow variable without changing the constraint provider at all, I start getting a score corruption when running with TRACKED_FULL_ASSERT
.
To Reproduce
I've attached a minimal reproducing example in jssp-repro.zip.
Observe the same behavior by extracting the contents and doing the following:
# Set Up
cd jssp-repro
mvn compile
# Run the broken version and see the score corruption
mvn exec:java
Now open Job.java
and comment out the endTime
shadow variable at lines 30-31, plus the updateEndTime
and getEndTime
functions that use it:
// @ShadowVariable(supplierName = "updateEndTime")
// public Long endTime;
...
// @ShadowSources({...})
// public Long updateEndTime() {
// ...
// }
// public long getEndTime() {
Then rerun with mvn exec:java
and see that there's no longer a score corruption.
Environment
Timefold Solver Version or Git ref: 1.24.0
Output of java -version
:
Updated: Ran mvn -V
on my machine to give:
Java version: 23.0.2, vendor: Homebrew, runtime: /usr/local/Cellar/openjdk/23.0.2/libexec/openjdk.jdk/Contents/Home
Output of uname -a
or ver
:
Darwin MakMac 24.4.0 Darwin Kernel Version 24.4.0: Fri Apr 11 18:28:23 PDT 2025; root:xnu-11417.101.15~117/RELEASE_X86_64 x86_64
Reproduced on Mac but originally observed on Ubuntu Linux.
Additional information
Let me know if you have any trouble reproducing and thanks for all the great work on Timefold!