Changeset 309


Ignore:
Timestamp:
Mar 9, 2010 1:46:46 AM (11 years ago)
Author:
pbelotti
Message:

a few fixes on semi-auxiliaries

Location:
trunk/Couenne/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Couenne/src/bound_tightening/obbt.cpp

    r218 r309  
    55 * Purpose: Optimality-Based Bound Tightening
    66 *
    7  * (C) Carnegie-Mellon University, 2006.
     7 * (C) Carnegie-Mellon University, 2006-10.
    88 * This file is licensed under the Common Public License (CPL)
    99 */
     
    1111#include "CoinHelperFunctions.hpp"
    1212#include "CglCutGenerator.hpp"
     13
     14#include "expression.hpp"
    1315#include "CouenneCutGenerator.hpp"
    1416#include "CouenneProblem.hpp"
     
    4749    int i = evalOrder (ii);
    4850
    49     if ((Var (i) -> Type () == type) &&
    50         (Var (i) -> Multiplicity () > 0)) {
     51    enum expression::auxSign aSign = Var (i) -> sign ();
     52
     53    if ((Var (i) -> Type () == type)     &&
     54        (Var (i) -> Multiplicity () > 0) &&
     55        ((type == VAR)                               ||
     56         (aSign  == expression::EQ)                  ||
     57         ((aSign == expression::LEQ) && (sense > 0)) ||
     58         ((aSign == expression::GEQ) && (sense < 0)))) {
    5159
    5260      int ni = obbt_iter (csi, chg_bds, warmstart, babInfo, objcoe, sense, i);
  • trunk/Couenne/src/bound_tightening/obbt_iter.cpp

    r215 r309  
    6767  // non-decreasing or non-increasing
    6868
    69   //  static int iter = 0;
     69  //static int iter = 0;
    7070
    7171  std::set <int> deplist;
     
    137137  // only improve bounds if
    138138  if (!issimple &&
    139       ((Var (index) -> Type () == VAR) ||             // it is an original variable
    140        (Var (index) -> Multiplicity () > 0)) &&       // or its multiplicity is at least 1
     139      ((Var (index) -> Type () == VAR) ||        // it is an original variable
     140       (Var (index) -> Multiplicity () > 0)) &&  // or its multiplicity is at least 1
    141141      (Lb (index) < Ub (index) - COUENNE_EPS) && // in any case, bounds are not equal
    142142
     
    169169    // m{in,ax}imize xi on csi
    170170
    171     /*
    172     if (Jnlst()->ProduceOutput(J_MOREVECTOR, J_BOUNDTIGHTENING)) {
     171    /*if (Jnlst()->ProduceOutput(J_MOREVECTOR, J_BOUNDTIGHTENING)) {
    173172      Jnlst()->Printf(J_MOREVECTOR, J_BOUNDTIGHTENING,
    174173                      "m%simizing x%d [%g,%g] %c= %g\n",
     
    178177        char fname [20];
    179178        sprintf (fname, "m%s_w%03d_%03d", (sense == 1) ? "in" : "ax", index, iter);
     179        printf ("saving in %s\n", fname);
    180180        //Jnlst()->Printf(J_MOREVECTOR, J_BOUNDTIGHTENING,"writing %s\n", fname);
    181181        csi -> writeLp (fname);
    182182      }
    183     }
    184     */
     183      }*/
    185184
    186185    csi -> setWarmStart (warmstart);
  • trunk/Couenne/src/bound_tightening/operators/impliedBounds-exprSum.cpp

    r307 r309  
    5050  CouNumber
    5151    a0 = 0.,   // constant term in the sum
    52     wl = /*sign == expression::GEQ ? -COIN_DBL_MAX : */ l [wind],
    53     wu = /*sign == expression::LEQ ?  COIN_DBL_MAX : */ u [wind];
     52    wl = sign == expression::GEQ ? -COIN_DBL_MAX : l [wind],
     53    wu = sign == expression::LEQ ?  COIN_DBL_MAX : u [wind];
    5454
    5555  // quick check: if both are infinite, nothing is implied...
  • trunk/Couenne/src/problem/problem.cpp

    r307 r309  
    108108
    109109      // set bounds
    110       if (var -> sign () != expression::GEQ) if ((Lb (ord) = CoinMax (Lb (ord), l)) <= -COUENNE_INFINITY) Lb (ord) = -COIN_DBL_MAX;
    111       if (var -> sign () != expression::LEQ) if ((Ub (ord) = CoinMin (Ub (ord), u)) >=  COUENNE_INFINITY) Ub (ord) =  COIN_DBL_MAX;
     110      if (var -> sign () != expression::LEQ) if ((Lb (ord) = CoinMax (Lb (ord), l)) <= -COUENNE_INFINITY) Lb (ord) = -COIN_DBL_MAX;
     111      if (var -> sign () != expression::GEQ) if ((Ub (ord) = CoinMin (Ub (ord), u)) >=  COUENNE_INFINITY) Ub (ord) =  COIN_DBL_MAX;
    112112      //if ((lb_ [ord] = (*(aux -> Lb ())) ()) <= -COUENNE_INFINITY) lb_ [ord] = -DBL_MAX;
    113113      //if ((ub_ [ord] = (*(aux -> Ub ())) ()) >=  COUENNE_INFINITY) ub_ [ord] =  DBL_MAX;
     
    119119
    120120      if (integer) {
    121         Lb (ord) = ceil  (Lb (ord) - COUENNE_EPS);
    122         Ub (ord) = floor (Ub (ord) + COUENNE_EPS);
     121        if (var -> sign () != expression::GEQ) Lb (ord) = ceil  (Lb (ord) - COUENNE_EPS);
     122        if (var -> sign () != expression::LEQ) Ub (ord) = floor (Ub (ord) + COUENNE_EPS);
    123123      }
    124124
     
    160160
    161161      if (var -> Type () == AUX) {
    162         X (index) =  // addresses of x[] and X() are equal
    163           CoinMax ((var -> sign () != expression::LEQ) ? l : -COIN_DBL_MAX,
    164           CoinMin ((var -> sign () != expression::GEQ) ? u :  COIN_DBL_MAX, (*(var -> Image ())) ()));
     162
     163        bool isInt = var -> isInteger ();
     164
     165        /*printf ("checking "); var -> print ();
     166        printf (" = %g = %g. Sign: %d, int: %d, [%g,%g]",
     167                X (index), (*(var -> Image ())) (),
     168                var -> sign (), isInt, l, u);*/
     169
     170        if (var -> sign () == expression::EQ)
     171          X (index) = (*(var -> Image ())) ();  // addresses of x[] and X() are equal
     172   
     173        X (index) =
     174          CoinMax ((var -> sign () != expression::LEQ) ? (isInt ? ceil  (l - COUENNE_EPS) : l) : -COIN_DBL_MAX,
     175          CoinMin ((var -> sign () != expression::GEQ) ? (isInt ? floor (u + COUENNE_EPS) : u) :  COIN_DBL_MAX, X (index)));
     176
     177        if (isInt) {
     178          if (var -> sign () == expression::GEQ) X (index) = ceil  (X (index) - COUENNE_EPS);
     179          if (var -> sign () == expression::LEQ) X (index) = floor (X (index) + COUENNE_EPS);
     180        }
     181
     182        //printf (" -> %g\n", X (index));
    165183      }
    166184    } else X (index) = 0.;
Note: See TracChangeset for help on using the changeset viewer.