Added comments
parent
37fe405872
commit
f1703db4aa
|
@ -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 << " "
|
||||||
|
|
|
@ -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(
|
||||||
|
|
Loading…
Reference in New Issue