mlpack  master
primal_dual.hpp
Go to the documentation of this file.
1 
11 #ifndef MLPACK_CORE_OPTIMIZERS_SDP_PRIMAL_DUAL_HPP
12 #define MLPACK_CORE_OPTIMIZERS_SDP_PRIMAL_DUAL_HPP
13 
14 #include <mlpack/prereqs.hpp>
16 
17 namespace mlpack {
18 namespace optimization {
19 
25 template <typename SDPType>
27 {
28  public:
35  PrimalDualSolver(const SDPType& sdp);
36 
48  PrimalDualSolver(const SDPType& sdp,
49  const arma::mat& initialX,
50  const arma::vec& initialYSparse,
51  const arma::vec& initialYDense,
52  const arma::mat& initialZ);
53 
63  double Optimize(arma::mat& X,
64  arma::vec& ySparse,
65  arma::vec& yDense,
66  arma::mat& Z);
67 
73  double Optimize(arma::mat& X)
74  {
75  arma::vec ysparse, ydense;
76  arma::mat Z;
77  return Optimize(X, ysparse, ydense, Z);
78  }
79 
81  const SDPType& SDP() const { return sdp; }
82 
84  double& Tau() { return tau; }
85 
87  double& NormXzTol() { return normXzTol; }
88 
90  double& PrimalInfeasTol() { return primalInfeasTol; }
91 
93  double& DualInfeasTol() { return dualInfeasTol; }
94 
96  size_t& MaxIterations() { return maxIterations; }
97 
98  private:
100  SDPType sdp;
101 
103  arma::mat initialX;
104 
106  arma::vec initialYsparse;
107 
109  arma::vec initialYdense;
110 
112  //positive definite.
113  arma::mat initialZ;
114 
116  double tau;
117 
119  double normXzTol;
120 
124 
127 
130 };
131 
132 } // namespace optimization
133 } // namespace mlpack
134 
135 // Include implementation.
136 #include "primal_dual_impl.hpp"
137 
138 #endif
arma::vec initialYdense
Starting lagrange multiplier for the sparse constraints.
double & Tau()
Modify tau. Typical values are 0.99.
Definition: primal_dual.hpp:84
const SDPType & SDP() const
Return the underlying SDP instance.
Definition: primal_dual.hpp:81
size_t maxIterations
Maximum number of iterations to run. Set to 0 for no limit.
double Optimize(arma::mat &X)
Invoke the optimization procedure, and only return the primal variable.
Definition: primal_dual.hpp:73
double Optimize(arma::mat &X, arma::vec &ySparse, arma::vec &yDense, arma::mat &Z)
Invoke the optimization procedure, returning the converged values for the primal and dual variables...
size_t & MaxIterations()
Modify the maximum number of iterations to run before converging.
Definition: primal_dual.hpp:96
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: binarize.hpp:18
double primalInfeasTol
The tolerance required on the primal constraints required before terminating.
The core includes that mlpack expects; standard C++ includes and Armadillo.
double & PrimalInfeasTol()
Modify the primal infeasibility tolerance.
Definition: primal_dual.hpp:90
double & NormXzTol()
Modify the XZ tolerance.
Definition: primal_dual.hpp:87
SDPType sdp
The SDP problem instance to optimize.
double tau
The step size modulating factor. Needs to be a scalar in (0, 1).
Interface to a primal dual interior point solver.
Definition: primal_dual.hpp:26
arma::mat initialZ
Starting point for Z, the complementary slack variable. Needs to be.
double & DualInfeasTol()
Modify the dual infeasibility tolerance.
Definition: primal_dual.hpp:93
double dualInfeasTol
The tolerance required on the dual constraint required before terminating.
double normXzTol
The tolerance on the norm of XZ required before terminating.
arma::vec initialYsparse
Starting lagrange multiplier for the sparse constraints.
arma::mat initialX
Starting point for X. Needs to be positive definite.
PrimalDualSolver(const SDPType &sdp)
Construct a new solver instance from a given SDP instance.