Changeset 370 for stable/0.2/Couenne


Ignore:
Timestamp:
Jun 15, 2010 3:16:19 PM (10 years ago)
Author:
pbelotti
Message:

merged changeset 367 -- fix infeasibility due to implied bound on exp

Location:
stable/0.2/Couenne/src/expression/operators
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable/0.2/Couenne/src/expression/operators

  • stable/0.2/Couenne/src/expression/operators/exprExp.cpp

    r159 r370  
    1 /* $Id: exprExp.cpp 154 2009-06-16 18:52:53Z pbelotti $ */
    2 /*
     1/* $Id$
     2 *
    33 * Name:    exprExp.cpp
    44 * Author:  Pietro Belotti
    55 * Purpose: definition of the exponential
    66 *
    7  * (C) Carnegie-Mellon University, 2006-08.
     7 * (C) Carnegie-Mellon University, 2006-10.
    88 * This file is licensed under the Common Public License (CPL)
    99 */
     
    1313#include "exprMul.hpp"
    1414#include "CouenneProblem.hpp"
     15
    1516
    1617// differentiation
     
    5354  CouNumber b;
    5455
    55   if ((b = l [wind]) >= COUENNE_EPS) // lower bound
    56     resL = updateBound (-1, l + ind, argument_->isInteger () ? ceil  (log (b)-COUENNE_EPS) : log (b));
     56  if ((b = l [wind]) > 0.) // lower bound   
     57    resL = updateBound (-1, l + ind, argument_->isInteger () ? ceil  (log (b)) : log (b));
    5758
    58   if ((b = u [wind]) < COUENNE_INFINITY / 1e5) // upper bound
    59     resU = updateBound ( 1, u + ind, argument_->isInteger () ? floor (log (b)+COUENNE_EPS) : log (b));
    60   else if (b < - COUENNE_EPS) {
     59  if ((b = u [wind]) < COIN_DBL_MAX / 10.) { // upper bound
     60
     61    if ((b >= -0.) && (b < COUENNE_EPS)) // to prevent infeasibilities due to numerics
     62      b = COUENNE_EPS;
     63
     64    resU = updateBound ( 1, u + ind, argument_ -> isInteger () ? floor (log (b)) : log (b));
     65  }
     66
     67  if (b < - COUENNE_EPS) {
    6168    // make it infeasible
    6269    resU = updateBound ( 1, u + ind, -1.) || true;
     
    6471  }
    6572
    66   if (resL) chg [ind].setLower(t_chg_bounds::CHANGED);
    67   if (resU) chg [ind].setUpper(t_chg_bounds::CHANGED);
     73  if (resL) chg [ind].setLower (t_chg_bounds::CHANGED);
     74  if (resU) chg [ind].setUpper (t_chg_bounds::CHANGED);
    6875
    6976  return (resL || resU);
  • stable/0.2/Couenne/src/expression/operators/exprGroup.cpp

    r159 r370  
    4242
    4343
    44 
    4544/// Generalized (static) constructor: check parameters and return a
    4645/// constant, a single variable, or a real exprGroup
     
    127126    out << ' ';
    128127
    129     if      (coeff >   0.) out << '+' << coeff << "*";
    130     else if (coeff < - 0.) out        << coeff << "*";
    131     //else continue;
     128    if      (coeff >   0.) { out << '+'; if (coeff !=  1.) out <<  coeff << "*";}
     129    else if (coeff < - 0.) { out << '-'; if (coeff != -1.) out << -coeff << "*";}
    132130
    133131    lcoeff_ [i]. first -> print (out, descend);
     
    162160      arglist [nargs++] = arglist_ [i] -> differentiate (index);
    163161
    164   if ((nargs == 0) ||
    165       (nargs == 1) && (fabs (totlin) > COUENNE_EPS)) {
     162  if ( (nargs == 0) ||
     163      ((nargs == 1) && (fabs (totlin) > COUENNE_EPS))) {
    166164    delete [] arglist;
    167165    return new exprConst (totlin);
Note: See TracChangeset for help on using the changeset viewer.