File tree Expand file tree Collapse file tree
core/src/main/java/ai/timefold/solver/core/impl/solver/recaller Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,8 +137,10 @@ public void updateBestSolutionAndFireIfInitialized(SolverScope<Solution_> solver
137137 private void updateBestSolutionAndFire (SolverScope <Solution_ > solverScope , InnerScore <?> bestScore ,
138138 Solution_ bestSolution ) {
139139 updateBestSolutionWithoutFiring (solverScope , bestScore , bestSolution );
140- // There is no need to clone the solution because the caller has already done that
141- solverEventSupport .fireBestSolutionChanged (solverScope , solverScope .getBestSolution ());
140+ // We need to clone the solution again, or we may use the same instance employed by the solver scope,
141+ // which is restored between solver phases.
142+ // The operation won't block the solving process.
143+ solverEventSupport .fireBestSolutionChanged (solverScope , solverScope .cloneBestSolution ());
142144 }
143145
144146 @ SuppressWarnings ({ "unchecked" , "rawtypes" })
You can’t perform that action at this time.
0 commit comments