]> git.donarmstrong.com Git - lilypond.git/blobdiff - src/qlp.cc
partial: 0.0.39-1.jcn
[lilypond.git] / src / qlp.cc
index 5aa8e9f45e7592f21fb9ab8c0a252886e4e9700e..e6696acf39966b4a25c72a77f70d89f67d898370 100644 (file)
@@ -12,15 +12,15 @@ Mixed_qp::add_equality_cons(Vector , double )
 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):
@@ -46,6 +46,14 @@ Ineq_constrained_qp::eval (Vector v)
 {
     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 
 {
@@ -65,6 +73,8 @@ 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)
@@ -96,7 +106,7 @@ Ineq_constrained_qp::assert_solution(Vector sol) const
        Real R=cons[i] * sol- consrhs[i];
        assert(R> -EPS);
        if (R < EPS)
-           binding.add(i);
+           binding.push(i);
     }
     // KKT check...
     // todo
@@ -116,16 +126,7 @@ Ineq_constrained_qp::print() const
 #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)