5 class Active_constraints
{
6 friend class Inactive_iter
;
11 svec
<int> inactive
; // actually this is a set, not an array.
12 const Ineq_constrained_qp
*opt
;
17 Vector
vec(int k
) const { return opt
->cons
[k
]; }
18 Real
rhs(int k
) const { return opt
->consrhs
[k
]; }
22 /** drop constraint k from the active set. k is the index of the
23 constraint in #active#
30 add constraint j to the active set j is the index of the
31 constraint in #inactive#
34 /// exchange in and out.
35 void exchange(int in
, int out
) { add(in
); drop (out
); }
38 Vector
find_active_optimum(Vector g
);
40 /// get lagrange multipliers.
41 Vector
get_lagrange(Vector v
);
43 Active_constraints(Ineq_constrained_qp
const *op
);
44 /** construct: no constraints active, n vars. Put the equalities
45 into the constraints. */
52 This class represents the set of active (binding) constraints
53 which can be active while the QLP algorithm is in a feasible
54 point. The active constraints are numbered.
55 If the constraints are of the form
59 then the binding constraints are those where the >= is equality.
66 Active_constraints
const* ac
;
68 Inactive_iter(Active_constraints
const &c
) { ac
=&c
; j
=0; }
69 int idx() const { return j
; }
70 void operator ++(int) { j
++; }
71 int constraint_id() const { return ac
->inactive
[j
]; }
72 Vector
vec() const { return ac
->vec(constraint_id()); }
73 Real
rhs() const { return ac
->rhs(constraint_id()); }
74 bool ok() const { return j
< ac
->inactive
.sz(); }
77 loop through the inactive constraints.