19 using namespace Couenne;
24 const OsiBranchingInformation *
info,
31 if (brDist) {free (brDist); brDist = NULL;}
35 wi = obj -> Reference () ->
Index ();
37 assert ((xi >= 0) && (yi >= 0) && (wi >= 0));
40 x0 = info -> solution_ [xi], y0 = info -> solution_ [yi],
41 xl = info -> lower_ [xi], yl = info -> lower_ [yi],
42 xu = info -> upper_ [xi], yu = info -> upper_ [yi];
45 printf (
" branch MUL: %g [%g,%g] %g [%g,%g]\n",
46 x0, xl, xu, y0, yl, yu);
49 brpts = (
double *) realloc (brpts,
sizeof (
double));
63 *brpts = 0.5 * (yl+yu);
64 brDist = (
double *) realloc (brDist, 2 *
sizeof (
double));
66 brDist [0] =
projectSeg (x0, y0, yl, xl*yl, *brpts, *brpts * xl, 0);
67 brDist [1] =
projectSeg (x0, y0, *brpts, *brpts * xl, yu, xl*yu, 0);
70 return CoinMin (brDist [0], brDist [1]);
76 *brpts = 0.5 * (xl+xu);
77 brDist = (
double *) realloc (brDist, 2 *
sizeof (
double));
79 brDist [0] =
projectSeg (x0, y0, xl, xl*yl, *brpts, *brpts * yl, 0);
80 brDist [1] =
projectSeg (x0, y0, *brpts, *brpts * yl, xu, xu*yl, 0);
83 return CoinMin (brDist [0], brDist [1]);
95 return CoinMin (brDist [0], brDist [1]);
105 {ind = xi; *brpts = obj -> midInterval (((x0 < 0.) ? 2 : 0.5) * x0, xl, xu, info); way =
TWO_RIGHT;}
108 {ind = xi; *brpts = obj -> midInterval (((x0 > 0.) ? 2 : 0.5) * x0, xl, xu, info); way =
TWO_LEFT;}
111 {ind = yi; *brpts = obj -> midInterval (((y0 < 0.) ? 2 : 0.5) * y0, yl, yu, info); way =
TWO_RIGHT;}
114 {ind = yi; *brpts = obj -> midInterval (((y0 > 0.) ? 2 : 0.5) * y0, yl, yu, info); way =
TWO_LEFT;}
124 else ind = (CoinDrand48 () < 0.5) ? xi : yi;
127 pt = info -> solution_ [ind],
128 lb = info -> lower_ [ind],
129 ub = info -> upper_ [ind],
130 margin = obj -> lp_clamp () * (ub - lb);
144 else switch (obj -> Strategy ()) {
147 pt = .5 * (lb+ub);
break;
149 CoinMin (ub - margin, pt));
break;
155 default: *brpts = (0.5 * (lb+ub));
break;
163 var =
arglist_ [(ind == xi) ? 0 : 1];
168 printf (
" MUL: br on x_%d %g [%g,%g] [%g,%g] (%g,%g)\n",
169 ind, *brpts, xl, xu, yl, yu, x0, y0);
172 return CoinMin (brDist [0], brDist [1]);
192 assert ((index >= 0) && (other >= 0));
195 xl = info -> lower_ [index], yl = info -> lower_ [other],
196 xu = info -> upper_ [index], yu = info -> upper_ [other],
197 x0 = info -> solution_ [index], y0 = info -> solution_ [other],
198 w0 = info -> solution_ [wind];
269 bool above = (w0 > x0*y0);
277 m = 1. / sqrt (area),
283 t_optA = m*z_opt + qA,
284 t_optB = m*z_opt + qB;
294 return (w0 > x0*y0) ?
const double large_bound
if |branching point| > this, change it
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 minMaxDelta(funtriplet *ft, CouNumber lb, CouNumber ub)
virtual int Index() const
Return index of variable (only valid for exprVar and exprAux)
double * computeMulBrDist(const OsiBranchingInformation *info, int xi, int yi, int wi, int brind, double *brpt, int nPts)
compute distance from future convexifications in set with x,y,w bounded.
CouNumber balancedMul(const OsiBranchingInformation *info, int index, int wind)
balanced strategy for branching point selection in products
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 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.
expression ** arglist_
argument list is an array of pointers to other expressions
double CouNumber
main number type in Couenne