Hello OptaPlanner community,
I’m using OptaPlanner with a single-thread configuration (<moveThreadCount>NONE</moveThreadCount>) and an IncrementalScoreCalculator, similar to the CloudBalancing example. During execution, I noticed that most IncrementalScoreCalculator methods run on a single thread (named [l-1-thread-2]), but resetWorkingSolution runs on a different thread (named [EventQueue-0]). This causes issues because I sync the internal state of the solution using interface notifications. For example, in beforeVariableChanged, I remove the entity’s internal state, expecting afterVariableChanged to add the updated one. However, at times the second thread interferes in the middle by persisting in another state, leading to a logical issue in afterVariableChanged.
Why does resetWorkingSolution not follow the single-thread configuration, and how can I fix this issue?
Thanks in advance for your time and assistance
Best wishes
Atefeh
https://www.linkedin.com/in/atefeh-zareh/