/home/coin/SVN-release/OS-2.4.1/Couenne/src/expression/operators/exprExp.cpp

Go to the documentation of this file.
00001 /* $Id: exprExp.cpp 560 2011-04-17 10:01:15Z stefan $
00002  *
00003  * Name:    exprExp.cpp
00004  * Author:  Pietro Belotti
00005  * Purpose: definition of the exponential
00006  *
00007  * (C) Carnegie-Mellon University, 2006-10.
00008  * This file is licensed under the Eclipse Public License (EPL)
00009  */
00010 
00011 #include "CouenneExprExp.hpp"
00012 #include "CouenneExprClone.hpp"
00013 #include "CouenneExprMul.hpp"
00014 #include "CouenneProblem.hpp"
00015 
00016 #include "CoinFinite.hpp"
00017 
00018 using namespace Couenne;
00019 
00020 // differentiation
00021 expression *exprExp::differentiate (int index) {
00022 
00023   return new exprMul (new exprExp (new exprClone (argument_)),
00024                       argument_ -> differentiate (index));
00025 }
00026 
00027 
00028 // Get expressions of lower and upper bound of an expression (if any)
00029 void exprExp::getBounds (expression *&lb, expression *&ub) {
00030 
00031   expression *lba, *uba;
00032   argument_ -> getBounds (lba, uba);
00033 
00034   lb = new exprExp (lba);
00035   ub = new exprExp (uba);
00036 }
00037 
00038 
00039 // Get value of lower and upper bound of an expression (if any)
00040 void exprExp::getBounds (CouNumber &lb, CouNumber&ub) {
00041 
00042   CouNumber lba, uba;
00043   argument_ -> getBounds (lba, uba);
00044 
00045   lb = exp (lba);
00046   ub = exp (uba);
00047 }
00048 
00049 
00052 bool exprExp::impliedBound (int wind, CouNumber *l, CouNumber *u, t_chg_bounds *chg, enum auxSign sign) {
00053 
00054   bool resU, resL = resU = false;
00055   int ind = argument_ -> Index ();
00056 
00057   CouNumber b;
00058 
00059   if ((b = sign == expression::AUX_GEQ ? 0.           : l [wind]) > 0.) // lower bound    
00060     resL = updateBound (-1, l + ind, argument_->isInteger () ? ceil  (log (b)) : log (b));
00061 
00062   if ((b = sign == expression::AUX_LEQ ? COIN_DBL_MAX : u [wind]) < COIN_DBL_MAX / 10.) { // upper bound
00063 
00064     if ((b >= -0.) && (b < COUENNE_EPS)) // to prevent infeasibilities due to numerics
00065       b = COUENNE_EPS;
00066 
00067     resU = updateBound ( 1, u + ind, argument_ -> isInteger () ? floor (log (b)) : log (b));
00068   }
00069 
00070   if (b < - COUENNE_EPS) {
00071     // make it infeasible
00072     resU = updateBound ( 1, u + ind, -1.) || true;
00073     resL = updateBound (-1, l + ind,  1.) || true;
00074   }
00075 
00076   if (resL) chg [ind].setLower (t_chg_bounds::CHANGED);
00077   if (resU) chg [ind].setUpper (t_chg_bounds::CHANGED);
00078 
00079   return (resL || resU);
00080 }
00081 
00082 
00085 bool exprExp::isCuttable (CouenneProblem *problem, int index) const {
00086 
00087   double 
00088     x = problem -> X (argument_ -> Index ()),
00089     y = problem -> X (index);
00090 
00091   return (y <= exp (x));
00092 }

Generated on Thu Nov 10 03:05:44 2011 by  doxygen 1.4.7