Changeset 523


Ignore:
Timestamp:
Apr 28, 2007 1:46:44 PM (12 years ago)
Author:
pbelotti
Message:

keep coefficients low in powers with big coefficients

Location:
branches/Couenne/Couenne/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/Couenne/Couenne/src/Makefile.am

    r521 r523  
    158158        include/operators/exprMin.h \
    159159        include/operators/exprBDiv.h \
    160         include/operators/exprCos.h \
    161160        include/operators/exprSum.h \
    162161        include/operators/exprMax.h \
    163162        include/operators/exprPow.h \
    164163        include/operators/exprSin.h \
     164        include/operators/exprCos.h \
    165165        include/operators/exprBSin.h \
    166166        include/operators/exprBCos.h \
  • branches/Couenne/Couenne/src/Makefile.in

    r521 r523  
    454454        include/operators/exprMin.h \
    455455        include/operators/exprBDiv.h \
    456         include/operators/exprCos.h \
    457456        include/operators/exprSum.h \
    458457        include/operators/exprMax.h \
    459458        include/operators/exprPow.h \
    460459        include/operators/exprSin.h \
     460        include/operators/exprCos.h \
    461461        include/operators/exprBSin.h \
    462462        include/operators/exprBCos.h \
  • branches/Couenne/Couenne/src/convex/generateCuts.cpp

    r520 r523  
    180180    if ((ntightened < 0) || (nbwtightened < 0)) {
    181181
    182       // set infeasibility for linear convexification
     182      // set infeasibility through a cut 1 <= x0 <= -1
    183183
    184184      OsiColCut *infeascut = new OsiColCut;
  • branches/Couenne/Couenne/src/convex/operators/conv-exprPow-envelope.cpp

    r520 r523  
    4646                     CouNumber l, CouNumber u,
    4747                     int sign) {
    48 
    4948  exponent = k;
    5049
     
    6059  // limit the bounds for the envelope
    6160
    62   CouNumber step     = 1 + log (1. + (double) (cg -> nSamples ())),
    63             powThres = pow (COU_MAX_COEFF, 1./k);
     61  CouNumber powThres = (k<=1) ? COU_MAX_COEFF: pow (COU_MAX_COEFF, 1./k),
     62            step     = (1 + log (1. + (double) (cg -> nSamples ()))) * powThres / COU_MAX_COEFF;
    6463
    6564  if (l < - powThres + 1) {
  • branches/Couenne/Couenne/src/convex/operators/conv-exprPow.cpp

    r520 r523  
    7878  int x_ind = xe  -> Index ();
    7979
    80   CouNumber w, x,
     80  CouNumber w = (*aux) (),
     81            x = (*xe)  (),
    8182            l = (*xle) (),
    8283            u = (*xue) ();
     
    130131    //    an internal point of the interval [l,u].
    131132
    132     Qroot qmap;
    133 
    134     // this case is somewhat simpler than the second, although we have
    135     // to resort to numerical procedures to find the (unique) root of
    136     // a polynomial Q(x) (see Liberti and Pantelides, 2003).
    137 
    138     CouNumber q = qmap (intk);
     133    // this case is somewhat simpler than the second, although if the
     134    // bound interval includes the origin we have to resort to
     135    // numerical procedures to find the (unique) root of a polynomial
     136    // Q(x) (see Liberti and Pantelides, 2003).
     137
     138    CouNumber q = 1;
     139
     140    if ((l<0) && (u>0)) {
     141
     142      Qroot qmap;
     143      q = qmap (intk);
     144    }
    139145
    140146    int sign;
     
    156162    }
    157163
    158     CouNumber powThres = pow (COU_MAX_COEFF, 1./k); // don't want big coefficients
     164    // don't want big coefficients -- check only when k>1
     165    CouNumber powThres = (k<=1) ? COUENNE_INFINITY : pow (COU_MAX_COEFF, 1./k);
    159166
    160167    // lower envelope
    161 
    162168    if (l > -powThres) {
    163       if (u > q * l) { // upper x is after "turning point", add lower envelope
    164         addPowEnvelope (cg, cs, w_ind, x_ind, x, w, k, q*l, u, sign);
    165         cg      -> addSegment (cs, w_ind, x_ind, l, safe_pow (l,k), q*l, safe_pow (q*l,k), sign);
    166       } else cg -> addSegment (cs, w_ind, x_ind, l, safe_pow (l,k), u,   safe_pow (u,k),   sign);
     169      if (l>0) addPowEnvelope (cg, cs, w_ind, x_ind, x, w, k,   l, u, sign); // 0<l<u, tangents only
     170      else if (u > q * l) { // upper x is after "turning point", add lower envelope
     171        addPowEnvelope        (cg, cs, w_ind, x_ind, x, w, k, q*l, u, sign);
     172        cg      -> addSegment     (cs, w_ind, x_ind, l, safe_pow (l,k), q*l, safe_pow (q*l,k), sign);
     173      } else cg -> addSegment     (cs, w_ind, x_ind, l, safe_pow (l,k), u,   safe_pow (u,  k), sign);
    167174    }
    168175
    169176    // upper envelope
    170 
    171177    if (u < powThres) {
    172       if (l < q * u) { // lower x is before "turning point", add upper envelope
    173         addPowEnvelope (cg, cs, w_ind, x_ind, x, w, k, l, q*u, -sign);
    174         cg      -> addSegment (cs, w_ind, x_ind, q*u, safe_pow (q*u,k), u, safe_pow (u,k), -sign);
    175       } else cg -> addSegment (cs, w_ind, x_ind, l,   safe_pow (l,k),   u, safe_pow (u,k), -sign);
     178      if (u<0) addPowEnvelope (cg, cs, w_ind, x_ind, x, w, k, l,   u, -sign);  // l<u<0, tangents only
     179      else if (l < q * u) { // lower x is before "turning point", add upper envelope
     180        addPowEnvelope        (cg, cs, w_ind, x_ind, x, w, k, l, q*u, -sign);
     181        cg      -> addSegment     (cs, w_ind, x_ind, q*u, safe_pow (q*u,k), u, safe_pow (u,k), -sign);
     182      } else cg -> addSegment     (cs, w_ind, x_ind, l,   safe_pow (l,k),   u, safe_pow (u,k), -sign);
    176183    }
    177184  }
  • branches/Couenne/Couenne/src/expression/exprAux.cpp

    r520 r523  
    4848
    4949  //  if (!(cg -> isFirst ()))
    50   //  if (j < cs.sizeRowCuts ())
     50  //if (j < cs.sizeRowCuts ())
    5151  if (0)
    5252    {
Note: See TracChangeset for help on using the changeset viewer.