Add the vpsc library for IPSEPCOLA features
authorerg <devnull@localhost>
Fri, 28 Apr 2006 19:03:46 +0000 (19:03 +0000)
committererg <devnull@localhost>
Fri, 28 Apr 2006 19:03:46 +0000 (19:03 +0000)
lib/vpsc/solve_VPSC.h [new file with mode: 0644]

diff --git a/lib/vpsc/solve_VPSC.h b/lib/vpsc/solve_VPSC.h
new file mode 100644 (file)
index 0000000..b73a704
--- /dev/null
@@ -0,0 +1,60 @@
+/**
+ * \brief Solve an instance of the "Variable Placement with Separation
+ * Constraints" problem.
+ *
+ * Authors:
+ *   Tim Dwyer <tgdwyer@gmail.com>
+ *
+ * Copyright (C) 2005 Authors
+ * 
+ * This version is released under the CPL (Common Public License) with
+ * the Graphviz distribution.
+ * A version is also available under the LGPL as part of the Adaptagrams
+ * project: http://sourceforge.net/projects/adaptagrams.  
+ * If you make improvements or bug fixes to this code it would be much
+ * appreciated if you could also contribute those changes back to the
+ * Adaptagrams repository.
+ */
+#ifndef SEEN_REMOVEOVERLAP_SOLVE_VPSC_H
+#define SEEN_REMOVEOVERLAP_SOLVE_VPSC_H
+
+#include <vector>
+class Variable;
+class Constraint;
+class Blocks;
+
+/**
+ * Variable Placement with Separation Constraints problem instance
+ */
+class VPSC {
+public:
+       virtual void satisfy();
+       virtual void solve();
+
+       VPSC(const unsigned n, Variable *vs[], const unsigned m, Constraint *cs[]);
+       virtual ~VPSC();
+protected:
+       Blocks *bs;
+       Constraint **cs;
+       unsigned m;
+       void printBlocks();
+private:
+       void refine();
+       bool constraintGraphIsCyclic(const unsigned n, Variable *vs[]);
+       bool blockGraphIsCyclic();
+};
+
+class IncVPSC : VPSC {
+public:
+       unsigned splitCnt;
+       void satisfy();
+       void solve();
+       void moveBlocks();
+       void splitBlocks();
+       IncVPSC(const unsigned n, Variable *vs[], const unsigned m, Constraint *cs[]);
+private:
+       typedef std::vector<Constraint*> ConstraintList;
+       ConstraintList inactive;
+       double mostViolated(ConstraintList &l,Constraint* &v);
+};
+#endif // SEEN_REMOVEOVERLAP_SOLVE_VPSC_H