From bcdeddbda177a983f621c9aa94e1c7837513eb08 Mon Sep 17 00:00:00 2001 From: krunalchande Date: Tue, 23 Dec 2014 16:09:18 -0500 Subject: [PATCH] Compute the least-square values of dual variables instead of forcing them to satisfy the stationarity condition exactly. This fixes an infinite-loop bug in QPSolver when a constraint was continuously added to and removed from the active set. --- gtsam_unstable/linear/QPSolver.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gtsam_unstable/linear/QPSolver.cpp b/gtsam_unstable/linear/QPSolver.cpp index f0eb7d7fb..e5b4cd801 100644 --- a/gtsam_unstable/linear/QPSolver.cpp +++ b/gtsam_unstable/linear/QPSolver.cpp @@ -58,7 +58,7 @@ JacobianFactor::shared_ptr QPSolver::createDualFactor(Key key, b += factor->gradient(key, delta); } } - return boost::make_shared(Aterms, b, noiseModel::Constrained::All(b.rows())); + return boost::make_shared(Aterms, b); // compute the least-square approximation of dual variables } else { return boost::make_shared(); @@ -156,7 +156,7 @@ boost::tuple QPSolver::computeStepSize( //****************************************************************************** QPState QPSolver::iterate(const QPState& state) const { - static bool debug = false; + static bool debug = true; // Solve with the current working set VectorValues newValues = solveWithCurrentWorkingSet(state.workingSet); @@ -164,7 +164,7 @@ QPState QPSolver::iterate(const QPState& state) const { newValues.print("New solution:"); // If we CAN'T move further - if (newValues.equals(state.values, 1e-5)) { + if (newValues.equals(state.values, 1e-7)) { // Compute lambda from the dual graph if (debug) cout << "Building dual graph..." << endl;