/home/coin/SVN-release/OS-2.1.0/Couenne/src/convex/operators/conv-exprPow-envelope.cpp

Go to the documentation of this file.
00001 /* $Id: conv-exprPow-envelope.cpp 217 2009-07-08 17:02:07Z pbelotti $
00002  *
00003  * Name:    conv-exprPow-envelope.cpp
00004  * Author:  Pietro Belotti
00005  * Purpose: methods of the expression class
00006  *
00007  * (C) Carnegie-Mellon University, 2006. 
00008  * This file is licensed under the Common Public License (CPL)
00009  */
00010 
00011 #include <math.h>
00012 
00013 #include "CouenneTypes.hpp"
00014 #include "rootQ.hpp"
00015 #include "exprPow.hpp"
00016 #include "CouennePrecisions.hpp"
00017 #include "CouenneProblem.hpp"
00018 #include "CouenneCutGenerator.hpp"
00019 #include "funtriplets.hpp"
00020 
00021 
00022 // adds convex (upper/lower) envelope to a power function
00023 
00024 void addPowEnvelope (const CouenneCutGenerator *cg, OsiCuts &cs,
00025                      int wi, int xi,
00026                      CouNumber x, CouNumber y,
00027                      CouNumber k, 
00028                      CouNumber l, CouNumber u,
00029                      int sign) {
00030 
00031   // set x to get a deeper cut (so that we get a tangent which is
00032   // orthogonal with line through current- and tangent point)
00033 
00034   if (!(cg -> isFirst ())) {
00035 
00036     powertriplet pt (k);
00037     x = powNewton (x, y, &pt);
00038   }
00039 
00040   if      (x<l) x=l;
00041   else if (x>u) x=u;
00042 
00043   // limit the bounds for the envelope
00044 
00045   CouNumber powThres = (k<=1) ? COU_MAX_COEFF: pow (COU_MAX_COEFF, 1./k),
00046             step     = (1 + log (1. + (double) (cg -> nSamples ()))) * powThres / COU_MAX_COEFF;
00047 
00048   if (l < - powThres + 1) {
00049     l = x - step;
00050     if (u > powThres - 1)
00051       u = x + step;
00052   } else 
00053     if (u > powThres - 1) 
00054       u = x + step;
00055 
00056   powertriplet pt (k);
00057 
00058   // convex envelope
00059   cg -> addEnvelope (cs, sign, &pt, 
00060                      wi, xi, x, l, u);
00061 }

Generated on Tue Mar 30 03:04:37 2010 by  doxygen 1.4.7