Array<int> allcons;
for (int i=0; i < opt->cons.size(); i++)
- allcons.add(0);
+ allcons.push(0);
for (int i=0; i < active.size(); i++) {
int j = active[i];
allcons[j]++;
{
// add indices
int cidx=inactive[k];
- active.add(cidx);
+ active.push(cidx);
inactive.swap(k,inactive.size()-1);
inactive.pop();
int q=active.size()-1;
// drop indices
- inactive.add(active[k]);
+ inactive.push(active[k]);
active.swap(k,q);
A.swap_rows(k,q);
active.pop();
opt(op)
{
for (int i=0; i < op->cons.size(); i++)
- inactive.add(i);
+ inactive.push(i);
Choleski_decomposition chol(op->quad);
H=chol.inverse();
}
-/* Find the optimum which is in the planes generated by the active
+/** Find the optimum which is in the planes generated by the active
constraints.
*/
Vector
return H*g;
}
-/****************************************************************/
+/* *************************************************************** */
int
min_elt_index(Vector v)
return idx;
}
-///the numerical solving
+
+/**the numerical solving. Mordecai Avriel, Nonlinear Programming: analysis and methods (1976)
+ Prentice Hall.
+
+ Section 13.3
+
+ This is a "projected gradient" algorithm. Starting from a point x
+ the next point is found in a direction determined by projecting
+ the gradient onto the active constraints. (well, not really the
+ gradient. The optimal solution obeying the active constraints is
+ tried. This is why H = Q^-1 in initialisation) )
+
+
+ */
Vector
Ineq_constrained_qp::solve(Vector start) const
{
Vector x(start);
Vector gradient=quad*x+lin;
-
-
+// Real fvalue = x*quad*x/2 + lin*x + const_term;
+// it's no use.
+
Vector last_gradient(gradient);
int iterations=0;
return x;
}
-/** Mordecai Avriel, Nonlinear Programming: analysis and methods (1976)
- Prentice Hall.
-
- Section 13.3
-
- This is a "projected gradient" algorithm. Starting from a point x
- the next point is found in a direction determined by projecting
- the gradient onto the active constraints. (well, not really the
- gradient. The optimal solution obeying the active constraints is
- tried. This is why H = Q^-1 in initialisation) )
-
-
- */