|
Totsu PrimalDualIPM
|
A basic Primal-Dual Interior-Point Method solver class. More...
#include <PrimalDualIPM.h>

Public Member Functions | |
| PrimalDualIPM () | |
| Constructor. | |
| virtual | ~PrimalDualIPM () |
| Destructor. | |
| void | setLog (std::ostream *pOuts) |
| Sets output destination of internal calculation log. More... | |
Protected Member Functions | |
| void | logWarn (const char *str) |
| Logs a warning message. More... | |
| void | logVector (const char *str, IPM_Vector_IN v) |
| Logs values of a vector, transposing if it is a colomn vector. More... | |
| void | logMatrix (const char *str, IPM_Matrix_IN m) |
| Logs values of a matrix. More... | |
| IPM_Error | start (const IPM_uint n, const IPM_uint m, const IPM_uint p) |
| Starts to solve a optimization problem by primal-dual interior-point method. More... | |
| virtual IPM_Error | initialPoint (IPM_Vector_IO x)=0 |
| Produces the initial values of \(x\). More... | |
| virtual IPM_Error | finalPoint (IPM_Vector_IN x, IPM_Vector_IN lmd, IPM_Vector_IN nu, bool converged)=0 |
| Obtains the final solution values of \(x\). More... | |
| virtual IPM_Error | objective (IPM_Vector_IN x, IPM_Single_IO f_o)=0 |
| Calculates the objective function \(f_{\rm obj}(x)\). More... | |
| virtual IPM_Error | Dobjective (IPM_Vector_IN x, IPM_Vector_IO Df_o)=0 |
| Calculates first derivatives of the objective function \(\nabla f_{\rm obj}(x)\). More... | |
| virtual IPM_Error | DDobjective (IPM_Vector_IN x, IPM_Matrix_IO DDf_o)=0 |
| Calculates second derivatives of the objective function \(\nabla^2 f_{\rm obj}(x)\). More... | |
| virtual IPM_Error | inequality (IPM_Vector_IN x, IPM_Vector_IO f_i)=0 |
| Calculates the inequality constraint functions \(f_i(x)\). More... | |
| virtual IPM_Error | Dinequality (IPM_Vector_IN x, IPM_Matrix_IO Df_i)=0 |
| Calculates first derivatives of the inequality constraint functions \(Df(x)\). More... | |
| virtual IPM_Error | DDinequality (IPM_Vector_IN x, IPM_Matrix_IO DDf_i, const IPM_uint of_i)=0 |
| Calculates second derivatives of the inequality constraint functions \(\nabla^2 f_i(x)\). More... | |
| virtual IPM_Error | equality (IPM_Matrix_IO A, IPM_Vector_IO b)=0 |
| Produces the equality constraints affine parameters \(A\) and \(b\). More... | |
Static Protected Member Functions | |
| static IPM_Scalar | max (const IPM_Scalar a, const IPM_Scalar b) |
| Returns the larger of a and b. | |
| static IPM_Scalar | min (const IPM_Scalar a, const IPM_Scalar b) |
| Returns the smaller of a and b. | |
| static IPM_Scalar | abs (const IPM_Scalar x) |
| Returns the absolute value of x. | |
Protected Attributes | |
| IPM_Scalar | m_margin |
| Initial margin value for dual variables of inequalities. | |
| IPM_Scalar | m_loop |
| Max iteration number of outer-loop for the Newton step. | |
| IPM_Scalar | m_bloop |
| Max iteration number of inner-loop for the backtracking line search. | |
| IPM_Scalar | m_eps_feas |
| Tolerance of the primal and dual residuals. | |
| IPM_Scalar | m_eps |
| Tolerance of the surrogate duality gap. | |
| IPM_Scalar | m_mu |
| The factor to squeeze complementary slackness. | |
| IPM_Scalar | m_alpha |
| The factor to decrease residuals in the backtracking line search. | |
| IPM_Scalar | m_beta |
| The factor to decrease a step size in the backtracking line search. | |
| IPM_Scalar | m_s_coef |
| The factor to determine an initial step size in the backtracking line search. | |
A basic Primal-Dual Interior-Point Method solver class.
This class 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
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\).
|
inline |
Sets output destination of internal calculation log.
| pOuts | is a pointer of output stream. NULL means no output. |
|
protected |
|
protected |
Logs values of a vector, transposing if it is a colomn vector.
| str | is a pointer of the name string of v. |
| v | is the logged vector. |

|
protected |
Logs values of a matrix.
| str | is a pointer of the name string of m. |
| m | is the logged matrix. |
Starts to solve a optimization problem by primal-dual interior-point method.
This is the main function of this class. All pure virtual functions are called within this method.
| 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\). |


|
protectedpure virtual |
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 many cases. Refer QCQP implementation for example.
| x | [OUT] is a column vector containing the initial values of \(x\). |

|
protectedpure virtual |
Obtains the final solution values of \(x\).
Dual variables \(\lambda, \nu\) can be obtained as well.
| x | [IN] is a column vector containing the final values of \(x\). |
| lmd | [IN] is a column vector containing the final values of \(\lambda\). |
| nu | [IN] is a column vector containing the final values of \(\nu\). |
| converged | is true when the solution ends with termination criteria satisfied. false means that x, lmd and nu are not optimal. |

|
protectedpure virtual |
Calculates the objective function \(f_{\rm obj}(x)\).
| x | [IN] is a column vector containing values of \(x\). |
| f_o | [OUT] is a single element matrix containing a value of \(f_{\rm obj}(x)\). |
|
protectedpure virtual |
Calculates first derivatives of the objective function \(\nabla f_{\rm obj}(x)\).
| x | [IN] is a column vector containing values of \(x\). |
| Df_o | [OUT] is a column vector containing values of \(\nabla f_{\rm obj}(x)\). |

|
protectedpure virtual |
Calculates second derivatives of the objective function \(\nabla^2 f_{\rm obj}(x)\).
| x | [IN] is a column vector containing values of \(x\). |
| DDf_o | [OUT] is a matrix containing values of \(\nabla^2 f_{\rm obj}(x)\). |

|
protectedpure virtual |
Calculates the inequality constraint functions \(f_i(x)\).
| x | [IN] is a column vector containing values of \(x\). |
| f_i | [OUT] is a column vector containing values of \(\left[\matrix{f_0(x) & \cdots & f_{m-1}(x)}\right]^T\). |

|
protectedpure virtual |
Calculates first derivatives of the inequality constraint functions \(Df(x)\).
NOTE: \(Df(x) = \left[\matrix{\nabla f_0(x) & \cdots & \nabla f_{m-1}(x)}\right]^T\).
| x | [IN] is a column vector containing values of \(x\). |
| Df_i | [OUT] is a matrix containing values of \(Df(x)\). |

|
protectedpure virtual |
Calculates second derivatives of the inequality constraint functions \(\nabla^2 f_i(x)\).
| x | [IN] is a column vector containing values of \(x\). |
| DDf_i | [OUT] is a matrix containing values of \(\nabla^2 f_i(x)\). |
| of_i | indicates an index \(i\) of \(f_i\). |

|
protectedpure virtual |
Produces the equality constraints affine parameters \(A\) and \(b\).
| A | [OUT] is a matrix containing values of \(A\). |
| b | [OUT] is a column vector containing values of \(b\). |
