
Module: ppl/ppl Branch: master Commit: a7af846ade60e2c4e9bdd7595b80abd5776d4704 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=a7af846ade60e...
Author: François Galea francois.galea@uvsq.fr Date: Sun Mar 7 20:25:00 2010 +0100
Added one more test for incremental solving.
---
tests/PIP_Problem/pipproblem1.cc | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/tests/PIP_Problem/pipproblem1.cc b/tests/PIP_Problem/pipproblem1.cc index 4c7568b..e361a7b 100644 --- a/tests/PIP_Problem/pipproblem1.cc +++ b/tests/PIP_Problem/pipproblem1.cc @@ -666,6 +666,42 @@ test22() { return ok; }
+bool +test23() { + // Same problem as test02, but incrementally adding a parameter constraint + // removing one level in the decision tree. + Variable i(0); + Variable j(1); + Variable n(2); + Variable m(3); + Variables_Set params(n, m); + + Constraint_System cs; + cs.insert(3*j >= -2*i+8); + cs.insert(j <= 4*i - 4); + cs.insert(j <= m); + cs.insert(i <= n); + + PIP_Problem pip(cs.space_dimension(), cs.begin(), cs.end(), params); + + bool ok = (pip.solve() == OPTIMIZED_PIP_PROBLEM); + if (ok) { + const PIP_Tree solution = pip.solution(); + ok &= solution->OK(); + pip.print_solution(nout); + } + + pip.add_constraint(7*n >= 10); + 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 @@ -691,4 +727,5 @@ BEGIN_MAIN DO_TEST_F8(test20); DO_TEST_F8(test21); DO_TEST_F8(test22); + DO_TEST_F8(test23); END_MAIN