pub struct Problem<'a, E>{
pub x: &'a mut [f64],
pub fx: f64,
pub gx: Vec<f64>,
/* private fields */
}Expand description
Represents an optimization problem.
Problem holds input variables x, gradient gx arrays, and function value fx.
Fields§
§x: &'a mut [f64]x is an array of length n. on input it must contain the base point for the line search.
fx: f64fx is a variable. It must contain the value of problem f at
x.
gx: Vec<f64>gx is an array of length n. It must contain the gradient of f at
x.
Implementations§
Source§impl<'a, E> Problem<'a, E>
impl<'a, E> Problem<'a, E>
Sourcepub fn new(x: &'a mut [f64], eval: E, owlqn: Option<Orthantwise>) -> Self
pub fn new(x: &'a mut [f64], eval: E, owlqn: Option<Orthantwise>) -> Self
Initialize problem with array length n
Sourcepub fn update_search_direction(&mut self)
pub fn update_search_direction(&mut self)
Update search direction using evaluated gradient.
Sourcepub fn search_direction(&self) -> &[f64]
pub fn search_direction(&self) -> &[f64]
Return a reference to current search direction vector
Sourcepub fn search_direction_mut(&mut self) -> &mut [f64]
pub fn search_direction_mut(&mut self) -> &mut [f64]
Return a mutable reference to current search direction vector
Sourcepub fn dg_unchecked(&self) -> f64
pub fn dg_unchecked(&self) -> f64
Compute the gradient in the search direction without sign checking.
pub fn evaluate(&mut self) -> Result<()>
Sourcepub fn number_of_evaluation(&self) -> usize
pub fn number_of_evaluation(&self) -> usize
Return total number of evaluations.
Sourcepub fn clone_from(&mut self, src: &Problem<'_, E>)
pub fn clone_from(&mut self, src: &Problem<'_, E>)
Copies all elements from src into self.
Sourcepub fn take_line_step(&mut self, step: f64)
pub fn take_line_step(&mut self, step: f64)
Take a line step along search direction.
Compute the current value of x: x <- x + (*step) * d.
pub fn orthantwise(&self) -> bool
Sourcepub fn save_state(&mut self)
pub fn save_state(&mut self)
Store the current position and gradient vectors.
Sourcepub fn constrain_search_direction(&mut self)
pub fn constrain_search_direction(&mut self)
Constrain the search direction for orthant-wise updates.