[−][src]Struct totsu::pdipm::PDIPM
A basic Primal-Dual Interior-Point Method solver struct.
This struct abstracts a solver of continuous scalar convex optimization problem:
\[
\begin{array}{ll}
{\rm minimize} & f_{\rm obj}(x) \
{\rm subject \ to} & f_i(x) \le 0 \quad (i = 0, \ldots, m - 1) \
& A x = b,
\end{array}
\]
where
- variables \( x \in {\bf R}^n \)
- \( f_{\rm obj}: {\bf R}^n \rightarrow {\bf R} \), convex and twice differentiable
- \( f_i: {\bf R}^n \rightarrow {\bf R} \), convex and twice differentiable
- \( A \in {\bf R}^{p \times n} \), \( {\bf rank} A = p < n \), \( b \in {\bf R}^p \).
The solution gives optimal values of primal variables \(x\) as well as dual variables \(\lambda \in {\bf R}^m\) and \(\nu \in {\bf R}^p\).
Methods
impl PDIPM
[src]
pub fn new() -> PDIPM
[src]
Creates an instance.
pub fn solve<L, Fo1, Fo2, Fi0, Fi1, Fi2, Fe, Fs>(
&mut self,
param: &PDIPMParam,
log: &mut L,
n: usize,
m: usize,
p: usize,
d_objective: Fo1,
dd_objective: Fo2,
inequality: Fi0,
d_inequality: Fi1,
dd_inequality: Fi2,
equality: Fe,
start_point: Fs
) -> Result<&Mat, PDIPMErr> where
L: Write,
Fo1: Fn(&MatSlice, &mut Mat),
Fo2: Fn(&MatSlice, &mut Mat),
Fi0: Fn(&MatSlice, &mut Mat),
Fi1: Fn(&MatSlice, &mut Mat),
Fi2: Fn(&MatSlice, &mut Mat, usize),
Fe: FnOnce(&mut Mat, &mut Mat),
Fs: FnOnce(MatSliMu),
[src]
&mut self,
param: &PDIPMParam,
log: &mut L,
n: usize,
m: usize,
p: usize,
d_objective: Fo1,
dd_objective: Fo2,
inequality: Fi0,
d_inequality: Fi1,
dd_inequality: Fi2,
equality: Fe,
start_point: Fs
) -> Result<&Mat, PDIPMErr> where
L: Write,
Fo1: Fn(&MatSlice, &mut Mat),
Fo2: Fn(&MatSlice, &mut Mat),
Fi0: Fn(&MatSlice, &mut Mat),
Fi1: Fn(&MatSlice, &mut Mat),
Fi2: Fn(&MatSlice, &mut Mat, usize),
Fe: FnOnce(&mut Mat, &mut Mat),
Fs: FnOnce(MatSliMu),
Starts to solve a optimization problem by primal-dual interior-point method.
Returns Ok
with optimal \(x, \lambda, \nu\) concatenated vector
or Err
with PDIPMErr
type.
param
is solver parameters.log
outputs solver progress.n
is \(n\), the dimension of the variable \(x\).m
is \(m\), the number of inequality constraints \(f_i\).p
is \(p\), the number of rows of equality constraints \(A\) and \(b\).d_objective(x, df_o)
calculates first derivatives of the objective function \(\nabla f_{\rm obj}(x)\).dd_objective(x, ddf_o)
calculates second derivatives of the objective function \(\nabla^2 f_{\rm obj}(x)\).inequality(x, f_i)
calculates the inequality constraint functions \(f_i(x)\).d_inequality(x, df_i)
calculates first derivatives of the inequality constraint functions \(Df(x) = \left[\matrix{\nabla f_0(x) & \cdots & \nabla f_{m-1}(x)}\right]^T\).dd_inequality(x, ddf_i, i)
calculates second derivatives of the inequality constraint functions \(\nabla^2 f_i(x)\).equality(a, b)
produces the equality constraints affine parameters \(A\) and \(b\).start_point(x)
produces the initial values of \(x\). The initial values must satisfy all inequality constraints strictly: \(f_i(x)<0\). This may seem a hard requirement, but introducing slack variables helps in most cases. Refer pre-defined solver implementations for example.
Trait Implementations
impl LP for PDIPM
[src]
fn solve_lp<L>(
&mut self,
param: &PDIPMParam,
log: &mut L,
vec_c: &Mat,
mat_g: &Mat,
vec_h: &Mat,
mat_a: &Mat,
vec_b: &Mat
) -> Result<Mat, String> where
L: Write,
[src]
&mut self,
param: &PDIPMParam,
log: &mut L,
vec_c: &Mat,
mat_g: &Mat,
vec_h: &Mat,
mat_a: &Mat,
vec_b: &Mat
) -> Result<Mat, String> where
L: Write,
Runs the solver with given parameters.
Returns Ok
with optimal \(x\) or Err
with message string.
param
is solver parameters.log
outputs solver progress.vec_c
is \(c\).mat_g
is \(G\).vec_h
is \(h\).mat_a
is \(A\).vec_b
is \(b\).
impl QP for PDIPM
[src]
fn solve_qp<L>(
&mut self,
param: &PDIPMParam,
log: &mut L,
mat_p: &Mat,
vec_q: &Mat,
mat_g: &Mat,
vec_h: &Mat,
mat_a: &Mat,
vec_b: &Mat
) -> Result<Mat, String> where
L: Write,
[src]
&mut self,
param: &PDIPMParam,
log: &mut L,
mat_p: &Mat,
vec_q: &Mat,
mat_g: &Mat,
vec_h: &Mat,
mat_a: &Mat,
vec_b: &Mat
) -> Result<Mat, String> where
L: Write,
Runs the solver with given parameters.
Returns Ok
with optimal \(x\) or Err
with message string.
param
is solver parameters.log
outputs solver progress.mat_p
is \(P\).vec_q
is \(q\).mat_g
is \(G\).vec_h
is \(h\).mat_a
is \(A\).vec_b
is \(b\).
impl QCQP for PDIPM
[src]
fn solve_qcqp<L>(
&mut self,
param: &PDIPMParam,
log: &mut L,
mat_p: &[Mat],
vec_q: &[Mat],
scl_r: &[FP],
mat_a: &Mat,
vec_b: &Mat
) -> Result<Mat, String> where
L: Write,
[src]
&mut self,
param: &PDIPMParam,
log: &mut L,
mat_p: &[Mat],
vec_q: &[Mat],
scl_r: &[FP],
mat_a: &Mat,
vec_b: &Mat
) -> Result<Mat, String> where
L: Write,
Runs the solver with given parameters.
Returns Ok
with optimal \(x\) or Err
with message string.
param
is solver parameters.log
outputs solver progress.mat_p
is \(P_0, \ldots, P_m\).vec_q
is \(q_0, \ldots, q_m\).scl_r
is \(r_0, \ldots, r_m\).mat_a
is \(A\).vec_b
is \(b\).
impl SOCP for PDIPM
[src]
fn solve_socp<L>(
&mut self,
param: &PDIPMParam,
log: &mut L,
vec_f: &Mat,
mat_g: &[Mat],
vec_h: &[Mat],
vec_c: &[Mat],
scl_d: &[FP],
mat_a: &Mat,
vec_b: &Mat
) -> Result<Mat, String> where
L: Write,
[src]
&mut self,
param: &PDIPMParam,
log: &mut L,
vec_f: &Mat,
mat_g: &[Mat],
vec_h: &[Mat],
vec_c: &[Mat],
scl_d: &[FP],
mat_a: &Mat,
vec_b: &Mat
) -> Result<Mat, String> where
L: Write,
Runs the solver with given parameters.
Returns Ok
with optimal \(x\) or Err
with message string.
param
is solver parameters.log
outputs solver progress.vec_f
is \(f\).mat_g
is \(G_0, \ldots, G_{m-1}\).vec_h
is \(h_0, \ldots, h_{m-1}\).vec_c
is \(c_0, \ldots, c_{m-1}\).scl_d
is \(d_0, \ldots, d_{m-1}\).mat_a
is \(A\).vec_b
is \(b\).
impl SDP for PDIPM
[src]
fn solve_sdp<L>(
&mut self,
param: &PDIPMParam,
log: &mut L,
vec_c: &Mat,
mat_f: &[Mat],
mat_a: &Mat,
vec_b: &Mat
) -> Result<Mat, String> where
L: Write,
[src]
&mut self,
param: &PDIPMParam,
log: &mut L,
vec_c: &Mat,
mat_f: &[Mat],
mat_a: &Mat,
vec_b: &Mat
) -> Result<Mat, String> where
L: Write,
Runs the solver with given parameters.
Returns Ok
with optimal \(x\) or Err
with message string.
param
is solver parameters.log
outputs solver progress.vec_c
is \(c\).mat_f
is \(F_0, \ldots, F_n\).mat_a
is \(A\).vec_b
is \(b\).
NOTE: Current implementation that uses the barrier method is not so accurate.
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,