43#define CUTSEL_NAME "dynamic"
44#define CUTSEL_DESC "dynamic orthogonality for hybrid cutsel"
45#define CUTSEL_PRIORITY 7000
47#define RANDSEED 0x5EED
49#define DEFAULT_EFFICACYWEIGHT 1.0
50#define DEFAULT_DIRCUTOFFDISTWEIGHT 0.0
51#define DEFAULT_OBJPARALWEIGHT 0.0
52#define DEFAULT_INTSUPPORTWEIGHT 0.0
53#define DEFAULT_MINORTHO 0.9
54#define DEFAULT_MINGAIN 0.01
55#define DEFAULT_MAXDEPTH (-1)
56#define DEFAULT_FILTERMODE 'd'
68 SCIP_Real objparalweight;
69 SCIP_Real efficacyweight;
70 SCIP_Real dircutoffdistweight;
71 SCIP_Real intsupportweight;
91 SCIP_Real dircutoffdistweight,
92 SCIP_Real efficacyweight,
93 SCIP_Real objparalweight,
94 SCIP_Real intsupportweight,
99 SCIP_Real maxscore = 0.0;
102 int ncuts = *currentncuts;
107 if(
sol !=
NULL && dircutoffdistweight > 0.0 )
109 for(
i = ncuts-1;
i >= 0; --
i )
112 SCIP_Real objparallelism;
113 SCIP_Real intsupport;
116 if( intsupportweight > 0.0 )
121 if( objparalweight > 0.0 )
124 objparallelism = 0.0;
130 score = dircutoffdistweight * efficacy;
135 score = dircutoffdistweight *
MAX(score, efficacy);
138 efficacy *= efficacyweight;
139 score += objparallelism + intsupport + efficacy;
145 if( randnumgen !=
NULL)
150 maxscore =
MAX(maxscore, score);
170 efficacyweight += dircutoffdistweight;
173 for(
i = ncuts-1;
i >= 0; --
i )
176 SCIP_Real objparallelism;
177 SCIP_Real intsupport;
180 if( intsupportweight > 0.0 )
185 if( objparalweight > 0.0 )
188 objparallelism = 0.0;
192 score = objparallelism + intsupport + efficacy;
198 if( randnumgen !=
NULL)
203 maxscore =
MAX(maxscore, score);
218 *currentncuts = ncuts;
231 SCIP_Real currentbestefficacy;
232 SCIP_Real cosineangle;
246 *score = sqrt(currentbestefficacy * currentbestefficacy + efficacy * efficacy
247 - 2.0 * fabs(currentbestefficacy) * fabs(efficacy) * cosineangle)
248 / sqrt((1.0 - (cosineangle * cosineangle)));
249 *score -= currentbestefficacy;
271 bestscore = scores[0];
274 for(
i = 1;
i < ncuts; ++
i )
276 if( scores[
i] > bestscore )
279 bestscore = scores[
i];
302 SCIP_Real bestcutefficacy;
313 for(
i = ncuts-1;
i >= 0; --
i )
315 SCIP_Real thisparall;
317 SCIP_Real currentcutefficacy;
318 SCIP_Real minmaxparall;
322 if(
SCIPisGE(
scip, bestcutefficacy, currentcutefficacy))
325 thisparall = cosine * bestcutefficacy / currentcutefficacy;
326 SCIPdebugMsg(
scip,
"Thisparall(%g) = cosine(%g) * (bestcutefficacy(%g)/ currentcutefficacy(%g))\n\n", thisparall,
327 cosine, bestcutefficacy, currentcutefficacy);
332 thisparall = cosine * currentcutefficacy / bestcutefficacy;
333 SCIPdebugMsg(
scip,
"Thisparall(%g) = cosine(%g) * (currentcutefficacy(%g) / bestcutefficacy(%g))\n\n", thisparall,
334 cosine, currentcutefficacy, bestcutefficacy);
339 minmaxparall =
MAX( (bestcutefficacy * bestcutefficacy
340 + currentcutefficacy * currentcutefficacy
341 - (1 + mingain) * bestcutefficacy * (1 + mingain) * bestcutefficacy * (1 - cosine * cosine))
342 / (2 * bestcutefficacy * currentcutefficacy),
437 if (cutseldata->maxdepth != -1 && cutseldata->maxdepth <
SCIPgetDepth(
scip))
444 cutseldata->mingain, 1-cutseldata->minortho, cutseldata->dircutoffdistweight, cutseldata->efficacyweight,
445 cutseldata->objparalweight, cutseldata->intsupportweight, ncuts, nforcedcuts,
446 maxnselectedcuts, nselectedcuts) );
482 "weight of efficacy in cut score calculation",
483 &cutseldata->efficacyweight,
FALSE,
487 "cutselection/" CUTSEL_NAME "/dircutoffdistweight",
488 "weight of directed cutoff distance in cut score calculation",
489 &cutseldata->dircutoffdistweight,
FALSE,
494 "weight of objective parallelism in cut score calculation",
495 &cutseldata->objparalweight,
FALSE,
500 "weight of integral support in cut score calculation",
501 &cutseldata->intsupportweight,
FALSE,
506 "minimal efficacy gain for a cut to enter the LP",
507 &cutseldata->mingain,
FALSE,
512 "filtering strategy during cut selection",
513 &cutseldata->filtermode,
FALSE,
518 "minimal orthogonality for a cut to enter the LP",
519 &cutseldata->minortho,
FALSE,
524 "maximum depth at which this cutselector is employed",
525 &cutseldata->maxdepth,
FALSE,
548 SCIP_Real dircutoffdistweight,
549 SCIP_Real efficacyweight,
550 SCIP_Real objparalweight,
551 SCIP_Real intsupportweight,
560 SCIP_Real* forcedscores;
561 SCIP_Real* scoresptr;
566 assert(forcedcuts !=
NULL || nforcedcuts == 0);
575 scoring(
scip, cuts, randnumgen, dircutoffdistweight, efficacyweight, objparalweight, intsupportweight, &ncuts,
592 if( *nselectedcuts == maxselectedcuts )
595 if( filtermode ==
'f' && nforcedcuts > 0 )
598 ngoodforcedcuts = nforcedcuts;
599 scoring(
scip, forcedcuts, randnumgen, dircutoffdistweight, efficacyweight, objparalweight, intsupportweight,
600 &ngoodforcedcuts, forcedscores);
602 if( ngoodforcedcuts != 0 )
608 for(
i = 0;
i < ncuts;
i++ )
616 if( ngoodforcedcuts == 0 )
618 assert(filtermode ==
'd' || ngoodforcedcuts == 0);
621 selectedcut = cuts[0];
627 if( *nselectedcuts == maxselectedcuts )
637 if( filtermode ==
'f' )
639 for(
i = 0;
i < ncuts;
i++ )
652 selectedcut = cuts[0];
658 if( *nselectedcuts == maxselectedcuts )
668 if( filtermode ==
'f' )
670 for(
i = 0;
i < ncuts;
i++ )
#define DEFAULT_EFFICACYWEIGHT
#define DEFAULT_OBJPARALWEIGHT
static int filterWithDynamicParallelism(SCIP *scip, SCIP_ROW *bestcut, SCIP_ROW **cuts, SCIP_Real *scores, SCIP_Real mingain, SCIP_Real maxparall, int ncuts)
static void selectBestCut(SCIP_ROW **cuts, SCIP_Real *scores, int ncuts)
#define DEFAULT_FILTERMODE
static SCIP_RETCODE computeProjectionScore(SCIP *scip, SCIP_ROW *bestcut, SCIP_ROW *cut, SCIP_Real *score)
#define DEFAULT_DIRCUTOFFDISTWEIGHT
static void scoring(SCIP *scip, SCIP_ROW **cuts, SCIP_RANDNUMGEN *randnumgen, SCIP_Real dircutoffdistweight, SCIP_Real efficacyweight, SCIP_Real objparalweight, SCIP_Real intsupportweight, int *currentncuts, SCIP_Real *scores)
#define DEFAULT_INTSUPPORTWEIGHT
#define SCIP_MAXTREEDEPTH
SCIP_RETCODE SCIPselectCutsDynamic(SCIP *scip, SCIP_ROW **cuts, SCIP_ROW **forcedcuts, SCIP_RANDNUMGEN *randnumgen, char filtermode, SCIP_Real mingain, SCIP_Real maxparall, SCIP_Real dircutoffdistweight, SCIP_Real efficacyweight, SCIP_Real objparalweight, SCIP_Real intsupportweight, int ncuts, int nforcedcuts, int maxselectedcuts, int *nselectedcuts)
SCIP_RETCODE SCIPincludeCutselDynamic(SCIP *scip)
SCIP_RETCODE SCIPaddCharParam(SCIP *scip, const char *name, const char *desc, char *valueptr, SCIP_Bool isadvanced, char defaultvalue, const char *allowedvalues, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
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)
SCIP_RETCODE SCIPaddRealParam(SCIP *scip, const char *name, const char *desc, SCIP_Real *valueptr, SCIP_Bool isadvanced, SCIP_Real defaultvalue, SCIP_Real minvalue, SCIP_Real maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
void SCIPswapPointers(void **pointer1, void **pointer2)
void SCIPswapReals(SCIP_Real *value1, SCIP_Real *value2)
SCIP_Real SCIPgetCutEfficacy(SCIP *scip, SCIP_SOL *sol, SCIP_ROW *cut)
SCIP_Real SCIPgetCutLPSolCutoffDistance(SCIP *scip, SCIP_SOL *sol, SCIP_ROW *cut)
SCIP_RETCODE SCIPsetCutselInit(SCIP *scip, SCIP_CUTSEL *cutsel,)
SCIP_RETCODE SCIPincludeCutselBasic(SCIP *scip, SCIP_CUTSEL **cutsel, const char *name, const char *desc, int priority, SCIP_DECL_CUTSELSELECT((*cutselselect)), SCIP_CUTSELDATA *cutseldata)
SCIP_RETCODE SCIPsetCutselCopy(SCIP *scip, SCIP_CUTSEL *cutsel,)
SCIP_RETCODE SCIPsetCutselExit(SCIP *scip, SCIP_CUTSEL *cutsel,)
SCIP_CUTSELDATA * SCIPcutselGetData(SCIP_CUTSEL *cutsel)
void SCIPcutselSetData(SCIP_CUTSEL *cutsel, SCIP_CUTSELDATA *cutseldata)
const char * SCIPcutselGetName(SCIP_CUTSEL *cutsel)
SCIP_RETCODE SCIPsetCutselFree(SCIP *scip, SCIP_CUTSEL *cutsel,)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPfreeBlockMemory(scip, ptr)
#define SCIPallocBlockMemory(scip, ptr)
SCIP_Real SCIProwGetParallelism(SCIP_ROW *row1, SCIP_ROW *row2, char orthofunc)
int SCIProwGetNNonz(SCIP_ROW *row)
SCIP_Bool SCIProwIsInGlobalCutpool(SCIP_ROW *row)
SCIP_Bool SCIProwIsLocal(SCIP_ROW *row)
const char * SCIProwGetName(SCIP_ROW *row)
SCIP_Real SCIPgetRowObjParallelism(SCIP *scip, SCIP_ROW *row)
int SCIPgetRowNumIntCols(SCIP *scip, SCIP_ROW *row)
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
int SCIPgetDepth(SCIP *scip)
SCIP_Real SCIPrandomGetReal(SCIP_RANDNUMGEN *randnumgen, SCIP_Real minrandval, SCIP_Real maxrandval)
SCIPfreeRandom(scip, &heurdata->randnumgen)
SCIPcreateRandom(scip, &heurdata->randnumgen, DEFAULT_RANDSEED, TRUE))
assert(minobj< SCIPgetCutoffbound(scip))
#define BMSclearMemory(ptr)
public methods for cuts and aggregation rows
public methods for cut selector plugins
public methods for the LP relaxation, rows and columns
public methods for random numbers
#define SCIP_DECL_CUTSELEXIT(x)
#define SCIP_DECL_CUTSELSELECT(x)
#define SCIP_DECL_CUTSELFREE(x)
struct SCIP_CutselData SCIP_CUTSELDATA
#define SCIP_DECL_CUTSELINIT(x)
#define SCIP_DECL_CUTSELCOPY(x)
enum SCIP_Retcode SCIP_RETCODE