2 qlp.cc -- implement Mixed_qp
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
14 Mixed_qp::add_equality_cons (Vector
, double)
20 Mixed_qp::add_fixed_var (int i
, Real r
)
28 eliminate appropriate variables, until we have a Ineq_constrained_qp
32 cons should be ascending
35 Mixed_qp::solve (Vector start
) const
41 Ineq_constrained_qp
pure (*this);
43 for (int i
= eq_cons
.size()-1; i
>=0; i
--)
45 pure
.eliminate_var (eq_cons
[i
], eq_consrhs
[i
]);
46 start
.del (eq_cons
[i
]);
48 Vector sol
= pure
.solve (start
);
49 for (int i
= 0; i
< eq_cons
.size(); i
++)
51 sol
.insert (eq_consrhs
[i
],eq_cons
[i
]);
57 Mixed_qp::Mixed_qp (int n
)
58 : Ineq_constrained_qp (n
)
66 Ineq_constrained_qp::OK();
67 assert (eq_consrhs
.size() == eq_cons
.size ());
72 Mixed_qp::print() const
75 Ineq_constrained_qp::print();
76 for (int i
=0; i
< eq_cons
.size(); i
++)
78 DOUT
<< "eq cons "<<i
<<": x["<<eq_cons
[i
]<<"] == " << eq_consrhs
[i
]<< '\n';