All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.chocosolver.solver.objective.IObjectiveManager Maven / Gradle / Ivy

The newest version!
/*
 * This file is part of choco-solver, http://choco-solver.org/
 *
 * Copyright (c) 2024, 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;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy