pub struct Solver<L: LinAlg> {
pub par: SolverParam<L::F>,
}Expand description
First-order conic linear program solver struct.
This struct abstracts a solver of a conic linear program: \[ \begin{array}{ll} {\rm minimize} & c^T x \\ {\rm subject \ to} & A x + s = b \\ & s \in \mathcal{K}, \end{array} \] where
- variables \( x \in \mathbb{R}^n,\ s \in \mathbb{R}^m \)
- \( c \in \mathbb{R}^n \) as an objective linear operator
- \( A \in \mathbb{R}^{m \times n} \) and \( b \in \mathbb{R}^m \) as constraint linear operators
- a nonempty, closed, convex cone \( \mathcal{K} \).
The solution gives optimal values of primal variables \(x\) as well as dual variables \(y\) of the dual problem: \[ \begin{array}{ll} {\rm maximize} & -b^T y \\ {\rm subject \ to} & -A^T y = c \\ & y \in \mathcal{K}^*, \end{array} \] where
- variables \( y \in \mathbb{R}^m \)
- \( \mathcal{K}^* \) is the dual cone of \( \mathcal{K} \).
Fields§
§par: SolverParam<L::F>solver parameters.
Implementations§
Source§impl<L: LinAlg> Solver<L>
impl<L: LinAlg> Solver<L>
Sourcepub fn query_worklen(op_a_size: (usize, usize)) -> usize
pub fn query_worklen(op_a_size: (usize, usize)) -> usize
Query of a length of work slice.
Returns a length of work slice that Solver::solve requires.
op_a_sizeis a number of rows and columns of \(A\).
Source§impl<L: LinAlg> Solver<L>
impl<L: LinAlg> Solver<L>
Sourcepub fn solve<OC, OA, OB, C>(
self,
(op_c, op_a, op_b, cone, work): (OC, OA, OB, C, &mut [L::F]),
) -> Result<(&[L::F], &[L::F]), SolverError>
pub fn solve<OC, OA, OB, C>( self, (op_c, op_a, op_b, cone, work): (OC, OA, OB, C, &mut [L::F]), ) -> Result<(&[L::F], &[L::F]), SolverError>
Starts to solve a conic linear program.
Returns Ok with a tuple of optimal \(x, y\)
or Err with SolverError type.
op_cis \(c\) as a linearOperator.op_ais \(A\) as a linearOperator.op_bis \(b\) as a linearOperator.coneis \(\mathcal{K}\) expressed byCone.workslice is used for temporal variables.Solver::solvedoes not rely on dynamic heap allocation.
Auto Trait Implementations§
impl<L> Freeze for Solver<L>
impl<L> RefUnwindSafe for Solver<L>
impl<L> Send for Solver<L>
impl<L> Sync for Solver<L>
impl<L> Unpin for Solver<L>
impl<L> UnwindSafe for Solver<L>
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