Struct Problem

Source
pub struct Problem { /* private fields */ }
Expand description

An instance of the OSQP solver.

Implementations§

Source§

impl Problem

Source

pub fn update_rho(&mut self, value: f64)

Sets the ADMM step rho.

Source

pub fn update_max_iter(&mut self, value: u32)

Sets the maximum number of ADMM iterations.

Panics on 32-bit platforms if the value is above i32::max_value().

Source

pub fn update_eps_abs(&mut self, value: f64)

Sets the absolute convergence tolerance.

Source

pub fn update_eps_rel(&mut self, value: f64)

Sets the relative convergence tolerance.

Source

pub fn update_eps_prim_inf(&mut self, value: f64)

Sets the primal infeasibility tolerance.

Source

pub fn update_eps_dual_inf(&mut self, value: f64)

Sets the dual infeasibility tolerance.

Source

pub fn update_alpha(&mut self, value: f64)

Sets the linear solver relaxation parameter.

Source

pub fn update_delta(&mut self, value: f64)

Sets the polishing regularization parameter.

Source

pub fn update_polish(&mut self, value: bool)

Enables polishing the ADMM solution.

Source

pub fn update_polish_refine_iter(&mut self, value: u32)

Sets the number of iterative refinement steps to use when polishing.

Panics on 32-bit platforms if the value is above i32::max_value().

Source

pub fn update_verbose(&mut self, value: bool)

Enables writing progress to stdout.

Source

pub fn update_scaled_termination(&mut self, value: bool)

Enables scaled termination criteria.

Source

pub fn update_check_termination(&mut self, value: Option<u32>)

Sets the number of ADMM iterations between termination checks.

If None termination checking is disabled.

Panics on 32-bit platforms if the value is above i32::max_value().

Source

pub fn update_warm_start(&mut self, value: bool)

Enables warm starting the primal and dual variables from the previous solution.

Source

pub fn update_time_limit(&mut self, value: Option<Duration>)

Sets the solve time limit.

Source§

impl Problem

Source

pub fn new<'a, 'b, T: Into<CscMatrix<'a>>, U: Into<CscMatrix<'b>>>( P: T, q: &[f64], A: U, l: &[f64], u: &[f64], settings: &Settings, ) -> Result<Problem, SetupError>

Initialises the solver and validates the problem.

Returns an error if the problem is non-convex or the solver cannot be initialised.

Panics if any of the matrix or vector dimensions are incompatible, if P or A are not valid CSC matrices, or if P is not structurally upper triangular.

Source

pub fn update_lin_cost(&mut self, q: &[f64])

Sets the linear part of the cost function to q.

Panics if the length of q is not the same as the number of problem variables.

Source

pub fn update_bounds(&mut self, l: &[f64], u: &[f64])

Sets the lower and upper bounds of the constraints to l and u.

Panics if the length of l or u is not the same as the number of problem constraints.

Source

pub fn update_lower_bound(&mut self, l: &[f64])

Sets the lower bound of the constraints to l.

Panics if the length of l is not the same as the number of problem constraints.

Source

pub fn update_upper_bound(&mut self, u: &[f64])

Sets the upper bound of the constraints to u.

Panics if the length of u is not the same as the number of problem constraints.

Source

pub fn warm_start(&mut self, x: &[f64], y: &[f64])

Warm starts the primal variables at x and the dual variables at y.

Panics if the length of x is not the same as the number of problem variables or the length of y is not the same as the number of problem constraints.

Source

pub fn warm_start_x(&mut self, x: &[f64])

Warm starts the primal variables at x.

Panics if the length of x is not the same as the number of problem variables.

Source

pub fn warm_start_y(&mut self, y: &[f64])

Warms start the dual variables at y.

Panics if the length of y is not the same as the number of problem constraints.

Source

pub fn update_P<'a, T: Into<CscMatrix<'a>>>(&mut self, P: T)

Updates the elements of matrix P without changing its sparsity structure.

Panics if the sparsity structure of P differs from the sparsity structure of the P matrix provided to Problem::new.

Source

pub fn update_A<'a, T: Into<CscMatrix<'a>>>(&mut self, A: T)

Updates the elements of matrix A without changing its sparsity structure.

Panics if the sparsity structure of A differs from the sparsity structure of the A matrix provided to Problem::new.

Source

pub fn update_P_A<'a, 'b, T: Into<CscMatrix<'a>>, U: Into<CscMatrix<'b>>>( &mut self, P: T, A: U, )

Updates the elements of matrices P and A without changing either’s sparsity structure.

Panics if the sparsity structure of P or A differs from the sparsity structure of the P or A matrices provided to Problem::new.

Source

pub fn solve<'a>(&'a mut self) -> Status<'a>

Attempts to solve the quadratic program.

Trait Implementations§

Source§

impl Drop for Problem

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for Problem

Source§

impl Sync for Problem

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.