27 #include "CoinFinite.hpp"
29 using namespace Couenne;
46 if (fabs (c1) == 0.) {
47 printf (
"Couenne: Warning, division by zero -- ");
print (); printf (
"\n");
189 if (ln > 0) lb =
safeDiv (ln,ud,-1);
193 else if (un > 0) lb =
safeDiv (un,ud,-1);
200 if (un < 0) ub =
safeDiv (un,ud,1);
204 else if (ln < 0) ub =
safeDiv (ln,ud,1);
268 bool numerator =
false;
270 if (varoth ->
Index () == varind ->
Index ()) {
283 if (
c*y > x) {assert (
c*y > right); right =
c*y;}
284 else {assert (
c*y < left); left =
c*y;}
286 if (
c*y < x) {assert (
c*y < left); left =
c*y;}
287 else {assert (
c*y > right); right =
c*y;}
288 else left = - (right = COIN_DBL_MAX);
293 if (x*y >
c) {assert (
c/y > right); right =
c/y;}
294 else {assert (
c/y < left); left =
c/y;}
296 if (x*y >
c) {assert (
c/y < left); left =
c/y;}
297 else {assert (
c/y > right); right =
c/y;}
298 else left = - (right = COIN_DBL_MAX);
321 if (ind1 < 0)
return 0.;
322 else return fabs (x0/(x1sq));
324 if (ind1 < 0)
return 1. /
x1;
325 else return sqrt (1. / x1sq + x0*x0 / (x1sq * x1sq));
exprDiv(expression **al, int n=2)
Constructor.
virtual void print(std::ostream &out=std::cout, bool=false) const
I/O.
virtual int dependsOn(int *ind, int n, enum dig_type type=STOP_AT_AUX)
dependence on variable set: return cardinality of subset of the set of indices in first argument whic...
class to compute upper bound of a fraction based on the bounds of both numerator and denominator ...
void getBounds(expression *&lb, expression *&ub)
Get lower and upper bound of an expression (if any)
expression * clone(Domain *d=NULL) const
Cloning method.
Power of an expression (binary operator), with constant.
virtual enum nodeType Type() const
Node type.
virtual int Index() const
Return index of variable (only valid for exprVar and exprAux)
expression clone (points to another expression)
virtual expression * simplify()
simplification
expression * simplify()
Simplification.
expression ** arglist_
argument list is an array of pointers to other expressions
double CouNumber
main number type in Couenne
CouNumber gradientNorm(const double *x)
return l-2 norm of gradient at given point
bool isInteger()
is this expression integer?
expression * differentiate(int index)
Differentiation.
virtual void closestFeasible(expression *varind, expression *vardep, CouNumber &left, CouNumber &right) const
compute $y^{lv}$ and $y^{uv}$ for Violation Transfer algorithm
static CouNumber safeDiv(register CouNumber a, register CouNumber b, int sign)
division that avoids NaN's and considers a sign when returning infinity
virtual CouNumber Value() const
value (empty)
class to compute lower bound of a fraction based on the bounds of both numerator and denominator ...
void fint fint fint real fint real * x
class for multiplications,