14package com.google.ortools.sat;
16import com.google.ortools.sat.CpSolverResponse;
17import com.google.ortools.sat.CpSolverStatus;
18import com.google.ortools.sat.SatParameters;
20import java.util.function.Consumer;
28public final class CpSolver {
32 this.logCallback =
null;
33 this.bestBoundCallback =
null;
34 this.solveWrapper =
null;
39 return solve(model,
null);
53 if (logCallback !=
null) {
56 if (bestBoundCallback !=
null) {
60 solveResponse = solveWrapper.
solve(model.
model());
66 releaseSolveWrapper();
79 return solve(model, cb);
99 solveParameters.setEnumerateAllSolutions(
true);
101 solveParameters.setEnumerateAllSolutions(oldValue);
105 private synchronized void createSolveWrapper() {
109 private synchronized void releaseSolveWrapper() {
115 if (solveWrapper !=
null) {
155 return solveResponse;
184 return solveParameters;
189 this.logCallback = cb;
194 this.logCallback =
null;
199 this.bestBoundCallback = cb;
204 this.bestBoundCallback =
null;
221 private final SatParameters.Builder solveParameters;
222 private Consumer<String> logCallback;
223 private Consumer<Double> bestBoundCallback;