[PPL-devel] [GIT] ppl/ppl(master): Got rid of a TODO item.
Enea Zaffanella
zaffanella at cs.unipr.it
Mon May 11 12:47:49 CEST 2009
Module: ppl/ppl
Branch: master
Commit: 71e9992afa9bc049b93d0b29fd9dbe52ead850cf
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=71e9992afa9bc049b93d0b29fd9dbe52ead850cf
Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date: Mon May 11 12:30:58 2009 +0200
Got rid of a TODO item.
Also avoid an annoying warning about an uninitialized variable.
---
TODO | 2 --
src/MIP_Problem.cc | 23 +++--------------------
2 files changed, 3 insertions(+), 22 deletions(-)
diff --git a/TODO b/TODO
index c0a11a1..145be12 100644
--- a/TODO
+++ b/TODO
@@ -11,8 +11,6 @@ Enhancements for PPL 0.11
- Make all the *affine*image() methods uniform as far as the
specification is concerned.
- Check the use or the NOT_EQUAL Relation_Symbol everywhere.
-- Get rid of ugly assign functions defined in anonymous namespace of
- MIP_Problem.cc replacing it with a more general-purpose approach.
- Reconsider the datatype for the units parameter in the Watchdog
constructors: should we prefer an unsigned?
- Rename set_rational_sqrt_precision_parameter to
diff --git a/src/MIP_Problem.cc b/src/MIP_Problem.cc
index 1fb17cf..132912b 100644
--- a/src/MIP_Problem.cc
+++ b/src/MIP_Problem.cc
@@ -855,22 +855,6 @@ PPL::MIP_Problem::process_pending_constraints() {
return true;
}
-namespace {
-
-inline void
-assign(double& d, const mpz_class& c) {
- d = c.get_d();
-}
-
-template <typename T, typename Policy>
-inline void
-assign(double& d,
- const Parma_Polyhedra_Library::Checked_Number<T, Policy>& c) {
- d = raw_value(c);
-}
-
-} // namespace
-
PPL::dimension_type
PPL::MIP_Problem::steepest_edge_float_entering_index() const {
PPL_DIRTY_TEMP0(mpq_class, real_coeff);
@@ -886,7 +870,7 @@ PPL::MIP_Problem::steepest_edge_float_entering_index() const {
if (sgn(cost_j) == cost_sign) {
// We cannot compute the (exact) square root of abs(\Delta x_j).
// The workaround is to compute the square of `cost[j]'.
- assign(challenger_num, cost_j);
+ assign_r(challenger_num, cost_j, ROUND_IGNORE);
challenger_num = fabs(challenger_num);
// Due to our integer implementation, the `1' term in the denominator
// of the original formula has to be replaced by `squared_lcm_basis'.
@@ -899,8 +883,7 @@ PPL::MIP_Problem::steepest_edge_float_entering_index() const {
assign_r(real_coeff.get_num(), tableau_ij, ROUND_NOT_NEEDED);
assign_r(real_coeff.get_den(), tableau_i[base[i]], ROUND_NOT_NEEDED);
real_coeff.canonicalize();
- double float_tableau_value;
- assign(float_tableau_value, real_coeff);
+ double float_tableau_value = real_coeff.get_d();
challenger_den += float_tableau_value * float_tableau_value;
}
}
@@ -1565,7 +1548,7 @@ PPL::MIP_Problem::solve_mip(bool& have_incumbent_solution,
bool found_satisfiable_generator = true;
PPL_DIRTY_TEMP_COEFFICIENT(gcd);
const Coefficient& p_divisor = p.divisor();
- dimension_type nonint_dim;
+ dimension_type nonint_dim = lp.space_dimension();
for (Variables_Set::const_iterator v_begin = i_vars.begin(),
v_end = i_vars.end(); v_begin != v_end; ++v_begin) {
gcd_assign(gcd, p.coefficient(Variable(*v_begin)), p_divisor);
More information about the PPL-devel
mailing list