43 #define BRANCHRULE_NAME "multaggr" 44 #define BRANCHRULE_DESC "fullstrong branching on fractional and multi-aggregated variables" 45 #define BRANCHRULE_PRIORITY 0 46 #define BRANCHRULE_MAXDEPTH -1 47 #define BRANCHRULE_MAXBOUNDDIST 1.0 50 #define DEFAULT_REEVALAGE 0LL 52 #define DEFAULT_MAXPROPROUNDS 0 54 #define DEFAULT_PROBINGBOUNDS TRUE 62 struct SCIP_BranchruleData
83 int firstmultaggrdepth;
101 int totalmultaggrcands;
112 #ifdef SCIP_STATISTIC 119 assert(scip != NULL);
120 assert(branchruledata != NULL);
121 assert(branchruledata->ratioggain != NULL);
122 assert(branchruledata->nmultaggrbranch >= 0);
123 assert(branchruledata->size >= 0);
126 if( branchruledata->nmultaggrbranch + 1 > branchruledata->size )
129 assert(newsize >= branchruledata->nmultaggrbranch + 1);
131 branchruledata->size = newsize;
153 #ifdef SCIP_STATISTIC
177 #ifdef SCIP_STATISTIC 182 assert(branchrule != NULL);
185 assert(branchruledata != NULL);
188 assert(scip != NULL);
189 assert(bestcand != NULL);
190 assert(bestscore != NULL);
203 SCIPdebugMsg(scip,
" fractional variable: <%s> with value: %f is selected by strong branching\n",
SCIPvarGetName(*bestcand), *bestsol);
208 SCIPdebugMsg(scip,
"cannot perform probing in selectVarMultAggrBranching, depth limit reached.\n");
215 assert(fixvars != NULL);
221 for( i = 0; i < nfixvars; i++ )
223 assert(fixvars[i] != NULL);
227 for( i = 0; i < nfixvars; i++ )
229 assert(fixvars[i] != NULL);
235 fixvarssol = fixvarssols[i];
260 startprobing =
FALSE;
275 assert(probingconsdown != NULL);
280 assert(node != NULL);
286 SCIPdebugMsg(scip,
" created down probing node with constraint:\n");
301 SCIPdebugMsg(scip,
"error solving down node probing LP: status=%d\n", solstatdown);
317 for( j = 0 ; j < ndownvars; j++ )
323 assert(downvars != NULL);
324 assert(downvars[j] != NULL);
328 estimateincr = MIN(pscdown, pscup);
330 estimateprobdown += estimateincr;
339 assert(probingconsup != NULL);
349 SCIPdebugMsg(scip,
" created up probing node with constraint:\n");
363 SCIPdebugMsg(scip,
"error solving up node probing LP: status=%d\n", solstatup);
372 SCIPdebugMsg(scip,
" down node objval: %g up node objval: %g\n", downobjval, upobjval);
381 for( k = 0 ; k < nupvars; k++ )
387 assert(upvars != NULL);
388 assert(upvars[k] != NULL);
392 estimateincr = MIN(pscdown, pscup);
393 estimateprobup += estimateincr;
399 if( downinf || upinf )
408 if( downinf && upinf )
410 SCIPdebugMsg(scip,
"node can be cut off due to strong branching on multi-aggregated variable <%s>\n",
424 SCIPdebugMsg(scip,
"%s child of multi-aggregated variable <%s> is infeasible\n",
449 SCIPdebugMsg(scip,
" both probing nodes are valid while branching on multi-aggregated variable: <%s>\n ",
SCIPvarGetName(fixvars[i]));
451 down =
MAX(downobjval, lpobjval);
452 up =
MAX(upobjval, lpobjval);
453 downgain = down - lpobjval;
454 upgain = up - lpobjval;
457 if( allcolsinlp && !exactsolve )
460 minbound = MIN(downobjval, upobjval);
461 *provedbound =
MAX(*provedbound, minbound);
465 if( score > *bestmultaggrscore )
466 *bestmultaggrscore = score;
470 if( score > *bestscore )
473 if( branchruledata->nmultaggrbranch == 0 )
475 branchruledata->rundepth = SCIPgetNRuns(scip);
476 branchruledata->firstmultaggrdepth = SCIPgetFocusDepth(scip);
482 *bestscore =
MAX(score, *bestscore);
483 *bestcand = fixvars[i];
484 *bestsol = fixvarssol;
485 *bestdown = downobjval;
487 *bestdownvalid =
TRUE;
489 *estimatedown = estimateprobdown;
490 *estimateup = estimateprobup;
492 assert(bestscore != NULL);
493 assert(bestcand != NULL);
494 assert(bestup != NULL);
495 assert(bestdown != NULL);
519 assert(probingconsup != NULL);
530 assert(probingconsdown != NULL);
550 assert(scip != NULL);
551 assert(branchrule != NULL);
568 assert(branchruledata != NULL);
587 assert(branchruledata != NULL);
589 branchruledata->lastcand = 0;
591 branchruledata->firstmultaggrdepth = 0;
592 branchruledata->nmultaggrbranch = 0;
593 branchruledata->nfracbranch = 0;
594 branchruledata->nEscore = 0;
595 branchruledata->nmultaggrcutoff = 0;
596 branchruledata->nmultaggrconsadd = 0;
597 branchruledata->nfractcutoff = 0;
598 branchruledata->nfractconsadd = 0;
599 branchruledata->nrun = 0;
600 branchruledata->size = 100;
601 branchruledata->ameanratio = 0.0;
602 branchruledata->noupdate =
FALSE;
603 branchruledata->clckstrongbr = NULL;
604 branchruledata->clckmultaggrbr = NULL;
605 branchruledata->nstrongbrcall = 0;
606 branchruledata->nmultaggrbrcall = 0;
607 branchruledata->totalmultaggrcands = 0;
608 branchruledata->totallpcands = 0;
626 assert(branchruledata != NULL);
627 assert((branchruledata->skipdown != NULL) == (branchruledata->skipup != NULL));
634 branchruledata->nmultaggrvars);
636 branchruledata->firstmultaggrdepth,
637 branchruledata->rundepth);
639 branchruledata->nmultaggrbranch, branchruledata->nmultaggrbranch + branchruledata->nfracbranch);
652 if( branchruledata->totallpcands != 0 )
655 SCIPgetClockTime(scip, branchruledata->clckstrongbr) / branchruledata->totallpcands);
667 if( branchruledata->totalmultaggrcands != 0 )
670 SCIPgetClockTime(scip, branchruledata->clckmultaggrbr) / branchruledata->totalmultaggrcands);
678 if( branchruledata->nmultaggrbranch != 0 )
680 for( j = 0; j < branchruledata->nmultaggrbranch; j++ )
682 branchruledata->ameanratio += branchruledata->ratioggain[j];
687 branchruledata->ameanratio = branchruledata->ameanratio / branchruledata->nmultaggrbranch;
699 if( branchruledata->ratioggain != NULL )
702 branchruledata->ratioggain = NULL;
707 if( branchruledata->skipdown != NULL )
711 branchruledata->skipdown = NULL;
712 branchruledata->skipup = NULL;
713 branchruledata->skipsize = 0;
749 assert(branchrule != NULL);
751 assert(scip != NULL);
752 assert(result != NULL);
754 SCIPdebugMsg(scip,
"Execlp method of mult-aggreg branching\n ");
759 assert(branchruledata != NULL);
775 branchruledata->nmultaggrvars = 0;
781 for( i = 0; i < nfixvars; i++ )
786 branchruledata->nmultaggrvars += 1;
796 assert(nlpcands > 0);
797 assert(npriolpcands > 0);
806 if( branchruledata->skipdown == NULL )
808 assert(branchruledata->skipup == NULL);
824 branchruledata->skipup, nlpcands, npriolpcands, nlpcands, &branchruledata->lastcand,
825 branchruledata->maxproprounds, branchruledata->probingbounds,
TRUE,
826 &bestcandpos, &bestdown, &bestup, &bestscore, &bestdownvalid, &bestupvalid, &provedbound, result) );
831 branchruledata->nstrongbrcall += 1;
836 SCIP_VAR* bestcand = lpcands[bestcandpos];
837 SCIP_Real bestsol = lpcandssol[bestcandpos];
848 || branchruledata->maxproprounds != 0 )
857 fdown = MAX(bestdown, lpobjval);
858 fup = MAX(bestup, lpobjval);
859 fdowngain = fdown - lpobjval;
860 fupgain = fup - lpobjval;
868 #ifdef SCIP_STATISTIC 870 &estimatedown, &estimateup, &bestmultaggrscore, result) );
873 &estimatedown, &estimateup, result) );
877 branchruledata->nmultaggrbrcall += 1;
883 if( !(branchruledata->noupdate) )
885 if( SCIPisEQ(scip, bestmultaggrscore, bestscore) )
886 branchruledata->nEscore += 1;
890 assert(bestcand != NULL);
900 if( !(branchruledata->noupdate) )
902 branchruledata->nmultaggrbranch += 1;
906 SCIP_Real gfractbranch;
907 SCIP_Real gmultaggrbranch;
914 down = MAX(bestdown, lpobjval);
915 up = MAX(bestup, lpobjval);
916 downgain = down - lpobjval;
917 upgain = up - lpobjval;
919 SCIP_CALL( ensureArraySize(scip, branchruledata) );
921 gfractbranch= SQRT(MAX(fdowngain,1e-06) * MAX(fupgain,1e-06));
922 gmultaggrbranch = SQRT(MAX(downgain,1e-06) * MAX(upgain,1e-06));
924 nmultaggrbranch = branchruledata->nmultaggrbranch;
926 if( gmultaggrbranch == 0.0 )
928 branchruledata->ratioggain[nmultaggrbranch - 1] = 1;
932 branchruledata->ratioggain[nmultaggrbranch - 1] = gfractbranch / gmultaggrbranch;
956 assert(downchild != NULL);
957 assert(upchild != NULL);
985 if( !(branchruledata->noupdate) )
986 branchruledata->nfracbranch += 1
994 assert(downchild != NULL);
995 assert(upchild != NULL);
1021 branchruledata->nfractcutoff += 1;
1025 branchruledata->nfractconsadd += 1;
1053 branchruledata->lastcand = 0;
1054 branchruledata->skipsize = 0;
1055 branchruledata->skipup = NULL;
1056 branchruledata->skipdown = NULL;
1063 assert(branchrule != NULL);
1074 "branching/multaggr/reevalage",
1075 "number of intermediate LPs solved to trigger reevaluation of strong branching value for a variable that was already evaluated at the current node",
1078 "branching/multaggr/maxproprounds",
1079 "maximum number of propagation rounds to be performed during multaggr branching before solving the LP (-1: no limit, -2: parameter settings)",
1082 "branching/multaggr/probingbounds",
1083 "should valid bounds be identified in a probing-like fashion during multaggr branching (only with propagation)?",
enum SCIP_Result SCIP_RESULT
SCIP_RETCODE SCIPgetLPBranchCands(SCIP *scip, SCIP_VAR ***lpcands, SCIP_Real **lpcandssol, SCIP_Real **lpcandsfrac, int *nlpcands, int *npriolpcands, int *nfracimplvars)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
static SCIP_DECL_BRANCHFREE(branchFreeMultAggr)
SCIP_BRANCHRULEDATA * SCIPbranchruleGetData(SCIP_BRANCHRULE *branchrule)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
SCIP_NODE * SCIPgetCurrentNode(SCIP *scip)
SCIP_Real * SCIPvarGetMultaggrScalars(SCIP_VAR *var)
public methods for branch and bound tree
SCIP_RETCODE SCIPbacktrackProbing(SCIP *scip, int probingdepth)
SCIP_Real SCIPgetCutoffbound(SCIP *scip)
SCIP_Real SCIPnodeGetLowerbound(SCIP_NODE *node)
internal methods for clocks and timing issues
int SCIPcalcMemGrowSize(SCIP *scip, int num)
SCIP_VAR ** SCIPvarGetMultaggrVars(SCIP_VAR *var)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
struct SCIP_BranchruleData SCIP_BRANCHRULEDATA
#define DEFAULT_REEVALAGE
SCIP_RETCODE SCIPstopClock(SCIP *scip, SCIP_CLOCK *clck)
SCIP_RETCODE SCIPsetBranchruleExit(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXIT((*branchexit)))
SCIP_RETCODE SCIPsetBranchruleFree(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHFREE((*branchfree)))
SCIP_RETCODE SCIPselectVarStrongBranching(SCIP *scip, SCIP_VAR **lpcands, SCIP_Real *lpcandssol, SCIP_Real *lpcandsfrac, SCIP_Bool *skipdown, SCIP_Bool *skipup, int nlpcands, int npriolpcands, int ncomplete, int *start, int maxproprounds, SCIP_Bool probingbounds, SCIP_Bool forcestrongbranch, int *bestcand, SCIP_Real *bestdown, SCIP_Real *bestup, SCIP_Real *bestscore, SCIP_Bool *bestdownvalid, SCIP_Bool *bestupvalid, SCIP_Real *provedbound, SCIP_RESULT *result)
SCIP_RETCODE SCIPaddLongintParam(SCIP *scip, const char *name, const char *desc, SCIP_Longint *valueptr, SCIP_Bool isadvanced, SCIP_Longint defaultvalue, SCIP_Longint minvalue, SCIP_Longint maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
#define BRANCHRULE_MAXDEPTH
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_RETCODE SCIPsetBranchruleCopy(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHCOPY((*branchcopy)))
enum SCIP_Retcode SCIP_RETCODE
SCIP_BRANCHRULE * SCIPfindBranchrule(SCIP *scip, const char *name)
static SCIP_DECL_BRANCHEXIT(branchExitMultAggr)
#define SCIPfreeBlockMemory(scip, ptr)
#define DEFAULT_MAXPROPROUNDS
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 DEFAULT_PROBINGBOUNDS
#define SCIPduplicateBufferArray(scip, ptr, source, num)
SCIP_RETCODE SCIPfreeClock(SCIP *scip, SCIP_CLOCK **clck)
#define SCIPfreeBufferArray(scip, ptr)
enum SCIP_LPSolStat SCIP_LPSOLSTAT
#define SCIPallocBlockMemory(scip, ptr)
int SCIPgetNLPBranchCands(SCIP *scip)
SCIP_RETCODE SCIPaddIntParam(SCIP *scip, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
static SCIP_RETCODE selectVarMultAggrBranching(SCIP *scip, SCIP_VAR **bestcand, SCIP_Real *bestscore, SCIP_Real *bestsol, SCIP_Real *bestdown, SCIP_Real *bestup, SCIP_Bool *bestdownvalid, SCIP_Bool *bestupvalid, SCIP_Real *provedbound, SCIP_Real *estimatedown, SCIP_Real *estimateup, SCIP_RESULT *result)
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_Real SCIPgetBranchScore(SCIP *scip, SCIP_VAR *var, SCIP_Real downgain, SCIP_Real upgain)
int SCIPgetNFixedVars(SCIP *scip)
SCIP_Longint SCIPnodeGetNumber(SCIP_NODE *node)
SCIP_VAR ** SCIPgetFixedVars(SCIP *scip)
SCIP_Real SCIPvarGetPseudocost(SCIP_VAR *var, SCIP_STAT *stat, SCIP_Real solvaldelta)
SCIP_RETCODE SCIPcreateClock(SCIP *scip, SCIP_CLOCK **clck)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
const char * SCIPconsGetName(SCIP_CONS *cons)
SCIP_RETCODE SCIPendProbing(SCIP *scip)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_Real SCIPsetFeasCeil(SCIP_SET *set, SCIP_Real val)
SCIP_Real SCIPvarGetLPSol(SCIP_VAR *var)
SCIP_RETCODE SCIPcreateChild(SCIP *scip, SCIP_NODE **node, SCIP_Real nodeselprio, SCIP_Real estimate)
internal methods for global SCIP settings
SCIP main data structure.
SCIP_RETCODE SCIPsolveProbingLP(SCIP *scip, int itlim, SCIP_Bool *lperror, SCIP_Bool *cutoff)
SCIP_Real SCIPvarGetMultaggrConstant(SCIP_VAR *var)
SCIP_RETCODE SCIPbranchVarVal(SCIP *scip, SCIP_VAR *var, SCIP_Real val, SCIP_NODE **downchild, SCIP_NODE **eqchild, SCIP_NODE **upchild)
SCIP_Longint SCIPgetVarStrongbranchLPAge(SCIP *scip, SCIP_VAR *var)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
SCIP_RETCODE SCIPgetLongintParam(SCIP *scip, const char *name, SCIP_Longint *value)
#define BRANCHRULE_MAXBOUNDDIST
SCIP_RETCODE SCIPaddConsNode(SCIP *scip, SCIP_NODE *node, SCIP_CONS *cons, SCIP_NODE *validnode)
internal methods for problem variables
#define SCIPallocBufferArray(scip, ptr, num)
full strong LP branching rule
fullstrong branching on fractional and multi-aggregated variables
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
static SCIP_DECL_BRANCHINIT(branchInitMultAggr)
SCIP_Real SCIPgetClockTime(SCIP *scip, SCIP_CLOCK *clck)
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 SCIPprintCons(SCIP *scip, SCIP_CONS *cons, FILE *file)
#define SCIPfreeMemoryArray(scip, ptr)
int SCIPgetNRuns(SCIP *scip)
Constraint handler for linear constraints in their most general form, .
int SCIPvarGetMultaggrNVars(SCIP_VAR *var)
#define SCIP_MAXTREEDEPTH
int SCIPgetNVars(SCIP *scip)
SCIP_Real SCIPnodeGetEstimate(SCIP_NODE *node)
SCIP_RETCODE SCIPcreateConsLinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
SCIP_Real SCIPsetFeasFloor(SCIP_SET *set, SCIP_Real val)
SCIP_Real SCIPgetLPObjval(SCIP *scip)
SCIP_RETCODE SCIPincludeBranchruleMultAggr(SCIP *scip)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
static SCIP_DECL_BRANCHCOPY(branchCopyMultAggr)
const char * SCIPbranchruleGetName(SCIP_BRANCHRULE *branchrule)
static SCIP_DECL_BRANCHEXECLP(branchExeclpMultAggr)
SCIP_RETCODE SCIPsetBranchruleInit(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHINIT((*branchinit)))
#define BRANCHRULE_PRIORITY
SCIP_Bool SCIPallColsInLP(SCIP *scip)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
SCIP_RETCODE SCIPnewProbingNode(SCIP *scip)
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPstartProbing(SCIP *scip)
#define BMSclearMemoryArray(ptr, num)
SCIP_RETCODE SCIPstartClock(SCIP *scip, SCIP_CLOCK *clck)
SCIP_Bool SCIPisExactSolve(SCIP *scip)
SCIP_RETCODE SCIPsetLongintParam(SCIP *scip, const char *name, SCIP_Longint value)
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)