00001
00002
00003
00004
00005
00006
00007
00008
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
00021 expression *exprExp::differentiate (int index) {
00022
00023 return new exprMul (new exprExp (new exprClone (argument_)),
00024 argument_ -> differentiate (index));
00025 }
00026
00027
00028
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
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.)
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.) {
00063
00064 if ((b >= -0.) && (b < COUENNE_EPS))
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
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 }