package com.srbenoit.math.optimizers;

/**
 * An interface for classes that represent optimizable functions.
 */
public interface Optimizable {

    /**
     * Gets the dimension of the function.
     *
     * @return  the dimension
     */
    int dimension();

    /**
     * Evaluates the function for a given set of parameters that are to be optimized.
     *
     * @param   parameters  the parameters
     * @return  the function value based on the parameters
     */
    OutputValue evaluate(double[] parameters);

    /**
     * Called when the optimizer has found a new set of parameters that result in a lower value
     * during its search for the optimal parameters.
     *
     * @param  parameters  the newly found parameters
     */
    void updatedParameters(double[] parameters);
}
