pub struct Nlp<P: Problem> { /* private fields */ }Expand description
Builder: Nlp::new(problem) then .var_bounds(..) / .x0(..) (which fix
the number of variables) and .solve().
Implementations§
Source§impl<P: Problem + 'static> Nlp<P>
impl<P: Problem + 'static> Nlp<P>
Sourcepub fn new(problem: P) -> Self
pub fn new(problem: P) -> Self
A new builder for problem. The number of variables is inferred from
the first of var_bounds / x0 you set
(they must agree); the number of constraints comes from
Problem::n_constraints. Variable bounds default to ±∞, constraint
bounds to 0, and x0 to the origin.
Sourcepub fn var_bounds(self, lo: &[f64], hi: &[f64]) -> Self
pub fn var_bounds(self, lo: &[f64], hi: &[f64]) -> Self
Variable bounds x_l ≤ x ≤ x_u (use ±2e19 for ∞). Fixes the number of
variables.
Sourcepub fn constraint_bounds(self, lo: &[f64], hi: &[f64]) -> Self
pub fn constraint_bounds(self, lo: &[f64], hi: &[f64]) -> Self
Constraint bounds g_l ≤ g(x) ≤ g_u (g_l == g_u is an equality).
Sourcepub fn option_num(self, tag: &str, value: f64) -> Self
pub fn option_num(self, tag: &str, value: f64) -> Self
A numeric solver option (e.g. ("tol", 1e-8)).
Sourcepub fn option_int(self, tag: &str, value: i32) -> Self
pub fn option_int(self, tag: &str, value: i32) -> Self
An integer solver option (e.g. ("max_iter", 500)).
Sourcepub fn option_str(self, tag: &str, value: &str) -> Self
pub fn option_str(self, tag: &str, value: &str) -> Self
A string solver option (e.g. ("mu_strategy", "adaptive")).
Sourcepub fn capture_iterations(self) -> Self
pub fn capture_iterations(self) -> Self
Record the per-iteration trajectory: one
IterRecord per Newton iteration into
Solution::stats.iterations (empty without this call).
Interior-point solves only, since the per-iteration event
is emitted by the IPM engine, so on the active-set SQP engine
(solver_selection=qp-active-set/algorithm=active-set-sqp)
stats.iterations stays empty even though
stats.iteration_count still reports the iterations run.
Auto Trait Implementations§
impl<P> Freeze for Nlp<P>where
P: Freeze,
impl<P> RefUnwindSafe for Nlp<P>where
P: RefUnwindSafe,
impl<P> Send for Nlp<P>where
P: Send,
impl<P> Sync for Nlp<P>where
P: Sync,
impl<P> Unpin for Nlp<P>where
P: Unpin,
impl<P> UnsafeUnpin for Nlp<P>where
P: UnsafeUnpin,
impl<P> UnwindSafe for Nlp<P>where
P: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T, U> Imply<T> for U
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more