Skip to content

Commit

Permalink
Student Scheduling: Restore Best
Browse files Browse the repository at this point in the history
- log the restore best phase
  • Loading branch information
tomas-muller committed Feb 24, 2021
1 parent 7bdb71e commit 9ce54f3
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.cpsolver.ifs.solution.Solution;
import org.cpsolver.ifs.solver.Solver;
import org.cpsolver.ifs.util.DataProperties;
import org.cpsolver.ifs.util.Progress;
import org.cpsolver.studentsct.model.Enrollment;
import org.cpsolver.studentsct.model.Request;

Expand Down Expand Up @@ -41,10 +42,13 @@ public RestoreBestSolution(DataProperties config) {

@Override
public void init(Solver<Request, Enrollment> solver) {
Progress.getInstance(solver.currentSolution().getModel()).setPhase("Restore best...", 1);
if (solver.currentSolution().getBestInfo() == null) return; // no best saved yet
if (iBestValue == null || iBestValue >= solver.currentSolution().getBestValue()) {
Progress.getInstance(solver.currentSolution().getModel()).debug("best value marked");
iBestValue = solver.currentSolution().getBestValue();
} else {
Progress.getInstance(solver.currentSolution().getModel()).debug("best solution restored");
solver.currentSolution().restoreBest();
}
}
Expand Down

0 comments on commit 9ce54f3

Please sign in to comment.