[PPL-devel] [GIT] ppl/ppl(master): Added a couple of tests using the big parameter.

François Galea francois.galea at uvsq.fr
Fri Mar 19 22:15:25 CET 2010


Module: ppl/ppl
Branch: master
Commit: ae2b90afc196deace10b7035dea30d9872d7b8b3
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=ae2b90afc196deace10b7035dea30d9872d7b8b3

Author: François Galea <francois.galea at uvsq.fr>
Date:   Fri Mar 19 07:44:11 2010 +0100

Added a couple of tests using the big parameter.

---

 tests/PIP_Problem/pipproblem1.cc |   55 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/tests/PIP_Problem/pipproblem1.cc b/tests/PIP_Problem/pipproblem1.cc
index e361a7b..438663e 100644
--- a/tests/PIP_Problem/pipproblem1.cc
+++ b/tests/PIP_Problem/pipproblem1.cc
@@ -702,6 +702,59 @@ test23() {
   return ok;
 }
 
+bool
+test24() {
+  // Minimization problem, using the big parameter trick to allow the
+  // variables to be negative.
+  Variable x(0);
+  Variable y(1);
+  Variable p(2);
+  Variable M(3);
+  Variables_Set params(p, M);
+
+  Constraint_System cs;
+  cs.insert(y - M >= -2*x + 2*M - 4);     // y >= -2*x - 4
+  cs.insert(2*y - 2*M <= x - M + 2*p);    // 2*y <= x + 2*p
+
+  PIP_Problem pip(cs.space_dimension(), cs.begin(), cs.end(), params);
+  pip.set_big_parameter_dimension(3);     // M is the big parameter
+
+  bool ok = (pip.solve() == OPTIMIZED_PIP_PROBLEM);
+  if (ok) {
+    const PIP_Tree solution = pip.solution();
+    ok &= solution->OK();
+    pip.print_solution(nout);
+  }
+
+  return ok;
+}
+
+bool
+test25() {
+  // Lexicographical maximization, using variable substitution.
+  Variable x(0);
+  Variable y(1);
+  Variable p(2);
+  Variable M(3);
+  Variables_Set params(p, M);
+
+  Constraint_System cs;
+  cs.insert(M - y >= 2*M - 2*x - 4);      // y >= 2*x - 4
+  cs.insert(M - y <= -M + x + p);         // y <= -x + p
+
+  PIP_Problem pip(cs.space_dimension(), cs.begin(), cs.end(), params);
+  pip.set_big_parameter_dimension(3);     // M is the big parameter
+
+  bool ok = (pip.solve() == OPTIMIZED_PIP_PROBLEM);
+  if (ok) {
+    const PIP_Tree solution = pip.solution();
+    ok &= solution->OK();
+    pip.print_solution(nout);
+  }
+
+  return ok;
+}
+
 } // namespace
 
 BEGIN_MAIN
@@ -728,4 +781,6 @@ BEGIN_MAIN
   DO_TEST_F8(test21);
   DO_TEST_F8(test22);
   DO_TEST_F8(test23);
+  DO_TEST(test24);
+  DO_TEST(test25);
 END_MAIN




More information about the PPL-devel mailing list