]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/qlpsolve.hh
release: 1.1.30
[lilypond.git] / lily / include / qlpsolve.hh
index 7c9b8da341b57342033d9bf97c71bdd45efb213f..9a342527eec657ea47f33a56af1c6b29988b4aac 100644 (file)
@@ -1,15 +1,15 @@
 /*
   qlpsolve.hh -- declare  Active_constraints, Inactive_iter
 
-  source file of the LilyPond music typesetter
+  source file of the GNU LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 
 #ifndef QLPSOLVE_HH
 #define QLPSOLVE_HH
-#include "qlp.hh"
+
 #include "matrix.hh"
 
 
   */
 
 class Active_constraints {
-    friend class Inactive_iter;
+  friend class Inactive_iter;
     
 
-    Matrix A,H;
-    Array<int> active;
-    Array<int> inactive;               // actually this is a set, not an array.
-    const Ineq_constrained_qp *opt;
+  Matrix A,H;
+  Array<int> active;
+  Array<int> inactive;         // actually this is a set, not an array.
+  Ineq_constrained_qp const *opt;
 
 public:
-    String status()const;
+  
+  /** This counts the number of errors the algorithms makes.  The
+      optimum search should be abandoned if it becomes too high.  */
+  int degenerate_count_i_;
+  String status() const;
     
-    Vector vec(int k) const { return opt->cons[k]; }
-    Real rhs(int k) const { return opt->consrhs[k]; }
+  Vector vec (int k) const { return opt->cons_[k]; }
+  Real rhs (int k) const { return opt->consrhs_[k]; }
     
 
-    /** drop constraint. drop constraint k from the active set. k is the index of the
+  /** drop constraint. drop constraint k from the active set. k is the index of the
     constraint in #active#
     
     */
-    void drop (int k);
+  void drop_constraint (int k);
     
 
-    /** add constraint j.
+  /** add constraint j.
     add constraint j to the active set j is the index of the
     constraint in #inactive#   
     */
-    void add(int j);
+  void add_constraint (int j);
 
-    /// exchange in and out.
-    void exchange(int in, int out) { add(in); drop (out); }
+  /// exchange in and out.
+  void exchange (int in, int out) { add_constraint (in); drop_constraint (out); }
     
 
-    Vector find_active_optimum(Vector g);
+  Vector find_active_optimum (Vector g);
 
-    /// get lagrange multipliers.
-    Vector get_lagrange(Vector v);
+  /// get lagrange multipliers.
+  Vector get_lagrange (Vector v);
 
-    Active_constraints(Ineq_constrained_qp const *op);
-    /** construct: no constraints active, n vars. Put the equalities
-     into the constraints.  */
+  Active_constraints (Ineq_constrained_qp const *op);
+  /** construct: no constraints active, n vars. Put the equalities
+    into the constraints.  */
 
-    /// check invariants
-    void OK();
+  /// check invariants
+  void OK();
 };
 
 
@@ -76,16 +80,16 @@ public:
     loop through the inactive constraints.
   */
 class Inactive_iter {
-    int j;
-    Active_constraints const* ac;
+  int j;
+  Active_constraints const* ac;
 public:
-    Inactive_iter(Active_constraints const &c) { ac=&c; j=0; }
-    int idx() const { return j; }
-    void operator ++(int) { j++; }
-    int constraint_id() const { return ac->inactive[j]; }
-    Vector vec() const { return ac->vec(constraint_id()); }
-    Real rhs() const { return ac->rhs(constraint_id()); }
-    bool ok() const { return j < ac->inactive.size(); }
+  Inactive_iter (Active_constraints const &c) { ac=&c; j=0; }
+  int idx() const { return j; }
+  void operator ++(int) { j++; }
+  int constraint_id() const { return ac->inactive[j]; }
+  Vector vec() const { return ac->vec (constraint_id ()); }
+  Real rhs() const { return ac->rhs (constraint_id ()); }
+  bool ok() const { return j < ac->inactive.size (); }
 };
 
 #endif // QLPSOLVE_HH