2 ineq-constrained-qp.hh -- declare Ineq_constrained_qp
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #ifndef INEQ_CONSTRAINED_QP_HH
11 #define INEQ_CONSTRAINED_QP_HH
17 /** inequality constrained quadratic program
21 optimise for x : x*quad_ *x + lin_* x + const_term_
23 subject to for all i: cons_[i] * x >= consrhs_[i]
27 instantiate Ineq_constrained_qp.
29 Modify quad_, lin_ and const_term_ directly. Use
30 add_inequality_cons () to add constraints. Call solve () with a
35 class Ineq_constrained_qp {
36 friend class Active_constraints;
47 use a KKT method to assert optimality of sol
49 void assert_solution (Vector sol) const;
50 /// solve the problem using a projected gradient method
51 Vector constraint_solve (Vector) const;
53 Solve it. First try it the easy way.
55 Vector solve (Vector start) const;
58 @return the number of variables in the problem
72 void add_inequality_cons (Vector c, double r);
74 /** set up matrices to go with the problem. */
75 Ineq_constrained_qp (int novars);
78 evaluate the quadratic function for input #v#
82 void eliminate_var (int idx, Real value);
91 #endif // INEQ_CONSTRAINED_QP_HH