Unverified Commit 85ae02cf authored by Guilhem Saurel's avatar Guilhem Saurel Committed by GitHub
Browse files

Merge pull request #25 from nim65s/devel

fix warning about conversion of unused parameters 
parents 9bfeb65d f6d519a1
Pipeline #18190 passed with stage
in 8 minutes and 28 seconds
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
[![Pipeline status](https://gitlab.laas.fr/stack-of-tasks/eiquadprog/badges/master/pipeline.svg)](https://gitlab.laas.fr/stack-of-tasks/eiquadprog/commits/master) [![Pipeline status](https://gitlab.laas.fr/stack-of-tasks/eiquadprog/badges/master/pipeline.svg)](https://gitlab.laas.fr/stack-of-tasks/eiquadprog/commits/master)
[![Coverage report](https://gitlab.laas.fr/stack-of-tasks/eiquadprog/badges/master/coverage.svg?job=doc-coverage)](http://projects.laas.fr/gepetto/doc/stack-of-tasks/eiquadprog/master/coverage/) [![Coverage report](https://gitlab.laas.fr/stack-of-tasks/eiquadprog/badges/master/coverage.svg?job=doc-coverage)](http://projects.laas.fr/gepetto/doc/stack-of-tasks/eiquadprog/master/coverage/)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/stack-of-tasks/eiquadprog/master.svg)](https://results.pre-commit.ci/latest/github/stack-of-tasks/eiquadprog/master)
This repo contains different C++ implementations of the algorithm of Goldfarb and Idnani for the solution of a (convex) Quadratic Programming problem by means of a dual method. This repo contains different C++ implementations of the algorithm of Goldfarb and Idnani for the solution of a (convex) Quadratic Programming problem by means of a dual method.
......
...@@ -245,7 +245,7 @@ RtEiquadprog_status RtEiquadprog<nVars, nEqCon, nIneqCon>::solve_quadprog( ...@@ -245,7 +245,7 @@ RtEiquadprog_status RtEiquadprog<nVars, nEqCon, nIneqCon>::solve_quadprog(
c2 = m_J.trace(); c2 = m_J.trace();
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
utils::print_matrix("m_J", m_J, nVars); utils::print_matrix("m_J", m_J);
#endif #endif
/* c1 * c2 is an estimate for cond(Hess) */ /* c1 * c2 is an estimate for cond(Hess) */
...@@ -271,7 +271,7 @@ RtEiquadprog_status RtEiquadprog<nVars, nEqCon, nIneqCon>::solve_quadprog( ...@@ -271,7 +271,7 @@ RtEiquadprog_status RtEiquadprog<nVars, nEqCon, nIneqCon>::solve_quadprog(
f_value = 0.5 * g0.dot(x); f_value = 0.5 * g0.dot(x);
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
std::cerr << "Unconstrained solution: " << f_value << std::endl; std::cerr << "Unconstrained solution: " << f_value << std::endl;
utils::print_vector("x", x, nVars); utils::print_vector("x", x);
#endif #endif
STOP_PROFILER_EIQUADPROG_RT(PROFILE_EIQUADPROG_STEP_1_UNCONSTR_MINIM); STOP_PROFILER_EIQUADPROG_RT(PROFILE_EIQUADPROG_STEP_1_UNCONSTR_MINIM);
...@@ -288,10 +288,10 @@ RtEiquadprog_status RtEiquadprog<nVars, nEqCon, nIneqCon>::solve_quadprog( ...@@ -288,10 +288,10 @@ RtEiquadprog_status RtEiquadprog<nVars, nEqCon, nIneqCon>::solve_quadprog(
update_r(R, r, d, iq); update_r(R, r, d, iq);
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
utils::print_matrix("R", R, iq); utils::print_matrix("R", R);
utils::print_vector("z", z, nVars); utils::print_vector("z", z);
utils::print_vector("r", r, iq); utils::print_vector("r", r);
utils::print_vector("d", d, nVars); utils::print_vector("d", d);
#endif #endif
/* compute full step length t2: i.e., the minimum step in primal space s.t. /* compute full step length t2: i.e., the minimum step in primal space s.t.
...@@ -372,7 +372,7 @@ l1: ...@@ -372,7 +372,7 @@ l1:
} }
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
utils::print_vector("x", x, nVars); utils::print_vector("x", x);
#endif #endif
/* step 1: choose a violated constraint */ /* step 1: choose a violated constraint */
for (i = nEqCon; i < iq; i++) { for (i = nEqCon; i < iq; i++) {
...@@ -400,7 +400,7 @@ l1: ...@@ -400,7 +400,7 @@ l1:
#endif #endif
STOP_PROFILER_EIQUADPROG_RT(PROFILE_EIQUADPROG_STEP_1_2); STOP_PROFILER_EIQUADPROG_RT(PROFILE_EIQUADPROG_STEP_1_2);
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
utils::print_vector("s", s, nIneqCon); utils::print_vector("s", s);
#endif #endif
STOP_PROFILER_EIQUADPROG_RT(PROFILE_EIQUADPROG_STEP_1); STOP_PROFILER_EIQUADPROG_RT(PROFILE_EIQUADPROG_STEP_1);
...@@ -447,7 +447,7 @@ l2: /* Step 2: check for feasibility and determine a new S-pair */ ...@@ -447,7 +447,7 @@ l2: /* Step 2: check for feasibility and determine a new S-pair */
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
std::cerr << "Trying with constraint " << ip << std::endl; std::cerr << "Trying with constraint " << ip << std::endl;
utils::print_vector("np", np, nVars); utils::print_vector("np", np);
#endif #endif
STOP_PROFILER_EIQUADPROG_RT(PROFILE_EIQUADPROG_STEP_2); STOP_PROFILER_EIQUADPROG_RT(PROFILE_EIQUADPROG_STEP_2);
...@@ -468,11 +468,11 @@ l2a: /* Step 2a: determine step direction */ ...@@ -468,11 +468,11 @@ l2a: /* Step 2a: determine step direction */
update_r(R, r, d, iq); update_r(R, r, d, iq);
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
std::cerr << "Step direction z" << std::endl; std::cerr << "Step direction z" << std::endl;
utils::print_vector("z", z, nVars); utils::print_vector("z", z);
utils::print_vector("r", r, iq + 1); utils::print_vector("r", r);
utils::print_vector("u", u, iq + 1); utils::print_vector("u", u);
utils::print_vector("d", d, nVars); utils::print_vector("d", d);
utils::print_vector("A", A, iq + 1); utils::print_vector("A", A);
#endif #endif
STOP_PROFILER_EIQUADPROG_RT(PROFILE_EIQUADPROG_STEP_2A); STOP_PROFILER_EIQUADPROG_RT(PROFILE_EIQUADPROG_STEP_2A);
...@@ -525,9 +525,9 @@ l2a: /* Step 2a: determine step direction */ ...@@ -525,9 +525,9 @@ l2a: /* Step 2a: determine step direction */
delete_constraint(R, m_J, A, u, iq, l); delete_constraint(R, m_J, A, u, iq, l);
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
std::cerr << " in dual space: " << f_value << std::endl; std::cerr << " in dual space: " << f_value << std::endl;
utils::print_vector("x", x, nVars); utils::print_vector("x", x);
utils::print_vector("z", z, nVars); utils::print_vector("z", z);
utils::print_vector("A", A, iq + 1); utils::print_vector("A", A);
#endif #endif
STOP_PROFILER_EIQUADPROG_RT(PROFILE_EIQUADPROG_STEP_2C); STOP_PROFILER_EIQUADPROG_RT(PROFILE_EIQUADPROG_STEP_2C);
goto l2a; goto l2a;
...@@ -543,16 +543,16 @@ l2a: /* Step 2a: determine step direction */ ...@@ -543,16 +543,16 @@ l2a: /* Step 2a: determine step direction */
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
std::cerr << " in both spaces: " << f_value << std::endl; std::cerr << " in both spaces: " << f_value << std::endl;
utils::print_vector("x", x, nVars); utils::print_vector("x", x);
utils::print_vector("u", u, iq + 1); utils::print_vector("u", u);
utils::print_vector("r", r, iq + 1); utils::print_vector("r", r);
utils::print_vector("A", A, iq + 1); utils::print_vector("A", A);
#endif #endif
if (t == t2) { if (t == t2) {
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
std::cerr << "Full step has taken " << t << std::endl; std::cerr << "Full step has taken " << t << std::endl;
utils::print_vector("x", x, nVars); utils::print_vector("x", x);
#endif #endif
/* full step has taken */ /* full step has taken */
/* add constraint ip to the active set*/ /* add constraint ip to the active set*/
...@@ -560,8 +560,8 @@ l2a: /* Step 2a: determine step direction */ ...@@ -560,8 +560,8 @@ l2a: /* Step 2a: determine step direction */
iaexcl(ip) = 0; iaexcl(ip) = 0;
delete_constraint(R, m_J, A, u, iq, ip); delete_constraint(R, m_J, A, u, iq, ip);
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
utils::print_matrix("R", R, nVars); utils::print_matrix("R", R);
utils::print_vector("A", A, iq); utils::print_vector("A", A);
#endif #endif
for (i = 0; i < nIneqCon; i++) iai(i) = i; for (i = 0; i < nIneqCon; i++) iai(i) = i;
for (i = 0; i < iq; i++) { for (i = 0; i < iq; i++) {
...@@ -575,8 +575,8 @@ l2a: /* Step 2a: determine step direction */ ...@@ -575,8 +575,8 @@ l2a: /* Step 2a: determine step direction */
} else } else
iai(ip) = -1; iai(ip) = -1;
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
utils::print_matrix("R", R, nVars); utils::print_matrix("R", R);
utils::print_vector("A", A, iq); utils::print_vector("A", A);
#endif #endif
STOP_PROFILER_EIQUADPROG_RT(PROFILE_EIQUADPROG_STEP_2C); STOP_PROFILER_EIQUADPROG_RT(PROFILE_EIQUADPROG_STEP_2C);
goto l1; goto l1;
...@@ -591,10 +591,10 @@ l2a: /* Step 2a: determine step direction */ ...@@ -591,10 +591,10 @@ l2a: /* Step 2a: determine step direction */
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
std::cerr << "Partial step has taken " << t << std::endl; std::cerr << "Partial step has taken " << t << std::endl;
utils::print_vector("x", x, nVars); utils::print_vector("x", x);
utils::print_matrix("R", R, nVars); utils::print_matrix("R", R);
utils::print_vector("A", A, iq); utils::print_vector("A", A);
utils::print_vector("s", s, nIneqCon); utils::print_vector("s", s);
#endif #endif
STOP_PROFILER_EIQUADPROG_RT(PROFILE_EIQUADPROG_STEP_2C); STOP_PROFILER_EIQUADPROG_RT(PROFILE_EIQUADPROG_STEP_2C);
......
...@@ -24,14 +24,23 @@ inline Scalar distance(Scalar a, Scalar b) { ...@@ -24,14 +24,23 @@ inline Scalar distance(Scalar a, Scalar b) {
} }
template <class Derived> template <class Derived>
void print_vector(const char *name, Eigen::MatrixBase<Derived> &x, int /*n*/) { void print_vector(const char *name, Eigen::MatrixBase<Derived> &x) {
std::cerr << name << x.transpose() << std::endl; std::cerr << name << x.transpose() << std::endl;
} }
template <class Derived> template <class Derived>
void print_matrix(const char *name, Eigen::MatrixBase<Derived> &x, int /*n*/) { void print_matrix(const char *name, Eigen::MatrixBase<Derived> &x) {
std::cerr << name << std::endl << x << std::endl; std::cerr << name << std::endl << x << std::endl;
} }
template <class Derived>
void print_vector(const char *name, Eigen::MatrixBase<Derived> &x, int /*n*/) {
print_vector(name, x);
}
template <class Derived>
void print_matrix(const char *name, Eigen::MatrixBase<Derived> &x, int /*n*/) {
print_matrix(name, x);
}
} // namespace utils } // namespace utils
} // namespace eiquadprog } // namespace eiquadprog
......
...@@ -255,7 +255,7 @@ EiquadprogFast_status EiquadprogFast::solve_quadprog( ...@@ -255,7 +255,7 @@ EiquadprogFast_status EiquadprogFast::solve_quadprog(
c2 = m_J.trace(); c2 = m_J.trace();
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
utils::print_matrix("m_J", m_J, nVars); utils::print_matrix("m_J", m_J);
#endif #endif
/* c1 * c2 is an estimate for cond(Hess) */ /* c1 * c2 is an estimate for cond(Hess) */
...@@ -283,7 +283,7 @@ EiquadprogFast_status EiquadprogFast::solve_quadprog( ...@@ -283,7 +283,7 @@ EiquadprogFast_status EiquadprogFast::solve_quadprog(
f_value = 0.5 * g0.dot(x); f_value = 0.5 * g0.dot(x);
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
std::cerr << "Unconstrained solution: " << f_value << std::endl; std::cerr << "Unconstrained solution: " << f_value << std::endl;
utils::print_vector("x", x, nVars); utils::print_vector("x", x);
#endif #endif
STOP_PROFILER_EIQUADPROG_FAST(EIQUADPROG_FAST_STEP_1_UNCONSTR_MINIM); STOP_PROFILER_EIQUADPROG_FAST(EIQUADPROG_FAST_STEP_1_UNCONSTR_MINIM);
...@@ -299,10 +299,10 @@ EiquadprogFast_status EiquadprogFast::solve_quadprog( ...@@ -299,10 +299,10 @@ EiquadprogFast_status EiquadprogFast::solve_quadprog(
update_r(R, r, d, iq); update_r(R, r, d, iq);
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
utils::print_matrix("R", R, iq); utils::print_matrix("R", R);
utils::print_vector("z", z, nVars); utils::print_vector("z", z);
utils::print_vector("r", r, iq); utils::print_vector("r", r);
utils::print_vector("d", d, nVars); utils::print_vector("d", d);
#endif #endif
/* compute full step length t2: i.e., /* compute full step length t2: i.e.,
...@@ -386,7 +386,7 @@ l1: ...@@ -386,7 +386,7 @@ l1:
START_PROFILER_EIQUADPROG_FAST(EIQUADPROG_FAST_STEP_1); START_PROFILER_EIQUADPROG_FAST(EIQUADPROG_FAST_STEP_1);
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
utils::print_vector("x", x, nVars); utils::print_vector("x", x);
#endif #endif
/* step 1: choose a violated constraint */ /* step 1: choose a violated constraint */
for (i = nEqCon; i < iq; i++) { for (i = nEqCon; i < iq; i++) {
...@@ -414,7 +414,7 @@ l1: ...@@ -414,7 +414,7 @@ l1:
#endif #endif
STOP_PROFILER_EIQUADPROG_FAST(EIQUADPROG_FAST_STEP_1_2); STOP_PROFILER_EIQUADPROG_FAST(EIQUADPROG_FAST_STEP_1_2);
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
utils::print_vector("s", s, nIneqCon); utils::print_vector("s", s);
#endif #endif
STOP_PROFILER_EIQUADPROG_FAST(EIQUADPROG_FAST_STEP_1); STOP_PROFILER_EIQUADPROG_FAST(EIQUADPROG_FAST_STEP_1);
...@@ -461,7 +461,7 @@ l2: /* Step 2: check for feasibility and determine a new S-pair */ ...@@ -461,7 +461,7 @@ l2: /* Step 2: check for feasibility and determine a new S-pair */
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
std::cerr << "Trying with constraint " << ip << std::endl; std::cerr << "Trying with constraint " << ip << std::endl;
utils::print_vector("np", np, nVars); utils::print_vector("np", np);
#endif #endif
STOP_PROFILER_EIQUADPROG_FAST(EIQUADPROG_FAST_STEP_2); STOP_PROFILER_EIQUADPROG_FAST(EIQUADPROG_FAST_STEP_2);
...@@ -482,11 +482,11 @@ l2a: /* Step 2a: determine step direction */ ...@@ -482,11 +482,11 @@ l2a: /* Step 2a: determine step direction */
update_r(R, r, d, iq); update_r(R, r, d, iq);
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
std::cerr << "Step direction z" << std::endl; std::cerr << "Step direction z" << std::endl;
utils::print_vector("z", z, nVars); utils::print_vector("z", z);
utils::print_vector("r", r, iq + 1); utils::print_vector("r", r);
utils::print_vector("u", u, iq + 1); utils::print_vector("u", u);
utils::print_vector("d", d, nVars); utils::print_vector("d", d);
utils::print_vector("A", A, iq + 1); utils::print_vector("A", A);
#endif #endif
STOP_PROFILER_EIQUADPROG_FAST(EIQUADPROG_FAST_STEP_2A); STOP_PROFILER_EIQUADPROG_FAST(EIQUADPROG_FAST_STEP_2A);
...@@ -539,9 +539,9 @@ l2a: /* Step 2a: determine step direction */ ...@@ -539,9 +539,9 @@ l2a: /* Step 2a: determine step direction */
delete_constraint(R, m_J, A, u, nEqCon, iq, l); delete_constraint(R, m_J, A, u, nEqCon, iq, l);
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
std::cerr << " in dual space: " << f_value << std::endl; std::cerr << " in dual space: " << f_value << std::endl;
utils::print_vector("x", x, nVars); utils::print_vector("x", x);
utils::print_vector("z", z, nVars); utils::print_vector("z", z);
utils::print_vector("A", A, iq + 1); utils::print_vector("A", A);
#endif #endif
STOP_PROFILER_EIQUADPROG_FAST(EIQUADPROG_FAST_STEP_2C); STOP_PROFILER_EIQUADPROG_FAST(EIQUADPROG_FAST_STEP_2C);
goto l2a; goto l2a;
...@@ -557,16 +557,16 @@ l2a: /* Step 2a: determine step direction */ ...@@ -557,16 +557,16 @@ l2a: /* Step 2a: determine step direction */
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
std::cerr << " in both spaces: " << f_value << std::endl; std::cerr << " in both spaces: " << f_value << std::endl;
utils::print_vector("x", x, nVars); utils::print_vector("x", x);
utils::print_vector("u", u, iq + 1); utils::print_vector("u", u);
utils::print_vector("r", r, iq + 1); utils::print_vector("r", r);
utils::print_vector("A", A, iq + 1); utils::print_vector("A", A);
#endif #endif
if (t == t2) { if (t == t2) {
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
std::cerr << "Full step has taken " << t << std::endl; std::cerr << "Full step has taken " << t << std::endl;
utils::print_vector("x", x, nVars); utils::print_vector("x", x);
#endif #endif
/* full step has taken */ /* full step has taken */
/* add constraint ip to the active set*/ /* add constraint ip to the active set*/
...@@ -574,8 +574,8 @@ l2a: /* Step 2a: determine step direction */ ...@@ -574,8 +574,8 @@ l2a: /* Step 2a: determine step direction */
iaexcl(ip) = 0; iaexcl(ip) = 0;
delete_constraint(R, m_J, A, u, nEqCon, iq, ip); delete_constraint(R, m_J, A, u, nEqCon, iq, ip);
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
utils::print_matrix("R", R, nVars); utils::print_matrix("R", R);
utils::print_vector("A", A, iq); utils::print_vector("A", A);
#endif #endif
for (i = 0; i < nIneqCon; i++) iai(i) = static_cast<VectorXi::Scalar>(i); for (i = 0; i < nIneqCon; i++) iai(i) = static_cast<VectorXi::Scalar>(i);
for (i = 0; i < iq; i++) { for (i = 0; i < iq; i++) {
...@@ -589,8 +589,8 @@ l2a: /* Step 2a: determine step direction */ ...@@ -589,8 +589,8 @@ l2a: /* Step 2a: determine step direction */
} else } else
iai(ip) = -1; iai(ip) = -1;
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
utils::print_matrix("R", R, nVars); utils::print_matrix("R", R);
utils::print_vector("A", A, iq); utils::print_vector("A", A);
#endif #endif
STOP_PROFILER_EIQUADPROG_FAST(EIQUADPROG_FAST_STEP_2C); STOP_PROFILER_EIQUADPROG_FAST(EIQUADPROG_FAST_STEP_2C);
goto l1; goto l1;
...@@ -603,10 +603,10 @@ l2a: /* Step 2a: determine step direction */ ...@@ -603,10 +603,10 @@ l2a: /* Step 2a: determine step direction */
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
std::cerr << "Partial step has taken " << t << std::endl; std::cerr << "Partial step has taken " << t << std::endl;
utils::print_vector("x", x, nVars); utils::print_vector("x", x);
utils::print_matrix("R", R, nVars); utils::print_matrix("R", R);
utils::print_vector("A", A, iq); utils::print_vector("A", A);
utils::print_vector("s", s, nIneqCon); utils::print_vector("s", s);
#endif #endif
STOP_PROFILER_EIQUADPROG_FAST(EIQUADPROG_FAST_STEP_2C); STOP_PROFILER_EIQUADPROG_FAST(EIQUADPROG_FAST_STEP_2C);
......
...@@ -98,7 +98,7 @@ double solve_quadprog(LLT<MatrixXd, Lower> &chol, double c1, VectorXd &g0, ...@@ -98,7 +98,7 @@ double solve_quadprog(LLT<MatrixXd, Lower> &chol, double c1, VectorXd &g0,
chol.matrixU().solveInPlace(J); chol.matrixU().solveInPlace(J);
c2 = J.trace(); c2 = J.trace();
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
utils::print_matrix("J", J, n); utils::print_matrix("J", J);
#endif #endif
/* c1 * c2 is an estimate for cond(G) */ /* c1 * c2 is an estimate for cond(G) */
...@@ -114,7 +114,7 @@ double solve_quadprog(LLT<MatrixXd, Lower> &chol, double c1, VectorXd &g0, ...@@ -114,7 +114,7 @@ double solve_quadprog(LLT<MatrixXd, Lower> &chol, double c1, VectorXd &g0,
f_value = 0.5 * g0.dot(x); f_value = 0.5 * g0.dot(x);
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
std::cerr << "Unconstrained solution: " << f_value << std::endl; std::cerr << "Unconstrained solution: " << f_value << std::endl;
utils::print_vector("x", x, n); utils::print_vector("x", x);
#endif #endif
/* Add equality constraints to the working set A */ /* Add equality constraints to the working set A */
...@@ -125,10 +125,10 @@ double solve_quadprog(LLT<MatrixXd, Lower> &chol, double c1, VectorXd &g0, ...@@ -125,10 +125,10 @@ double solve_quadprog(LLT<MatrixXd, Lower> &chol, double c1, VectorXd &g0,
update_z(z, J, d, iq); update_z(z, J, d, iq);
update_r(R, r, d, iq); update_r(R, r, d, iq);
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
utils::print_matrix("R", R, iq); utils::print_matrix("R", R);
utils::print_vector("z", z, n); utils::print_vector("z", z);
utils::print_vector("r", r, iq); utils::print_vector("r", r);
utils::print_vector("d", d, n); utils::print_vector("d", d);
#endif #endif
/* compute full step length t2: i.e., the minimum step in primal space s.t. /* compute full step length t2: i.e., the minimum step in primal space s.t.
...@@ -161,7 +161,7 @@ double solve_quadprog(LLT<MatrixXd, Lower> &chol, double c1, VectorXd &g0, ...@@ -161,7 +161,7 @@ double solve_quadprog(LLT<MatrixXd, Lower> &chol, double c1, VectorXd &g0,
l1: l1:
iter++; iter++;
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
utils::print_vector("x", x, n); utils::print_vector("x", x);
#endif #endif
/* step 1: choose a violated constraint */ /* step 1: choose a violated constraint */
for (i = me; i < iq; i++) { for (i = me; i < iq; i++) {
...@@ -180,7 +180,7 @@ l1: ...@@ -180,7 +180,7 @@ l1:
psi += std::min(0.0, sum); psi += std::min(0.0, sum);
} }
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
utils::print_vector("s", s, mi); utils::print_vector("s", s);
#endif #endif
if (std::abs(psi) <= static_cast<double>(mi) * if (std::abs(psi) <= static_cast<double>(mi) *
...@@ -217,7 +217,7 @@ l2: /* Step 2: check for feasibility and determine a new S-pair */ ...@@ -217,7 +217,7 @@ l2: /* Step 2: check for feasibility and determine a new S-pair */
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
std::cerr << "Trying with constraint " << ip << std::endl; std::cerr << "Trying with constraint " << ip << std::endl;
utils::print_vector("np", np, n); utils::print_vector("np", np);
#endif #endif
l2a: /* Step 2a: determine step direction */ l2a: /* Step 2a: determine step direction */
...@@ -230,11 +230,11 @@ l2a: /* Step 2a: determine step direction */ ...@@ -230,11 +230,11 @@ l2a: /* Step 2a: determine step direction */
update_r(R, r, d, iq); update_r(R, r, d, iq);
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
std::cerr << "Step direction z" << std::endl; std::cerr << "Step direction z" << std::endl;
utils::print_vector("z", z, n); utils::print_vector("z", z);
utils::print_vector("r", r, iq + 1); utils::print_vector("r", r);
utils::print_vector("u", u, iq + 1); utils::print_vector("u", u);
utils::print_vector("d", d, n); utils::print_vector("d", d);
utils::print_vector("A", A, iq + 1); utils::print_vector("A", A);
#endif #endif
/* Step 2b: compute step length */ /* Step 2b: compute step length */
...@@ -283,9 +283,9 @@ l2a: /* Step 2a: determine step direction */ ...@@ -283,9 +283,9 @@ l2a: /* Step 2a: determine step direction */
delete_constraint(R, J, A, u, p, iq, l); delete_constraint(R, J, A, u, p, iq, l);
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
std::cerr << " in dual space: " << f_value << std::endl; std::cerr << " in dual space: " << f_value << std::endl;
utils::print_vector("x", x, n); utils::print_vector("x", x);
utils::print_vector("z", z, n); utils::print_vector("z", z);
utils::print_vector("A", A, iq + 1); utils::print_vector("A", A);
#endif #endif
goto l2a; goto l2a;
} }
...@@ -300,16 +300,16 @@ l2a: /* Step 2a: determine step direction */ ...@@ -300,16 +300,16 @@ l2a: /* Step 2a: determine step direction */
u(iq) += t; u(iq) += t;
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
std::cerr << " in both spaces: " << f_value << std::endl; std::cerr << " in both spaces: " << f_value << std::endl;
utils::print_vector("x", x, n); utils::print_vector("x", x);
utils::print_vector("u", u, iq + 1); utils::print_vector("u", u);
utils::print_vector("r", r, iq + 1); utils::print_vector("r", r);
utils::print_vector("A", A, iq + 1); utils::print_vector("A", A);
#endif #endif
if (t == t2) { if (t == t2) {
#ifdef EIQGUADPROG_TRACE_SOLVER #ifdef EIQGUADPROG_TRACE_SOLVER
std::cerr << "Full step has taken " << t << std::endl; std::cerr << "Full step has taken " << t << std::endl;
utils::print_vector("x", x, n);