00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <math.h>
00012
00013 #include "CoinHelperFunctions.hpp"
00014 #include "exprAbs.hpp"
00015 #include "CouenneObject.hpp"
00016
00017 static const double sqrt_2 = sqrt (2.);
00018
00021 CouNumber exprAbs::selectBranch (const CouenneObject *obj,
00022 const OsiBranchingInformation *info,
00023 expression * &var,
00024 double * &brpts,
00025 double * &brDist,
00026
00027 int &way) {
00028 var = argument_;
00029
00030 int ind = var -> Index ();
00031
00032 assert ((ind >= 0) && (obj -> Reference () -> Index () >= 0));
00033
00034 CouNumber x0 = info -> solution_ [ind],
00035 y0 = info -> solution_ [obj -> Reference () -> Index ()];
00036
00037 brpts = (double *) realloc (brpts, sizeof (double));
00038
00039
00040
00041 *brpts = 0.;
00042
00043 way = TWO_RAND;
00044
00045
00046
00047
00048 brDist = (double *) realloc (brDist, 2 * sizeof (double));
00049
00050 assert ((y0 >= x0) && (y0 >= -x0));
00051
00052 brDist [0] = (x0 + y0) / sqrt_2;
00053 brDist [1] = (y0 - x0) / sqrt_2;
00054
00055
00056
00057 return CoinMin (brDist [0], brDist [1]);
00058 }