11 #include "CoinHelperFunctions.hpp"
19 using namespace Couenne;
23 const OsiBranchingInformation *
info,
32 brDist = (
double *) realloc (brDist, 2 *
sizeof (
double));
33 brpts = (
double *) realloc (brpts,
sizeof (
CouNumber));
69 if (((x0+y0 < 0.) && (x0 > 0.)) ||
70 ((x0+y0 > 0.) && (x0 < 0.))) {
86 brDist [0] = sqrt (diff*diff + y0*y0);
87 brDist [1] = CoinMax (fabs (x0), 1.);
90 double swap = brDist [0];
91 brDist [0] = brDist [1];
95 return CoinMin (brDist [0], brDist [1]);
107 if (((x0 >= 0.) && (y0 <
safe_pow (x0,k))) ||
109 (((isInt && !(intk % 2) && (y0 <
safe_pow (x0,k)))) ||
110 (((isInt || isInvInt) && (intk % 2) && (y0 > -
safe_pow (-x0,k))))))) {
119 *brpts = obj -> midInterval ((x0 >= 0.) ?
125 return (brDist [0] = brDist [1] = sqrt (x0*x0 + dy*dy));
149 *brpts = 0.5 * (fabs (x0) + pow (fabs (y0), 1./k));
153 brDist [0] = fabs (fabs (y0) -
safe_pow (fabs (x0), k));
154 brDist [1] = *brpts -
x0;
156 brDist [0] = x0 - *brpts;
157 brDist [1] = fabs (y0 -
safe_pow (x0, k));
169 return CoinMin (brDist [0], brDist [1]);
179 *brpts = obj -> midInterval (x0, l, u, info);
181 return CoinMin (brDist [0] = y0 -
safe_pow (*brpts, 1. / k),
189 *brpts = obj -> midInterval (x0, l, u, info);
191 return CoinMin (brDist [1] = y0 -
safe_pow (*brpts, 1. / k),
199 *brpts = obj -> getBrPoint (&ft, x0, l, u, info);
221 return CoinMin (brDist [0], brDist [1]);
230 const OsiBranchingInformation *
info,
241 wi = obj -> Reference () ->
Index ();
243 assert ((ind >= 0) && (wi >= 0));
246 x0 = info -> solution_ [ind],
247 l = info -> lower_ [ind],
248 u = info -> upper_ [ind];
static Bigint * diff(Bigint *a, Bigint *b)
void fint fint fint real fint real real real real real real real real real fint real fint fint fint real fint fint fint fint * info
OsiObject for auxiliary variables $w=f(x)$.
CouNumber negPowSelectBranch(const CouenneObject *obj, const OsiBranchingInformation *info, double *&brpts, double *&brDist, int &way, CouNumber k, CouNumber x0, CouNumber y0, CouNumber l, CouNumber u)
generic approach for negative powers (commom with exprInv::selectBranch())
CouNumber powNewton(CouNumber xc, CouNumber yc, unary_function f, unary_function fp, unary_function fpp)
find proper tangent point to add deepest tangent cut
expression * argument_
single argument taken by this expression
virtual int Index() const
Return index of variable (only valid for exprVar and exprAux)
CouNumber projectSeg(CouNumber x0, CouNumber y0, CouNumber x1, CouNumber y1, CouNumber x2, CouNumber y2, int sign, CouNumber *xp=NULL, CouNumber *yp=NULL)
Compute projection of point (x0, y0) on the segment defined by two points (x1,y1), (x2, y2) – sign provided by parameter sign.
double CouNumber
main number type in Couenne
virtual CouNumber selectBranch(const CouenneObject *obj, const OsiBranchingInformation *info, expression *&var, double *&brpts, double *&brDist, int &way)
set up branching object by evaluating many branching points for each expression's arguments ...
CouNumber safe_pow(CouNumber base, CouNumber exponent, bool signpower=false)
compute power and check for integer-and-odd inverse exponent