Struct argmin::problem::ArgminProblem [] [src]

pub struct ArgminProblem<'a, T: ArgminParameter + 'a, U: ArgminCostValue + 'a, V: 'a> {
    pub cost_function: &'a Fn(&T) -> U,
    pub gradient: Option<&'a Fn(&T) -> T>,
    pub hessian: Option<&'a Fn(&T) -> V>,
    pub lower_bound: Option<T>,
    pub upper_bound: Option<T>,
    pub constraint: &'a Fn(&T) -> bool,
    pub target_cost: U,
}

This struct hold all information that describes the optimization problem.

Fields

reference to a function which computes the cost/fitness for a given parameter vector

optional reference to a function which provides the gradient at a given point in parameter space

optional reference to a function which provides the Hessian at a given point in parameter space

lower bound of the parameter vector

upper bound of the parameter vector

(non)linear constraint which is true if a parameter vector lies within the bounds

Target cost function value. The optimization will stop once this value is reached.

Methods

impl<'a, T: ArgminParameter + 'a, U: ArgminCostValue + 'a, V: 'a> ArgminProblem<'a, T, U, V>
[src]

[src]

Create a new ArgminProblem struct.

The field gradient is automatically set to None, but can be manually set by the gradient function. The (non) linear constraint constraint is set to a closure which evaluates to true everywhere. This can be overwritten with the constraint function.

cost_function: Reference to a cost function

[src]

Set lower and upper bounds

lower_bound: lower bound for the parameter vector upper_bound: upper bound for the parameter vector

[src]

Provide the gradient

The function has to have the signature &Fn(&T) -> T where T is the type of the parameter vector. The function returns the gradient for a given parameter vector.

[src]

Provide the Hessian

The function has to have the signature &Fn(&T) -> T where T is the type of the parameter vector. The function returns the gradient for a given parameter vector.

[src]

Provide additional (non) linear constraint.

The function has to have the signature &Fn(&T) -> bool where T is the type of the parameter vector. The function returns true if all constraints are satisfied and false otherwise.

[src]

Set target cost function value

If the optimization reaches this value, it will be stopped.

[src]

Create a random parameter vector

The parameter vector satisfies the lower_bound and upper_bound.