[PPL-devel] [GIT] ppl/ppl(pip): Corrected capacity mismatch bug in PIP_Solution_Node:: solve().
Enea Zaffanella
zaffanella at cs.unipr.it
Sat Jan 30 21:39:31 CET 2010
Module: ppl/ppl
Branch: pip
Commit: 07cdb790656ae87064b7633b0f9b3bdd3e85b446
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=07cdb790656ae87064b7633b0f9b3bdd3e85b446
Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date: Sat Jan 30 21:37:50 2010 +0100
Corrected capacity mismatch bug in PIP_Solution_Node::solve().
---
src/PIP_Tree.cc | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/PIP_Tree.cc b/src/PIP_Tree.cc
index 3e42b9f..8cf8d29 100644
--- a/src/PIP_Tree.cc
+++ b/src/PIP_Tree.cc
@@ -1605,8 +1605,10 @@ PIP_Solution_Node::solve(PIP_Tree_Node*& parent_ref,
var_column[j_] = var_i;
/* create the identity matrix row corresponding to basic variable j_ */
- Row prs(num_vars, tableau.s_capacity(), Row::Flags());
- Row prt(num_params, tableau.t_capacity(), Row::Flags());
+ tableau.s.add_zero_rows(1, Row::Flags());
+ Row& prs = tableau.s[num_rows];
+ tableau.t.add_zero_rows(1, Row::Flags());
+ Row& prt = tableau.t[num_rows];
prs[j_] = tableau.get_denominator();
/* swap it with pivot row which would become identity after pivoting */
prs.swap(tableau.s[i_]);
@@ -1681,6 +1683,10 @@ PIP_Solution_Node::solve(PIP_Tree_Node*& parent_ref,
}
}
+ // Drop rows previously added at end of tableau.
+ tableau.s.erase_to_end(num_rows);
+ tableau.t.erase_to_end(num_rows);
+
/* compute column s[*][j_] : s[k][j_] /= sij */
if (sij != sij_denom) {
// Update column only if pivot != 1
More information about the PPL-devel
mailing list