[PPL-devel] [GIT] ppl/ppl(MPI): MIP_Problem: improve a little bit the get_exiting_base_index() performance.

Marco Poletti poletti.marco at gmail.com
Sun Sep 12 11:02:54 CEST 2010


Module: ppl/ppl
Branch: MPI
Commit: 620592736a503f2ee3d40880a6ca4ee25a6a7bd9
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=620592736a503f2ee3d40880a6ca4ee25a6a7bd9

Author: Marco Poletti <poletti.marco at gmail.com>
Date:   Sun Sep 12 10:56:32 2010 +0200

MIP_Problem: improve a little bit the get_exiting_base_index() performance.

---

 src/MIP_Problem.cc |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/MIP_Problem.cc b/src/MIP_Problem.cc
index 882af9e..6d1981a 100644
--- a/src/MIP_Problem.cc
+++ b/src/MIP_Problem.cc
@@ -1467,9 +1467,8 @@ PPL::MIP_Problem
   PPL_DIRTY_TEMP_COEFFICIENT(challenger);
   // These pointers are used instead of references in the following loop, to
   // improve performance.
-  const matrix_type::row_type* t_e = &(tableau[exiting_base_index]);
-  Coefficient t_e0 = t_e->get(0);
-  Coefficient t_ee = t_e->get(entering_var_index);
+  Coefficient t_e0 = tableau[exiting_base_index].get(0);
+  Coefficient t_ee = tableau[exiting_base_index].get(entering_var_index);
   for (dimension_type i = exiting_base_index + 1; i < tableau_num_rows; ++i) {
     const matrix_type::row_type& t_i = tableau[i];
     Coefficient_traits::const_reference t_ie = t_i.get(entering_var_index);
@@ -1477,21 +1476,21 @@ PPL::MIP_Problem
     const int t_ie_sign = sgn(t_ie);
     if (t_ie_sign != 0 && t_ie_sign == sgn(t_ib)) {
       WEIGHT_BEGIN();
+      Coefficient_traits::const_reference t_i0 = t_i.get(0);
       lcm_assign(lcm, t_ee, t_ie);
       exact_div_assign(current_min, lcm, t_ee);
       current_min *= t_e0;
       abs_assign(current_min);
       exact_div_assign(challenger, lcm, t_ie);
-      challenger *= t_i.get(0);
+      challenger *= t_i0;
       abs_assign(challenger);
       current_min -= challenger;
       const int sign = sgn(current_min);
       if (sign > 0
           || (sign == 0 && base[i] < base[exiting_base_index])) {
         exiting_base_index = i;
-        t_e = &(tableau[exiting_base_index]);
-        t_e0 = t_e->get(0);
-        t_ee = t_e->get(entering_var_index);
+        t_e0 = t_i0;
+        t_ee = t_ie;
       }
       WEIGHT_ADD(1044);
     }




More information about the PPL-devel mailing list