
Module: ppl/ppl Branch: sparse_matrices Commit: 07dfb14d484ef7b552388152934e3e0ae6f1099b URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=07dfb14d484ef...
Author: Marco Poletti poletti.marco@gmail.com Date: Tue Sep 14 14:26:46 2010 +0200
MIP_Problem: fix regression in textbook_entering_index(), introduced in commit 6880A6.
---
src/MIP_Problem.cc | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/MIP_Problem.cc b/src/MIP_Problem.cc index 3538b33..560b47a 100644 --- a/src/MIP_Problem.cc +++ b/src/MIP_Problem.cc @@ -1266,9 +1266,13 @@ PPL::MIP_Problem::textbook_entering_index() const { const dimension_type cost_sign_index = working_cost.size() - 1; const int cost_sign = sgn(working_cost.get(cost_sign_index)); PPL_ASSERT(cost_sign != 0); - for (working_cost_type::const_iterator - i = working_cost.lower_bound(1), i_end = working_cost.end(); - i != i_end; ++i) + + working_cost_type::const_iterator i = working_cost.lower_bound(1); + // Note that find() is used instead of lower_bound() because they are + // equivalent when searching the last element in the row. + working_cost_type::const_iterator i_end + = working_cost.find(cost_sign_index); + for ( ; i != i_end; ++i) if (sgn(*i) == cost_sign) return i.index(); // No variable has to enter the base: