* @param policy optimization policy, among ResolutionPolicy.MINIMIZE and ResolutionPolicy.MAXIMIZE
* @param objective the variable to optimize
*/
public void findOptimalSolution(ResolutionPolicy policy, IntVar objective) {
if (policy == ResolutionPolicy.SATISFACTION) {
throw new SolverException("Solver.findOptimalSolution(...) cannot be called with ResolutionPolicy.SATISFACTION.");
}
if (objective == null) {
throw new SolverException("No objective variable has been defined");
}
if (!getObjectiveManager().isOptimization()) {
set(new ObjectiveManager<IntVar, Integer>(objective, policy, true));
}
set(new LastSolutionRecorder(new Solution(), true, this));