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);
312 if( !
SCIPisParamFixed(heurdata->subscip,
"propagating/probing/maxprerounds") )
342 assert(scip !=
NULL);
343 assert(heurdata !=
NULL);
345 assert(heurdata->subscip !=
NULL);
348 if( heurdata->nlpstatistics !=
NULL )
350 assert(heurdata->nlpstatistics ==
NULL);
353 assert(nsubvars == heurdata->nsubvars);
358 for( i = 0; i < heurdata->nsubvars; ++i )
361 assert(subvar !=
NULL);
378 heurdata->nsubvars = 0;
397 assert(event !=
NULL);
398 assert(eventdata !=
NULL);
399 assert(eventhdlr !=
NULL);
402 assert(heurdata !=
NULL);
415 assert(idx < heurdata->nvars);
417 subvar = heurdata->var_scip2subscip[idx];
421 for( idx = 0; idx < heurdata->nsubvars; ++idx )
423 if( heurdata->var_subscip2scip[idx] == var )
426 assert(idx < heurdata->nsubvars);
429 assert(subvar !=
NULL);
462 assert(scip !=
NULL);
463 assert(conshdlr !=
NULL);
471 for( i = 0; i < nconss; ++i )
488 if( !addcombconss || !addcontconss )
490 iscombinatorial =
TRUE;
492 for( j = 0; j < nvars; ++j )
495 iscombinatorial =
FALSE;
500 if( (iscombinatorial && !addcombconss) || (!iscombinatorial && !addcontconss) )
534 assert(scip !=
NULL);
535 assert(conshdlr !=
NULL);
543 for( i = 0; i < nconss; ++i )
555 if( (iscombinatorial && !addcombconss) || (!iscombinatorial && !addcontconss) )
590 assert(scip !=
NULL);
591 assert(conshdlr !=
NULL);
602 for( i = 0; i < nconss; ++i )
610 if( coefssize < nvars )
620 for( j = coefssize; j < nvars; ++j )
660 assert(scip !=
NULL);
661 assert(conshdlr !=
NULL);
672 for( i = 0; i < nconss; ++i )
680 if( coefssize < nvars )
690 for( j = coefssize; j < nvars; ++j )
750 assert(scip !=
NULL);
751 assert(conshdlr !=
NULL);
758 assert(conss !=
NULL);
763 for( i = 0; i < nconss; ++i )
773 if( coefssize < nvars )
787 for( j = 0; j < nvars; ++j )
817 if( conshdlr !=
NULL )
824 if( conshdlr !=
NULL )
833 if( conshdlr !=
NULL )
840 if( conshdlr !=
NULL )
847 if( conshdlr !=
NULL )
870 assert(scip !=
NULL);
871 assert(heur !=
NULL);
875 assert(heurdata !=
NULL);
891 for( i = 0; i < heurdata->nsubvars; ++i )
893 var = heurdata->var_subscip2scip[i];
898 assert(subvar !=
NULL);
920 assert(scip !=
NULL);
921 assert(heur !=
NULL);
923 assert(subsol !=
NULL);
926 assert(heurdata !=
NULL);
938 for( i = 0; i < heurdata->nsubvars; ++i )
940 if( heurdata->var_subscip2scip[i] ==
NULL || !
SCIPvarIsActive(heurdata->var_subscip2scip[i]) )
971 assert(scip !=
NULL);
972 assert(heur !=
NULL);
973 assert(result !=
NULL);
976 assert(heurdata !=
NULL);
978 if( tighttolerances )
989 if( !
SCIPisParamFixed(heurdata->subscip,
"constraints/linear/aggregatevariables") )
1010 SCIPdebugMsg(scip,
"SCIP presolve interrupted by user\n");
1025 SCIPdebugMsg(scip,
"SCIP returned from presolve in stage presolving with status %d\n",
SCIPgetStatus(heurdata->subscip));
1063 SCIPwarningMessage(scip,
"Error while solving subproblem in subnlp heuristic; sub-SCIP terminated with code <%d>\n", retcode);
1080 if( resultsol ==
NULL )
1087 heurdata->lastsol = sol;
1091 if( heurdata->nlpverblevel >= 1 )
1095 SCIPdebugMsg(scip,
"SCIP stored solution from sub-SCIP root node\n");
1098 ++heurdata->nsolfound;
1103 if( heurdata->nlpverblevel >= 1 )
1107 SCIPdebugMsg(scip,
"SCIP did not store sub-SCIP optimal solution\n");
1115 heurdata->lastsol = resultsol;
1119 if( heurdata->nlpverblevel >= 1 )
1123 SCIPdebugMsg(scip,
"SCIP solution from sub-SCIP root node is feasible\n");
1126 ++heurdata->nsolfound;
1131 if( heurdata->nlpverblevel >= 1 )
1135 SCIPdebugMsg(scip,
"SCIP solution form sub-SCIP root node is not feasible\n");
1147 if( heurdata->nlpverblevel >= 1 )
1151 SCIPdebugMsg(scip,
"sub-SCIP detected infeasibility\n");
1194 if( timelimit == 0.0 )
1203 if( heurdata->nlpverblevel >= 2 )
1217 if( subvar ==
NULL )
1219 startpoint[i] = constant;
1221 if( heurdata->nlpverblevel >= 2 && !
SCIPisZero(heurdata->subscip, startpoint[i]) )
1234 startpoint[i] = scalar *
SCIPgetSolVal(scip, refpoint, var) + constant;
1236 if( heurdata->nlpverblevel >= 2 && !
SCIPisZero(heurdata->subscip, startpoint[i]) )
1247 if( tighttolerances )
1260 if( heurdata->nlpoptfile !=
NULL && *heurdata->nlpoptfile !=
'\0' )
1266 if( itercontingent == -1 && heurdata->nlpiterlimit > 0 )
1267 itercontingent = heurdata->nlpiterlimit;
1268 if( itercontingent > 0 )
1281 SCIPdebugMsg(scip,
"start NLP solve with iteration limit %" SCIP_LONGINT_FORMAT
" and timelimit %g\n", itercontingent, timelimit);
1284 SCIPdebugMsg(scip,
"NLP solver returned with termination status %d and solution status %d, objective value is %g\n",
1290 if( heurdata->nlpverblevel >= 1 )
1294 ++(heurdata->nseriousnlpierror);
1296 "NLP solver in subNLP heuristic for problem <%s> returned with bad termination status %d. This was the %d%s successive time.\n",
1298 heurdata->nseriousnlpierror == 1 ?
"st" : heurdata->nseriousnlpierror == 2 ?
"nd" : heurdata->nseriousnlpierror == 3 ?
"rd" :
"th");
1299 if( heurdata->nseriousnlpierror >= 5 )
1306 heurdata->nseriousnlpierror = 0;
1310 if( iterused !=
NULL )
1312 SCIPdebugMsg(scip,
"NLP solver used %d iterations and %g seconds\n",
1321 if( resultsol ==
NULL )
1329 heurdata->lastsol = sol;
1330 if( heurdata->resolvefromscratch )
1351 if( heurdata->nlpverblevel >= 1 )
1359 ++heurdata->nsolfound;
1361 else if( !tighttolerances && heurdata->resolvetolfactor < 1.0 )
1364 if( heurdata->nlpverblevel >= 1 )
1369 SCIPdebugMsg(scip,
"solution reported by NLP solver not feasible for SCIP, resolve with feasibility tolerance %g and epsilon %g\n",
1376 SCIP_CALL(
solveSubNLP(scip, heur, result, heurdata->resolvefromscratch ? refpoint : sol, itercontingent, timelimit, iterused,
TRUE, resultsol) );
1380 if( heurdata->nlpverblevel >= 1 )
1384 SCIPdebugMsg(scip,
"solution reported by NLP solver not stored by SCIP\n");
1399 heurdata->lastsol = resultsol;
1409 if( heurdata->nlpverblevel >= 1 )
1413 SCIPdebugMsg(scip,
"solution reported by NLP solver feasible for SCIP\n");
1416 ++heurdata->nsolfound;
1418 else if( !tighttolerances && heurdata->resolvetolfactor < 1.0 )
1426 if( heurdata->nlpverblevel >= 1 )
1428 "solution reported by NLP solver not feasible for SCIP, resolve with feasibility tolerance %g and epsilon %g\n",
1432 SCIPdebugMsg(scip,
"solution reported by NLP solver not feasible for SCIP, resolve with feasibility tolerance %g and epsilon %g\n",
1436 SCIP_CALL(
solveSubNLP(scip, heur, result, heurdata->resolvefromscratch ? refpoint : resultsol, itercontingent, timelimit, iterused,
TRUE, resultsol) );
1440 if( heurdata->nlpverblevel >= 1 )
1444 SCIPdebugMsg(scip,
"solution reported by NLP solver not feasible for SCIP\n");
1449 else if( heurdata->nlpverblevel >= 1 )
1467 else if( heurdata->nlpverblevel >= 1
1476 if( heurdata->subscip !=
NULL )
1479 if( tighttolerances )
1493 if( iterused !=
NULL && *iterused == 0 )
1520 assert(scip !=
NULL);
1523 assert(nsubvars == heurdata->nsubvars);
1525 if( nsubbinvars == 0 && nsubintvars == 0 )
1528 SCIPwarningMessage(scip,
"heur_subnlp found subCIP infeasible after fixing no variables, something is strange here...\n");
1542 if( nsubintvars == 0 )
1551 for( i = nsubbinvars - 1; i >= 0; --i )
1553 subvar = subvars[i];
1556 var = heurdata->var_subscip2scip[i];
1563 assert(fixval == 0.0 || fixval == 1.0);
1568 consvars[nconsvars] = var;
1604 for( i = nsubbinvars + nsubintvars - 1; i >= 0; --i )
1606 subvar = subvars[i];
1609 var = heurdata->var_subscip2scip[i];
1617 assert((
int)fixval == fixval);
1622 assert(nconsvars < nsubbinvars + 2*nsubintvars);
1626 bounds[nconsvars] = fixval - 1.0;
1627 consvars[nconsvars] = var;
1633 assert(nconsvars < nsubbinvars + 2*nsubintvars);
1637 bounds[nconsvars] = fixval + 1.0;
1638 consvars[nconsvars] = var;
1655 SCIPdebugMsg(scip,
"adding constraint to forbid fixation in main problem\n");
1687 assert(scip !=
NULL);
1688 assert(heur !=
NULL);
1692 assert(heurdata !=
NULL);
1695 if( heurdata->subscip ==
NULL && !heurdata->triedsetupsubscip )
1703 if( heurdata->subscip ==
NULL )
1706 assert(heurdata->nsubvars > 0);
1707 assert(heurdata->var_subscip2scip !=
NULL);
1710 if( iterused !=
NULL )
1723 assert(nsubvars == heurdata->nsubvars);
1726 for( i = nsubbinvars + nsubintvars - 1; i >= 0; --i )
1728 subvar = subvars[i];
1731 var = heurdata->var_subscip2scip[i];
1732 assert(var !=
NULL);
1745 SCIPdebugMsg(scip,
"skip NLP heuristic because start candidate not integer feasible: var <%s> has value %g\n",
SCIPvarGetName(var), fixval);
1791 cutoff =
MIN(upperbound, cutoff);
1793 SCIPdebugMsg(scip,
"set objective limit %g\n", cutoff);
1801 if( heurdata->subscip ==
NULL )
1833 heurdata->triedsetupsubscip =
FALSE;
1844 assert(nsubvars == heurdata->nsubvars);
1847 for( i = nsubbinvars + nsubintvars - 1; i >= 0; --i )
1849 subvar = subvars[i];
1852 var = heurdata->var_subscip2scip[i];
1853 assert(var !=
NULL);
1880 assert(scip !=
NULL);
1881 assert(heur !=
NULL);
1882 assert(sol !=
NULL);
1883 assert(success !=
NULL);
1887 assert(heurdata !=
NULL);
1890 if( heurdata->subscip ==
NULL && !heurdata->triedsetupsubscip )
1898 if( heurdata->subscip ==
NULL )
1901 assert(heurdata->nsubvars > 0);
1902 assert(heurdata->var_subscip2scip !=
NULL);
1917 assert(nsubvars == heurdata->nsubvars);
1920 for( i = nsubbinvars + nsubintvars - 1; i >= 0; --i )
1922 subvar = subvars[i];
1925 var = heurdata->var_subscip2scip[i];
1926 assert(var !=
NULL);
1937 SCIPdebugMsg(scip,
"skip NLP heuristic because start candidate not integer feasible: var <%s> has value %g\n",
SCIPvarGetName(var), fixval);
1961 cutoff += 0.01 *
REALABS(cutoff);
1965 cutoff -= 0.01 *
REALABS(cutoff);
1968 SCIPdebugMsg(scip,
"set objective limit %g\n", cutoff);
1974 if( heurdata->subscip ==
NULL )
1991 heurdata->triedsetupsubscip =
FALSE;
2002 assert(nsubvars == heurdata->nsubvars);
2005 for( i = nsubbinvars + nsubintvars - 1; i >= 0; --i )
2007 subvar = subvars[i];
2010 var = heurdata->var_subscip2scip[i];
2011 assert(var !=
NULL);
2030 assert(heur !=
NULL);
2045 assert(heur !=
NULL);
2048 assert(heurdata !=
NULL);
2049 assert(heurdata->subscip ==
NULL);
2050 assert(heurdata->var_subscip2scip ==
NULL);
2051 assert(heurdata->var_scip2subscip ==
NULL);
2052 assert(heurdata->startcand ==
NULL);
2066 assert(heur !=
NULL);
2073 assert(heurdata !=
NULL);
2074 assert(heurdata->subscip ==
NULL);
2077 heurdata->nsolfound = 0;
2079 if( heurdata->keepcopy )
2085 if( heurdata->subscip ==
NULL )
2102 assert(heur !=
NULL);
2106 assert(heurdata !=
NULL);
2108 if( heurdata->subscip !=
NULL )
2114 if( heurdata->startcand !=
NULL )
2122 heurdata->triedsetupsubscip =
FALSE;
2123 heurdata->comblinearconsadded =
FALSE;
2124 heurdata->contlinearconsadded =
FALSE;
2125 heurdata->nseriousnlpierror = 0;
2126 heurdata->iterused = 0;
2142 assert(heur !=
NULL);
2149 assert(heurdata !=
NULL);
2158 if( heurdata->subscip ==
NULL && (heurdata->keepcopy || heurdata->triedsetupsubscip) )
2165 if( heurdata->startcand ==
NULL )
2170 if( nodeinfeasible )
2186 SCIPdebugMsg(
scip,
"LP is unbounded in root node, so we are quite desperate; run NLP heuristic and pray\n");
2193 SCIPdebugMsg(
scip,
"NLP heuristic delayed because no start candidate given and current LP solution is fractional\n");
2199 SCIPdebugMsg(
scip,
"NLP heuristic delayed because lower and upper bound coincide in current node\n");
2209 if( !heurdata->runalways )
2221 itercontingent += heurdata->iteroffset;
2223 itercontingent -= heurdata->iterused;
2225 if( itercontingent < heurdata->itermin )
2228 SCIPdebugMsg(
scip,
"skip NLP heuristic; contingent=%" SCIP_LONGINT_FORMAT
"; minimal number of iterations=%d; success ratio=%g\n",
2229 itercontingent, heurdata->itermin, (heurdata->nsolfound+1.0)/(
SCIPheurGetNCalls(heur) + 1.0));
2234 if( heurdata->nlpiterlimit > 0 )
2235 itercontingent =
MIN(itercontingent, heurdata->nlpiterlimit);
2239 itercontingent = -1;
2247 if( timelimit <= 0.0 )
2254 if( heurdata->nlptimelimit > 0 )
2255 timelimit =
MIN(heurdata->nlptimelimit, timelimit);
2260 if( heurdata->nlpverblevel >= 1 )
2264 heurdata->minimprove, &iterused,
NULL) );
2265 heurdata->iterused += iterused;
2272 if( heurdata->startcand !=
NULL )
2302 heurdata->eventhdlr =
NULL;
2304 processVarEvent,
NULL) );
2305 assert(heurdata->eventhdlr !=
NULL);
2312 assert(heur !=
NULL);
2322 "verbosity level of NLP solver",
2323 &heurdata->nlpverblevel,
FALSE, 0, 0, INT_MAX,
NULL,
NULL) );
2326 "iteration limit of NLP solver; 0 to use solver default",
2327 &heurdata->nlpiterlimit,
FALSE, 0, 0, INT_MAX,
NULL,
NULL) );
2330 "time limit of NLP solver; 0 to use solver default",
2334 "name of an NLP solver specific options file",
2338 "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)",
2339 &heurdata->resolvetolfactor,
TRUE, 0.001, 0.0, 1.0,
NULL,
NULL) );
2342 "should the NLP resolve be started from the original starting point or the infeasible solution?",
2346 "number of iterations added to the contingent of the total number of iterations",
2347 &heurdata->iteroffset,
FALSE, 500, 0, INT_MAX,
NULL,
NULL) );
2350 "contingent of NLP iterations in relation to the number of nodes in SCIP",
2354 "contingent of NLP iterations in relation to the number of nodes in SCIP",
2358 "whether to run NLP heuristic always if starting point available (does not use iteroffset,iterquot,itermin)",
2362 "factor by which NLP heuristic should at least improve the incumbent",
2363 &heurdata->minimprove,
TRUE, 0.01, 0.0, 1.0,
NULL,
NULL) );
2366 "limit on number of presolve rounds in sub-SCIP (-1 for unlimited, 0 for no presolve)",
2367 &heurdata->maxpresolverounds,
TRUE, -1, -1, INT_MAX,
NULL,
NULL) );
2370 "whether to add constraints that forbid specific fixings that turned out to be infeasible",
2374 "whether to keep SCIP copy or to create new copy each time heuristic is applied",
2392 assert(scip !=
NULL);
2393 assert(heur !=
NULL);
2397 assert(heurdata !=
NULL);
2400 if( (!addcombconss || heurdata->comblinearconsadded) && (!addcontconss || heurdata->contlinearconsadded) )
2404 addcombconss && !heurdata->comblinearconsadded,
2405 addcontconss && !heurdata->contlinearconsadded) );
2407 heurdata->comblinearconsadded |= addcombconss;
2408 heurdata->contlinearconsadded |= addcontconss;
2426 assert(scip !=
NULL);
2427 assert(heur !=
NULL);
2429 assert(solcand !=
NULL);
2437 assert(heurdata !=
NULL);
2440 if( heurdata->subscip ==
NULL )
2446 if( heurdata->lastsol == solcand )
2449 SCIPdebugMsg(scip,
"consider solution candidate with violation %g and objective %g from %s\n",
2453 if( heurdata->startcand ==
NULL || violation < heurdata->startcandviol ||
2456 if( heurdata->startcand !=
NULL )
2462 heurdata->startcandviol = violation;
2479 assert(heur !=
NULL);
2483 assert(heurdata !=
NULL);
2485 return heurdata->subscip;
2496 assert(heur !=
NULL);
2500 assert(heurdata !=
NULL);
2502 return heurdata->var_scip2subscip;
2513 assert(heur !=
NULL);
2517 assert(heurdata !=
NULL);
2519 return heurdata->var_subscip2scip;
2530 assert(heur !=
NULL);
2534 assert(heurdata !=
NULL);
2536 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)