Added comments

release/4.3a0
krunalchande 2015-01-20 22:19:14 -05:00 committed by thduynguyen
parent 37fe405872
commit f1703db4aa
2 changed files with 6 additions and 4 deletions

View File

@ -158,12 +158,14 @@ boost::tuple<double, int> QPSolver::computeStepSize(
QPState QPSolver::iterate(const QPState& state) const { QPState QPSolver::iterate(const QPState& state) const {
static bool debug = false; static bool debug = false;
// Solve with the current working set // Algorithm 16.3 from Nocedal06book.
// Solve with the current working set eqn 16.39, but instead of solving for p solve for x
VectorValues newValues = solveWithCurrentWorkingSet(state.workingSet); VectorValues newValues = solveWithCurrentWorkingSet(state.workingSet);
if (debug) if (debug)
newValues.print("New solution:"); newValues.print("New solution:");
// If we CAN'T move further // If we CAN'T move further
// if p_k = 0 is the original condition, modified by Duy to say that the state update is zero.
if (newValues.equals(state.values, 1e-7)) { if (newValues.equals(state.values, 1e-7)) {
// Compute lambda from the dual graph // Compute lambda from the dual graph
if (debug) if (debug)
@ -191,12 +193,12 @@ QPState QPSolver::iterate(const QPState& state) const {
} }
} }
else { else {
// If we CAN make some progress // If we CAN make some progress, i.e. p_k != 0
// Adapt stepsize if some inactive constraints complain about this move // Adapt stepsize if some inactive constraints complain about this move
double alpha; double alpha;
int factorIx; int factorIx;
VectorValues p = newValues - state.values; VectorValues p = newValues - state.values;
boost::tie(alpha, factorIx) = // boost::tie(alpha, factorIx) = // using 16.41
computeStepSize(state.workingSet, state.values, p); computeStepSize(state.workingSet, state.values, p);
if (debug) if (debug)
cout << "alpha, factorIx: " << alpha << " " << factorIx << " " cout << "alpha, factorIx: " << alpha << " " << factorIx << " "

View File

@ -30,7 +30,7 @@ public:
NonlinearInequalityFactorGraph() { NonlinearInequalityFactorGraph() {
} }
/// Linearize to a LinearEqualityFactorGraph /// Linearize to a LinearInequalityFactorGraph
LinearInequalityFactorGraph::shared_ptr linearize( LinearInequalityFactorGraph::shared_ptr linearize(
const Values& linearizationPoint) const { const Values& linearizationPoint) const {
LinearInequalityFactorGraph::shared_ptr linearGraph( LinearInequalityFactorGraph::shared_ptr linearGraph(