37 #define HEUR_NAME "subnlp" 38 #define HEUR_DESC "primal heuristic that performs a local search in an NLP after fixing integer variables and presolving" 39 #define HEUR_DISPCHAR 'q' 40 #define HEUR_PRIORITY -2000000 42 #define HEUR_FREQOFS 0 43 #define HEUR_MAXDEPTH -1 44 #define HEUR_TIMING SCIP_HEURTIMING_AFTERNODE 45 #define HEUR_USESSUBSCIP FALSE 57 int nseriousnlpierror;
80 int maxpresolverounds;
103 assert(scip !=
NULL);
141 assert(heurdata !=
NULL);
142 assert(heurdata->subscip ==
NULL);
146 heurdata->triedsetupsubscip =
TRUE;
184 SCIPdebugMsg(scip,
"some NLPIs from main SCIP did not copy into sub-SCIP, give up heuristic.\n");
206 if( !heurdata->subscipisvalid )
209 SCIPdebugMsg(scip,
"In heur_subnlp: failed to copy some constraints to sub-SCIP, continue anyway\n");
224 heurdata->nvars = nvars;
266 for( i = 0; i < heurdata->nvars; ++i )
268 assert(heurdata->var_scip2subscip[i] !=
NULL);
271 for( i = 0; i < heurdata->nsubvars; ++i )
273 assert(heurdata->var_subscip2scip[i] !=
NULL);
310 if( !
SCIPisParamFixed(heurdata->subscip,
"constraints/components/maxprerounds") )
340 assert(scip !=
NULL);
341 assert(heurdata !=
NULL);
343 assert(heurdata->subscip !=
NULL);
346 if( heurdata->nlpstatistics !=
NULL )
348 assert(heurdata->nlpstatistics ==
NULL);
351 assert(nsubvars == heurdata->nsubvars);
356 for( i = 0; i < heurdata->nsubvars; ++i )
359 assert(subvar !=
NULL);
376 heurdata->nsubvars = 0;
395 assert(event !=
NULL);
396 assert(eventdata !=
NULL);
397 assert(eventhdlr !=
NULL);
400 assert(heurdata !=
NULL);
413 assert(idx < heurdata->nvars);
415 subvar = heurdata->var_scip2subscip[idx];
419 for( idx = 0; idx < heurdata->nsubvars; ++idx )
421 if( heurdata->var_subscip2scip[idx] == var )
424 assert(idx < heurdata->nsubvars);
427 assert(subvar !=
NULL);
460 assert(scip !=
NULL);
461 assert(conshdlr !=
NULL);
469 for( i = 0; i < nconss; ++i )
486 if( !addcombconss || !addcontconss )
488 iscombinatorial =
TRUE;
490 for( j = 0; j < nvars; ++j )
493 iscombinatorial =
FALSE;
498 if( (iscombinatorial && !addcombconss) || (!iscombinatorial && !addcontconss) )
532 assert(scip !=
NULL);
533 assert(conshdlr !=
NULL);
541 for( i = 0; i < nconss; ++i )
553 if( (iscombinatorial && !addcombconss) || (!iscombinatorial && !addcontconss) )
588 assert(scip !=
NULL);
589 assert(conshdlr !=
NULL);
600 for( i = 0; i < nconss; ++i )
608 if( coefssize < nvars )
618 for( j = coefssize; j < nvars; ++j )
658 assert(scip !=
NULL);
659 assert(conshdlr !=
NULL);
670 for( i = 0; i < nconss; ++i )
678 if( coefssize < nvars )
688 for( j = coefssize; j < nvars; ++j )
748 assert(scip !=
NULL);
749 assert(conshdlr !=
NULL);
756 assert(conss !=
NULL);
761 for( i = 0; i < nconss; ++i )
771 if( coefssize < nvars )
785 for( j = 0; j < nvars; ++j )
815 if( conshdlr !=
NULL )
822 if( conshdlr !=
NULL )
831 if( conshdlr !=
NULL )
838 if( conshdlr !=
NULL )
845 if( conshdlr !=
NULL )
868 assert(scip !=
NULL);
869 assert(heur !=
NULL);
873 assert(heurdata !=
NULL);
889 for( i = 0; i < heurdata->nsubvars; ++i )
891 var = heurdata->var_subscip2scip[i];
896 assert(subvar !=
NULL);
918 assert(scip !=
NULL);
919 assert(heur !=
NULL);
921 assert(subsol !=
NULL);
924 assert(heurdata !=
NULL);
936 for( i = 0; i < heurdata->nsubvars; ++i )
938 if( heurdata->var_subscip2scip[i] ==
NULL || !
SCIPvarIsActive(heurdata->var_subscip2scip[i]) )
969 assert(scip !=
NULL);
970 assert(heur !=
NULL);
971 assert(result !=
NULL);
974 assert(heurdata !=
NULL);
980 if( timelimit == 0.0 )
983 if( tighttolerances )
994 if( !
SCIPisParamFixed(heurdata->subscip,
"constraints/linear/aggregatevariables") )
1017 SCIPdebugMsg(scip,
"SCIP presolve interrupted by user\n");
1032 SCIPdebugMsg(scip,
"SCIP returned from presolve in stage presolving with status %d\n",
SCIPgetStatus(heurdata->subscip));
1070 SCIPwarningMessage(scip,
"Error while solving subproblem in subnlp heuristic; sub-SCIP terminated with code <%d>\n", retcode);
1087 if( resultsol ==
NULL )
1094 heurdata->lastsol = sol;
1098 if( heurdata->nlpverblevel >= 1 )
1102 SCIPdebugMsg(scip,
"SCIP stored solution from sub-SCIP root node\n");
1105 ++heurdata->nsolfound;
1110 if( heurdata->nlpverblevel >= 1 )
1114 SCIPdebugMsg(scip,
"SCIP did not store sub-SCIP optimal solution\n");
1122 heurdata->lastsol = resultsol;
1126 if( heurdata->nlpverblevel >= 1 )
1130 SCIPdebugMsg(scip,
"SCIP solution from sub-SCIP root node is feasible\n");
1133 ++heurdata->nsolfound;
1138 if( heurdata->nlpverblevel >= 1 )
1142 SCIPdebugMsg(scip,
"SCIP solution form sub-SCIP root node is not feasible\n");
1154 if( heurdata->nlpverblevel >= 1 )
1158 SCIPdebugMsg(scip,
"sub-SCIP detected infeasibility\n");
1206 if( heurdata->nlpverblevel >= 2 )
1220 if( subvar ==
NULL )
1222 startpoint[i] = constant;
1224 if( heurdata->nlpverblevel >= 2 && !
SCIPisZero(heurdata->subscip, startpoint[i]) )
1237 startpoint[i] = scalar *
SCIPgetSolVal(scip, refpoint, var) + constant;
1239 if( heurdata->nlpverblevel >= 2 && !
SCIPisZero(heurdata->subscip, startpoint[i]) )
1250 if( tighttolerances )
1263 if( heurdata->nlpoptfile !=
NULL && *heurdata->nlpoptfile !=
'\0' )
1269 if( itercontingent == -1 && heurdata->nlpiterlimit > 0 )
1270 itercontingent = heurdata->nlpiterlimit;
1271 if( itercontingent > 0 )
1284 SCIPdebugMsg(scip,
"start NLP solve with iteration limit %" SCIP_LONGINT_FORMAT
" and timelimit %g\n", itercontingent, timelimit);
1287 SCIPdebugMsg(scip,
"NLP solver returned with termination status %d and solution status %d, objective value is %g\n",
1293 if( heurdata->nlpverblevel >= 1 )
1297 ++(heurdata->nseriousnlpierror);
1299 "NLP solver in subNLP heuristic for problem <%s> returned with bad termination status %d. This was the %d%s successive time.\n",
1301 heurdata->nseriousnlpierror == 1 ?
"st" : heurdata->nseriousnlpierror == 2 ?
"nd" : heurdata->nseriousnlpierror == 3 ?
"rd" :
"th");
1302 if( heurdata->nseriousnlpierror >= 5 )
1309 heurdata->nseriousnlpierror = 0;
1313 if( iterused !=
NULL )
1315 SCIPdebugMsg(scip,
"NLP solver used %d iterations and %g seconds\n",
1324 if( resultsol ==
NULL )
1332 heurdata->lastsol = sol;
1333 if( heurdata->resolvefromscratch )
1354 if( heurdata->nlpverblevel >= 1 )
1362 ++heurdata->nsolfound;
1364 else if( !tighttolerances && heurdata->resolvetolfactor < 1.0 )
1367 if( heurdata->nlpverblevel >= 1 )
1372 SCIPdebugMsg(scip,
"solution reported by NLP solver not feasible for SCIP, resolve with feasibility tolerance %g and epsilon %g\n",
1379 SCIP_CALL(
solveSubNLP(scip, heur, result, heurdata->resolvefromscratch ? refpoint : sol, itercontingent, timelimit, iterused,
TRUE, resultsol) );
1383 if( heurdata->nlpverblevel >= 1 )
1387 SCIPdebugMsg(scip,
"solution reported by NLP solver not stored by SCIP\n");
1402 heurdata->lastsol = resultsol;
1412 if( heurdata->nlpverblevel >= 1 )
1416 SCIPdebugMsg(scip,
"solution reported by NLP solver feasible for SCIP\n");
1419 ++heurdata->nsolfound;
1421 else if( !tighttolerances && heurdata->resolvetolfactor < 1.0 )
1429 if( heurdata->nlpverblevel >= 1 )
1431 "solution reported by NLP solver not feasible for SCIP, resolve with feasibility tolerance %g and epsilon %g\n",
1435 SCIPdebugMsg(scip,
"solution reported by NLP solver not feasible for SCIP, resolve with feasibility tolerance %g and epsilon %g\n",
1439 SCIP_CALL(
solveSubNLP(scip, heur, result, heurdata->resolvefromscratch ? refpoint : resultsol, itercontingent, timelimit, iterused,
TRUE, resultsol) );
1443 if( heurdata->nlpverblevel >= 1 )
1447 SCIPdebugMsg(scip,
"solution reported by NLP solver not feasible for SCIP\n");
1452 else if( heurdata->nlpverblevel >= 1 )
1470 else if( heurdata->nlpverblevel >= 1
1479 if( heurdata->subscip !=
NULL )
1482 if( tighttolerances )
1496 if( iterused !=
NULL && *iterused == 0 )
1523 assert(scip !=
NULL);
1526 assert(nsubvars == heurdata->nsubvars);
1528 if( nsubbinvars == 0 && nsubintvars == 0 )
1531 SCIPwarningMessage(scip,
"heur_subnlp found subCIP infeasible after fixing no variables, something is strange here...\n");
1545 if( nsubintvars == 0 )
1554 for( i = nsubbinvars - 1; i >= 0; --i )
1556 subvar = subvars[i];
1559 var = heurdata->var_subscip2scip[i];
1566 assert(fixval == 0.0 || fixval == 1.0);
1571 consvars[nconsvars] = var;
1607 for( i = nsubbinvars + nsubintvars - 1; i >= 0; --i )
1609 subvar = subvars[i];
1612 var = heurdata->var_subscip2scip[i];
1620 assert((
int)fixval == fixval);
1625 assert(nconsvars < nsubbinvars + 2*nsubintvars);
1629 bounds[nconsvars] = fixval - 1.0;
1630 consvars[nconsvars] = var;
1636 assert(nconsvars < nsubbinvars + 2*nsubintvars);
1640 bounds[nconsvars] = fixval + 1.0;
1641 consvars[nconsvars] = var;
1658 SCIPdebugMsg(scip,
"adding constraint to forbid fixation in main problem\n");
1690 assert(scip !=
NULL);
1691 assert(heur !=
NULL);
1695 assert(heurdata !=
NULL);
1698 if( heurdata->subscip ==
NULL && !heurdata->triedsetupsubscip )
1706 if( heurdata->subscip ==
NULL )
1709 assert(heurdata->nsubvars > 0);
1710 assert(heurdata->var_subscip2scip !=
NULL);
1713 if( iterused !=
NULL )
1726 assert(nsubvars == heurdata->nsubvars);
1729 for( i = nsubbinvars + nsubintvars - 1; i >= 0; --i )
1731 subvar = subvars[i];
1734 var = heurdata->var_subscip2scip[i];
1735 assert(var !=
NULL);
1748 SCIPdebugMsg(scip,
"skip NLP heuristic because start candidate not integer feasible: var <%s> has value %g\n",
SCIPvarGetName(var), fixval);
1797 cutoff =
MIN(upperbound, cutoff);
1799 SCIPdebugMsg(scip,
"set objective limit %g\n", cutoff);
1807 if( heurdata->subscip ==
NULL )
1839 heurdata->triedsetupsubscip =
FALSE;
1850 assert(nsubvars == heurdata->nsubvars);
1853 for( i = nsubbinvars + nsubintvars - 1; i >= 0; --i )
1855 subvar = subvars[i];
1858 var = heurdata->var_subscip2scip[i];
1859 assert(var !=
NULL);
1886 assert(scip !=
NULL);
1887 assert(heur !=
NULL);
1888 assert(sol !=
NULL);
1889 assert(success !=
NULL);
1893 assert(heurdata !=
NULL);
1896 if( heurdata->subscip ==
NULL && !heurdata->triedsetupsubscip )
1904 if( heurdata->subscip ==
NULL )
1907 assert(heurdata->nsubvars > 0);
1908 assert(heurdata->var_subscip2scip !=
NULL);
1923 assert(nsubvars == heurdata->nsubvars);
1926 for( i = nsubbinvars + nsubintvars - 1; i >= 0; --i )
1928 subvar = subvars[i];
1931 var = heurdata->var_subscip2scip[i];
1932 assert(var !=
NULL);
1943 SCIPdebugMsg(scip,
"skip NLP heuristic because start candidate not integer feasible: var <%s> has value %g\n",
SCIPvarGetName(var), fixval);
1967 cutoff += 0.01 *
REALABS(cutoff);
1971 cutoff -= 0.01 *
REALABS(cutoff);
1974 SCIPdebugMsg(scip,
"set objective limit %g\n", cutoff);
1980 if( heurdata->subscip ==
NULL )
1997 heurdata->triedsetupsubscip =
FALSE;
2008 assert(nsubvars == heurdata->nsubvars);
2011 for( i = nsubbinvars + nsubintvars - 1; i >= 0; --i )
2013 subvar = subvars[i];
2016 var = heurdata->var_subscip2scip[i];
2017 assert(var !=
NULL);
2036 assert(heur !=
NULL);
2051 assert(heur !=
NULL);
2054 assert(heurdata !=
NULL);
2055 assert(heurdata->subscip ==
NULL);
2056 assert(heurdata->var_subscip2scip ==
NULL);
2057 assert(heurdata->var_scip2subscip ==
NULL);
2058 assert(heurdata->startcand ==
NULL);
2072 assert(heur !=
NULL);
2079 assert(heurdata !=
NULL);
2080 assert(heurdata->subscip ==
NULL);
2083 heurdata->nsolfound = 0;
2085 if( heurdata->keepcopy )
2091 if( heurdata->subscip ==
NULL )
2108 assert(heur !=
NULL);
2112 assert(heurdata !=
NULL);
2114 if( heurdata->subscip !=
NULL )
2120 if( heurdata->startcand !=
NULL )
2128 heurdata->triedsetupsubscip =
FALSE;
2129 heurdata->comblinearconsadded =
FALSE;
2130 heurdata->contlinearconsadded =
FALSE;
2131 heurdata->nseriousnlpierror = 0;
2132 heurdata->iterused = 0;
2148 assert(heur !=
NULL);
2155 assert(heurdata !=
NULL);
2164 if( heurdata->subscip ==
NULL && (heurdata->keepcopy || heurdata->triedsetupsubscip) )
2171 if( heurdata->startcand ==
NULL )
2176 if( nodeinfeasible )
2192 SCIPdebugMsg(
scip,
"LP is unbounded in root node, so we are quite desperate; run NLP heuristic and pray\n");
2199 SCIPdebugMsg(
scip,
"NLP heuristic delayed because no start candidate given and current LP solution is fractional\n");
2205 SCIPdebugMsg(
scip,
"NLP heuristic delayed because lower and upper bound coincide in current node\n");
2215 if( !heurdata->runalways )
2227 itercontingent += heurdata->iteroffset;
2229 itercontingent -= heurdata->iterused;
2231 if( itercontingent < heurdata->itermin )
2234 SCIPdebugMsg(
scip,
"skip NLP heuristic; contingent=%" SCIP_LONGINT_FORMAT
"; minimal number of iterations=%d; success ratio=%g\n",
2235 itercontingent, heurdata->itermin, (heurdata->nsolfound+1.0)/(
SCIPheurGetNCalls(heur) + 1.0));
2240 if( heurdata->nlpiterlimit > 0 )
2241 itercontingent =
MIN(itercontingent, heurdata->nlpiterlimit);
2245 itercontingent = -1;
2253 if( timelimit <= 0.0 )
2260 if( heurdata->nlptimelimit > 0 )
2261 timelimit =
MIN(heurdata->nlptimelimit, timelimit);
2266 if( heurdata->nlpverblevel >= 1 )
2270 heurdata->minimprove, &iterused,
NULL) );
2271 heurdata->iterused += iterused;
2278 if( heurdata->startcand !=
NULL )
2308 heurdata->eventhdlr =
NULL;
2310 processVarEvent,
NULL) );
2311 assert(heurdata->eventhdlr !=
NULL);
2318 assert(heur !=
NULL);
2328 "verbosity level of NLP solver",
2329 &heurdata->nlpverblevel,
FALSE, 0, 0, INT_MAX,
NULL,
NULL) );
2332 "iteration limit of NLP solver; 0 to use solver default",
2333 &heurdata->nlpiterlimit,
FALSE, 0, 0, INT_MAX,
NULL,
NULL) );
2336 "time limit of NLP solver; 0 to use solver default",
2340 "name of an NLP solver specific options file",
2344 "if SCIP does not accept a NLP feasible solution, resolve NLP with feas. tolerance reduced by this factor (set to 1.0 to turn off resolve)",
2345 &heurdata->resolvetolfactor,
TRUE, 0.001, 0.0, 1.0,
NULL,
NULL) );
2348 "should the NLP resolve be started from the original starting point or the infeasible solution?",
2352 "number of iterations added to the contingent of the total number of iterations",
2353 &heurdata->iteroffset,
FALSE, 500, 0, INT_MAX,
NULL,
NULL) );
2356 "contingent of NLP iterations in relation to the number of nodes in SCIP",
2360 "contingent of NLP iterations in relation to the number of nodes in SCIP",
2364 "whether to run NLP heuristic always if starting point available (does not use iteroffset,iterquot,itermin)",
2368 "factor by which NLP heuristic should at least improve the incumbent",
2369 &heurdata->minimprove,
TRUE, 0.01, 0.0, 1.0,
NULL,
NULL) );
2372 "limit on number of presolve rounds in sub-SCIP (-1 for unlimited, 0 for no presolve)",
2373 &heurdata->maxpresolverounds,
TRUE, -1, -1, INT_MAX,
NULL,
NULL) );
2376 "whether to add constraints that forbid specific fixings that turned out to be infeasible",
2380 "whether to keep SCIP copy or to create new copy each time heuristic is applied",
2398 assert(scip !=
NULL);
2399 assert(heur !=
NULL);
2403 assert(heurdata !=
NULL);
2406 if( (!addcombconss || heurdata->comblinearconsadded) && (!addcontconss || heurdata->contlinearconsadded) )
2410 addcombconss && !heurdata->comblinearconsadded,
2411 addcontconss && !heurdata->contlinearconsadded) );
2413 heurdata->comblinearconsadded |= addcombconss;
2414 heurdata->contlinearconsadded |= addcontconss;
2432 assert(scip !=
NULL);
2433 assert(heur !=
NULL);
2435 assert(solcand !=
NULL);
2443 assert(heurdata !=
NULL);
2446 if( heurdata->subscip ==
NULL )
2452 if( heurdata->lastsol == solcand )
2455 SCIPdebugMsg(scip,
"consider solution candidate with violation %g and objective %g from %s\n",
2459 if( heurdata->startcand ==
NULL || violation < heurdata->startcandviol ||
2462 if( heurdata->startcand !=
NULL )
2468 heurdata->startcandviol = violation;
2485 assert(heur !=
NULL);
2489 assert(heurdata !=
NULL);
2491 return heurdata->subscip;
2502 assert(heur !=
NULL);
2506 assert(heurdata !=
NULL);
2508 return heurdata->var_scip2subscip;
2519 assert(heur !=
NULL);
2523 assert(heurdata !=
NULL);
2525 return heurdata->var_subscip2scip;
2536 assert(heur !=
NULL);
2540 assert(heurdata !=
NULL);
2542 return heurdata->startcand;
enum SCIP_Result SCIP_RESULT
SCIP_RETCODE SCIPsetHeurExitsol(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEUREXITSOL((*heurexitsol)))
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
enum SCIP_BoundType SCIP_BOUNDTYPE
int SCIPgetNIntVars(SCIP *scip)
#define SCIP_HEURTIMING_DURINGLPLOOP
void * SCIPhashmapEntryGetImage(SCIP_HASHMAPENTRY *entry)
SCIP_RETCODE SCIPchgVarLbGlobal(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
SCIP_Real SCIPgetSolvingTime(SCIP *scip)
static SCIP_RETCODE createSubSCIP(SCIP *scip, SCIP_HEURDATA *heurdata)
SCIP_Real SCIPfeastol(SCIP *scip)
SCIP_Bool SCIPconsIsEnabled(SCIP_CONS *cons)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
SCIP_Bool SCIPisNLPConstructed(SCIP *scip)
SCIP_RETCODE SCIPnlpStatisticsCreate(SCIP_NLPSTATISTICS **statistics)
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_VAR ** SCIPgetNLPVars(SCIP *scip)
SCIP_STAGE SCIPgetStage(SCIP *scip)
Constraint handler for variable bound constraints .
SCIP_RETCODE SCIPcatchVarEvent(SCIP *scip, SCIP_VAR *var, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
SCIP_Real SCIPgetPrimalbound(SCIP *scip)
int SCIPgetNVarsSetppc(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarMappingScip2SubScipHeurSubNlp(SCIP *scip, SCIP_HEUR *heur)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
int SCIPgetNVarsLogicor(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPgetRealParam(SCIP *scip, const char *name, SCIP_Real *value)
SCIP_RETCODE SCIPincludeHeurSubNlp(SCIP *scip)
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_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPnlpStatisticsGetTotalTime(SCIP_NLPSTATISTICS *statistics)
int SCIPgetNOrigVars(SCIP *scip)
SCIP_RETCODE SCIPcreateConsSetcover(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, 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)
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)
static SCIP_RETCODE createSolFromNLP(SCIP *scip, SCIP_HEUR *heur, SCIP_SOL **sol, SCIP_HEUR *authorheur)
static SCIP_RETCODE addLogicOrConstraints(SCIP *scip, SCIP_CONSHDLR *conshdlr)
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_SOL ** SCIPgetSols(SCIP *scip)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
SCIP_Bool SCIPhasNLPContinuousNonlinearity(SCIP *scip)
int SCIPgetNActivePricers(SCIP *scip)
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_RETCODE SCIPsetPresolving(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
int SCIPheurGetFreqofs(SCIP_HEUR *heur)
int SCIPvarGetProbindex(SCIP_VAR *var)
#define SCIP_EVENTTYPE_GLBCHANGED
SCIP_VAR ** SCIPgetOrigVars(SCIP *scip)
struct SCIP_HeurData SCIP_HEURDATA
#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 SCIPaddStringParam(SCIP *scip, const char *name, const char *desc, char **valueptr, SCIP_Bool isadvanced, const char *defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPgetOrigVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
SCIP_MESSAGEHDLR * SCIPgetMessagehdlr(SCIP *scip)
SCIP_RETCODE SCIPsetNLPIntPar(SCIP *scip, SCIP_NLPPARAM type, int ival)
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
SCIP_RETCODE SCIPsetNLPStringPar(SCIP *scip, SCIP_NLPPARAM type, const char *sval)
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)
SCIP_Bool SCIPpressedCtrlC(SCIP *scip)
SCIP_RETCODE SCIPsetRealParam(SCIP *scip, const char *name, SCIP_Real value)
static SCIP_RETCODE createSolFromSubScipSol(SCIP *scip, SCIP_HEUR *heur, SCIP_SOL **sol, SCIP_SOL *subsol, SCIP_HEUR *authorheur)
static SCIP_DECL_HEUREXITSOL(heurExitsolSubNlp)
static SCIP_DECL_HEURINITSOL(heurInitsolSubNlp)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
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 SCIPnlpStatisticsFree(SCIP_NLPSTATISTICS **statistics)
SCIP_SOL * SCIPgetStartCandidateHeurSubNlp(SCIP *scip, SCIP_HEUR *heur)
SCIP_Real SCIPepsilon(SCIP *scip)
SCIP_Bool SCIPisRelGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_DECL_HEUREXEC(heurExecSubNlp)
static SCIP_RETCODE addKnapsackConstraints(SCIP *scip, SCIP_CONSHDLR *conshdlr)
static SCIP_RETCODE addSetppcConstraints(SCIP *scip, SCIP_CONSHDLR *conshdlr)
const char * SCIPgetProbName(SCIP *scip)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
Constraint handler for knapsack constraints of the form , x binary and .
int SCIPgetNNLPVars(SCIP *scip)
SCIP_RETCODE SCIPcreateSolCopy(SCIP *scip, SCIP_SOL **sol, SCIP_SOL *sourcesol)
SCIP_NLPTERMSTAT SCIPgetNLPTermstat(SCIP *scip)
static SCIP_RETCODE solveSubNLP(SCIP *scip, SCIP_HEUR *heur, SCIP_RESULT *result, SCIP_SOL *refpoint, SCIP_Longint itercontingent, SCIP_Real timelimit, SCIP_Longint *iterused, SCIP_Bool tighttolerances, SCIP_SOL *resultsol)
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 SCIPaddLinearConsToNlpHeurSubNlp(SCIP *scip, SCIP_HEUR *heur, SCIP_Bool addcombconss, SCIP_Bool addcontconss)
const char * SCIPheurGetName(SCIP_HEUR *heur)
static SCIP_RETCODE addVarboundConstraints(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_Bool addcombconss, SCIP_Bool addcontconss)
SCIP_Bool SCIPisParamFixed(SCIP *scip, const char *name)
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
int SCIPhashmapGetNEntries(SCIP_HASHMAP *hashmap)
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...
SCIP_RETCODE SCIPreleaseNlRow(SCIP *scip, SCIP_NLROW **nlrow)
static SCIP_RETCODE forbidFixation(SCIP *scip, SCIP_HEURDATA *heurdata)
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)
#define SCIPfreeBufferArrayNull(scip, ptr)
SCIP_RETCODE SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value)
SCIP_STATUS SCIPgetStatus(SCIP *scip)
SCIP_RETCODE SCIPpresolve(SCIP *scip)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
const char * SCIPconsGetName(SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsLogicor(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE freeSubSCIP(SCIP *scip, SCIP_HEURDATA *heurdata)
struct SCIP_EventData SCIP_EVENTDATA
const char * SCIPvarGetName(SCIP_VAR *var)
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
SCIP_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
SCIP_Real SCIPgetSolTransObj(SCIP *scip, SCIP_SOL *sol)
SCIP_RETCODE SCIPsetNLPInitialGuess(SCIP *scip, SCIP_Real *initialguess)
int SCIPgetNNlpis(SCIP *scip)
SCIP_Real SCIPgetLocalDualbound(SCIP *scip)
int SCIPheurGetFreq(SCIP_HEUR *heur)
SCIP_VAR * SCIPgetVbdvarVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetLowerbound(SCIP *scip)
static SCIP_RETCODE addLinearConstraintsToNlp(SCIP *scip, SCIP_Bool addcombconss, SCIP_Bool addcontconss)
void SCIPmessagePrintInfo(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
SCIP_Longint SCIPheurGetNCalls(SCIP_HEUR *heur)
SCIP_Longint SCIPgetCapacityKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPsetNLPRealPar(SCIP *scip, SCIP_NLPPARAM type, SCIP_Real dval)
#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_VAR * SCIPeventGetVar(SCIP_EVENT *event)
SCIP_RETCODE SCIPcheckSol(SCIP *scip, SCIP_SOL *sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *feasible)
SCIP_RETCODE SCIPgetNLPStatistics(SCIP *scip, SCIP_NLPSTATISTICS *statistics)
static SCIP_DECL_HEURFREE(heurFreeSubNlp)
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
SCIP_Real SCIPgetObjlimit(SCIP *scip)
SCIP_EVENTTYPE SCIPeventGetType(SCIP_EVENT *event)
SCIP_RETCODE SCIPsetObjlimit(SCIP *scip, SCIP_Real objlimit)
SCIP_Real SCIPvarGetNLPSol(SCIP_VAR *var)
SCIP_SETPPCTYPE SCIPgetTypeSetppc(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPresolveSolHeurSubNlp(SCIP *scip, SCIP_HEUR *heur, SCIP_SOL *sol, SCIP_Bool *success, SCIP_Longint itercontingent, SCIP_Real timelimit)
SCIP_RETCODE SCIPcopyConss(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, SCIP_Bool enablepricing, SCIP_Bool *valid)
void SCIPsolSetHeur(SCIP_SOL *sol, SCIP_HEUR *heur)
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_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
SCIP_RETCODE SCIPfreeSol(SCIP *scip, SCIP_SOL **sol)
SCIP_Bool SCIPconsIsChecked(SCIP_CONS *cons)
SCIP_RETCODE SCIPdropVarEvent(SCIP *scip, SCIP_VAR *var, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
int SCIPgetNSols(SCIP *scip)
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
Constraint handler for linear constraints in their most general form, .
SCIP_RETCODE SCIPapplyHeurSubNlp(SCIP *scip, SCIP_HEUR *heur, SCIP_RESULT *result, SCIP_SOL *refpoint, SCIP_Longint itercontingent, SCIP_Real timelimit, SCIP_Real minimprove, SCIP_Longint *iterused, SCIP_SOL *resultsol)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
#define BMSclearMemory(ptr)
#define SCIP_EVENTTYPE_GBDCHANGED
SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
SCIP_VAR ** SCIPgetVarMappingSubScip2ScipHeurSubNlp(SCIP *scip, SCIP_HEUR *heur)
SCIP_RETCODE SCIPtrySol(SCIP *scip, SCIP_SOL *sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
int SCIPgetNBinVars(SCIP *scip)
int SCIPconshdlrGetNActiveConss(SCIP_CONSHDLR *conshdlr)
static SCIP_RETCODE addLinearConstraints(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_Bool addcombconss, SCIP_Bool addcontconss)
SCIP_VAR ** SCIPgetVarsSetppc(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVars(SCIP *scip)
static SCIP_DECL_HEURCOPY(heurCopySubNlp)
SCIP_VAR ** SCIPgetVarsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPtransformObj(SCIP *scip, SCIP_Real obj)
int SCIPgetNConss(SCIP *scip)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
NLP local search primal heuristic using sub-SCIPs.
SCIP_VAR ** SCIPgetVars(SCIP *scip)
SCIP_HEUR * SCIPgetSolHeur(SCIP *scip, SCIP_SOL *sol)
SCIP_RETCODE SCIPcaptureVar(SCIP *scip, SCIP_VAR *var)
int SCIPgetNVarsKnapsack(SCIP *scip, SCIP_CONS *cons)
void SCIPheurSetTimingmask(SCIP_HEUR *heur, SCIP_HEURTIMING timingmask)
int SCIPnlpStatisticsGetNIterations(SCIP_NLPSTATISTICS *statistics)
SCIP_RETCODE SCIPunlinkSol(SCIP *scip, SCIP_SOL *sol)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_OBJSENSE SCIPgetObjsense(SCIP *scip)
SCIP_RETCODE SCIPcreateConsBounddisjunction(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_BOUNDTYPE *boundtypes, SCIP_Real *bounds, 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)
SCIP_RETCODE SCIPtransformProb(SCIP *scip)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPgetNLPObjval(SCIP *scip)
SCIP_Real * SCIPgetValsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPsetHeurCopy(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURCOPY((*heurcopy)))
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPupdateStartpointHeurSubNlp(SCIP *scip, SCIP_HEUR *heur, SCIP_SOL *solcand, SCIP_Real violation)
SCIP_Real SCIPsumepsilon(SCIP *scip)
SCIP_Real SCIPgetUpperbound(SCIP *scip)
#define BMSclearMemoryArray(ptr, num)
static SCIP_DECL_EVENTEXEC(processVarEvent)
static SCIP_Bool runHeuristic(SCIP *scip)
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)
#define SCIP_EVENTTYPE_GUBCHANGED
SCIP_HEURDATA * SCIPheurGetData(SCIP_HEUR *heur)
constraint handler for bound disjunction constraints
SCIP_Longint * SCIPgetWeightsKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPresetParam(SCIP *scip, const char *name)
SCIP_Longint SCIPgetNNodes(SCIP *scip)
SCIP_Real SCIPgetLhsVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP * SCIPgetSubScipHeurSubNlp(SCIP *scip, SCIP_HEUR *heur)
SCIP_Real SCIPround(SCIP *scip, SCIP_Real val)
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_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
#define SCIPreallocBufferArray(scip, ptr, num)