37 #include <bias_config.h>
39 #include <MathAlgo/SOCP.hh>
40 #include <Base/Math/Random.hh>
45 int main(
int args,
char **arg)
55 A[0][0] = A[1][1] = 1;
77 int res = socp.
Compute(m, n, f, A, b, c, d, x, z, w);
80 cout <<
"Return code of SOCP solver = " << res << endl;
81 cout <<
"Primal problem : " << endl;
82 cout <<
" Final primal solution x = " << x << endl;
83 cout <<
" Target value of f'x = " << f.ScalarProduct(x) << endl;
84 cout <<
" Constraint evaluation for solution x : " << endl
87 cout <<
"Dual problem : " << endl;
88 cout <<
" Final dual solution z = " << z <<
", w = " << w << endl;
89 cout <<
" Target value of -(b'z + dw) = " << -(b.ScalarProduct(z) + d*w) << endl;
90 cout <<
" Constraint evaluation for solution z, w : " << endl
92 <<
" = f = " << f << endl;
93 cout <<
" |z| = " << z.
NormL2() <<
" <= w = " << w << endl;
T ScalarProduct(const Vector< T > &argvec) const
scalar product (inner product) of two vectors returning a scalr
double NormL2() const
Return the L2 norm: sqrt(a^1 + a^2 + ...)
Wrapper for Second-Order Cone Programming implementation, by Miguel S.
void SetNu(double nu)
Set parameter nu that controls the rate of convergence.
void SetTargetValue(double target)
Set target value used in convergence criterion only when relative tolerance given is < 0...
void SetRelativeTolerance(double tol)
Set relative tolerance used to determine convergence.
void SetAbsoluteTolerance(double tol)
Set absolute tolerance used to determine convergence.
int Compute(int L, int m, const std::vector< int > &N, const Vector< double > &f, const std::vector< Matrix< double > > &A, const std::vector< Vector< double > > &b, const std::vector< Vector< double > > &c, const std::vector< double > &d, Vector< double > &x, std::vector< Vector< double > > &z, std::vector< double > &w)
Solve Second-Order Cone Programming instance with L constraints.
void SetMaxIterations(int iter)
Set maximal number of iterations performed by SOCP algorithm.