/** creates the reoptsols primal heuristic and includes it in SCIP */ SCIP_RETCODE SCIPincludeHeurReoptsols( SCIP* scip /**< SCIP data structure */ ) { SCIP_HEURDATA* heurdata; SCIP_HEUR* heur; /* create reoptsols primal heuristic data */ SCIP_CALL( SCIPallocMemory(scip, &heurdata) ); /* include primal heuristic */ SCIP_CALL( SCIPincludeHeurBasic(scip, &heur, HEUR_NAME, HEUR_DESC, HEUR_DISPCHAR, HEUR_PRIORITY, HEUR_FREQ, HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecReoptsols, heurdata) ); assert(heur != NULL); /* set non fundamental callbacks via setter functions */ SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyReoptsols) ); SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeReoptsols) ); SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitReoptsols) ); SCIP_CALL( SCIPsetHeurExit(scip, heur, heurExitReoptsols) ); SCIP_CALL( SCIPsetHeurInitsol(scip, heur, heurInitsolReoptsols) ); SCIP_CALL( SCIPsetHeurExitsol(scip, heur, heurExitsolReoptsols) ); /* parameters */ SCIP_CALL( SCIPaddIntParam(scip, "heuristics/" HEUR_NAME "/maxsols", "maximal number solutions which should be checked. (-1: all)", &heurdata->maxsols, TRUE, 1000, -1, INT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddIntParam(scip, "heuristics/" HEUR_NAME "/maxruns", "check solutions of the last k runs. (-1: all)", &heurdata->maxruns, TRUE, -1, -1, INT_MAX, NULL, NULL) ); return SCIP_OKAY; }
/** creates the fix-and-infer primal heuristic and includes it in SCIP */ SCIP_RETCODE SCIPincludeHeurFixandinfer( SCIP* scip /**< SCIP data structure */ ) { SCIP_HEURDATA* heurdata; SCIP_HEUR* heur; /* create Fixandinfer primal heuristic data */ SCIP_CALL( SCIPallocMemory(scip, &heurdata) ); /* include primal heuristic */ SCIP_CALL( SCIPincludeHeurBasic(scip, &heur, HEUR_NAME, HEUR_DESC, HEUR_DISPCHAR, HEUR_PRIORITY, HEUR_FREQ, HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecFixandinfer, heurdata) ); assert(heur != NULL); /* set non-NULL pointers to callback methods */ SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyFixandinfer) ); SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeFixandinfer) ); /* fixandinfer heuristic parameters */ SCIP_CALL( SCIPaddIntParam(scip, "heuristics/fixandinfer/proprounds", "maximal number of propagation rounds in probing subproblems (-1: no limit, 0: auto)", &heurdata->proprounds, TRUE, DEFAULT_PROPROUNDS, -1, INT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddIntParam(scip, "heuristics/fixandinfer/minfixings", "minimal number of fixings to apply before dive may be aborted", &heurdata->minfixings, TRUE, DEFAULT_MINFIXINGS, 0, INT_MAX, NULL, NULL) ); return SCIP_OKAY; }
/** creates the local primal heuristic and includes it in SCIP */ SCIP_RETCODE SCIPincludeHeurForward( SCIP* scip /**< SCIP data structure */ ) { SCIP_HEURDATA* heurdata; SCIP_HEUR* heur; /* create Local primal heuristic data */ SCIP_CALL( SCIPallocMemory(scip, &heurdata) ); /* heurdata-> */ /* include primal heuristic */ SCIP_CALL( SCIPincludeHeurBasic(scip, &heur, HEUR_NAME, HEUR_DESC, HEUR_DISPCHAR, HEUR_PRIORITY, HEUR_FREQ, HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecForward, heurdata) ); assert(heur != NULL); /* set non-NULL pointers to callback methods */ SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyForward) ); SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeForward) ); return SCIP_OKAY; }
/** creates the fracdiving heuristic and includes it in SCIP */ SCIP_RETCODE SCIPincludeHeurFracdiving( SCIP* scip /**< SCIP data structure */ ) { SCIP_HEURDATA* heurdata; SCIP_HEUR* heur; /* create Fracdiving primal heuristic data */ SCIP_CALL( SCIPallocMemory(scip, &heurdata) ); /* include primal heuristic */ SCIP_CALL( SCIPincludeHeurBasic(scip, &heur, HEUR_NAME, HEUR_DESC, HEUR_DISPCHAR, HEUR_PRIORITY, HEUR_FREQ, HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecFracdiving, heurdata) ); assert(heur != NULL); /* set non-NULL pointers to callback methods */ SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyFracdiving) ); SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeFracdiving) ); SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitFracdiving) ); SCIP_CALL( SCIPsetHeurExit(scip, heur, heurExitFracdiving) ); /* create a diveset (this will automatically install some additional parameters for the heuristic)*/ SCIP_CALL( SCIPcreateDiveset(scip, NULL, heur, HEUR_NAME, DEFAULT_MINRELDEPTH, DEFAULT_MAXRELDEPTH, DEFAULT_MAXLPITERQUOT, DEFAULT_MAXDIVEUBQUOT, DEFAULT_MAXDIVEAVGQUOT, DEFAULT_MAXDIVEUBQUOTNOSOL, DEFAULT_MAXDIVEAVGQUOTNOSOL, DEFAULT_LPRESOLVEDOMCHGQUOT, DEFAULT_LPSOLVEFREQ, DEFAULT_MAXLPITEROFS, DEFAULT_BACKTRACK, DEFAULT_ONLYLPBRANCHCANDS, DIVESET_DIVETYPES, divesetGetScoreFracdiving) ); return SCIP_OKAY; }
/** creates the distributiondiving heuristic and includes it in SCIP */ SCIP_RETCODE SCIPincludeHeurDistributiondiving( SCIP* scip /**< SCIP data structure */ ) { SCIP_HEURDATA* heurdata; SCIP_HEUR* heur; SCIP_EVENTHDLRDATA* eventhdlrdata; /* create distributiondiving data */ heurdata = NULL; SCIP_CALL( SCIPallocMemory(scip, &heurdata) ); heurdata->memsize = 0; heurdata->rowmeans = NULL; heurdata->rowvariances = NULL; heurdata->rowinfinitiesdown = NULL; heurdata->rowinfinitiesup = NULL; heurdata->varfilterposs = NULL; heurdata->currentlbs = NULL; heurdata->currentubs = NULL; /* create event handler first to finish heuristic data */ eventhdlrdata = NULL; SCIP_CALL( SCIPallocMemory(scip, &eventhdlrdata) ); eventhdlrdata->heurdata = heurdata; heurdata->eventhdlr = NULL; SCIP_CALL( SCIPincludeEventhdlrBasic(scip, &heurdata->eventhdlr, EVENTHDLR_NAME, "event handler for dynamic acitivity distribution updating", eventExecDistribution, eventhdlrdata) ); assert( heurdata->eventhdlr != NULL); SCIP_CALL( SCIPsetEventhdlrFree(scip, heurdata->eventhdlr, eventFreeDistributiondiving) ); /* include primal heuristic */ SCIP_CALL( SCIPincludeHeurBasic(scip, &heur, HEUR_NAME, HEUR_DESC, HEUR_DISPCHAR, HEUR_PRIORITY, HEUR_FREQ, HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecDistributiondiving, heurdata) ); assert(heur != NULL); /* set non-NULL pointers to callback methods */ SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyDistributiondiving) ); SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeDistributiondiving) ); SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitDistributiondiving) ); SCIP_CALL( SCIPsetHeurExit(scip, heur, heurExitDistributiondiving) ); SCIP_CALL( SCIPcreateDiveset(scip, NULL, heur, HEUR_NAME, DEFAULT_MINRELDEPTH, DEFAULT_MAXRELDEPTH, DEFAULT_MAXLPITERQUOT, DEFAULT_MAXDIVEUBQUOT, DEFAULT_MAXDIVEAVGQUOT, DEFAULT_MAXDIVEUBQUOTNOSOL, DEFAULT_MAXDIVEAVGQUOTNOSOL, DEFAULT_LPRESOLVEDOMCHGQUOT, DEFAULT_LPSOLVEFREQ, DEFAULT_MAXLPITEROFS, DEFAULT_BACKTRACK, DEFAULT_ONLYLPBRANCHCANDS, DIVESET_DIVETYPES, divesetGetScoreDistributiondiving) ); SCIP_CALL( SCIPaddCharParam(scip, "heuristics/" HEUR_NAME "/scoreparam", "the score;largest 'd'ifference, 'l'owest cumulative probability,'h'ighest c.p., 'v'otes lowest c.p., votes highest c.p.('w'), 'r'evolving", &heurdata->scoreparam, TRUE, DEFAULT_SCOREPARAM, "lvdhwr", NULL, NULL) ); return SCIP_OKAY; }
/** creates the rootsoldiving heuristic and includes it in SCIP */ SCIP_RETCODE SCIPincludeHeurRootsoldiving( SCIP* scip /**< SCIP data structure */ ) { SCIP_HEURDATA* heurdata; SCIP_HEUR* heur; /* create Rootsoldiving primal heuristic data */ SCIP_CALL( SCIPallocMemory(scip, &heurdata) ); /* include primal heuristic */ SCIP_CALL( SCIPincludeHeurBasic(scip, &heur, HEUR_NAME, HEUR_DESC, HEUR_DISPCHAR, HEUR_PRIORITY, HEUR_FREQ, HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecRootsoldiving, heurdata) ); assert(heur != NULL); /* set non-NULL pointers to callback methods */ SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyRootsoldiving) ); SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeRootsoldiving) ); SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitRootsoldiving) ); SCIP_CALL( SCIPsetHeurExit(scip, heur, heurExitRootsoldiving) ); /* rootsoldiving heuristic parameters */ SCIP_CALL( SCIPaddRealParam(scip, "heuristics/rootsoldiving/minreldepth", "minimal relative depth to start diving", &heurdata->minreldepth, TRUE, DEFAULT_MINRELDEPTH, 0.0, 1.0, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "heuristics/rootsoldiving/maxreldepth", "maximal relative depth to start diving", &heurdata->maxreldepth, TRUE, DEFAULT_MAXRELDEPTH, 0.0, 1.0, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "heuristics/rootsoldiving/maxlpiterquot", "maximal fraction of diving LP iterations compared to node LP iterations", &heurdata->maxlpiterquot, FALSE, DEFAULT_MAXLPITERQUOT, 0.0, SCIP_REAL_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddIntParam(scip, "heuristics/rootsoldiving/maxlpiterofs", "additional number of allowed LP iterations", &heurdata->maxlpiterofs, FALSE, DEFAULT_MAXLPITEROFS, 0, INT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddIntParam(scip, "heuristics/rootsoldiving/maxsols", "total number of feasible solutions found up to which heuristic is called (-1: no limit)", &heurdata->maxsols, TRUE, DEFAULT_MAXSOLS, -1, INT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "heuristics/rootsoldiving/depthfac", "maximal diving depth: number of binary/integer variables times depthfac", &heurdata->depthfac, TRUE, DEFAULT_DEPTHFAC, 0.0, SCIP_REAL_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "heuristics/rootsoldiving/depthfacnosol", "maximal diving depth factor if no feasible solution was found yet", &heurdata->depthfacnosol, TRUE, DEFAULT_DEPTHFACNOSOL, 0.0, SCIP_REAL_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "heuristics/rootsoldiving/alpha", "soft rounding factor to fade out objective coefficients", &heurdata->alpha, TRUE, DEFAULT_ALPHA, 0.0, 1.0, NULL, NULL) ); return SCIP_OKAY; }
/** creates the zeroobj primal heuristic and includes it in SCIP */ SCIP_RETCODE SCIPincludeHeurZeroobj( SCIP* scip /**< SCIP data structure */ ) { SCIP_HEURDATA* heurdata; SCIP_HEUR* heur; /* create heuristic data */ SCIP_CALL( SCIPallocMemory(scip, &heurdata) ); /* include primal heuristic */ heur = NULL; SCIP_CALL( SCIPincludeHeurBasic(scip, &heur, HEUR_NAME, HEUR_DESC, HEUR_DISPCHAR, HEUR_PRIORITY, HEUR_FREQ, HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecZeroobj, heurdata) ); assert(heur != NULL); /* set non-NULL pointers to callback methods */ SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyZeroobj) ); SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeZeroobj) ); SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitZeroobj) ); /* add zeroobj primal heuristic parameters */ SCIP_CALL( SCIPaddLongintParam(scip, "heuristics/"HEUR_NAME"/maxnodes", "maximum number of nodes to regard in the subproblem", &heurdata->maxnodes, TRUE,DEFAULT_MAXNODES, 0LL, SCIP_LONGINT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddLongintParam(scip, "heuristics/"HEUR_NAME"/nodesofs", "number of nodes added to the contingent of the total nodes", &heurdata->nodesofs, FALSE, DEFAULT_NODESOFS, 0LL, SCIP_LONGINT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddLongintParam(scip, "heuristics/"HEUR_NAME"/minnodes", "minimum number of nodes required to start the subproblem", &heurdata->minnodes, TRUE, DEFAULT_MINNODES, 0LL, SCIP_LONGINT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddLongintParam(scip, "heuristics/"HEUR_NAME"/maxlpiters", "maximum number of LP iterations to be performed in the subproblem", &heurdata->maxlpiters, TRUE, DEFAULT_MAXLPITERS, -1LL, SCIP_LONGINT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "heuristics/"HEUR_NAME"/nodesquot", "contingent of sub problem nodes in relation to the number of nodes of the original problem", &heurdata->nodesquot, FALSE, DEFAULT_NODESQUOT, 0.0, 1.0, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "heuristics/"HEUR_NAME"/minimprove", "factor by which zeroobj should at least improve the incumbent", &heurdata->minimprove, TRUE, DEFAULT_MINIMPROVE, 0.0, 1.0, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/"HEUR_NAME"/addallsols", "should all subproblem solutions be added to the original SCIP?", &heurdata->addallsols, TRUE, DEFAULT_ADDALLSOLS, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/"HEUR_NAME"/onlywithoutsol", "should heuristic only be executed if no primal solution was found, yet?", &heurdata->onlywithoutsol, TRUE, DEFAULT_ONLYWITHOUTSOL, NULL, NULL) ); return SCIP_OKAY; }
/** creates the guideddiving heuristic and includes it in SCIP */ SCIP_RETCODE SCIPincludeHeurGuideddiving( SCIP* scip /**< SCIP data structure */ ) { SCIP_HEURDATA* heurdata; SCIP_HEUR* heur; /* create Guideddiving primal heuristic data */ SCIP_CALL( SCIPallocMemory(scip, &heurdata) ); /* include primal heuristic */ SCIP_CALL( SCIPincludeHeurBasic(scip, &heur, HEUR_NAME, HEUR_DESC, HEUR_DISPCHAR, HEUR_PRIORITY, HEUR_FREQ, HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecGuideddiving, heurdata) ); assert(heur != NULL); /* set non-NULL pointers to callback methods */ SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyGuideddiving) ); SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeGuideddiving) ); SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitGuideddiving) ); SCIP_CALL( SCIPsetHeurExit(scip, heur, heurExitGuideddiving) ); /* guideddiving heuristic parameters */ SCIP_CALL( SCIPaddRealParam(scip, "heuristics/guideddiving/minreldepth", "minimal relative depth to start diving", &heurdata->minreldepth, TRUE, DEFAULT_MINRELDEPTH, 0.0, 1.0, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "heuristics/guideddiving/maxreldepth", "maximal relative depth to start diving", &heurdata->maxreldepth, TRUE, DEFAULT_MAXRELDEPTH, 0.0, 1.0, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "heuristics/guideddiving/maxlpiterquot", "maximal fraction of diving LP iterations compared to node LP iterations", &heurdata->maxlpiterquot, FALSE, DEFAULT_MAXLPITERQUOT, 0.0, SCIP_REAL_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddIntParam(scip, "heuristics/guideddiving/maxlpiterofs", "additional number of allowed LP iterations", &heurdata->maxlpiterofs, FALSE, DEFAULT_MAXLPITEROFS, 0, INT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "heuristics/guideddiving/maxdiveubquot", "maximal quotient (curlowerbound - lowerbound)/(cutoffbound - lowerbound) where diving is performed (0.0: no limit)", &heurdata->maxdiveubquot, TRUE, DEFAULT_MAXDIVEUBQUOT, 0.0, 1.0, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "heuristics/guideddiving/maxdiveavgquot", "maximal quotient (curlowerbound - lowerbound)/(avglowerbound - lowerbound) where diving is performed (0.0: no limit)", &heurdata->maxdiveavgquot, TRUE, DEFAULT_MAXDIVEAVGQUOT, 0.0, SCIP_REAL_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/guideddiving/backtrack", "use one level of backtracking if infeasibility is encountered?", &heurdata->backtrack, FALSE, DEFAULT_BACKTRACK, NULL, NULL) ); return SCIP_OKAY; }
/** creates the trivial primal heuristic and includes it in SCIP */ SCIP_RETCODE SCIPincludeHeurTrivial( SCIP* scip /**< SCIP data structure */ ) { SCIP_HEUR* heur; /* include primal heuristic */ SCIP_CALL( SCIPincludeHeurBasic(scip, &heur, HEUR_NAME, HEUR_DESC, HEUR_DISPCHAR, HEUR_PRIORITY, HEUR_FREQ, HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecTrivial, NULL) ); assert(heur != NULL); /* set non-NULL pointers to callback methods */ SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyTrivial) ); return SCIP_OKAY; }
/** creates the oneopt primal heuristic and includes it in SCIP */ SCIP_RETCODE SCIPincludeHeurOneopt( SCIP* scip /**< SCIP data structure */ ) { SCIP_HEURDATA* heurdata; SCIP_HEUR* heur; /* create Oneopt primal heuristic data */ SCIP_CALL( SCIPallocMemory(scip, &heurdata) ); /* include primal heuristic */ SCIP_CALL( SCIPincludeHeurBasic(scip, &heur, HEUR_NAME, HEUR_DESC, HEUR_DISPCHAR, HEUR_PRIORITY, HEUR_FREQ, HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecOneopt, heurdata) ); assert(heur != NULL); /* set non-NULL pointers to callback methods */ SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyOneopt) ); SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeOneopt) ); SCIP_CALL( SCIPsetHeurInitsol(scip, heur, heurInitsolOneopt) ); SCIP_CALL( SCIPsetHeurExitsol(scip, heur, heurExitsolOneopt) ); SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitOneopt) ); /* add oneopt primal heuristic parameters */ SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/oneopt/weightedobj", "should the objective be weighted with the potential shifting value when sorting the shifting candidates?", &heurdata->weightedobj, TRUE, DEFAULT_WEIGHTEDOBJ, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/oneopt/duringroot", "should the heuristic be called before and during the root node?", &heurdata->duringroot, TRUE, DEFAULT_DURINGROOT, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/oneopt/forcelpconstruction", "should the construction of the LP be forced even if LP solving is deactivated?", &heurdata->forcelpconstruction, TRUE, DEFAULT_FORCELPCONSTRUCTION, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/oneopt/beforepresol", "should the heuristic be called before presolving?", &heurdata->beforepresol, TRUE, DEFAULT_BEFOREPRESOL, NULL, NULL) ); return SCIP_OKAY; }
/** creates the zirounding primal heuristic and includes it in SCIP */ SCIP_RETCODE SCIPincludeHeurZirounding( SCIP* scip /**< SCIP data structure */ ) { SCIP_HEURDATA* heurdata; SCIP_HEUR* heur; /* create zirounding primal heuristic data */ SCIP_CALL( SCIPallocMemory(scip, &heurdata) ); /* include primal heuristic */ SCIP_CALL( SCIPincludeHeurBasic(scip, &heur, HEUR_NAME, HEUR_DESC, HEUR_DISPCHAR, HEUR_PRIORITY, HEUR_FREQ, HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecZirounding, heurdata) ); assert(heur != NULL); /* set non-NULL pointers to callback methods */ SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyZirounding) ); SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeZirounding) ); SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitZirounding) ); SCIP_CALL( SCIPsetHeurExit(scip, heur, heurExitZirounding) ); SCIP_CALL( SCIPsetHeurInitsol(scip, heur, heurInitsolZirounding) ); /* add zirounding primal heuristic parameters */ SCIP_CALL( SCIPaddIntParam(scip, "heuristics/zirounding/maxroundingloops", "determines maximum number of rounding loops", &heurdata->maxroundingloops, TRUE, DEFAULT_MAXROUNDINGLOOPS, -1, INT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/zirounding/stopziround", "flag to determine if Zirounding is deactivated after a certain percentage of unsuccessful calls", &heurdata->stopziround, TRUE, DEFAULT_STOPZIROUND, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip,"heuristics/zirounding/stoppercentage", "if percentage of found solutions falls below this parameter, Zirounding will be deactivated", &heurdata->stoppercentage, TRUE, DEFAULT_STOPPERCENTAGE, 0.0, 1.0, NULL, NULL) ); SCIP_CALL( SCIPaddIntParam(scip, "heuristics/zirounding/minstopncalls", "determines the minimum number of calls before percentage-based deactivation of Zirounding is applied", &heurdata->minstopncalls, TRUE, DEFAULT_MINSTOPNCALLS, 1, INT_MAX, NULL, NULL) ); return SCIP_OKAY; }
/** creates the indicator primal heuristic and includes it in SCIP */ SCIP_RETCODE SCIPincludeHeurIndicator( SCIP* scip /**< SCIP data structure */ ) { SCIP_HEURDATA* heurdata; SCIP_HEUR* heur; /* create Indicator primal heuristic data */ SCIP_CALL( SCIPallocMemory(scip, &heurdata) ); heurdata->nindconss = 0; heurdata->indconss = NULL; heurdata->solcand = NULL; heurdata->lastsol = NULL; heurdata->indicatorconshdlr = NULL; /* include primal heuristic */ SCIP_CALL( SCIPincludeHeurBasic(scip, &heur, HEUR_NAME, HEUR_DESC, HEUR_DISPCHAR, HEUR_PRIORITY, HEUR_FREQ, HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecIndicator, heurdata) ); assert( heur != NULL ); /* set non-NULL pointers to callback methods */ SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyIndicator) ); SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitIndicator) ); SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeIndicator) ); /* add parameters */ SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/oneopt", "whether the one-opt heuristic should be started", &heurdata->oneopt, TRUE, DEFAULT_ONEOPT, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/improvesols", "Try to improve other solutions by one-opt?", &heurdata->improvesols, TRUE, DEFAULT_IMPROVESOLS, NULL, NULL) ); return SCIP_OKAY; }
/** creates the rand rounding heuristic and includes it in SCIP */ SCIP_RETCODE SCIPincludeHeurRandrounding( SCIP* scip /**< SCIP data structure */ ) { SCIP_HEURDATA* heurdata; SCIP_HEUR* heur; /* create heuristic data */ SCIP_CALL( SCIPallocMemory(scip, &heurdata) ); /* include primal heuristic */ SCIP_CALL( SCIPincludeHeurBasic(scip, &heur, HEUR_NAME, HEUR_DESC, HEUR_DISPCHAR, HEUR_PRIORITY, HEUR_FREQ, HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecRandrounding, heurdata) ); assert(heur != NULL); /* set non-NULL pointers to callback methods */ SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyRandrounding) ); SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitRandrounding) ); SCIP_CALL( SCIPsetHeurExit(scip, heur, heurExitRandrounding) ); SCIP_CALL( SCIPsetHeurInitsol(scip, heur, heurInitsolRandrounding) ); SCIP_CALL( SCIPsetHeurExitsol(scip, heur, heurExitsolRandrounding) ); SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeRandrounding) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/oncepernode", "should the heuristic only be called once per node?", &heurdata->oncepernode, TRUE, DEFAULT_ONCEPERNODE, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/usesimplerounding", "should the heuristic apply the variable lock strategy of simple rounding, if possible?", &heurdata->usesimplerounding, TRUE, DEFAULT_USESIMPLEROUNDING, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/propagateonlyroot", "should the probing part of the heuristic be applied exclusively at the root node?", &heurdata->propagateonlyroot, TRUE, DEFAULT_PROPAGATEONLYROOT, NULL, NULL) ); SCIP_CALL( SCIPaddIntParam(scip, "heuristics/" HEUR_NAME "/maxproprounds", "limit of rounds for each propagation call", &heurdata->maxproprounds, TRUE, DEFAULT_MAXPROPROUNDS, -1, INT_MAX, NULL, NULL) ); return SCIP_OKAY; }
/** creates the rounding heuristic with infeasibility recovering and includes it in SCIP */ SCIP_RETCODE SCIPincludeHeurRounding( SCIP* scip /**< SCIP data structure */ ) { SCIP_HEURDATA* heurdata; SCIP_HEUR* heur; /* create Rounding primal heuristic data */ SCIP_CALL( SCIPallocMemory(scip, &heurdata) ); /* include primal heuristic */ SCIP_CALL( SCIPincludeHeurBasic(scip, &heur, HEUR_NAME, HEUR_DESC, HEUR_DISPCHAR, HEUR_PRIORITY, HEUR_FREQ, HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecRounding, heurdata) ); assert(heur != NULL); /* set non-NULL pointers to callback methods */ SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyRounding) ); SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeRounding) ); SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitRounding) ); SCIP_CALL( SCIPsetHeurExit(scip, heur, heurExitRounding) ); SCIP_CALL( SCIPsetHeurInitsol(scip, heur, heurInitsolRounding) ); SCIP_CALL( SCIPsetHeurExitsol(scip, heur, heurExitsolRounding) ); /* add rounding primal heuristic parameters */ SCIP_CALL( SCIPaddIntParam(scip, "heuristics/"HEUR_NAME"/successfactor", "number of calls per found solution that are considered as standard success, a higher factor causes the heuristic to be called more often", &heurdata->successfactor, TRUE, DEFAULT_SUCCESSFACTOR, -1, INT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/"HEUR_NAME"/oncepernode", "should the heuristic only be called once per node?", &heurdata->oncepernode, TRUE, DEFAULT_ONCEPERNODE, NULL, NULL) ); return SCIP_OKAY; }
/** creates the localbranching primal heuristic and includes it in SCIP */ SCIP_RETCODE SCIPincludeHeurLocalbranching( SCIP* scip /**< SCIP data structure */ ) { SCIP_HEURDATA* heurdata; SCIP_HEUR* heur; /* create Localbranching primal heuristic data */ SCIP_CALL( SCIPallocMemory(scip, &heurdata) ); /* include primal heuristic */ SCIP_CALL( SCIPincludeHeurBasic(scip, &heur, HEUR_NAME, HEUR_DESC, HEUR_DISPCHAR, HEUR_PRIORITY, HEUR_FREQ, HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecLocalbranching, heurdata) ); assert(heur != NULL); /* set non-NULL pointers to callback methods */ SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyLocalbranching) ); SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeLocalbranching) ); SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitLocalbranching) ); /* add localbranching primal heuristic parameters */ SCIP_CALL( SCIPaddIntParam(scip, "heuristics/"HEUR_NAME"/nodesofs", "number of nodes added to the contingent of the total nodes", &heurdata->nodesofs, FALSE, DEFAULT_NODESOFS, 0, INT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddIntParam(scip, "heuristics/"HEUR_NAME"/neighborhoodsize", "radius (using Manhattan metric) of the incumbent's neighborhood to be searched", &heurdata->neighborhoodsize, FALSE, DEFAULT_NEIGHBORHOODSIZE, 1, INT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "heuristics/"HEUR_NAME"/nodesquot", "contingent of sub problem nodes in relation to the number of nodes of the original problem", &heurdata->nodesquot, FALSE, DEFAULT_NODESQUOT, 0.0, 1.0, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "heuristics/"HEUR_NAME"/lplimfac", "factor by which the limit on the number of LP depends on the node limit", &heurdata->lplimfac, TRUE, DEFAULT_LPLIMFAC, 1.0, SCIP_REAL_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddIntParam(scip, "heuristics/"HEUR_NAME"/minnodes", "minimum number of nodes required to start the subproblem", &heurdata->minnodes, TRUE, DEFAULT_MINNODES, 0, INT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddIntParam(scip, "heuristics/"HEUR_NAME"/maxnodes", "maximum number of nodes to regard in the subproblem", &heurdata->maxnodes, TRUE, DEFAULT_MAXNODES, 0, INT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddIntParam(scip, "heuristics/"HEUR_NAME"/nwaitingnodes", "number of nodes without incumbent change that heuristic should wait", &heurdata->nwaitingnodes, TRUE, DEFAULT_NWAITINGNODES, 0, INT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "heuristics/"HEUR_NAME"/minimprove", "factor by which localbranching should at least improve the incumbent", &heurdata->minimprove, TRUE, DEFAULT_MINIMPROVE, 0.0, 1.0, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/"HEUR_NAME"/uselprows", "should subproblem be created out of the rows in the LP rows?", &heurdata->uselprows, TRUE, DEFAULT_USELPROWS, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/"HEUR_NAME"/copycuts", "if uselprows == FALSE, should all active cuts from cutpool be copied to constraints in subproblem?", &heurdata->copycuts, TRUE, DEFAULT_COPYCUTS, NULL, NULL) ); return SCIP_OKAY; }
/** creates the crossover primal heuristic and includes it in SCIP */ SCIP_RETCODE SCIPincludeHeurCrossover( SCIP* scip /**< SCIP data structure */ ) { SCIP_HEURDATA* heurdata; SCIP_HEUR* heur; /* create Crossover primal heuristic data */ SCIP_CALL( SCIPallocMemory(scip, &heurdata) ); /* include primal heuristic */ SCIP_CALL( SCIPincludeHeurBasic(scip, &heur, HEUR_NAME, HEUR_DESC, HEUR_DISPCHAR, HEUR_PRIORITY, HEUR_FREQ, HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecCrossover, heurdata) ); assert(heur != NULL); /* set non-NULL pointers to callback methods */ SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyCrossover) ); SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeCrossover) ); SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitCrossover) ); SCIP_CALL( SCIPsetHeurExit(scip, heur, heurExitCrossover) ); /* add crossover primal heuristic parameters */ SCIP_CALL( SCIPaddLongintParam(scip, "heuristics/"HEUR_NAME"/nodesofs", "number of nodes added to the contingent of the total nodes", &heurdata->nodesofs, FALSE, DEFAULT_NODESOFS, 0LL, SCIP_LONGINT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddLongintParam(scip, "heuristics/"HEUR_NAME"/maxnodes", "maximum number of nodes to regard in the subproblem", &heurdata->maxnodes, TRUE, DEFAULT_MAXNODES, 0LL, SCIP_LONGINT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddLongintParam(scip, "heuristics/"HEUR_NAME"/minnodes", "minimum number of nodes required to start the subproblem", &heurdata->minnodes, TRUE, DEFAULT_MINNODES, 0LL, SCIP_LONGINT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddIntParam(scip, "heuristics/"HEUR_NAME"/nusedsols", "number of solutions to be taken into account", &heurdata->nusedsols, FALSE, DEFAULT_NUSEDSOLS, 2, INT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddLongintParam(scip, "heuristics/"HEUR_NAME"/nwaitingnodes", "number of nodes without incumbent change that heuristic should wait", &heurdata->nwaitingnodes, TRUE, DEFAULT_NWAITINGNODES, 0LL, SCIP_LONGINT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "heuristics/"HEUR_NAME"/nodesquot", "contingent of sub problem nodes in relation to the number of nodes of the original problem", &heurdata->nodesquot, FALSE, DEFAULT_NODESQUOT, 0.0, 1.0, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "heuristics/"HEUR_NAME"/minfixingrate", "minimum percentage of integer variables that have to be fixed", &heurdata->minfixingrate, FALSE, DEFAULT_MINFIXINGRATE, 0.0, 1.0, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "heuristics/"HEUR_NAME"/minimprove", "factor by which Crossover should at least improve the incumbent", &heurdata->minimprove, TRUE, DEFAULT_MINIMPROVE, 0.0, 1.0, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/"HEUR_NAME"/randomization", "should the choice which sols to take be randomized?", &heurdata->randomization, TRUE, DEFAULT_RANDOMIZATION, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/"HEUR_NAME"/dontwaitatroot", "should the nwaitingnodes parameter be ignored at the root node?", &heurdata->dontwaitatroot, TRUE, DEFAULT_DONTWAITATROOT, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/"HEUR_NAME"/uselprows", "should subproblem be created out of the rows in the LP rows?", &heurdata->uselprows, TRUE, DEFAULT_USELPROWS, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/"HEUR_NAME"/copycuts", "if uselprows == FALSE, should all active cuts from cutpool be copied to constraints in subproblem?", &heurdata->copycuts, TRUE, DEFAULT_COPYCUTS, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/"HEUR_NAME"/permute", "should the subproblem be permuted to increase diversification?", &heurdata->permute, TRUE, DEFAULT_PERMUTE, NULL, NULL) ); return SCIP_OKAY; }
/** creates the mutation primal heuristic and includes it in SCIP */ SCIP_RETCODE SCIPincludeHeurMutation( SCIP* scip /**< SCIP data structure */ ) { SCIP_HEURDATA* heurdata; SCIP_HEUR* heur; /* create Mutation primal heuristic data */ SCIP_CALL( SCIPallocMemory(scip, &heurdata) ); /* include primal heuristic */ SCIP_CALL( SCIPincludeHeurBasic(scip, &heur, HEUR_NAME, HEUR_DESC, HEUR_DISPCHAR, HEUR_PRIORITY, HEUR_FREQ, HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecMutation, heurdata) ); assert(heur != NULL); /* set non-NULL pointers to callback methods */ SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyMutation) ); SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeMutation) ); SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitMutation) ); /* add mutation primal heuristic parameters */ SCIP_CALL( SCIPaddIntParam(scip, "heuristics/"HEUR_NAME"/nodesofs", "number of nodes added to the contingent of the total nodes", &heurdata->nodesofs, FALSE, DEFAULT_NODESOFS, 0, INT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddIntParam(scip, "heuristics/"HEUR_NAME"/maxnodes", "maximum number of nodes to regard in the subproblem", &heurdata->maxnodes, TRUE, DEFAULT_MAXNODES, 0, INT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddIntParam(scip, "heuristics/"HEUR_NAME"/minnodes", "minimum number of nodes required to start the subproblem", &heurdata->minnodes, TRUE, DEFAULT_MINNODES, 0, INT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddIntParam(scip, "heuristics/"HEUR_NAME"/nwaitingnodes", "number of nodes without incumbent change that heuristic should wait", &heurdata->nwaitingnodes, TRUE, DEFAULT_NWAITINGNODES, 0, INT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "heuristics/"HEUR_NAME"/nodesquot", "contingent of sub problem nodes in relation to the number of nodes of the original problem", &heurdata->nodesquot, FALSE, DEFAULT_NODESQUOT, 0.0, 1.0, NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "heuristics/"HEUR_NAME"/minfixingrate", "percentage of integer variables that have to be fixed", &heurdata->minfixingrate, FALSE, DEFAULT_MINFIXINGRATE, SCIPsumepsilon(scip), 1.0-SCIPsumepsilon(scip), NULL, NULL) ); SCIP_CALL( SCIPaddRealParam(scip, "heuristics/"HEUR_NAME"/minimprove", "factor by which "HEUR_NAME" should at least improve the incumbent", &heurdata->minimprove, TRUE, DEFAULT_MINIMPROVE, 0.0, 1.0, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/"HEUR_NAME"/uselprows", "should subproblem be created out of the rows in the LP rows?", &heurdata->uselprows, TRUE, DEFAULT_USELPROWS, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/"HEUR_NAME"/copycuts", "if uselprows == FALSE, should all active cuts from cutpool be copied to constraints in subproblem?", &heurdata->copycuts, TRUE, DEFAULT_COPYCUTS, NULL, NULL) ); return SCIP_OKAY; }
/** creates the octane primal heuristic and includes it in SCIP */ SCIP_RETCODE SCIPincludeHeurOctane( SCIP* scip /**< SCIP data structure */ ) { SCIP_HEURDATA* heurdata; SCIP_HEUR* heur; /* create Octane primal heuristic data */ SCIP_CALL( SCIPallocMemory(scip, &heurdata) ); /* include primal heuristic */ SCIP_CALL( SCIPincludeHeurBasic(scip, &heur, HEUR_NAME, HEUR_DESC, HEUR_DISPCHAR, HEUR_PRIORITY, HEUR_FREQ, HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecOctane, heurdata) ); assert(heur != NULL); /* set non-NULL pointers to callback methods */ SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyOctane) ); SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeOctane) ); SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitOctane) ); SCIP_CALL( SCIPsetHeurExit(scip, heur, heurExitOctane) ); /* add octane primal heuristic parameters */ SCIP_CALL( SCIPaddIntParam(scip, "heuristics/octane/fmax", "number of 0-1-points to be tested as possible solutions by OCTANE", &heurdata->f_max, TRUE, DEFAULT_FMAX, 1, INT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddIntParam(scip, "heuristics/octane/ffirst", "number of 0-1-points to be tested at first whether they violate a common row", &heurdata->f_first, TRUE, DEFAULT_FFIRST, 1, INT_MAX, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/octane/usefracspace", "execute OCTANE only in the space of fractional variables (TRUE) or in the full space?", &heurdata->usefracspace, TRUE, DEFAULT_USEFRACSPACE, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/octane/useobjray", "should the inner normal of the objective be used as one ray direction?", &heurdata->useobjray, TRUE, TRUE, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/octane/useavgray", "should the average of the basic cone be used as one ray direction?", &heurdata->useavgray, TRUE, TRUE, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/octane/usediffray", "should the difference between the root solution and the current LP solution be used as one ray direction?", &heurdata->usediffray, TRUE, FALSE, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/octane/useavgwgtray", "should the weighted average of the basic cone be used as one ray direction?", &heurdata->useavgwgtray, TRUE, TRUE, NULL, NULL) ); SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/octane/useavgnbray", "should the weighted average of the nonbasic cone be used as one ray direction?", &heurdata->useavgnbray, TRUE, TRUE, NULL, NULL) ); return SCIP_OKAY; }