[PPL-devel] [GIT] ppl/ppl(master): Fixed MIP_Problem bug shown by tests/MIP_Problem/ mipproblem4.cc.

Enea Zaffanella zaffanella at cs.unipr.it
Mon Oct 17 09:53:26 CEST 2011


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

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Mon Oct 17 09:52:30 2011 +0200

Fixed MIP_Problem bug shown by tests/MIP_Problem/mipproblem4.cc.

---

 src/MIP_Problem.cc |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/MIP_Problem.cc b/src/MIP_Problem.cc
index ed19471..9224ceb 100644
--- a/src/MIP_Problem.cc
+++ b/src/MIP_Problem.cc
@@ -1701,6 +1701,13 @@ PPL::MIP_Problem::erase_artificials(const dimension_type begin_artificials,
 // See page 55 of [PapadimitriouS98].
 void
 PPL::MIP_Problem::compute_generator() const {
+  // Early exit for 0-dimensional problems.
+  if (external_space_dim == 0) {
+    MIP_Problem& x = const_cast<MIP_Problem&>(*this);
+    x.last_generator = point();
+    return;
+  }
+
   // We will store in num[] and in den[] the numerators and
   // the denominators of every variable of the original problem.
   std::vector<Coefficient> num(external_space_dim);
@@ -1772,6 +1779,7 @@ PPL::MIP_Problem::compute_generator() const {
   }
 
   // Compute the lcm of all denominators.
+  PPL_ASSERT(external_space_dim > 0);
   lcm = den[0];
   for (dimension_type i = 1; i < external_space_dim; ++i)
     lcm_assign(lcm, lcm, den[i]);
@@ -1794,7 +1802,8 @@ PPL::MIP_Problem::compute_generator() const {
 void
 PPL::MIP_Problem::second_phase() {
   // Second_phase requires that *this is satisfiable.
-  PPL_ASSERT(status == SATISFIABLE || status == UNBOUNDED
+  PPL_ASSERT(status == SATISFIABLE
+             || status == UNBOUNDED
              || status == OPTIMIZED);
   // In the following cases the problem is already solved.
   if (status == UNBOUNDED || status == OPTIMIZED)




More information about the PPL-devel mailing list