[PPL-devel] [GIT] ppl/ppl(sparse_matrices): MIP_Problem: optimize second_phase() for sparse working_cost rows.
Marco Poletti
poletti.marco at gmail.com
Tue Sep 14 14:55:17 CEST 2010
Module: ppl/ppl
Branch: sparse_matrices
Commit: f2479e2b3e49803d56e972cf3e036d238037030b
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=f2479e2b3e49803d56e972cf3e036d238037030b
Author: Marco Poletti <poletti.marco at gmail.com>
Date: Tue Sep 14 14:34:19 2010 +0200
MIP_Problem: optimize second_phase() for sparse working_cost rows.
---
src/MIP_Problem.cc | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/MIP_Problem.cc b/src/MIP_Problem.cc
index 560b47a..784880d 100644
--- a/src/MIP_Problem.cc
+++ b/src/MIP_Problem.cc
@@ -1857,12 +1857,20 @@ PPL::MIP_Problem::second_phase() {
i = new_cost.begin(), i_end = new_cost.end(); i != i_end; ++i)
neg_assign(*i);
- // Substitute properly the cost function in the `costs' matrix.
const dimension_type cost_zero_size = working_cost.size();
- working_cost_type tmp_cost = working_cost_type(cost_zero_size,
- cost_zero_size,
- new_cost.flags());
- tmp_cost.swap(working_cost);
+
+ // Substitute properly the cost function in the `costs' matrix.
+#if USE_PPL_SPARSE_MATRIX
+ working_cost.clear();
+ working_cost.flags() = Row_Flags();
+#else
+ {
+ working_cost_type tmp_cost = working_cost_type(cost_zero_size,
+ cost_zero_size,
+ new_cost.flags());
+ tmp_cost.swap(working_cost);
+ }
+#endif
{
working_cost_type::iterator itr
More information about the PPL-devel
mailing list