org.chocosolver.solver.objective.IObjectiveManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of choco-solver Show documentation
Show all versions of choco-solver Show documentation
Open-source constraint solver.
/*
* This file is part of choco-solver, http://choco-solver.org/
*
* Copyright (c) 2023, IMT Atlantique. All rights reserved.
*
* Licensed under the BSD 4-clause license.
*
* See LICENSE file in the project root for full license information.
*/
package org.chocosolver.solver.objective;
import org.chocosolver.solver.ICause;
import org.chocosolver.solver.exception.ContradictionException;
import org.chocosolver.solver.variables.Variable;
import java.util.function.DoubleUnaryOperator;
import java.util.function.Function;
import java.util.function.IntUnaryOperator;
/**
* interface to monitor the bounds of the objective variable.
*
* @param type of objective variable
* @author Jean-Guillaume Fages, Charles Prud'homme, Arnaud Malapert
*/
public interface IObjectiveManager extends IBoundsManager, ICause {
/**
* @return the objective variable
*/
V getObjective();
/**
* Informs the manager that a new solution has been found
*/
boolean updateBestSolution(Number n);
/**
* Informs the manager that a new solution has been found
*/
boolean updateBestSolution();
/**
* Set a user-defined cut computer to avoid "worse" solutions.
* @see AbstractIntObjManager#setCutComputer(IntUnaryOperator)
* @see AbstractRealObjManager#setCutComputer(DoubleUnaryOperator)
*/
void setCutComputer(Function cutComputer);
/**
* Define a strict cut computer where in the next solution to find should be strictly greater (resp. lesser) than
* the best solution found so far when maximizing (resp. minimizing) a problem.
*/
void setStrictDynamicCut();
/**
* Define a walking cut computer where in the next solution to find should be greater than (resp. less than)
* or equal to the best solution found so far when maximizing (resp. minimizing) a problem.
*/
void setWalkingDynamicCut();
/**
* Prevent the model from computing worse quality solutions
*
* @throws org.chocosolver.solver.exception.ContradictionException if posting this cut fails
*/
void postDynamicCut() throws ContradictionException;
}