pub struct NlProblemParts {
pub minimize: bool,
pub objective: Expr,
pub obj_constant: f64,
pub constraints: Vec<Expr>,
pub x_l: Vec<f64>,
pub x_u: Vec<f64>,
pub x0: Vec<f64>,
pub g_l: Vec<f64>,
pub g_u: Vec<f64>,
pub var_names: Vec<String>,
pub con_names: Vec<String>,
}Expand description
The pieces of a model built in memory, as handed to
NlProblem::from_expressions.
Everything is expressed as Expr trees — there is no linear/nonlinear
split to fill in, because the AD tape treats a linear term exactly like
any other subexpression (.nl’s J/G segments are a file-format
optimization, not an evaluator requirement). n is taken from the length
of x_l; m from the length of constraints.
One cost to that simplification, in metadata rather than values: with
con_linear empty, get_constraints_linearity tags a row Linear only
when its expression is literally Const(0.0), so a genuinely linear row
built here reports NonLinear. Presolve consumes that tag, and the
direction is the safe one — it loses tightening it could have done, and
never asserts linearity that does not hold — but a frontend that cares
about presolve strength on linear rows should know the tag is
pessimistic on this path.
Fields§
§minimize: booltrue to minimize objective, false to maximize it. Matches
NlProblem::minimize: the evaluator negates a maximize objective
so callers always see the minimization form.
objective: ExprObjective expression.
obj_constant: f64Constant offset added to the objective.
constraints: Vec<Expr>One expression per constraint row; row i is bounded by
g_l[i] <= constraints[i](x) <= g_u[i].
x_l: Vec<f64>Variable bounds and starting point, each length n. Use ±1e19
for “unbounded”, the same sentinel the .nl reader emits.
x_u: Vec<f64>§x0: Vec<f64>§g_l: Vec<f64>Constraint bounds, each length m. g_l[i] == g_u[i] is an
equality row.
g_u: Vec<f64>§var_names: Vec<String>Optional names, index-aligned to x / g. Empty is fine — every
consumer falls back to indices (see NlProblem::var_names).
con_names: Vec<String>Trait Implementations§
Source§impl Clone for NlProblemParts
impl Clone for NlProblemParts
Source§fn clone(&self) -> NlProblemParts
fn clone(&self) -> NlProblemParts
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for NlProblemParts
impl RefUnwindSafe for NlProblemParts
impl Send for NlProblemParts
impl Sync for NlProblemParts
impl Unpin for NlProblemParts
impl UnsafeUnpin for NlProblemParts
impl UnwindSafe for NlProblemParts
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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