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'
102 int ncuts = *currentncuts;
107 if(
sol !=
NULL && dircutoffdistweight > 0.0 )
109 for(
i = ncuts-1;
i >= 0; --
i )
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 score += objparallelism + intsupport + efficacyweight * efficacy;
144 if( randnumgen !=
NULL)
149 maxscore =
MAX(maxscore, score);
158 else if( scores !=
NULL )
169 efficacyweight += dircutoffdistweight;
172 for(
i = ncuts-1;
i >= 0; --
i )
179 if( intsupportweight > 0.0 )
184 if( objparalweight > 0.0 )
187 objparallelism = 0.0;
191 score = objparallelism + intsupport + efficacyweight * efficacy;
197 if( randnumgen !=
NULL)
202 maxscore =
MAX(maxscore, score);
211 else if( scores !=
NULL )
217 *currentncuts = ncuts;
245 *score = sqrt(currentbestefficacy * currentbestefficacy + efficacy * efficacy
246 - 2.0 * fabs(currentbestefficacy) * fabs(efficacy) * cosineangle)
247 / sqrt((1.0 - (cosineangle * cosineangle)));
248 *score -= currentbestefficacy;
270 bestscore = scores[0];
273 for(
i = 1;
i < ncuts; ++
i )
275 if( scores[
i] > bestscore )
278 bestscore = scores[
i];
310 assert(bestcutefficacy > 0.0);
313 for(
i = ncuts-1;
i >= 0; --
i )
321 assert(currentcutefficacy > 0.0);
323 if(
SCIPisGE(
scip, bestcutefficacy, currentcutefficacy))
326 thisparall = cosine * bestcutefficacy / currentcutefficacy;
327 SCIPdebugMsg(
scip,
"Thisparall(%g) = cosine(%g) * (bestcutefficacy(%g)/ currentcutefficacy(%g))\n\n", thisparall,
328 cosine, bestcutefficacy, currentcutefficacy);
333 thisparall = cosine * currentcutefficacy / bestcutefficacy;
334 SCIPdebugMsg(
scip,
"Thisparall(%g) = cosine(%g) * (currentcutefficacy(%g) / bestcutefficacy(%g))\n\n", thisparall,
335 cosine, currentcutefficacy, bestcutefficacy);
340 minmaxparall =
MAX( (bestcutefficacy * bestcutefficacy
341 + currentcutefficacy * currentcutefficacy
342 - (1 + mingain) * bestcutefficacy * (1 + mingain) * bestcutefficacy * (1 - cosine * cosine))
343 / (2 * bestcutefficacy * currentcutefficacy),
438 if (cutseldata->maxdepth != -1 && cutseldata->maxdepth <
SCIPgetDepth(
scip))
445 cutseldata->mingain, 1-cutseldata->minortho, cutseldata->dircutoffdistweight, cutseldata->efficacyweight,
446 cutseldata->objparalweight, cutseldata->intsupportweight, ncuts, nforcedcuts,
447 maxnselectedcuts, nselectedcuts) );
483 "weight of efficacy in cut score calculation",
484 &cutseldata->efficacyweight,
FALSE,
488 "cutselection/" CUTSEL_NAME "/dircutoffdistweight",
489 "weight of directed cutoff distance in cut score calculation",
490 &cutseldata->dircutoffdistweight,
FALSE,
495 "weight of objective parallelism in cut score calculation",
496 &cutseldata->objparalweight,
FALSE,
501 "weight of integral support in cut score calculation",
502 &cutseldata->intsupportweight,
FALSE,
507 "minimal efficacy gain for a cut to enter the LP",
508 &cutseldata->mingain,
FALSE,
513 "filtering strategy during cut selection",
514 &cutseldata->filtermode,
FALSE,
519 "minimal orthogonality for a cut to enter the LP",
520 &cutseldata->minortho,
FALSE,
525 "maximum depth at which this cutselector is employed",
526 &cutseldata->maxdepth,
FALSE,
567 assert(forcedcuts !=
NULL || nforcedcuts == 0);
576 scoring(
scip, cuts, randnumgen, dircutoffdistweight, efficacyweight, objparalweight, intsupportweight, &ncuts,
593 if( *nselectedcuts == maxselectedcuts )
596 if( filtermode ==
'f' && nforcedcuts > 0 )
599 ngoodforcedcuts = nforcedcuts;
600 scoring(
scip, forcedcuts, randnumgen, dircutoffdistweight, efficacyweight, objparalweight, intsupportweight,
601 &ngoodforcedcuts, forcedscores);
603 if( ngoodforcedcuts != 0 )
609 for(
i = 0;
i < ncuts;
i++ )
617 if( ngoodforcedcuts == 0 )
619 assert(filtermode ==
'd' || ngoodforcedcuts == 0);
622 selectedcut = cuts[0];
628 if( *nselectedcuts == maxselectedcuts )
638 if( filtermode ==
'f' )
640 for(
i = 0;
i < ncuts;
i++ )
653 selectedcut = cuts[0];
659 if( *nselectedcuts == maxselectedcuts )
669 if( filtermode ==
'f' )
671 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
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