[][src]Struct totsu::pdipm::PDIPM

pub struct PDIPM {
    pub eps: FP,
    pub mu: FP,
    pub alpha: FP,
    pub beta: FP,
    pub s_coef: FP,
    pub margin: FP,
    pub n_loop: usize,
    pub svd_warm: bool,
    pub log_kkt: bool,
}

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\).

Fields

eps: FP

Tolerance of the surrogate duality gap. Tolerance of the primal and dual residuals.

mu: FP

The factor to squeeze complementary slackness.

alpha: FP

The factor to decrease residuals in the backtracking line search.

beta: FP

The factor to decrease a step size in the backtracking line search.

s_coef: FP

The factor to determine an initial step size in the backtracking line search.

margin: FP

Initial margin value for dual variables of inequalities.

n_loop: usize

Max iteration number of outer-loop for the Newton step. Max iteration number of inner-loop for the backtracking line search.

svd_warm: bool

Enables to warm-start svd.

log_kkt: bool

Enables to log kkt matrix.

Methods

impl PDIPM
[src]

pub fn new() -> PDIPM
[src]

Creates an instance with default parameters.

pub fn solve<L, Fo1, Fo2, Fi0, Fi1, Fi2, Fe, Fs>(
    &self,
    n: usize,
    m: usize,
    p: usize,
    log: &mut L,
    d_objective: Fo1,
    dd_objective: Fo2,
    inequality: Fi0,
    d_inequality: Fi1,
    dd_inequality: Fi2,
    equality: Fe,
    start_point: Fs
) -> Result<Mat, &'static str> 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]

Starts to solve a optimization problem by primal-dual interior-point method.

Returns Ok with optimal \(x, \lambda, \nu\) concatenated vector or Err with message string.

  • 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\).
  • log outputs solver progress.
  • 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>(
    &self,
    log: &mut L,
    vec_c: &Mat,
    mat_g: &Mat,
    vec_h: &Mat,
    mat_a: &Mat,
    vec_b: &Mat
) -> Result<Mat, &'static str> where
    L: Write
[src]

Runs the solver with given parameters.

Returns Ok with optimal \(x\) or Err with message string.

  • 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>(
    &self,
    log: &mut L,
    mat_p: &Mat,
    vec_q: &Mat,
    mat_g: &Mat,
    vec_h: &Mat,
    mat_a: &Mat,
    vec_b: &Mat
) -> Result<Mat, &'static str> where
    L: Write
[src]

Runs the solver with given parameters.

Returns Ok with optimal \(x\) or Err with message string.

  • 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>(
    &self,
    log: &mut L,
    mat_p: &[Mat],
    vec_q: &[Mat],
    scl_r: &[FP],
    mat_a: &Mat,
    vec_b: &Mat
) -> Result<Mat, &'static str> where
    L: Write
[src]

Runs the solver with given parameters.

Returns Ok with optimal \(x\) or Err with message string.

  • 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>(
    &self,
    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, &'static str> where
    L: Write
[src]

Runs the solver with given parameters.

Returns Ok with optimal \(x\) or Err with message string.

  • 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>(
    &self,
    log: &mut L,
    vec_c: &Mat,
    mat_f: &[Mat],
    mat_a: &Mat,
    vec_b: &Mat
) -> Result<Mat, &'static str> where
    L: Write
[src]

Runs the solver with given parameters.

Returns Ok with optimal \(x\) or Err with message string.

  • 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 is neither efficient nor accurate. You may need lower eps parameter.

Auto Trait Implementations

impl Send for PDIPM

impl Sync for PDIPM

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]