12 #include "CoinHelperFunctions.hpp"
14 #include "OsiRowCut.hpp"
23 using namespace Ipopt;
24 using namespace Couenne;
35 CouenneBranchingObject::CouenneBranchingObject (OsiSolverInterface *solver,
36 const OsiObject * originalObject,
43 bool doFBBT,
bool doConvCuts):
45 OsiTwoWayBranchingObject (solver, originalObject, way, brpoint),
52 doConvCuts_ (doConvCuts),
79 value_ = (fabs (brpoint) < 1e27) ? brpoint : (*
variable_) ();
90 if (value_ < lb + margin) value_ = lb + margin;
91 else if (value_ > ub - margin) value_ = ub - margin;
95 "Branch: x%-3d will branch on %g (cur. %g) [%g,%g]; firstBranch_ = %d\n",
110 "::branch: at %.20e\n", value_);
116 way = (!branchIndex_) ? firstBranch_ : !firstBranch_,
124 l = solver -> getColLower () [index],
125 u = solver -> getColUpper () [index],
128 if (brpt < l) brpt = l;
129 else if (brpt > u) brpt = u;
135 brpt = ((u < -
COUENNE_EPS) ? CoinMax (CoinMax (brpt, .5 * (l+u)),
AGGR_MUL * (-1. + brpt)) :
140 brpt = ((l >
COUENNE_EPS) ? CoinMin (CoinMin (brpt, .5 * (l+u)),
AGGR_MUL * ( 1. + brpt)) :
172 if ((brpt - l > .5) &&
206 solver->setColLower(index, u+1);
214 index, way ?
'>' :
'<', integer ? (way ? ceil (brpt) : floor (brpt)) : brpt);
217 if (brpt < l)
jnlst_->Printf (J_STRONGWARNING,
J_BRANCHING,
"Nonsense up-br: [ %.8f ,(%.8f)] -> %.8f\n",l,u,value_);
220 if (brpt > u)
jnlst_->Printf (J_STRONGWARNING,
J_BRANCHING,
"Nonsense dn-br: [(%.8f), %.8f ] -> %.8f\n",l,u,value_);
240 branchCore (solver, index, way, integer, brpt, chg_bds);
248 objind =
problem_ -> Obj (0) -> Body () -> Index ();
256 problem_ -> domain () -> push (solver);
269 *lb = solver -> getColLower (),
270 *ub = solver -> getColUpper ();
273 estimate = CoinMax (0., objind >= 0 ? (
problem_ -> Lb (objind) - lb [objind]) : 0.);
275 for (
int i=0; i<nvars; i++) {
276 if (
problem_ -> Lb (i) > lb [i]) solver -> setColLower (i,
problem_ -> Lb (i));
277 if (
problem_ -> Ub (i) < ub [i]) solver -> setColUpper (i,
problem_ -> Ub (i));
285 int nchanged, *changed = NULL;
290 cutGen_ -> genRowCuts (*solver, cs, nchanged, changed, chg_bds);
293 solver -> applyCuts (cs);
301 if (chg_bds)
delete [] chg_bds;
306 return (
infeasible ? COIN_DBL_MAX : estimate);
Cut Generator for linear convexifications.
const double large_bound
if |branching point| > this, change it
CouenneProblem * problem_
Pointer to CouenneProblem (necessary to allow FBBT)
CouenneCutGenerator * cutGen_
Pointer to CouenneCutGenerator (if any); if not NULL, allows to do extra cut generation during branch...
JnlstPtr jnlst_
SmartPointer to the Journalist.
status of lower/upper bound of a variable, to be checked/modified in bound tightening ...
void sparse2dense(int ncols, t_chg_bounds *chg_bds, int *&changed, int &nchanged)
translate sparse to dense vector (should be replaced)
virtual double branch(OsiSolverInterface *solver=NULL)
Execute the actions required to branch, as specified by the current state of the branching object...
const Ipopt::EJournalCategory J_BRANCHING(Ipopt::J_USER1)
void sparse2dense(int ncols, t_chg_bounds *chg_bds, int *&changed, int &nchanged)
translate sparse to dense vector (should be replaced)
const CouNumber default_alpha
bool doFBBT_
shall we do Feasibility based Bound Tightening (FBBT) at branching?
Class for MINLP problems with symbolic information.
const CouNumber closeToBounds
static const int infeasible
double CouNumber
main number type in Couenne
bool simulate_
are we currently in strong branching?
expression * variable_
The index of the variable this branching object refers to.
void branchCore(OsiSolverInterface *, int, int, bool, double, t_chg_bounds *&)
Perform branching step.
bool doConvCuts_
shall we add convexification cuts at branching?
bool isInteger(CouNumber x)
is this number integer?