43 #define HEUR_NAME "dualval" 44 #define HEUR_DESC "primal heuristic using dual values" 45 #define HEUR_DISPCHAR 'Y' 46 #define HEUR_PRIORITY 0 48 #define HEUR_FREQOFS 0 49 #define HEUR_MAXDEPTH -1 50 #define HEUR_TIMING SCIP_HEURTIMING_AFTERNODE 51 #define HEUR_USESSUBSCIP TRUE 53 #define EVENTHDLR_NAME "lpsol_dualval" 54 #define EVENTHDLR_DESC "event handler for lp solution found" 58 #define DEFAULT_FORCEIMPROVEMENTS FALSE 59 #define DEFAULT_ONLYCHEAPER TRUE 60 #define DEFAULT_ONLYLEAVES FALSE 61 #define DEFAULT_RELAXINDICATORS FALSE 62 #define DEFAULT_RELAXCONTVARS FALSE 65 #define DEFAULT_HEURVERBLEVEL 0 66 #define DEFAULT_NLPVERBLEVEL 0 67 #define DEFAULT_RANKVALUE 10 68 #define DEFAULT_MAXCALLS 25 69 #define DEFAULT_DYNAMICDEPTH 0 70 #define DEFAULT_MAXEQUALRANKS 50 73 #define DEFAULT_MINGAP 5.0 74 #define DEFAULT_LAMBDASLACK 1.0 75 #define DEFAULT_LAMBDAOBJ 0.0 110 int nonimprovingRounds;
138 assert(eventhdlr !=
NULL);
151 assert(eventhdlr !=
NULL);
169 assert(eventhdlr !=
NULL);
170 assert(event !=
NULL);
179 for( i = 0; i < nsubconss; i++ )
182 if( dualval !=
NULL )
188 for( i = 0; i < nsubconss; i++ )
193 if( transcons ==
NULL )
203 if( heurdata->heurverblevel > 2 )
223 assert(eventhdlr !=
NULL);
246 assert(scip !=
NULL);
247 assert(hashmap !=
NULL);
251 for( i = 0; i < nentries; ++i )
288 assert(scip !=
NULL);
289 assert(hashmap !=
NULL);
293 for( i = 0; i < nentries; ++i )
329 assert(scip !=
NULL);
330 assert(conshdlr !=
NULL);
338 for( i = 0; i < nconss; ++i )
356 if( !addcombconss || !addcontconss )
358 iscombinatorial =
TRUE;
360 for( j = 0; j < nvars; ++j )
364 iscombinatorial =
FALSE;
370 if( (iscombinatorial && !addcombconss) || (!iscombinatorial && !addcontconss) )
406 assert(scip !=
NULL);
407 assert(conshdlr !=
NULL);
415 for( i = 0; i < nconss; ++i )
427 if( (iscombinatorial && !addcombconss) || (!iscombinatorial && !addcontconss) )
464 assert(scip !=
NULL);
465 assert(conshdlr !=
NULL);
476 for( i = 0; i < nconss; ++i )
484 if( coefssize < nvars )
494 for( j = coefssize; j < nvars; ++j )
534 assert(scip !=
NULL);
535 assert(conshdlr !=
NULL);
546 for( i = 0; i < nconss; ++i )
554 if( coefssize < nvars )
564 for( j = coefssize; j < nvars; ++j )
625 assert(scip !=
NULL);
626 assert(conshdlr !=
NULL);
633 assert(conss !=
NULL);
638 for( i = 0; i < nconss; ++i )
648 if( coefssize < nvars )
662 for( j = 0; j < nvars; ++j )
694 if( conshdlr !=
NULL )
701 if( conshdlr !=
NULL )
710 if( conshdlr !=
NULL )
717 if( conshdlr !=
NULL )
724 if( conshdlr !=
NULL )
757 assert( heurdata !=
NULL );
768 for( i = 0; i < nvars; ++i )
784 SCIPdebugMsg(scip,
"return14 : abort building solution since a variable was not in our list\n");
802 assert(subvar !=
NULL);
807 transval = tscalar * transval + tconstant;
809 val = scalar * transval + constant;
814 val = scalar * val + constant;
877 assert( heurdata !=
NULL );
878 assert( heurdata->subscip ==
NULL );
880 heurdata->usedcalls = 0;
881 heurdata->solfound =
FALSE;
882 heurdata->nonimprovingRounds = 0;
900 for (i = 0; i < nconss; i++ )
905 if( currentconshdlr == conshdlrindi ||
906 currentconshdlr == conshdlrabspow ||
907 currentconshdlr == conshdlrquad ||
908 currentconshdlr == conshdlrnonlin ||
909 currentconshdlr == conshdlrvarbound ||
910 currentconshdlr == conshdlrknapsack ||
911 currentconshdlr == conshdlrlogicor ||
912 currentconshdlr == conshdlrsetppc ||
913 currentconshdlr == conshdlrlin ||
914 currentconshdlr == conshdlrsignpower)
926 if( heurdata->dynamicdepth == 1 )
928 heurdata->maxcalls = (int)
SCIPfloor(scip,
sqrt((
double)(nvars - ncontvars)));
931 heurdata->triedsetupsubscip =
TRUE;
945 FALSE,
FALSE,
TRUE,
FALSE,
TRUE,
TRUE,
FALSE,
TRUE,
FALSE,
TRUE,
FALSE, &success) );
947 if( success ==
FALSE )
949 SCIPdebugMsg(scip,
"In heur_dualval: failed to copy some plugins to sub-SCIP, continue anyway\n");
976 for( i = 0; i < nconss; ++i )
982 assert( subcons !=
NULL );
990 if( !heurdata->subscipisvalid )
992 SCIPdebugMsg(scip,
"In heur_dualval: failed to copy some constraints to sub-SCIP, continue anyway\n");
996 heurdata->nvars = nvars;
1048 for( i = 0; i < nconsindicator; i++ )
1053 currcons = indicatorconss[i];
1054 assert(currcons !=
NULL);
1074 heurdata->integervarssize = nvars;
1078 for( i = 0; i < nvars; ++i )
1081 assert( var !=
NULL );
1089 heurdata->integervars[j++] = vars[i];
1092 assert( var !=
NULL );
1098 for( k = 0; k < nconsindicator; k++ )
1105 currcons = indicatorconss[k];
1106 assert(currcons !=
NULL);
1109 assert(indicatorbinvar !=
NULL);
1113 if( indicatorbinvar ==
SCIPhashmapGetImage(heurdata->varsubsciptoscip, var) || indicatorbinvar == negatedvar )
1118 assert(indicatorbinvar == negatedvar);
1123 assert(indicatorbinvar != negatedvar);
1127 varobjective = heurdata->lambdaobj *
REALABS(varobjective);
1129 indicons = currcons;
1130 assert( indicons !=
NULL );
1134 assert( indicons !=
NULL );
1148 if( heurdata->relaxindicators )
1163 indicatorbinvar = negatedvar;
1240 assert(imagecons !=
NULL);
1262 if( heurdata->relaxindicators )
1265 for( k = 0; k < nvars; k++ )
1287 for( k = 0; k < nconsindicator; k++ )
1292 currcons = indicatorconss[k];
1293 assert(currcons !=
NULL);
1344 if( heurdata->relaxcontvars )
1346 for( i = 0; i < nvars; ++i )
1349 assert( var !=
NULL );
1364 assert( var !=
NULL );
1413 SCIPinfinity(scip),
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE ) );
1414 heurdata->objbound = cons;
1416 for( i = 0; i < nvars; ++i )
1419 assert( var !=
NULL );
1425 assert( subvar !=
NULL );
1440 if( heurdata->heurverblevel > 3 )
1449 heurdata->nintegervars = j;
1462 assert(scip !=
NULL);
1463 assert(heurdata !=
NULL);
1464 assert(heurdata->subscip !=
NULL);
1466 heurdata->nsubvars = 0;
1467 heurdata->nvars = 0;
1491 assert(scip !=
NULL);
1492 assert(heur !=
NULL);
1493 assert(sol !=
NULL);
1496 assert(heurdata !=
NULL);
1510 for( i = 0; i < nsubvars; ++i )
1512 subvar = subvars[i];
1513 assert(subvar !=
NULL);
1527 #define BIG_VALUE 1E+10 1548 for( i = 0; i < heurdata->nintegervars; i++ )
1550 var = heurdata->integervars[i];
1551 assert(var !=
NULL);
1554 assert(var !=
NULL);
1557 if( subvar ==
NULL )
1565 fixval =
SCIPgetSolVal(scip, refpoint, heurdata->integervars[i]);
1625 if( clearswitchedvars )
1628 for( i = 0; i < heurdata->nintegervars; i++ )
1630 var = heurdata->integervars[i];
1656 if( transsol !=
NULL )
1661 if( beforeswitching )
1670 for( i = nsubbinvars + nsubintvars - 1; i >= 0; --i )
1672 subvar = subvars[i];
1680 assert(var !=
NULL);
1714 for( j = 0; j < heurdata->nintegervars; j++ )
1716 sortedvars[j] = heurdata->integervars[j];
1720 if( sortedvars[j] ==
NULL )
1724 assert(var !=
NULL);
1735 assert(var !=
NULL);
1739 if( relaxcons !=
NULL )
1744 if( dualvalue ==
NULL )
1747 if( dualvalue ==
NULL )
1750 assert(dualvalue !=
NULL);
1751 ranks[j] = (*dualvalue);
1756 assert(ranks[j] == 0.0);
1764 if( dualvalue ==
NULL )
1767 assert(dualvalue !=
NULL);
1769 ranks[j] = (*dualvalue);
1773 for( k = 0; k < nconsindicator; k++ )
1779 currcons = indicatorconss[k];
1780 assert(currcons !=
NULL);
1783 assert(indicatorbinvar !=
NULL);
1788 indicons = currcons;
1789 assert(indicons !=
NULL);
1792 assert(subcons !=
NULL);
1795 assert(subcons !=
NULL);
1799 if( dualvalue ==
NULL )
1802 assert(dualvalue !=
NULL);
1805 ranks[j] = (*dualvalue);
1812 absranks[j] =
REALABS(ranks[j]);
1841 maxslackset =
FALSE;
1846 for( i = 0; i < nsubvars; i++ )
1855 if( heurdata->isnlp )
1866 assert(bestsol !=
NULL);
1867 if( maxslack <
SCIPgetSolVal(heurdata->subscip, bestsol, subvar) )
1869 maxslack =
SCIPgetSolVal(heurdata->subscip, bestsol, subvar);
1883 assert(maxslack >= 0);
1885 if( heurdata->heurverblevel > 0 && maxslackset )
1911 assert(heurdata !=
NULL);
1918 heurdata->solfound =
TRUE;
1921 assert( heurdata->isnlp );
1930 SCIPdebugMsg(scip,
"return10 : turn off heuristic, ipopt error\n");
1932 if( heurdata->heurverblevel > 1 )
1947 if( heurdata->heurverblevel > 0 )
1959 if( stored && heurdata->heurverblevel > 1 )
1962 if( heurdata->isnlp )
1970 heurdata->solfound =
TRUE;
1972 if( heurdata->heurverblevel >= 1 )
1980 heurdata->prevInfeasible =
FALSE;
1981 heurdata->solfound =
TRUE;
1984 if( heurdata->heurverblevel >= 1 )
2030 assert(scip !=
NULL);
2031 assert(heur !=
NULL);
2039 assert(heurdata !=
NULL);
2042 if(
SCIPgetGap(scip) * 100 < heurdata->mingap )
2044 SCIPdebugMsg(scip,
"return13 : gap is less than mingap\n");
2053 if( heurdata->subscip ==
NULL && !heurdata->triedsetupsubscip )
2059 if( heurdata->solfound )
2061 SCIPdebugMsg(scip,
"return1 : already found solution \n");
2068 if( heurdata->subscip ==
NULL )
2074 assert(heurdata->nsubvars > 0);
2075 assert(heurdata->varsubsciptoscip !=
NULL);
2094 SCIPdebugMsg(scip,
"return 4 : subscip is infeasible\n");
2097 heurdata->prevInfeasible =
TRUE;
2108 heurdata->isnlp =
TRUE;
2125 heurdata->isnlp =
FALSE;
2129 if( heurdata->isnlp )
2146 if( subvar ==
NULL )
2148 startpoint[i] = constant;
2161 startpoint[i] = scalar *
SCIPgetSolVal(scip, refpoint, var) + constant;
2186 for( i = 0; i < nsubconss; i++ )
2194 for( i = 0; i < nsubconss; i++ )
2200 if( transcons ==
NULL )
2229 SCIPdebugMsg(scip,
"return4 : the subscip is infeasible\n");
2240 assert(bestsol !=
NULL);
2243 for( i = 0; i < nsubvars; i++ )
2252 if( heurdata->forceimprovements )
2256 heurdata->nonimprovingRounds++;
2257 SCIPdebugMsg(scip,
"nonimpr rounds %d prevobj %f \n", heurdata->nonimprovingRounds, heurdata->prevobjective);
2260 if( heurdata->nonimprovingRounds > heurdata->maxcalls/8 )
2264 if( heurdata->isnlp )
2271 heurdata->solfound =
TRUE;
2272 heurdata->switchdifferent =
TRUE;
2274 SCIPdebugMsg(scip,
"return11 : solution did not improve\n");
2281 heurdata->prevobjective =
SCIPgetSolOrigObj(heurdata->subscip, bestsol) - objvalue;
2285 return storeSolution(scip, heur, result, transsol, bestsol);
2295 if( heurdata->heurverblevel > 1 )
2297 k = heurdata->rankvalue;
2299 if( heurdata->nintegervars < heurdata->rankvalue )
2300 k = heurdata->nintegervars;
2302 for( i = 0; i < k; i++ )
2309 if( heurdata->isnlp )
2313 maxequalranks =
MIN(heurdata->maxequalranks, heurdata->nintegervars/3);
2329 for( k = 0; k < heurdata->nintegervars; ++k )
2331 var = heurdata->integervars[k];
2342 assert(var !=
NULL);
2343 assert(subvar !=
NULL);
2353 for( i = 0; i < heurdata->nintegervars; i++ )
2368 if( heurdata->heurverblevel > 1 )
2409 if( seclastval !=
NULL )
2417 if( heurdata->heurverblevel > 1 )
2424 if( heurdata->usedcalls >= heurdata->maxcalls )
2426 SCIPdebugMsg(scip,
"return5 : reached iteration limit\n");
2433 heurdata->usedcalls++;
2435 if( heurdata->heurverblevel > 1 )
2442 if( *result ==
SCIP_DIDNOTFIND || heurdata->solfound || heurdata->prevInfeasible )
2448 if( heurdata->switchdifferent )
2450 heurdata->switchdifferent =
FALSE;
2451 heurdata->solfound =
FALSE;
2453 heurdata->nonimprovingRounds -= 2;
2456 if( heurdata->prevInfeasible )
2458 heurdata->prevInfeasible =
FALSE;
2459 heurdata->solfound =
FALSE;
2461 heurdata->nonimprovingRounds++;
2469 if( heurdata->subscip ==
NULL )
2473 SCIPdebugMsg(scip,
"return7 : subscip was set NULL\n");
2480 SCIPdebugMsg(scip,
"return8 : cannot switch any variable\n");
2498 assert(heur !=
NULL);
2515 assert(heur !=
NULL);
2524 assert(heurdata !=
NULL);
2525 assert(heurdata->subscip ==
NULL);
2526 assert(!heurdata->triedsetupsubscip);
2532 if( heurdata->subscip ==
NULL )
2555 assert(heur !=
NULL);
2558 assert(heurdata !=
NULL);
2562 if( heurdata->subscip !=
NULL)
2568 for( i = 0; i < nsubconss; i++ )
2576 if( heurdata->varsciptosubscip !=
NULL )
2582 if( heurdata->origsubscipConsMap !=
NULL )
2588 if( heurdata->relaxcons !=
NULL )
2594 if( heurdata->conss2nlrow !=
NULL )
2600 if( heurdata->slack2var !=
NULL )
2606 if( heurdata->indicopymap !=
NULL )
2612 if( heurdata->indicopymapback !=
NULL )
2618 if( heurdata->relaxconsindi !=
NULL )
2624 if( heurdata->slackvarlbMap !=
NULL )
2630 if( heurdata->slackvarubMap !=
NULL )
2637 if( heurdata->subscip !=
NULL )
2643 if( heurdata->varsubsciptoscip !=
NULL )
2649 if( heurdata->slacktoindivarsmap !=
NULL )
2655 if( heurdata->indicators !=
NULL )
2661 if( heurdata->switchedvars !=
NULL )
2665 if( heurdata->switchedvars2 !=
NULL )
2671 heurdata->triedsetupsubscip =
FALSE;
2672 heurdata->usedcalls = 0;
2673 heurdata->solfound =
FALSE;
2674 heurdata->prevInfeasible =
FALSE;
2676 assert(heurdata->subscip ==
NULL);
2677 assert(heurdata->varsubsciptoscip ==
NULL);
2678 assert(heurdata->varsciptosubscip ==
NULL);
2690 assert(heur !=
NULL);
2697 assert(heurdata !=
NULL);
2700 if( heurdata->subscip ==
NULL )
2716 assert(heur !=
NULL);
2731 assert(heur !=
NULL);
2732 assert(result !=
NULL);
2736 assert(heurdata !=
NULL);
2742 heurdata->usedcalls = 0;
2743 heurdata->prevInfeasible =
FALSE;
2744 heurdata->solfound =
FALSE;
2745 heurdata->nonimprovingRounds = 0;
2746 heurdata->prevobjective = INT_MAX;
2784 assert(heur !=
NULL);
2794 "exit if objective doesn't improve",
2798 "add constraint to ensure that discrete vars are improving",
2802 "disable the heuristic if it was not called at a leaf of the B&B tree",
2806 "relax the indicator variables by introducing continuous copies",
2810 "relax the continous variables",
2814 "verblevel of the heuristic, default is 0 to display nothing",
2818 "verblevel of the nlp solver, can be 0 or 1",
2822 "number of ranks that should be displayed when the heuristic is called",
2826 "maximal number of recursive calls of the heuristic (if dynamicdepth is off)",
2830 "says if and how the recursion depth is computed at runtime",
2834 "maximal number of variables that may have maximal rank, quit if there are more, turn off by setting -1",
2838 "minimal gap for which we still run the heuristic, if gap is less we return without doing anything",
2842 "value added to objective of slack variables, must not be zero",
2846 "scaling factor for the objective function",
enum SCIP_Result SCIP_RESULT
SCIP_RETCODE SCIPsetHeurExitsol(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEUREXITSOL((*heurexitsol)))
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
#define SCIP_HEURTIMING_DURINGLPLOOP
static SCIP_DECL_EVENTEXIT(eventExitLPsol)
void * SCIPhashmapEntryGetImage(SCIP_HASHMAPENTRY *entry)
SCIP_RETCODE SCIPchgVarLbGlobal(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
static SCIP_DECL_EVENTINIT(eventInitLPsol)
#define SCIP_EVENTTYPE_LPSOLVED
SCIP_Bool SCIPconsIsEnabled(SCIP_CONS *cons)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
SCIP_Bool SCIPisNLPConstructed(SCIP *scip)
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_VAR ** SCIPgetNLPVars(SCIP *scip)
SCIP_STAGE SCIPgetStage(SCIP *scip)
methods to interpret (evaluate) an expression tree "fast"
SCIP_Bool SCIPconsIsDynamic(SCIP_CONS *cons)
Constraint handler for variable bound constraints .
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
int SCIPgetNVarsSetppc(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
int SCIPgetNVarsLogicor(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateProb(SCIP *scip, const char *name, SCIP_DECL_PROBDELORIG((*probdelorig)), SCIP_DECL_PROBTRANS((*probtrans)), SCIP_DECL_PROBDELTRANS((*probdeltrans)), SCIP_DECL_PROBINITSOL((*probinitsol)), SCIP_DECL_PROBEXITSOL((*probexitsol)), SCIP_DECL_PROBCOPY((*probcopy)), SCIP_PROBDATA *probdata)
SCIP_RETCODE SCIPsetEventhdlrExit(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTEXIT((*eventexit)))
SCIP_RETCODE SCIPdelCons(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPsetHeurExit(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEUREXIT((*heurexit)))
int SCIPgetNOrigVars(SCIP *scip)
SCIP_RETCODE SCIPapplyHeurDualval(SCIP *scip, SCIP_HEUR *heur, SCIP_RESULT *result, SCIP_SOL *refpoint)
int SCIPgetNPseudoBranchCands(SCIP *scip)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
internal methods for NLPI solver interfaces
SCIP_RETCODE SCIPincludeEventhdlrBasic(SCIP *scip, SCIP_EVENTHDLR **eventhdlrptr, const char *name, const char *desc, SCIP_DECL_EVENTEXEC((*eventexec)), SCIP_EVENTHDLRDATA *eventhdlrdata)
SCIP_NLPSOLSTAT SCIPgetNLPSolstat(SCIP *scip)
void * SCIPhashmapEntryGetOrigin(SCIP_HASHMAPENTRY *entry)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
struct SCIP_EventhdlrData SCIP_EVENTHDLRDATA
methods to store an NLP and request function, gradient, and hessian values
constraint handler for indicator constraints
#define DEFAULT_LAMBDASLACK
SCIP_RETCODE SCIPgetVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
#define DEFAULT_NLPVERBLEVEL
SCIP_Real SCIPinfinity(SCIP *scip)
int SCIPsnprintf(char *t, int len, const char *s,...)
enum SCIP_Retcode SCIP_RETCODE
SCIP_RETCODE SCIPsolveNLP(SCIP *scip)
SCIP_Bool SCIPconsIsStickingAtNode(SCIP_CONS *cons)
int SCIPheurGetFreqofs(SCIP_HEUR *heur)
int SCIPvarGetProbindex(SCIP_VAR *var)
SCIP_VAR ** SCIPgetOrigVars(SCIP *scip)
static SCIP_DECL_HEUREXITSOL(heurExitsolDualval)
static SCIP_DECL_EVENTEXEC(eventExecLPsol)
struct SCIP_HeurData SCIP_HEURDATA
static SCIP_RETCODE storeSolution(SCIP *scip, SCIP_HEUR *heur, SCIP_RESULT *result, SCIP_SOL *transsol, SCIP_SOL *bestsol)
#define SCIPfreeBlockMemory(scip, ptr)
SCIP_VAR ** SCIPgetVarsKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPincludeHeurBasic(SCIP *scip, SCIP_HEUR **heur, const char *name, const char *desc, char dispchar, int priority, int freq, int freqofs, int maxdepth, SCIP_HEURTIMING timingmask, SCIP_Bool usessubscip, SCIP_DECL_HEUREXEC((*heurexec)), SCIP_HEURDATA *heurdata)
SCIP_RETCODE SCIPgetOrigVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
static SCIP_RETCODE addLinearConstraints(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_Bool addcombconss, SCIP_Bool addcontconss, SCIP_HEURDATA *heurdata)
SCIP_RETCODE SCIPsetNLPIntPar(SCIP *scip, SCIP_NLPPARAM type, int ival)
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define SCIPfreeBufferArray(scip, ptr)
SCIP_RETCODE SCIPcreate(SCIP **scip)
Constraint handler for the set partitioning / packing / covering constraints .
#define SCIPallocBlockMemory(scip, ptr)
SCIP_Bool SCIPisTransformed(SCIP *scip)
int SCIPgetNLPBranchCands(SCIP *scip)
static SCIP_RETCODE freeSubSCIP(SCIP *scip, SCIP_HEURDATA *heurdata)
static SCIP_DECL_HEUREXIT(heurExitDualval)
SCIP_Bool SCIPconsIsRemovable(SCIP_CONS *cons)
SCIP_RETCODE SCIPchgVarUbGlobal(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
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 SCIPcopyParamSettings(SCIP *sourcescip, SCIP *targetscip)
SCIP_Real SCIPgetRhsLinear(SCIP *scip, SCIP_CONS *cons)
void SCIPheurSetFreq(SCIP_HEUR *heur, int freq)
SCIP_RETCODE SCIPaddCoefLinear(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real val)
SCIP_RETCODE SCIPcreateOrigSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
SCIP_Real SCIPsolGetOrigObj(SCIP_SOL *sol)
SCIP_VAR * SCIPvarGetNegatedVar(SCIP_VAR *var)
const char * SCIPgetProbName(SCIP *scip)
SCIP_VAR * SCIPgetSlackVarIndicator(SCIP_CONS *cons)
SCIP_RETCODE SCIPchgVarType(SCIP *scip, SCIP_VAR *var, SCIP_VARTYPE vartype, SCIP_Bool *infeasible)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
static SCIP_RETCODE computeRanks(SCIP *scip, SCIP_HEURDATA *heurdata, SCIP_Real *absranks, SCIP_Real *ranks, SCIP_VAR **sortedvars)
Constraint handler for knapsack constraints of the form , x binary and .
primal heuristic that uses dualvalues for successive switching variable values
static SCIP_RETCODE addKnapsackConstraints(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_HEURDATA *heurdata)
int SCIPgetNNLPVars(SCIP *scip)
static SCIP_RETCODE releaseHashmapNLPRows(SCIP *scip, SCIP_HASHMAP *hashmap)
SCIP_RETCODE SCIPsetHeurInitsol(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURINITSOL((*heurinitsol)))
SCIP_VAR * SCIPgetVarVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPsolve(SCIP *scip)
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
int SCIPhashmapGetNEntries(SCIP_HASHMAP *hashmap)
SCIP_Real SCIPgetDualsolLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_HASHMAPENTRY * SCIPhashmapGetEntry(SCIP_HASHMAP *hashmap, int entryidx)
SCIP_RETCODE SCIPsetHeurFree(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURFREE((*heurfree)))
SCIP_RETCODE SCIPaddNlRow(SCIP *scip, SCIP_NLROW *nlrow)
SCIP_Real SCIPgetRhsVarbound(SCIP *scip, SCIP_CONS *cons)
Constraint handler for logicor constraints (equivalent to set covering, but algorithms are suited fo...
#define DEFAULT_DYNAMICDEPTH
SCIP_RETCODE SCIPreleaseNlRow(SCIP *scip, SCIP_NLROW **nlrow)
SCIP_RETCODE SCIPgetProbvarSum(SCIP *scip, SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
SCIP_RETCODE SCIPcopyVars(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_VAR **fixedvars, SCIP_Real *fixedvals, int nfixedvars, SCIP_Bool global)
SCIP_Real SCIPgetVbdcoefVarbound(SCIP *scip, SCIP_CONS *cons)
SCIPInterval sqrt(const SCIPInterval &x)
#define SCIPfreeBufferArrayNull(scip, ptr)
SCIP_STATUS SCIPgetStatus(SCIP *scip)
SCIP_RETCODE SCIPpresolve(SCIP *scip)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
SCIP_RETCODE SCIPsetEventhdlrInit(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTINIT((*eventinit)))
static SCIP_RETCODE freeMemory(SCIP *scip, SCIP_HEURDATA *heurdata, SCIP_SOL *transsol, SCIP_Real *absranks, SCIP_Real *ranks, SCIP_VAR **sortedvars, SCIP_Bool beforeswitching, SCIP_Bool clearswitchedvars)
const char * SCIPconsGetName(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsPropagated(SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsLogicor(SCIP *scip, SCIP_CONS *cons)
SCIP_CONS ** SCIPgetOrigConss(SCIP *scip)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_Real SCIPnlrowGetDualsol(SCIP_NLROW *nlrow)
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
#define DEFAULT_FORCEIMPROVEMENTS
SCIP_RETCODE SCIPsetNLPInitialGuess(SCIP *scip, SCIP_Real *initialguess)
int SCIPgetNNlpis(SCIP *scip)
int SCIPheurGetFreq(SCIP_HEUR *heur)
#define DEFAULT_MAXEQUALRANKS
#define DEFAULT_LAMBDAOBJ
SCIP_VAR * SCIPgetVbdvarVarbound(SCIP *scip, SCIP_CONS *cons)
#define DEFAULT_RANKVALUE
static SCIP_RETCODE addSetppcConstraints(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_HEURDATA *heurdata)
int SCIPgetNOrigConss(SCIP *scip)
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
static SCIP_DECL_HEUREXEC(heurExecDualval)
SCIP_Bool SCIPconsIsLocal(SCIP_CONS *cons)
SCIP_RETCODE SCIPgetTransformedCons(SCIP *scip, SCIP_CONS *cons, SCIP_CONS **transcons)
SCIP_RETCODE SCIPcaptureCons(SCIP *scip, SCIP_CONS *cons)
static SCIP_DECL_HEURFREE(heurFreeDualval)
int SCIPconshdlrGetNConss(SCIP_CONSHDLR *conshdlr)
SCIP_Longint SCIPgetCapacityKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPchgVarObj(SCIP *scip, SCIP_VAR *var, SCIP_Real newobj)
#define SCIPallocBufferArray(scip, ptr, num)
SCIP_RETCODE SCIPsetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real val)
SCIP_RETCODE SCIPfreeTransform(SCIP *scip)
SCIP_RETCODE SCIPcatchEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
SCIP_RETCODE SCIPcreateConsIndicatorLinCons(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *binvar, SCIP_CONS *lincons, SCIP_VAR *slackvar, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
SCIP_RETCODE SCIPhashmapRemoveAll(SCIP_HASHMAP *hashmap)
#define DEFAULT_HEURVERBLEVEL
SCIP_Real SCIPvarGetNLPSol(SCIP_VAR *var)
SCIP_SETPPCTYPE SCIPgetTypeSetppc(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetGap(SCIP *scip)
SCIP_RETCODE SCIPcopyConss(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, SCIP_Bool enablepricing, SCIP_Bool *valid)
SCIP_RETCODE SCIPtrySolFree(SCIP *scip, SCIP_SOL **sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
SCIP_RETCODE SCIPdropEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
SCIP_RETCODE SCIPfreeSol(SCIP *scip, SCIP_SOL **sol)
SCIP_Bool SCIPconsIsChecked(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsInitial(SCIP_CONS *cons)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
SCIP_RETCODE SCIPcreateVar(SCIP *scip, SCIP_VAR **var, const char *name, SCIP_Real lb, SCIP_Real ub, SCIP_Real obj, SCIP_VARTYPE vartype, SCIP_Bool initial, SCIP_Bool removable, SCIP_DECL_VARDELORIG((*vardelorig)), SCIP_DECL_VARTRANS((*vartrans)), SCIP_DECL_VARDELTRANS((*vardeltrans)), SCIP_DECL_VARCOPY((*varcopy)), SCIP_VARDATA *vardata)
#define DEFAULT_ONLYLEAVES
static SCIP_RETCODE addVarboundConstraints(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_Bool addcombconss, SCIP_Bool addcontconss, SCIP_HEURDATA *heurdata)
static SCIP_Real maximalslack(SCIP *scip, SCIP_HEURDATA *heurdata)
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
Constraint handler for linear constraints in their most general form, .
SCIP_RETCODE SCIPchgRhsLinear(SCIP *scip, SCIP_CONS *cons, SCIP_Real rhs)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
#define BMSclearMemory(ptr)
#define SCIP_EVENTTYPE_FIRSTLPSOLVED
SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
SCIP_VAR * SCIPgetBinaryVarIndicator(SCIP_CONS *cons)
int SCIPconshdlrGetNActiveConss(SCIP_CONSHDLR *conshdlr)
static SCIP_RETCODE releaseHashmapEntries(SCIP *scip, SCIP_HASHMAP *hashmap, SCIP_Bool isvarmap)
SCIP_VAR ** SCIPgetVarsSetppc(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE addLinearConstraintsToNlp(SCIP *scip, SCIP_Bool addcombconss, SCIP_Bool addcontconss, SCIP_HEURDATA *heurdata)
static SCIP_DECL_HEURINIT(heurInitDualval)
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)
#define DEFAULT_ONLYCHEAPER
SCIP_RETCODE SCIPhashmapRemove(SCIP_HASHMAP *hashmap, void *origin)
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
SCIP_VAR ** SCIPgetVarsLinear(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNConss(SCIP *scip)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
SCIP_RETCODE SCIPsetHeurInit(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURINIT((*heurinit)))
void SCIPsortDownRealRealPtr(SCIP_Real *realarray1, SCIP_Real *realarray2, void **ptrarray, int len)
SCIP_RETCODE SCIPcaptureVar(SCIP *scip, SCIP_VAR *var)
SCIP_RETCODE SCIPincludeHeurDualval(SCIP *scip)
int SCIPgetNVarsKnapsack(SCIP *scip, SCIP_CONS *cons)
void SCIPheurSetTimingmask(SCIP_HEUR *heur, SCIP_HEURTIMING timingmask)
SCIP_Bool SCIPconsIsEnforced(SCIP_CONS *cons)
static SCIP_DECL_HEURINITSOL(heurInitsolDualval)
SCIP_Bool SCIPconsIsSeparated(SCIP_CONS *cons)
#define DEFAULT_RELAXINDICATORS
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Real * SCIPgetValsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPchgLhsLinear(SCIP *scip, SCIP_CONS *cons, SCIP_Real lhs)
static SCIP_RETCODE createSolFromNLP(SCIP *scip, SCIP_HEUR *heur, SCIP_SOL **sol)
static SCIP_RETCODE fixDiscreteVars(SCIP *scip, SCIP_HEURDATA *heurdata, SCIP_SOL *refpoint, SCIP_SOL **transsol)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
void SCIPconsAddUpgradeLocks(SCIP_CONS *cons, int nlocks)
SCIP_Real SCIPgetUpperbound(SCIP *scip)
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
#define BMSclearMemoryArray(ptr, num)
static SCIP_RETCODE SCIPincludeEventHdlrLPsol(SCIP *scip, SCIP_HEURDATA *heurdata)
static SCIP_RETCODE createSolFromSubScipSol(SCIP *scip, SCIP_HEUR *heur, SCIP_SOL **sol, SCIP_SOL *subsol)
#define DEFAULT_RELAXCONTVARS
SCIP_RETCODE SCIPcreateNlRow(SCIP *scip, SCIP_NLROW **nlrow, const char *name, SCIP_Real constant, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadvars, SCIP_VAR **quadvars, int nquadelems, SCIP_QUADELEM *quadelems, SCIP_EXPRTREE *expression, SCIP_Real lhs, SCIP_Real rhs, SCIP_EXPRCURV curvature)
static SCIP_RETCODE createSubSCIP(SCIP *scip, SCIP_HEURDATA *heurdata)
SCIP_EVENTHDLRDATA * SCIPeventhdlrGetData(SCIP_EVENTHDLR *eventhdlr)
SCIP_HEURDATA * SCIPheurGetData(SCIP_HEUR *heur)
SCIP_CONS * SCIPgetLinearConsIndicator(SCIP_CONS *cons)
SCIP_Longint * SCIPgetWeightsKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR * SCIPvarGetTransVar(SCIP_VAR *var)
SCIP_Real SCIPgetLhsVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPvarIsIntegral(SCIP_VAR *var)
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
int SCIPgetNVarsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetLhsLinear(SCIP *scip, SCIP_CONS *cons)
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)
SCIP_Bool SCIPisRelLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPfloor(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPsetLongintParam(SCIP *scip, const char *name, SCIP_Longint value)
SCIP_RETCODE SCIPcopyPlugins(SCIP *sourcescip, SCIP *targetscip, SCIP_Bool copyreaders, SCIP_Bool copypricers, SCIP_Bool copyconshdlrs, SCIP_Bool copyconflicthdlrs, SCIP_Bool copypresolvers, SCIP_Bool copyrelaxators, SCIP_Bool copyseparators, SCIP_Bool copypropagators, SCIP_Bool copyheuristics, SCIP_Bool copyeventhdlrs, SCIP_Bool copynodeselectors, SCIP_Bool copybranchrules, SCIP_Bool copydisplays, SCIP_Bool copydialogs, SCIP_Bool copynlpis, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
SCIP_RETCODE SCIPgetNegatedVar(SCIP *scip, SCIP_VAR *var, SCIP_VAR **negvar)
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)
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)
SCIP_RETCODE SCIPfree(SCIP **scip)
SCIP_Bool SCIPvarIsNegated(SCIP_VAR *var)
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
#define SCIPreallocBufferArray(scip, ptr, num)
static SCIP_RETCODE addLogicOrConstraints(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_HEURDATA *heurdata)