Struct argmin::problem::Problem [] [src]

pub struct Problem<'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: T,
    pub upper_bound: T,
    pub constraint: &'a Fn(&T) -> bool,
}

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

Methods

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

[src]

Create a new Problem 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 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]

Create a random parameter vector

The parameter vector satisfies the lower_bound and upper_bound.