void
Mixed_qp::add_fixed_var(int i, Real r)
{
- eq_cons.add(i);
- eq_consrhs.add(r);
+ eq_cons.push(i);
+ eq_consrhs.push(r);
}
void
Ineq_constrained_qp::add_inequality_cons(Vector c, double r)
{
- cons.add(c);
- consrhs.add(r);
+ cons.push(c);
+ consrhs.push(r);
}
Ineq_constrained_qp::Ineq_constrained_qp(int novars):
{
return v * quad * v + lin * v + const_term;
}
+
+/**
+ eliminate appropriate variables, until we have a Ineq_constrained_qp
+ then solve that.
+
+ PRE
+ cons should be ascending
+ */
Vector
Mixed_qp::solve(Vector start) const
{
/*
assume x(idx) == value, and adjust constraints, lin and quad accordingly
+
+ TODO: add const_term
*/
void
Ineq_constrained_qp::eliminate_var(int idx, Real value)
Real R=cons[i] * sol- consrhs[i];
assert(R> -EPS);
if (R < EPS)
- binding.add(i);
+ binding.push(i);
}
// KKT check...
// todo
#endif
}
-/****************/
-
-/*
- eliminate appropriate variables, until we have a Ineq_constrained_qp
- then solve that.
-
- PRE
- cons should be ascending
- */
-
+/* *************** */
Mixed_qp::Mixed_qp(int n)
: Ineq_constrained_qp(n)