40#define CUTSEL_NAME "dynamic"
41#define CUTSEL_DESC "dynamic orthogonality for hybrid cutsel"
42#define CUTSEL_PRIORITY 7000
44#define RANDSEED 0x5EED
46#define DEFAULT_EFFICACYWEIGHT 1.0
47#define DEFAULT_DIRCUTOFFDISTWEIGHT 0.0
48#define DEFAULT_OBJPARALWEIGHT 0.0
49#define DEFAULT_INTSUPPORTWEIGHT 0.0
50#define DEFAULT_MINORTHO 0.9
51#define DEFAULT_MINGAIN 0.01
52#define DEFAULT_MAXDEPTH (-1)
53#define DEFAULT_FILTERMODE 'd'
99 int ncuts = *currentncuts;
104 if(
sol !=
NULL && dircutoffdistweight > 0.0 )
106 for(
i = ncuts-1;
i >= 0; --
i )
113 if( intsupportweight > 0.0 )
118 if( objparalweight > 0.0 )
121 objparallelism = 0.0;
127 score = dircutoffdistweight * efficacy;
132 score = dircutoffdistweight *
MAX(score, efficacy);
135 score += objparallelism + intsupport + efficacyweight * efficacy;
141 if( randnumgen !=
NULL)
146 maxscore =
MAX(maxscore, score);
155 else if( scores !=
NULL )
166 efficacyweight += dircutoffdistweight;
169 for(
i = ncuts-1;
i >= 0; --
i )
176 if( intsupportweight > 0.0 )
181 if( objparalweight > 0.0 )
184 objparallelism = 0.0;
188 score = objparallelism + intsupport + efficacyweight * efficacy;
194 if( randnumgen !=
NULL)
199 maxscore =
MAX(maxscore, score);
208 else if( scores !=
NULL )
214 *currentncuts = ncuts;
242 *score = sqrt(currentbestefficacy * currentbestefficacy + efficacy * efficacy
243 - 2.0 * fabs(currentbestefficacy) * fabs(efficacy) * cosineangle)
244 / sqrt((1.0 - (cosineangle * cosineangle)));
245 *score -= currentbestefficacy;
267 bestscore = scores[0];
270 for(
i = 1;
i < ncuts; ++
i )
272 if( scores[
i] > bestscore )
275 bestscore = scores[
i];
307 assert(bestcutefficacy > 0.0);
310 for(
i = ncuts-1;
i >= 0; --
i )
318 assert(currentcutefficacy > 0.0);
320 if(
SCIPisGE(
scip, bestcutefficacy, currentcutefficacy))
323 thisparall = cosine * bestcutefficacy / currentcutefficacy;
324 SCIPdebugMsg(
scip,
"Thisparall(%g) = cosine(%g) * (bestcutefficacy(%g)/ currentcutefficacy(%g))\n\n", thisparall,
325 cosine, bestcutefficacy, currentcutefficacy);
330 thisparall = cosine * currentcutefficacy / bestcutefficacy;
331 SCIPdebugMsg(
scip,
"Thisparall(%g) = cosine(%g) * (currentcutefficacy(%g) / bestcutefficacy(%g))\n\n", thisparall,
332 cosine, currentcutefficacy, bestcutefficacy);
337 minmaxparall =
MAX( (bestcutefficacy * bestcutefficacy
338 + currentcutefficacy * currentcutefficacy
339 - (1 + mingain) * bestcutefficacy * (1 + mingain) * bestcutefficacy * (1 - cosine * cosine))
340 / (2 * bestcutefficacy * currentcutefficacy),
436 if (cutseldata->maxdepth != -1 && cutseldata->maxdepth <
SCIPgetDepth(
scip))
443 cutseldata->mingain, 1-cutseldata->minortho, cutseldata->dircutoffdistweight, cutseldata->efficacyweight,
444 cutseldata->objparalweight, cutseldata->intsupportweight, ncuts, nforcedcuts,
445 maxnselectedcuts, nselectedcuts) );
481 "weight of efficacy in cut score calculation",
482 &cutseldata->efficacyweight,
FALSE,
486 "cutselection/" CUTSEL_NAME "/dircutoffdistweight",
487 "weight of directed cutoff distance in cut score calculation",
488 &cutseldata->dircutoffdistweight,
FALSE,
493 "weight of objective parallelism in cut score calculation",
494 &cutseldata->objparalweight,
FALSE,
499 "weight of integral support in cut score calculation",
500 &cutseldata->intsupportweight,
FALSE,
505 "minimal efficacy gain for a cut to enter the LP",
506 &cutseldata->mingain,
FALSE,
511 "filtering strategy during cut selection",
512 &cutseldata->filtermode,
FALSE,
517 "minimal orthogonality for a cut to enter the LP",
518 &cutseldata->minortho,
FALSE,
523 "maximum depth at which this cutselector is employed",
524 &cutseldata->maxdepth,
FALSE,
565 assert(forcedcuts !=
NULL || nforcedcuts == 0);
574 scoring(
scip, cuts, randnumgen, dircutoffdistweight, efficacyweight, objparalweight, intsupportweight, &ncuts,
591 if( *nselectedcuts == maxselectedcuts )
594 if( filtermode ==
'f' && nforcedcuts > 0 )
597 ngoodforcedcuts = nforcedcuts;
598 scoring(
scip, forcedcuts, randnumgen, dircutoffdistweight, efficacyweight, objparalweight, intsupportweight,
599 &ngoodforcedcuts, forcedscores);
601 if( ngoodforcedcuts != 0 )
607 for(
i = 0;
i < ncuts;
i++ )
615 if( ngoodforcedcuts == 0 )
617 assert(filtermode ==
'd' || ngoodforcedcuts == 0);
620 selectedcut = cuts[0];
626 if( *nselectedcuts == maxselectedcuts )
636 if( filtermode ==
'f' )
638 for(
i = 0;
i < ncuts;
i++ )
651 selectedcut = cuts[0];
657 if( *nselectedcuts == maxselectedcuts )
667 if( filtermode ==
'f' )
669 for(
i = 0;
i < ncuts;
i++ )
#define DEFAULT_EFFICACYWEIGHT
#define DEFAULT_INTSUPPORTWEIGHT
#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 SCIP_MAXTREEDEPTH
#define SCIP_STRINGEQ(name, reference, retcode)
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_Cutsel SCIP_CUTSEL
struct SCIP_CutselData SCIP_CUTSELDATA
#define SCIP_DECL_CUTSELINIT(x)
#define SCIP_DECL_CUTSELCOPY(x)
struct SCIP_RandNumGen SCIP_RANDNUMGEN
enum SCIP_Retcode SCIP_RETCODE