pub struct RobustProblem<S: Scalar> { /* private fields */ }Expand description
Declarative builder for robust optimization problems.
The objective and constraints are functions of both decision variables x
and uncertain parameters p. The solver reformulates the problem so that
constraints hold under worst-case parameter perturbations at the specified
confidence level.
Implementations§
Source§impl<S: Scalar> RobustProblem<S>
impl<S: Scalar> RobustProblem<S>
Sourcepub fn new(n: usize) -> Self
pub fn new(n: usize) -> Self
Create a new robust optimization problem with n decision variables.
Sourcepub fn all_bounds(self, bounds: &[(S, S)]) -> Self
pub fn all_bounds(self, bounds: &[(S, S)]) -> Self
Set bounds for all variables at once.
Sourcepub fn gradient<G>(self, g: G) -> Self
pub fn gradient<G>(self, g: G) -> Self
Set the gradient of the objective w.r.t. x.
g(x, params, grad_out) writes the gradient into grad_out.
Sourcepub fn constraint_ineq<F>(self, f: F) -> Self
pub fn constraint_ineq<F>(self, f: F) -> Self
Add an inequality constraint g(x, params) <= 0.
Sourcepub fn constraint_eq<F>(self, f: F) -> Self
pub fn constraint_eq<F>(self, f: F) -> Self
Add an equality constraint h(x, params) = 0.
Sourcepub fn params(self, params: Vec<UncertainParam<S>>) -> Self
pub fn params(self, params: Vec<UncertainParam<S>>) -> Self
Add multiple uncertain parameters at once.
Sourcepub fn confidence(self, level: S) -> Self
pub fn confidence(self, level: S) -> Self
Set the confidence level (must be in (0, 1)).
Source§impl<S: Scalar + SimpleEntity + Conjugate<Canonical = S> + ComplexField> RobustProblem<S>
impl<S: Scalar + SimpleEntity + Conjugate<Canonical = S> + ComplexField> RobustProblem<S>
Sourcepub fn solve(self) -> Result<RobustResult<S>, OptimError>
pub fn solve(self) -> Result<RobustResult<S>, OptimError>
Solve the robust optimization problem.
- Computes worst-case parameter vectors for each inequality constraint.
- Reformulates as a standard
OptimProblemwith tightened constraints. - Solves the reformulated problem.
- Computes parametric sensitivity and solution uncertainty.
Auto Trait Implementations§
impl<S> Freeze for RobustProblem<S>where
S: Freeze,
impl<S> !RefUnwindSafe for RobustProblem<S>
impl<S> Send for RobustProblem<S>
impl<S> Sync for RobustProblem<S>
impl<S> Unpin for RobustProblem<S>where
S: Unpin,
impl<S> UnsafeUnpin for RobustProblem<S>where
S: UnsafeUnpin,
impl<S> !UnwindSafe for RobustProblem<S>
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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