45 #define BRANCHRULE_NAME "allfullstrong" 46 #define BRANCHRULE_DESC "all variables full strong branching" 47 #define BRANCHRULE_PRIORITY -1000 48 #define BRANCHRULE_MAXDEPTH -1 49 #define BRANCHRULE_MAXBOUNDDIST 1.0 53 struct SCIP_BranchruleData
90 assert(branchrule !=
NULL);
93 assert(result !=
NULL);
105 assert(branchruledata !=
NULL);
107 if( branchruledata->skipdown ==
NULL )
109 assert(branchruledata->skipup ==
NULL);
120 assert(npseudocands > 0);
121 assert(npriopseudocands > 0);
126 allowaddcons, &bestpseudocand, &bestdown, &bestup, &bestscore, &bestdownvalid, &bestupvalid, &provedbound, result) );
136 assert(0 <= bestpseudocand && bestpseudocand < npseudocands);
137 assert(
SCIPisLT(scip, provedbound, cutoffbound));
139 var = pseudocandscopy[bestpseudocand];
142 SCIPdebugMsg(scip,
" -> %d candidates, selected candidate %d: variable <%s>[%g,%g] (solval=%g, down=%g, up=%g, score=%g)\n",
144 bestdown, bestup, bestscore);
148 if( allcolsinlp && !exactsolve )
150 if( downchild !=
NULL )
155 if( eqchild !=
NULL )
160 if( upchild !=
NULL )
185 assert(branchrule !=
NULL);
220 branchruledata->lastcand = 0;
230 assert(result !=
NULL);
246 assert(result !=
NULL);
278 int npriopseudocands,
299 assert(scip !=
NULL);
300 assert(pseudocands !=
NULL);
301 assert(bestpseudocand !=
NULL);
302 assert(skipdown !=
NULL);
303 assert(skipup !=
NULL);
304 assert(bestdown !=
NULL);
305 assert(bestup !=
NULL);
306 assert(bestscore !=
NULL);
307 assert(bestdownvalid !=
NULL);
308 assert(bestupvalid !=
NULL);
309 assert(provedbound !=
NULL);
310 assert(result !=
NULL);
326 *bestdown = lpobjval;
328 *bestdownvalid =
TRUE;
331 *provedbound = lpobjval;
332 if( npseudocands > 1 )
356 assert(branchrule !=
NULL);
360 assert(branchruledata !=
NULL);
370 for( i = 0, c = branchruledata->lastcand; i < npseudocands; ++i, ++c )
372 c = c % npseudocands;
373 assert(pseudocands[c] !=
NULL);
382 SCIPdebugMsg(scip,
"applying strong branching on %s variable <%s>[%g,%g] with solution %g\n",
392 skipdown[c] ?
NULL : &down, skipup[c] ?
NULL : &up, &downvalid, &upvalid, &downinf, &upinf, &downconflict, &upconflict, &lperror) );
397 skipdown[c] ?
NULL : &down, skipup[c] ?
NULL : &up, &downvalid, &upvalid, &downinf, &upinf, &downconflict, &upconflict, &lperror) );
411 "(node %" SCIP_LONGINT_FORMAT
") error in strong branching call for variable <%s> with solution %g\n",
417 down =
MAX(down, lpobjval);
418 up =
MAX(up, lpobjval);
419 downgain = down - lpobjval;
420 upgain = up - lpobjval;
421 assert(!allcolsinlp || exactsolve || !downvalid || downinf ==
SCIPisGE(scip, down, cutoffbound));
422 assert(!allcolsinlp || exactsolve || !upvalid || upinf ==
SCIPisGE(scip, up, cutoffbound));
423 assert(downinf || !downconflict);
424 assert(upinf || !upconflict);
427 if( downinf || upinf )
436 if( allowaddcons && downinf == downconflict && upinf == upconflict )
439 SCIPdebugMsg(scip,
" -> fractional variable <%s> is infeasible in %d directions - added conflict\n",
443 else if( downinf && upinf )
455 SCIPdebugMsg(scip,
" -> integral variable <%s> is infeasible in both directions\n",
463 SCIPdebugMsg(scip,
" -> fractional variable <%s> is infeasible in both directions\n",
498 else if( allcolsinlp && !exactsolve && downvalid && upvalid )
503 minbound =
MIN(down, up);
504 *provedbound =
MAX(*provedbound, minbound);
508 if( c < npriopseudocands )
536 if( score > *bestscore )
541 *bestdownvalid = downvalid;
542 *bestupvalid = upvalid;
555 solval-
SCIPfeasCeil(scip, solval-1.0), downgain, 1.0) );
563 SCIPdebugMsg(scip,
" -> var <%s> (solval=%g, downgain=%g, upgain=%g, score=%g) -- best: <%s> (%g)\n",
569 branchruledata->lastcand = c;
588 branchruledata->lastcand = 0;
589 branchruledata->skipsize = 0;
590 branchruledata->skipup =
NULL;
591 branchruledata->skipdown =
NULL;
597 assert(branchrule !=
NULL);
enum SCIP_Result SCIP_RESULT
SCIP_BRANCHRULEDATA * SCIPbranchruleGetData(SCIP_BRANCHRULE *branchrule)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
SCIP_RETCODE SCIPsetBranchruleExecPs(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECPS((*branchexecps)))
#define BRANCHRULE_MAXBOUNDDIST
SCIP_Real SCIPgetCutoffbound(SCIP *scip)
SCIP_Real SCIPnodeGetLowerbound(SCIP_NODE *node)
static SCIP_DECL_BRANCHEXECPS(branchExecpsAllfullstrong)
#define BRANCHRULE_MAXDEPTH
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
struct SCIP_BranchruleData SCIP_BRANCHRULEDATA
static SCIP_DECL_BRANCHINIT(branchInitAllfullstrong)
SCIP_RETCODE SCIPsetBranchruleFree(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHFREE((*branchfree)))
SCIP_RETCODE SCIPprintDisplayLine(SCIP *scip, FILE *file, SCIP_VERBLEVEL verblevel, SCIP_Bool endline)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_RETCODE SCIPsetBranchruleCopy(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHCOPY((*branchcopy)))
enum SCIP_Retcode SCIP_RETCODE
SCIP_Real SCIPgetBranchScoreMultiple(SCIP *scip, SCIP_VAR *var, int nchildren, SCIP_Real *gains)
SCIP_BRANCHRULE * SCIPfindBranchrule(SCIP *scip, const char *name)
#define SCIPfreeBlockMemory(scip, ptr)
SCIP_RETCODE SCIPincludeBranchruleBasic(SCIP *scip, SCIP_BRANCHRULE **branchruleptr, const char *name, const char *desc, int priority, int maxdepth, SCIP_Real maxbounddist, SCIP_BRANCHRULEDATA *branchruledata)
#define SCIPduplicateBufferArray(scip, ptr, source, num)
SCIP_RETCODE SCIPchgVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPallocBlockMemory(scip, ptr)
SCIP_RETCODE SCIPincludeBranchruleAllfullstrong(SCIP *scip)
SCIP_Real SCIPfeasCeil(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPfeasFloor(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPsetBranchruleExecLp(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECLP((*branchexeclp)))
SCIP_RETCODE SCIPupdateVarPseudocost(SCIP *scip, SCIP_VAR *var, SCIP_Real solvaldelta, SCIP_Real objdelta, SCIP_Real weight)
SCIP_Real SCIPgetBranchScore(SCIP *scip, SCIP_VAR *var, SCIP_Real downgain, SCIP_Real upgain)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_DECL_BRANCHFREE(branchFreeAllfullstrong)
SCIP_RETCODE SCIPchgVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_RETCODE SCIPgetVarStrongbranchInt(SCIP *scip, SCIP_VAR *var, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, SCIP_Bool *downinf, SCIP_Bool *upinf, SCIP_Bool *downconflict, SCIP_Bool *upconflict, SCIP_Bool *lperror)
SCIP_Real SCIPvarGetLPSol(SCIP_VAR *var)
SCIP_RETCODE SCIPbranchVarVal(SCIP *scip, SCIP_VAR *var, SCIP_Real val, SCIP_NODE **downchild, SCIP_NODE **eqchild, SCIP_NODE **upchild)
static SCIP_DECL_BRANCHEXECLP(branchExeclpAllfullstrong)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
SCIP_RETCODE SCIPgetPseudoBranchCands(SCIP *scip, SCIP_VAR ***pseudocands, int *npseudocands, int *npriopseudocands)
SCIP_Bool SCIPhasCurrentNodeLP(SCIP *scip)
SCIP_RETCODE SCIPstartStrongbranch(SCIP *scip, SCIP_Bool enablepropagation)
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
SCIP_Bool SCIPvarIsInLP(SCIP_VAR *var)
int SCIPgetDepth(SCIP *scip)
SCIP_RETCODE SCIPupdateNodeLowerbound(SCIP *scip, SCIP_NODE *node, SCIP_Real newbound)
void SCIPbranchruleSetData(SCIP_BRANCHRULE *branchrule, SCIP_BRANCHRULEDATA *branchruledata)
SCIP_RETCODE SCIPselectVarPseudoStrongBranching(SCIP *scip, SCIP_VAR **pseudocands, SCIP_Bool *skipdown, SCIP_Bool *skipup, int npseudocands, int npriopseudocands, SCIP_Bool allowaddcons, int *bestpseudocand, SCIP_Real *bestdown, SCIP_Real *bestup, SCIP_Real *bestscore, SCIP_Bool *bestdownvalid, SCIP_Bool *bestupvalid, SCIP_Real *provedbound, SCIP_RESULT *result)
#define BRANCHRULE_PRIORITY
SCIP_RETCODE SCIPfixVar(SCIP *scip, SCIP_VAR *var, SCIP_Real fixedval, SCIP_Bool *infeasible, SCIP_Bool *fixed)
static SCIP_RETCODE branch(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_Bool allowaddcons, SCIP_RESULT *result)
static SCIP_DECL_BRANCHCOPY(branchCopyAllfullstrong)
int SCIPgetNVars(SCIP *scip)
all variables full strong LP branching rule
SCIP_Real SCIPgetLPObjval(SCIP *scip)
SCIP_RETCODE SCIPendStrongbranch(SCIP *scip)
const char * SCIPbranchruleGetName(SCIP_BRANCHRULE *branchrule)
SCIP_RETCODE SCIPsetBranchruleInit(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHINIT((*branchinit)))
SCIP_Bool SCIPallColsInLP(SCIP *scip)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
#define BMSclearMemoryArray(ptr, num)
SCIP_RETCODE SCIPgetVarStrongbranchFrac(SCIP *scip, SCIP_VAR *var, int itlim, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, SCIP_Bool *downinf, SCIP_Bool *upinf, SCIP_Bool *downconflict, SCIP_Bool *upconflict, SCIP_Bool *lperror)
SCIP_Longint SCIPgetNNodes(SCIP *scip)
SCIP_Bool SCIPisExactSolve(SCIP *scip)