
Module: ppl/ppl Branch: pip Commit: 150b3c6db234103b9a0ad8ea24357eb8ec5fb9e1 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=150b3c6db2341...
Author: François Galea francois.galea@uvsq.fr Date: Thu Oct 1 16:32:23 2009 +0200
Fixed bugs.
---
src/PIP_Tree.cc | 7 ++++++- src/PIP_Tree.inlines.hh | 2 +- tests/PIP_Problem/pipproblem1.cc | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/PIP_Tree.cc b/src/PIP_Tree.cc index 8da372e..08c6c83 100644 --- a/src/PIP_Tree.cc +++ b/src/PIP_Tree.cc @@ -430,6 +430,7 @@ PIP_Solution_Node::Rational_Matrix::scale(const Coefficient &ratio) { for (i=0; i<i_max; ++i) for (j=0; j<j_max; ++j) rows[i][j] *= ratio; + denominator *= ratio; }
void @@ -941,6 +942,7 @@ PIP_Solution_Node::solve(PIP_Tree_Node*& parent_ref, const Matrix& ctx, gcd_assign(gcd, mult, sij); Coefficient scale_factor = sij/gcd; tableau.s.scale(scale_factor); + tableau.t.scale(scale_factor); mult *= scale_factor; } tableau.s[k][j] -= mult / sij; @@ -955,6 +957,7 @@ PIP_Solution_Node::solve(PIP_Tree_Node*& parent_ref, const Matrix& ctx, // Must scale matrix to stay in integer case gcd_assign(gcd, c, sij); Coefficient scale_factor = sij/gcd; + tableau.s.scale(scale_factor); tableau.t.scale(scale_factor); c *= scale_factor; } @@ -992,6 +995,7 @@ PIP_Solution_Node::solve(PIP_Tree_Node*& parent_ref, const Matrix& ctx, gcd_assign(gcd, c, sij); Coefficient scale_factor = sij/gcd; tableau.s.scale(scale_factor); + tableau.t.scale(scale_factor); } c /= sij; } @@ -1118,7 +1122,7 @@ PIP_Solution_Node::solve(PIP_Tree_Node*& parent_ref, const Matrix& ctx, if (tableau.s.is_integer() && tableau.t.is_integer()) { /* The solution is integer */ #ifdef NOISY_PIP - std::cout << "Solution found for in current node." + std::cout << "Solution found for problem in current node." << std::endl; #endif return OPTIMIZED_PIP_PROBLEM; @@ -1130,6 +1134,7 @@ PIP_Solution_Node::solve(PIP_Tree_Node*& parent_ref, const Matrix& ctx, std::cout << "Cut generation required." << std::endl; #endif + return OPTIMIZED_PIP_PROBLEM; } } } // Main loop of the simplex algorithm diff --git a/src/PIP_Tree.inlines.hh b/src/PIP_Tree.inlines.hh index c7f66bb..79f48c1 100644 --- a/src/PIP_Tree.inlines.hh +++ b/src/PIP_Tree.inlines.hh @@ -42,7 +42,7 @@ PIP_Solution_Node::Rational_Matrix::Rational_Matrix(dimension_type n_rows, inline PIP_Solution_Node::Rational_Matrix::Rational_Matrix(const Rational_Matrix& y) : Matrix(y), - denominator(1) { + denominator(y.denominator) { }
inline bool diff --git a/tests/PIP_Problem/pipproblem1.cc b/tests/PIP_Problem/pipproblem1.cc index 4895eb8..5169f0f 100644 --- a/tests/PIP_Problem/pipproblem1.cc +++ b/tests/PIP_Problem/pipproblem1.cc @@ -105,7 +105,7 @@ test02() { cs.insert(3*j >= -2*i+8); cs.insert(j <= 4*i - 4); cs.insert(j <= m); - cs.insert(j >= 0); + //cs.insert(j >= 0); cs.insert(i <= n);
PIP_Problem pip(cs.space_dimension(), cs.begin(), cs.end(), params);