30 #define SCIP_PRIVATE_ROWPREP 40 #define CONSHDLR_NAME "nonlinear" 41 #define CONSHDLR_DESC "constraint handler for nonlinear constraints" 42 #define CONSHDLR_SEPAPRIORITY 10 43 #define CONSHDLR_ENFOPRIORITY -60 44 #define CONSHDLR_CHECKPRIORITY -4000010 45 #define CONSHDLR_SEPAFREQ 1 46 #define CONSHDLR_PROPFREQ 1 47 #define CONSHDLR_EAGERFREQ 100 49 #define CONSHDLR_MAXPREROUNDS -1 50 #define CONSHDLR_DELAYSEPA FALSE 51 #define CONSHDLR_DELAYPROP FALSE 52 #define CONSHDLR_NEEDSCONS TRUE 54 #define CONSHDLR_PROP_TIMING SCIP_PROPTIMING_BEFORELP 55 #define CONSHDLR_PRESOLTIMING SCIP_PRESOLTIMING_ALWAYS 57 #define INTERVALINFTY 1E+43 58 #define BOUNDTIGHTENING_MINSTRENGTH 0.05 59 #define INITLPMAXVARVAL 1000.0 96 unsigned int linvarssorted:1;
97 unsigned int linvarsmerged:1;
99 unsigned int iscurvchecked:1;
100 unsigned int isremovedfixingslin:1;
101 unsigned int ispresolved:1;
102 unsigned int forcebackprop:1;
106 int minlinactivityinf;
107 int maxlinactivityinf;
112 int linvar_maydecrease;
113 int linvar_mayincrease;
131 struct SCIP_ConshdlrData
144 int maxexpansionexponent;
152 int newsoleventfilterpos;
155 int nlconsupgradessize;
160 unsigned int isremovedfixings:1;
161 unsigned int ispropagated:1;
162 unsigned int isreformulated:1;
163 unsigned int sepanlp:1;
164 int naddedreformconss;
177 #define infty2infty(infty1, infty2, val) ((val) >= (infty1) ? (infty2) : (val)) 192 assert(scip !=
NULL);
193 assert(cons !=
NULL);
199 assert(conshdlrdata !=
NULL);
200 assert(conshdlrdata->linvareventhdlr !=
NULL);
203 assert(consdata !=
NULL);
205 assert(linvarpos >= 0);
206 assert(linvarpos < consdata->nlinvars);
214 if( consdata->lincoefs[linvarpos] > 0.0 )
222 if( consdata->lincoefs[linvarpos] > 0.0 )
230 eventdata->
varidx = linvarpos;
234 if( consdata->lineventdata ==
NULL )
239 consdata->lineventdata[linvarpos] = eventdata;
263 assert(scip !=
NULL);
264 assert(cons !=
NULL);
273 assert(consdata !=
NULL);
275 assert(linvarpos >= 0);
276 assert(linvarpos < consdata->nlinvars);
277 assert(consdata->lineventdata !=
NULL);
278 assert(consdata->lineventdata[linvarpos] !=
NULL);
279 assert(consdata->lineventdata[linvarpos]->cons == cons);
280 assert(consdata->lineventdata[linvarpos]->varidx == linvarpos);
281 assert(consdata->lineventdata[linvarpos]->filterpos >= 0);
287 if( consdata->lincoefs[linvarpos] > 0.0 )
295 if( consdata->lincoefs[linvarpos] > 0.0 )
319 assert(scip !=
NULL);
320 assert(cons !=
NULL);
325 assert(consdata !=
NULL);
350 assert(scip !=
NULL);
351 assert(cons !=
NULL);
356 assert(consdata !=
NULL);
385 assert(scip !=
NULL);
386 assert(consdata !=
NULL);
391 assert(consdata->minlinactivityinf >= 0);
392 assert(consdata->maxlinactivityinf >= 0);
396 consdata->minlinactivityinf = 0;
397 consdata->maxlinactivityinf = 0;
405 if( consdata->nlinvars == 0 )
410 assert(consdata->lineventdata !=
NULL);
419 for( i = 0; i < consdata->nlinvars; ++i )
422 assert(consdata->lineventdata[i] !=
NULL);
423 if( consdata->lincoefs[i] >= 0.0 )
428 ++consdata->minlinactivityinf;
438 ++consdata->minlinactivityinf;
443 consdata->minlinactivity += consdata->lincoefs[i] * bnd;
452 for( i = 0; i < consdata->nlinvars; ++i )
454 assert(consdata->lineventdata[i] !=
NULL);
456 if( consdata->lincoefs[i] >= 0.0 )
461 ++consdata->maxlinactivityinf;
471 ++consdata->maxlinactivityinf;
476 consdata->maxlinactivity += consdata->lincoefs[i] * bnd;
479 assert(consdata->minlinactivity <= consdata->maxlinactivity || consdata->minlinactivityinf > 0 || consdata->maxlinactivityinf > 0);
496 assert(scip !=
NULL);
497 assert(consdata !=
NULL);
524 --consdata->minlinactivityinf;
525 assert(consdata->minlinactivityinf >= 0);
534 ++consdata->minlinactivityinf;
538 consdata->minlinactivity += coef * newbnd;
560 --consdata->maxlinactivityinf;
561 assert(consdata->maxlinactivityinf >= 0);
570 ++consdata->maxlinactivityinf;
574 consdata->maxlinactivity += coef * newbnd;
593 assert(scip !=
NULL);
594 assert(consdata !=
NULL);
620 --consdata->maxlinactivityinf;
621 assert(consdata->maxlinactivityinf >= 0);
630 ++consdata->maxlinactivityinf;
634 consdata->maxlinactivity += coef * newbnd;
656 --consdata->minlinactivityinf;
657 assert(consdata->minlinactivityinf >= 0);
666 ++consdata->minlinactivityinf;
670 consdata->minlinactivity += coef * newbnd;
686 assert(scip !=
NULL);
687 assert(event !=
NULL);
688 assert(eventdata !=
NULL);
689 assert(eventhdlr !=
NULL);
692 assert(cons !=
NULL);
695 assert(consdata !=
NULL);
699 assert(varidx < consdata->nlinvars);
705 consdata->isremovedfixingslin =
FALSE;
736 assert(scip !=
NULL);
737 assert(event !=
NULL);
738 assert(eventdata !=
NULL);
739 assert(eventhdlr !=
NULL);
742 assert(conshdlrdata !=
NULL);
743 assert(conshdlrdata->exprgraph !=
NULL);
752 SCIPdebugMsg(scip,
"changed %s bound on expression graph variable <%s> from %g to %g\n",
757 conshdlrdata->ispropagated =
FALSE;
761 if( eventtype & SCIP_EVENTTYPE_LBCHANGED )
786 conshdlrdata->isremovedfixings =
FALSE;
800 assert(exprgraph !=
NULL);
802 assert(varnode !=
NULL);
807 assert(conshdlrdata !=
NULL);
808 assert(conshdlrdata->exprgraph == exprgraph);
828 conshdlrdata->ispropagated =
FALSE;
840 assert(exprgraph !=
NULL);
842 assert(varnode !=
NULL);
847 assert(conshdlrdata !=
NULL);
848 assert(conshdlrdata->exprgraph == exprgraph);
875 assert(scip !=
NULL);
876 assert(consdata !=
NULL);
877 assert(consdata->exprtrees !=
NULL || consdata->nexprtrees == 0);
879 if( nexprtrees == 0 )
886 if( consdata->nlrow !=
NULL )
891 consdata->ispresolved =
FALSE;
893 consdata->iscurvchecked =
FALSE;
895 if( consdata->nexprtrees == 0 )
897 assert(consdata->exprtrees ==
NULL);
898 assert(consdata->nonlincoefs ==
NULL);
905 assert(consdata->exprtrees !=
NULL);
906 assert(consdata->nonlincoefs !=
NULL);
912 for( i = 0; i < nexprtrees; ++i )
914 assert(exprtrees[i] !=
NULL);
924 consdata->exprtrees[consdata->nexprtrees + i] = exprtrees[i];
927 consdata->nonlincoefs[consdata->nexprtrees + i] = (coefs !=
NULL ? coefs[i] : 1.0);
930 consdata->nexprtrees += nexprtrees;
948 assert(scip !=
NULL);
949 assert(consdata !=
NULL);
950 assert(consdata->exprtrees !=
NULL || consdata->nexprtrees == 0);
953 if( consdata->nexprtrees > 0 )
955 for( i = 0; i < consdata->nexprtrees; ++i )
957 assert(consdata->exprtrees[i] !=
NULL);
965 if( consdata->nlrow !=
NULL )
970 consdata->ispresolved =
FALSE;
972 consdata->iscurvchecked =
TRUE;
977 consdata->nexprtrees = 0;
993 assert(scip !=
NULL);
994 assert(consdata !=
NULL);
995 assert(consdata->nlinvars <= consdata->linvarssize);
997 if( num > consdata->linvarssize )
1004 if( consdata->lineventdata !=
NULL )
1008 consdata->linvarssize = newsize;
1010 assert(num <= consdata->linvarssize);
1033 assert(scip !=
NULL);
1034 assert(consdata !=
NULL);
1036 assert(nlinvars == 0 || linvars !=
NULL);
1037 assert(nlinvars == 0 || lincoefs !=
NULL);
1038 assert(nexprtrees == 0 || exprtrees !=
NULL);
1039 assert(nexprtrees == 0 || nonlincoefs !=
NULL);
1046 (*consdata)->minlinactivityinf = -1;
1047 (*consdata)->maxlinactivityinf = -1;
1049 (*consdata)->lhs = lhs;
1050 (*consdata)->rhs = rhs;
1056 (*consdata)->nlinvars = nlinvars;
1057 (*consdata)->linvarssize = nlinvars;
1060 for( i = 0; i < nlinvars; ++i )
1067 (*consdata)->linvarssorted =
TRUE;
1068 (*consdata)->linvarsmerged =
TRUE;
1073 (*consdata)->linvar_maydecrease = -1;
1074 (*consdata)->linvar_mayincrease = -1;
1090 assert(scip !=
NULL);
1091 assert(consdata !=
NULL);
1099 (*consdata)->linvarssorted =
TRUE;
1100 (*consdata)->linvarsmerged =
TRUE;
1102 (*consdata)->isremovedfixingslin =
TRUE;
1104 (*consdata)->linvar_maydecrease = -1;
1105 (*consdata)->linvar_mayincrease = -1;
1109 (*consdata)->minlinactivityinf = -1;
1110 (*consdata)->maxlinactivityinf = -1;
1113 (*consdata)->iscurvchecked =
TRUE;
1115 (*consdata)->ncuts = 0;
1129 assert(scip !=
NULL);
1130 assert(consdata !=
NULL);
1131 assert(*consdata !=
NULL);
1134 if( (*consdata)->linvarssize > 0 )
1136 for( i = 0; i < (*consdata)->nlinvars; ++i )
1138 assert((*consdata)->lineventdata ==
NULL || (*consdata)->lineventdata[i] ==
NULL);
1145 assert((*consdata)->linvars ==
NULL);
1146 assert((*consdata)->lincoefs ==
NULL);
1147 assert((*consdata)->lineventdata ==
NULL);
1149 if( (*consdata)->nexprtrees > 0 )
1151 assert((*consdata)->exprtrees !=
NULL);
1152 assert((*consdata)->nonlincoefs !=
NULL);
1153 assert((*consdata)->curvatures !=
NULL);
1154 for( i = 0; i < (*consdata)->nexprtrees; ++i )
1156 assert((*consdata)->exprtrees[i] !=
NULL);
1158 assert((*consdata)->exprtrees[i] ==
NULL);
1164 assert((*consdata)->exprtrees ==
NULL);
1165 assert((*consdata)->nonlincoefs ==
NULL);
1166 assert((*consdata)->curvatures ==
NULL);
1169 if( (*consdata)->nlrow !=
NULL )
1186 assert(consdata !=
NULL);
1188 if( consdata->linvarssorted )
1191 if( consdata->nlinvars <= 1 )
1193 consdata->linvarssorted =
TRUE;
1197 if( consdata->lineventdata ==
NULL )
1199 SCIPsortPtrReal((
void**)consdata->linvars, consdata->lincoefs, SCIPvarComp, consdata->nlinvars);
1205 SCIPsortPtrPtrReal((
void**)consdata->linvars, (
void**)consdata->lineventdata, consdata->lincoefs, SCIPvarComp, consdata->nlinvars);
1208 for( i = 0; i < consdata->nlinvars; ++i )
1209 if( consdata->lineventdata[i] !=
NULL )
1210 consdata->lineventdata[i]->varidx = i;
1213 consdata->linvarssorted =
TRUE;
1217 #ifdef SCIP_DISABLED_CODE 1220 int consdataFindLinearVar(
1227 assert(consdata !=
NULL);
1228 assert(var !=
NULL);
1230 if( consdata->nlinvars == 0 )
1235 if( !
SCIPsortedvecFindPtr((
void**)consdata->linvars, SCIPvarComp, (
void*)var, consdata->nlinvars, &pos) )
1250 assert(consdata !=
NULL);
1251 assert(oldpos >= 0);
1252 assert(oldpos < consdata->nlinvars);
1253 assert(newpos >= 0);
1254 assert(newpos < consdata->linvarssize);
1256 if( newpos == oldpos )
1259 consdata->linvars [newpos] = consdata->linvars [oldpos];
1260 consdata->lincoefs[newpos] = consdata->lincoefs[oldpos];
1262 if( consdata->lineventdata !=
NULL )
1264 assert(newpos >= consdata->nlinvars || consdata->lineventdata[newpos] ==
NULL);
1266 consdata->lineventdata[newpos] = consdata->lineventdata[oldpos];
1267 consdata->lineventdata[newpos]->varidx = newpos;
1269 consdata->lineventdata[oldpos] =
NULL;
1272 consdata->linvarssorted =
FALSE;
1287 assert(scip !=
NULL);
1288 assert(cons !=
NULL);
1289 assert(var !=
NULL);
1296 assert(consdata !=
NULL);
1306 assert(var !=
NULL);
1310 consdata->linvars [consdata->nlinvars] = var;
1311 consdata->lincoefs[consdata->nlinvars] = coef;
1313 ++consdata->nlinvars;
1326 consdata->minlinactivityinf = -1;
1327 consdata->maxlinactivityinf = -1;
1330 if( consdata->nlrow !=
NULL )
1341 consdata->ispresolved =
FALSE;
1342 consdata->isremovedfixingslin = consdata->isremovedfixingslin &&
SCIPvarIsActive(var);
1343 if( consdata->nlinvars == 1 )
1344 consdata->linvarssorted =
TRUE;
1346 consdata->linvarssorted = consdata->linvarssorted &&
1347 (
SCIPvarCompare(consdata->linvars[consdata->nlinvars-2], consdata->linvars[consdata->nlinvars-1]) == -1);
1349 consdata->linvarsmerged =
FALSE;
1366 assert(scip !=
NULL);
1367 assert(cons !=
NULL);
1370 assert(consdata !=
NULL);
1371 assert(0 <= pos && pos < consdata->nlinvars);
1373 var = consdata->linvars[pos];
1374 coef = consdata->lincoefs[pos];
1375 assert(var !=
NULL);
1393 --consdata->nlinvars;
1399 consdata->minlinactivityinf = -1;
1400 consdata->maxlinactivityinf = -1;
1403 if( consdata->nlrow !=
NULL )
1408 consdata->ispresolved =
FALSE;
1426 assert(scip !=
NULL);
1427 assert(cons !=
NULL);
1431 assert(consdata !=
NULL);
1433 assert(pos < consdata->nlinvars);
1436 var = consdata->linvars[pos];
1437 coef = consdata->lincoefs[pos];
1438 assert(var !=
NULL);
1445 consdata->minlinactivityinf = -1;
1446 consdata->maxlinactivityinf = -1;
1449 if( consdata->nlrow !=
NULL )
1455 if( newcoef * coef < 0.0 )
1473 consdata->lincoefs[pos] = newcoef;
1476 if( newcoef * coef < 0.0 )
1491 consdata->ispresolved =
FALSE;
1509 assert(scip !=
NULL);
1510 assert(cons !=
NULL);
1514 if( consdata->linvarsmerged )
1517 if( consdata->nlinvars == 0 )
1519 consdata->linvarsmerged =
TRUE;
1524 while( i < consdata->nlinvars )
1530 newcoef = consdata->lincoefs[i];
1531 for( j = i+1; j < consdata->nlinvars && consdata->linvars[i] == consdata->linvars[j]; ++j )
1532 newcoef += consdata->lincoefs[j];
1534 for( j = j-1; j > i; --j )
1551 consdata->linvarsmerged =
TRUE;
1570 assert(scip !=
NULL);
1571 assert(cons !=
NULL);
1575 if( !consdata->isremovedfixingslin )
1578 while( i < consdata->nlinvars )
1580 var = consdata->linvars[i];
1588 coef = consdata->lincoefs[i];
1603 consdata->lhs -= offset;
1608 consdata->rhs -= offset;
1639 for( j = 0; j < naggrs; ++j )
1644 if( aggrconstant != 0.0 )
1648 consdata->lhs -= coef * aggrconstant;
1653 consdata->rhs -= coef * aggrconstant;
1662 consdata->isremovedfixingslin =
TRUE;
1669 for( i = 0; i < consdata->nlinvars; ++i )
1723 if( requsize > varssize )
1727 varssize = requsize;
1736 for( j = 0; j < nvars; ++j )
1775 assert(scip !=
NULL);
1776 assert(conshdlr !=
NULL);
1777 assert(cons !=
NULL);
1780 assert(consdata !=
NULL);
1782 *infeasible =
FALSE;
1784 if( consdata->exprgraphnode ==
NULL )
1805 for( i = 0; i < consdata->nlinvars; ++i )
1819 for( i = 0; i < consdata->nlinvars; ++i )
1843 for( i = 0; i < consdata->nlinvars; ++i )
1857 for( i = 0; i < consdata->nlinvars; ++i )
1875 else if( constant != 0.0 )
1879 consdata->lhs -= constant;
1884 consdata->rhs -= constant;
1890 for( i = 0; i < nlinvars; ++i )
1912 assert(scip !=
NULL);
1913 assert(cons !=
NULL);
1916 assert(consdata !=
NULL);
1918 if( consdata->nlrow !=
NULL )
1923 if( consdata->nexprtrees == 0 )
1926 consdata->nlinvars, consdata->linvars, consdata->lincoefs,
1928 NULL, consdata->lhs, consdata->rhs,
1929 consdata->curvature) );
1931 else if( consdata->nexprtrees == 1 && consdata->nonlincoefs[0] == 1.0 )
1933 assert(consdata->exprtrees[0] !=
NULL);
1935 consdata->nlinvars, consdata->linvars, consdata->lincoefs,
1937 consdata->exprtrees[0], consdata->lhs, consdata->rhs,
1938 consdata->curvature) );
1948 assert(consdata->exprgraphnode !=
NULL);
1950 assert(conshdlrdata !=
NULL);
1954 consdata->nlinvars, consdata->linvars, consdata->lincoefs,
1956 exprtree, consdata->lhs, consdata->rhs,
1957 consdata->curvature) );
1981 assert(scip !=
NULL);
1982 assert(conshdlr !=
NULL);
1983 assert(cons !=
NULL);
1985 assert(upgraded !=
NULL);
1986 assert(nupgdconss !=
NULL);
1987 assert(naddconss !=
NULL);
2001 #ifdef SCIP_DEBUG_SOLUTION 2002 if( SCIPdebugIsMainscip(scip) )
2022 SCIPdebugMsg(scip,
"upgrading nonlinear constraint <%s> (up to %d upgrade methods):\n",
2034 SCIP_CALL(
conshdlrdata->nlconsupgrades[i]->nlconsupgd(scip, cons, &nupgdconss_, upgdconss, upgdconsssize) );
2036 while( nupgdconss_ < 0 )
2039 assert(-nupgdconss_ > upgdconsssize);
2040 upgdconsssize = -nupgdconss_;
2043 SCIP_CALL(
conshdlrdata->nlconsupgrades[i]->nlconsupgd(scip, cons, &nupgdconss_, upgdconss, upgdconsssize) );
2045 assert(nupgdconss_ != 0);
2048 if( nupgdconss_ > 0 )
2053 SCIPdebugMsg(scip,
" -> upgraded to %d constraints:\n", nupgdconss_);
2056 for( j = 0; j < nupgdconss_; ++j )
2067 *naddconss += nupgdconss_ - 1;
2099 assert(scip !=
NULL);
2100 assert(cons !=
NULL);
2103 assert(consdata !=
NULL);
2105 if( consdata->iscurvchecked )
2111 consdata->iscurvchecked =
TRUE;
2116 for( i = 0; i < consdata->nexprtrees; ++i )
2118 assert(consdata->exprtrees[i] !=
NULL);
2133 if( varboundssize == 0 )
2143 assert(varbounds !=
NULL);
2154 consdata->curvatures[i] =
SCIPexprcurvMultiply(consdata->nonlincoefs[i], consdata->curvatures[i]);
2166 consdata->curvature =
SCIPexprcurvAdd(consdata->curvature, consdata->curvatures[i]);
2193 assert(exprgraph !=
NULL);
2194 assert(node !=
NULL);
2195 assert(*node !=
NULL);
2196 assert(replacement !=
NULL);
2197 assert(conss !=
NULL || nconss == 0);
2210 for( c = 0; c < nconss; ++c )
2212 assert(conss[c] !=
NULL);
2215 assert(consdata !=
NULL);
2217 if( consdata->exprgraphnode == *node )
2220 consdata->exprgraphnode = replacement;
2224 consdata->ispresolved =
FALSE;
2254 assert(scip !=
NULL);
2255 assert(exprgraph !=
NULL);
2256 assert(node !=
NULL);
2257 assert(naddcons !=
NULL);
2269 #ifdef SCIP_DEBUG_SOLUTION 2270 if( SCIPdebugIsMainscip(scip) )
2291 SCIP_CALL(
SCIPcreateConsNonlinear2(scip, &auxcons, name, 1, &auxvar, &minusone, node, 0.0, 0.0,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
2323 assert(scip !=
NULL);
2324 assert(exprgraph !=
NULL);
2325 assert(node !=
NULL);
2326 assert(naddcons !=
NULL);
2335 assert(child !=
NULL);
2339 SCIPdebugMsg(scip,
"add auxiliary variable for child %p(%d,%d) with curvature %s\n",
2381 assert(scip !=
NULL);
2382 assert(exprgraph !=
NULL);
2383 assert(nfactors > 0);
2384 assert(factors !=
NULL);
2385 assert(resultnode !=
NULL);
2386 assert(naddcons !=
NULL);
2389 if( nfactors == 1 && (exponents ==
NULL || exponents[0] == 1.0) )
2391 *resultnode = factors[0];
2405 SCIPdebugMsg(scip,
"add auxiliary variable and constraint %s\n", name);
2412 #ifdef SCIP_DEBUG_SOLUTION 2414 if( SCIPdebugIsMainscip(scip) )
2429 reformfactors[0] = *resultnode;
2430 reformfactors[1] = factors[0];
2432 reformexp[1] = -exponents[0];
2453 assert(exponents !=
NULL);
2473 if( expnode ==
NULL )
2489 SCIPdebugMsg(scip,
"add auxiliary variable and constraint %s\n", name);
2496 #ifdef SCIP_DEBUG_SOLUTION 2497 if( SCIPdebugIsMainscip(scip) )
2506 SCIP_CALL(
SCIPcreateConsNonlinear2(scip, &auxcons, name, 1, &auxvar, &minusone, expnode, 0.0, 0.0,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
2517 *resultnode = expnode;
2523 if( nfactors == 2 && exponents !=
NULL && exponents[0] != 1.0 && exponents[0] == exponents[1] )
2532 SCIP_CALL(
reformMonomial(scip, exprgraph, 1, &productnode, &exponents[0], resultnode, createauxcons, mindepth, naddcons) );
2537 if( nfactors == 2 && exponents !=
NULL && exponents[0] == -exponents[1] )
2548 SCIPdebugMsg(scip,
"add auxiliary variable and constraint %s\n", name);
2555 #ifdef SCIP_DEBUG_SOLUTION 2557 if( SCIPdebugIsMainscip(scip) )
2560 if( exponents[0] > 0.0 )
2570 leftright[0] = auxvarnode;
2571 leftright[1] = exponents[0] > 0.0 ? factors[1] : factors[0];
2576 leftright[0] = auxconsnode;
2577 leftright[1] = exponents[0] > 0.0 ? factors[0] : factors[1];
2593 absexp = fabs(exponents[0]);
2594 SCIP_CALL(
reformMonomial(scip, exprgraph, 1, &auxvarnode, &absexp, resultnode, createauxcons, mindepth, naddcons) );
2612 half = nfactors / 2;
2614 assert(half < nfactors);
2631 productnode = parent;
2635 if( productnode == NULL )
2648 SCIPdebugMsg(scip,
"add auxiliary variable and constraint %s\n", name);
2655 #ifdef SCIP_DEBUG_SOLUTION 2656 if( SCIPdebugIsMainscip(scip) )
2665 SCIP_CALL(
SCIPcreateConsNonlinear2(scip, &auxcons, name, 1, &auxvar, &minusone, productnode, 0.0, 0.0,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
2676 *resultnode = productnode;
2712 assert(scip !=
NULL);
2713 assert(conshdlr !=
NULL);
2714 assert(conss !=
NULL || nconss == 0);
2715 assert(naddcons !=
NULL);
2724 SCIPdebugMsg(scip,
"skip reformulation, already done\n");
2732 assert(!domainerror);
2735 #ifdef SCIP_DEBUG_SOLUTION 2736 if( SCIPdebugIsMainscip(scip) )
2757 assert(node !=
NULL);
2775 SCIP_CALL(
conshdlrdata->nlconsupgrades[u]->nodereform(scip, exprgraph, node, naddcons, &reformnode) );
2776 if( reformnode ==
NULL )
2779 SCIPdebugMsg(scip,
"external nodereform reformulated node %p(%d,%d), replace by %p\n",
2790 if( u < conshdlrdata->nnlconsupgrades )
2817 assert(children !=
NULL || nchildren == 0);
2823 for( j = 0; j < nchildren; ++j )
2825 assert(children[j] !=
NULL);
2826 if( havenonlinparent ||
2852 if( havenonlinparent )
2855 assert(node !=
NULL);
2878 assert(child !=
NULL);
2882 SCIPdebugMessage(
"add auxiliary variable for child %p(%d,%d) with curvature %s operator %s\n",
2915 assert(node !=
NULL);
2939 assert(children !=
NULL);
2940 assert(nchildren == 2);
2952 #ifdef SCIP_DEBUG_SOLUTION 2953 if( SCIPdebugIsMainscip(scip) )
2963 auxchildren[0] = children[0];
2964 auxchildren[1] = children[1];
2965 auxchildren[2] = auxvarnode;
2973 quadelem.
coef = 1.0;
3015 assert(nchildren == 1);
3046 assert(nchildren == 1);
3074 if( havenonlinparent )
3077 assert(node !=
NULL);
3137 assert(nmonomials >= 1);
3139 if( nmonomials > 1 )
3172 for( m = 0; m < nmonomials; ++m )
3174 monomial = monomials[m];
3175 assert(monomial !=
NULL);
3181 assert(nfactors >= 1);
3182 assert(coef != 0.0);
3184 if( nfactors == 1 && exponents[0] == 1.0 )
3187 if( lincoefs ==
NULL )
3192 assert(0 <= childidxs[0] && childidxs[0] < nchildren);
3193 assert(lincoefs[childidxs[0]] == 0.0);
3194 lincoefs[childidxs[0]] = coef;
3196 else if( nfactors == 1 && exponents[0] == 2.0 )
3199 if( quadelems ==
NULL )
3203 quadelems[nquadelems].
idx1 = childidxs[0];
3204 quadelems[nquadelems].
idx2 = childidxs[0];
3205 quadelems[nquadelems].
coef = coef;
3208 else if( nfactors == 2 && exponents[0] == 1.0 && exponents[1] == 1.0 )
3211 if( quadelems ==
NULL )
3215 if( childidxs[0] < childidxs[1] )
3217 quadelems[nquadelems].
idx1 = childidxs[0];
3218 quadelems[nquadelems].
idx2 = childidxs[1];
3222 quadelems[nquadelems].
idx1 = childidxs[1];
3223 quadelems[nquadelems].
idx2 = childidxs[0];
3225 quadelems[nquadelems].
coef = coef;
3238 if( childrennew ==
NULL )
3242 assert(nfactors <= nchildren);
3243 for( f = 0; f < nfactors; ++f )
3244 childrennew[f] = children[childidxs[f]];
3254 assert(lincoefs !=
NULL || nquadelems > 0 || nmonomialnodes > 0);
3256 if( nquadelems > 0 )
3264 else if( lincoefs !=
NULL )
3272 assert(constant == 0.0);
3278 assert(nmonomialnodes > 0);
3279 if( nmonomialnodes > 1 )
3289 sumnode = monomialnodes[0];
3296 SCIPdebugMsg(scip,
"splitup polynomial into sum of %d nodes\n", nmonomialnodes);
3303 monomial = monomials[0];
3304 assert(monomial !=
NULL);
3310 assert(nfactors >= 1);
3311 assert(coef != 0.0);
3312 assert(children !=
NULL);
3371 for( f = 0; f < nfactors; ++f )
3376 if( childbounds.
inf < 0.0 && childbounds.
sup > 0.0 )
3379 if( exponents[f] < 0.0 )
3383 sum += exponents[f];
3386 if( childbounds.
inf < 0.0 )
3414 if( nnegative == nfactors || (nnegative == nfactors-1 &&
SCIPisGE(scip, sum, 1.0)) )
3417 SCIPdebugMsg(scip,
"%d-variate monomial is convex (modulo sign), child curv fits = %u\n", nfactors, expcurvpos);
3419 assert(!expcurvpos);
3422 else if( npositive == nfactors &&
SCIPisLE(scip, sum, 1.0) )
3425 SCIPdebugMsg(scip,
"%d-variate monomial is concave (modulo sign), child curv fits = %u\n", nfactors, expcurvneg);
3427 assert(!expcurvneg);
3440 for( f = 0; f < nfactors; ++f )
3445 assert(childbounds.
inf >= 0.0 || childbounds.
sup <= 0.0);
3448 if( childbounds.
inf < 0.0 )
3456 SCIPdebugMsg(scip,
"reform child %d (factor %d) with curv %s into var\n",
3480 assert(nfactors > 1 ||
3486 assert(!(nfactors == 2 && exponents[0] == 1.0 && exponents[1] == 1.0));
3490 if( nfactors > 1 || havenonlinparent || exponents[0] < 0.0 )
3498 for( f = 0; f < nfactors; ++f )
3499 factors[f] = children[childidxs[f]];
3502 factors = &children[childidxs[0]];
3504 SCIPdebugMsg(scip,
"reform monomial node, create auxvar = %u\n", havenonlinparent);
3535 SCIPdebugMsg(scip,
"no reformulation of monomial node, assume signpower will take care of it\n");
3570 for( c = 0; c < nconss; ++c )
3575 assert(conss[c] !=
NULL);
3582 assert(consdata !=
NULL);
3584 if( consdata->exprgraphnode ==
NULL )
3591 consdata->forcebackprop =
TRUE;
3604 assert(monomial !=
NULL);
3633 SCIPdebugMsg(scip,
"replace linear multivariate node %p(%d,%d) in expression of cons <%s> by auxvar\n",
3653 multivarnode = consdata->exprgraphnode;
3665 if( multivarnode == consdata->exprgraphnode )
3673 SCIPdebugMsg(scip,
"replace linear multivariate node %p(%d,%d) in expression of cons <%s> by auxvar\n",
3701 assert(scip !=
NULL);
3702 assert(cons !=
NULL);
3703 assert(maxelem !=
NULL);
3706 assert(consdata !=
NULL);
3707 assert(exprint !=
NULL);
3708 assert(consdata->nexprtrees != 0 || consdata->exprgraphnode ==
NULL);
3713 for( i = 0; i < consdata->nlinvars; ++i )
3714 if(
REALABS(consdata->lincoefs[i]) > *maxelem )
3715 *maxelem =
REALABS(consdata->lincoefs[i]);
3719 *maxelem = consdata->lincoefsmax;
3722 for( j = 0; j < consdata->nexprtrees; ++j )
3727 assert(consdata->exprtrees[j] !=
NULL);
3747 if(
REALABS(grad) > *maxelem )
3761 for( i = 0; i < nvars; ++i )
3763 grad[i] *= consdata->nonlincoefs[j];
3764 if(
REALABS(grad[i]) > *maxelem )
3781 if(
REALABS(grad) > *maxelem )
3792 for( i = 0; i < nvars; ++i )
3794 grad[i] *= consdata->nonlincoefs[j];
3795 if(
REALABS(grad[i]) > *maxelem )
3828 assert(scip !=
NULL);
3829 assert(conshdlr !=
NULL);
3830 assert(cons !=
NULL);
3831 assert(solviolbounds !=
NULL);
3838 assert(consdata !=
NULL);
3840 consdata->activity = 0.0;
3841 consdata->lhsviol = 0.0;
3842 consdata->rhsviol = 0.0;
3844 *solviolbounds =
FALSE;
3846 for( i = 0; i < consdata->nlinvars; ++i )
3850 var = consdata->linvars[i];
3860 *solviolbounds =
TRUE;
3865 activity = consdata->lincoefs[i] * varval;
3887 consdata->activity += activity;
3890 for( i = 0; i < consdata->nexprtrees; ++i )
3917 *solviolbounds =
TRUE;
3932 for( j = 0; j < nvars; ++j )
3944 *solviolbounds =
TRUE;
3973 activity = consdata->nonlincoefs[i] * val;
3991 consdata->activity += activity;
3994 if( consdata->nexprtrees == 0 && consdata->exprgraphnode !=
NULL )
4027 consdata->activity += val;
4031 consdata->lhsviol = consdata->lhs - consdata->activity;
4033 consdata->lhsviol = 0.0;
4036 consdata->rhsviol = consdata->activity - consdata->rhs;
4038 consdata->rhsviol = 0.0;
4050 if( (consdata->lhsviol > 0.0 || consdata->rhsviol > 0.0) && (consdata->exprgraphnode ==
NULL || consdata->nexprtrees > 0) )
4058 consdata->lhsviol /= norm;
4059 consdata->rhsviol /= norm;
4066 if( consdata->lhsviol > 0.0 )
4067 consdata->lhsviol /=
MAX(1.0,
REALABS(consdata->lhs));
4069 if( consdata->rhsviol > 0.0 )
4070 consdata->rhsviol /=
MAX(1.0,
REALABS(consdata->rhs));
4103 assert(scip !=
NULL);
4104 assert(conshdlr !=
NULL);
4105 assert(conss !=
NULL || nconss == 0);
4106 assert(maxviolcon !=
NULL);
4107 assert(solviolbounds !=
NULL);
4115 assert(conshdlrdata !=
NULL);
4116 assert(conshdlrdata->exprgraph !=
NULL);
4130 for( c = 0; c < nconss; ++c )
4132 assert(conss !=
NULL);
4133 assert(conss[c] !=
NULL);
4138 if( *solviolbounds )
4142 assert(consdata !=
NULL);
4144 viol =
MAX(consdata->lhsviol, consdata->rhsviol);
4148 *maxviolcon = conss[c];
4180 assert(scip !=
NULL);
4181 assert(cons !=
NULL);
4183 assert(rowprep !=
NULL);
4184 assert(success !=
NULL);
4187 assert(consdata !=
NULL);
4188 assert(exprtreeidx >= 0);
4189 assert(exprtreeidx < consdata->nexprtrees);
4190 assert(consdata->exprtrees !=
NULL);
4192 exprtree = consdata->exprtrees[exprtreeidx];
4193 assert(exprtree !=
NULL);
4196 treecoef = consdata->nonlincoefs[exprtreeidx];
4219 for( i = 0; i < nvars; ++i )
4224 grad[i] *= treecoef;
4225 constant -= grad[i] * x[i];
4236 if( grad[i] != 0.0 &&
SCIPisZero(scip, grad[i]) )
4253 SCIPdebugMsg(scip,
"var <%s> [%g,%g] has tiny gradient %g, replace coefficient by constant %g\n",
4255 constant += grad[i] * xbnd;
4261 SCIPdebugMsg(scip,
"skipping linearization, var <%s> [%g,%g] has tiny gradient %g but no finite bound in this direction\n",
4280 for( i = 0; i < nvars; ++i )
4286 else if(
SCIPisEQ(scip, x[i], ub) )
4289 x[i] += MIN3(0.9*(ub-x[i]), 0.9*(x[i]-lb), i*
SCIPfeastol(scip)) * (i%2 != 0 ? -1.0 : 1.0);
4338 assert(scip !=
NULL);
4339 assert(cons !=
NULL);
4340 assert(rowprep !=
NULL);
4341 assert(success !=
NULL);
4344 assert(consdata !=
NULL);
4345 assert(exprtreeidx >= 0);
4346 assert(exprtreeidx < consdata->nexprtrees);
4347 assert(consdata->exprtrees !=
NULL);
4349 exprtree = consdata->exprtrees[exprtreeidx];
4350 assert(exprtree !=
NULL);
4353 treecoef = consdata->nonlincoefs[exprtreeidx];
4364 SCIPdebugMsg(scip,
"skip secant for tree %d of constraint <%s> since variable is unbounded\n", exprtreeidx,
SCIPconsGetName(cons));
4372 SCIPdebugMsg(scip,
"skip secant for tree %d of constraint <%s> since function cannot be evaluated in lower bound\n", exprtreeidx,
SCIPconsGetName(cons));
4380 SCIPdebugMsg(scip,
"skip secant for tree %d of constraint <%s> since function cannot be evaluated in upper bound\n", exprtreeidx,
SCIPconsGetName(cons));
4390 constant =
MAX(vallb, valub);
4392 constant =
MIN(vallb, valub);
4396 slope = (valub - vallb) / (xub - xlb);
4397 constant = vallb - slope * xlb;
4445 assert(scip !=
NULL);
4446 assert(cons !=
NULL);
4447 assert(ref !=
NULL);
4448 assert(rowprep !=
NULL);
4449 assert(success !=
NULL);
4452 assert(consdata !=
NULL);
4453 assert(exprtreeidx >= 0);
4454 assert(exprtreeidx < consdata->nexprtrees);
4455 assert(consdata->exprtrees !=
NULL);
4457 exprtree = consdata->exprtrees[exprtreeidx];
4458 assert(exprtree !=
NULL);
4461 treecoef = consdata->nonlincoefs[exprtreeidx];
4481 ref[0] =
MIN(xub,
MAX(xlb, ref[0]));
4484 ref[1] =
MIN(yub,
MAX(ylb, ref[1]));
4508 SCIPdebugMsg(scip,
"skip secant for tree %d of constraint <%s> since function cannot be evaluated\n", exprtreeidx,
SCIPconsGetName(cons));
4518 else if(
SCIPisEQ(scip, xlb, xub) )
4527 SCIPdebugMsg(scip,
"skip secant for tree %d of constraint <%s> since function cannot be evaluated\n", exprtreeidx,
SCIPconsGetName(cons));
4534 coefy = (p4val - p1val) / (yub - ylb);
4535 constant = p1val - coefy * ylb;
4537 else if(
SCIPisEQ(scip, ylb, yub) )
4546 SCIPdebugMsg(scip,
"skip secant for tree %d of constraint <%s> since function cannot be evaluated\n", exprtreeidx,
SCIPconsGetName(cons));
4553 coefx = (p2val - p1val) / (xub - xlb);
4555 constant = p1val - coefx * xlb;
4574 SCIPdebugMsg(scip,
"skip secant for tree %d of constraint <%s> since function cannot be evaluated\n", exprtreeidx,
SCIPconsGetName(cons));
4591 SCIPdebugMsg(scip,
"p1 = (%g, %g), f(p1) = %g\n", p1[0], p1[1], p1val);
4592 SCIPdebugMsg(scip,
"p2 = (%g, %g), f(p2) = %g\n", p2[0], p2[1], p2val);
4593 SCIPdebugMsg(scip,
"p3 = (%g, %g), f(p3) = %g\n", p3[0], p3[1], p3val);
4594 SCIPdebugMsg(scip,
"p4 = (%g, %g), f(p4) = %g\n", p4[0], p4[1], p4val);
4607 if( ref[1] <= ylb + (yub - ylb)/(xub - xlb) * (ref[0] - xlb) )
4609 SCIP_CALL(
SCIPcomputeHyperplaneThreePoints(scip, p1[0], p1[1], p1val, p2[0], p2[1], p2val, p3[0], p3[1], p3val,
4610 &alpha, &beta, &gamma_, &delta) );
4612 assert(
SCIPisRelEQ(scip, alpha * p1[0] + beta * p1[1] + gamma_ * p1val, delta));
4613 assert(
SCIPisRelEQ(scip, alpha * p2[0] + beta * p2[1] + gamma_ * p2val, delta));
4614 assert(
SCIPisRelEQ(scip, alpha * p3[0] + beta * p3[1] + gamma_ * p3val, delta));
4617 if( alpha * p4[0] + beta * p4[1] + gamma_ * p4val > delta )
4624 p4val, &alpha, &beta, &gamma_, &delta) );
4626 assert(
SCIPisRelEQ(scip, alpha * p1[0] + beta * p1[1] + gamma_ * p1val, delta));
4627 assert(
SCIPisRelEQ(scip, alpha * p3[0] + beta * p3[1] + gamma_ * p3val, delta));
4628 assert(
SCIPisRelEQ(scip, alpha * p4[0] + beta * p4[1] + gamma_ * p4val, delta));
4631 if( alpha * p2[0] + beta * p2[1] + gamma_ * p2val > delta )
4637 SCIP_CALL(
SCIPcomputeHyperplaneThreePoints(scip, p1[0], p1[1], p1val, p3[0], p3[1], p3val, p4[0], p4[1], p4val,
4638 &alpha, &beta, &gamma_, &delta) );
4640 assert(
SCIPisRelEQ(scip, alpha * p1[0] + beta * p1[1] + gamma_ * p1val, delta));
4641 assert(
SCIPisRelEQ(scip, alpha * p3[0] + beta * p3[1] + gamma_ * p3val, delta));
4642 assert(
SCIPisRelEQ(scip, alpha * p4[0] + beta * p4[1] + gamma_ * p4val, delta));
4645 if( alpha * p2[0] + beta * p2[1] + gamma_ * p2val > delta )
4652 p3val, &alpha, &beta, &gamma_, &delta) );
4654 assert(
SCIPisRelEQ(scip, alpha * p1[0] + beta * p1[1] + gamma_ * p1val, delta));
4655 assert(
SCIPisRelEQ(scip, alpha * p2[0] + beta * p2[1] + gamma_ * p2val, delta));
4656 assert(
SCIPisRelEQ(scip, alpha * p3[0] + beta * p3[1] + gamma_ * p3val, delta));
4659 if( alpha * p4[0] + beta * p4[1] + gamma_ * p4val > delta )
4666 if( ref[1] <= yub + (ylb - yub)/(xub - xlb) * (ref[0] - xlb) )
4669 p4val, &alpha, &beta, &gamma_, &delta) );
4672 assert(
SCIPisRelEQ(scip, alpha * p1[0] + beta * p1[1] + gamma_ * p1val, delta));
4673 assert(
SCIPisRelEQ(scip, alpha * p2[0] + beta * p2[1] + gamma_ * p2val, delta));
4674 assert(
SCIPisRelLE(scip, alpha * p3[0] + beta * p3[1] + gamma_ * p3val, delta));
4675 assert(
SCIPisRelEQ(scip, alpha * p4[0] + beta * p4[1] + gamma_ * p4val, delta));
4682 p4val, &alpha, &beta, &gamma_, &delta) );
4685 assert(
SCIPisRelLE(scip, alpha * p1[0] + beta * p1[1] + gamma_ * p1val, delta));
4686 assert(
SCIPisRelEQ(scip, alpha * p2[0] + beta * p2[1] + gamma_ * p2val, delta));
4687 assert(
SCIPisRelEQ(scip, alpha * p3[0] + beta * p3[1] + gamma_ * p3val, delta));
4688 assert(
SCIPisRelEQ(scip, alpha * p4[0] + beta * p4[1] + gamma_ * p4val, delta));
4694 p4val, &alpha, &beta, &gamma_, &delta) );
4697 assert(
SCIPisRelLE(scip, alpha * p1[0] + beta * p1[1] + gamma_ * p1val, delta));
4698 assert(
SCIPisRelEQ(scip, alpha * p2[0] + beta * p2[1] + gamma_ * p2val, delta));
4699 assert(
SCIPisRelEQ(scip, alpha * p3[0] + beta * p3[1] + gamma_ * p3val, delta));
4700 assert(
SCIPisRelEQ(scip, alpha * p4[0] + beta * p4[1] + gamma_ * p4val, delta));
4707 p4val, &alpha, &beta, &gamma_, &delta) );
4710 assert(
SCIPisRelEQ(scip, alpha * p1[0] + beta * p1[1] + gamma_ * p1val, delta));
4711 assert(
SCIPisRelEQ(scip, alpha * p2[0] + beta * p2[1] + gamma_ * p2val, delta));
4712 assert(
SCIPisRelLE(scip, alpha * p3[0] + beta * p3[1] + gamma_ * p3val, delta));
4713 assert(
SCIPisRelEQ(scip, alpha * p4[0] + beta * p4[1] + gamma_ * p4val, delta));
4718 SCIPdebugMsg(scip,
"alpha = %g, beta = %g, gamma = %g, delta = %g\n", alpha, beta, gamma_, delta);
4729 coefx = -alpha / gamma_;
4730 coefy = -beta / gamma_;
4731 constant = delta / gamma_;
4806 assert(scip !=
NULL);
4807 assert(cons !=
NULL);
4808 assert(ref !=
NULL);
4809 assert(rowprep !=
NULL);
4810 assert(success !=
NULL);
4813 assert(consdata !=
NULL);
4814 assert(exprtreeidx >= 0);
4815 assert(exprtreeidx < consdata->nexprtrees);
4816 assert(consdata->exprtrees !=
NULL);
4818 exprtree = consdata->exprtrees[exprtreeidx];
4819 assert(exprtree !=
NULL);
4829 if( !warned_highdim_concave )
4832 warned_highdim_concave =
TRUE;
4837 treecoef = consdata->nonlincoefs[exprtreeidx];
4844 for( j = 0; j < nvars; ++j )
4848 SCIPdebugMsg(scip,
"cannot compute underestimator for concave because variable <%s> is unbounded\n",
SCIPvarGetName(vars[j]));
4873 nrows = (int)(1u << nvars);
4878 nnonz = nrows * ncols;
4884 for( i = 0; i < nrows; ++i )
4889 for( j = 0; j < nvars; ++j )
4893 if( ((
unsigned int)i >> j) & 0x1 )
4900 ind[i * ncols + j] = j;
4909 SCIPdebugMsg(scip,
"cannot compute underestimator for concave because constaint <%s> cannot be evaluated\n",
SCIPconsGetName(cons));
4913 funcval *= treecoef;
4927 val[i * ncols + nvars] = 1.0;
4928 ind[i * ncols + nvars] = nvars;
4932 for( j = 0; j < ncols; ++j )
4944 funcval *= treecoef;
4963 SCIPwarningMessage(scip,
"solving auxiliary LP for underestimator of concave function returned %d\n", lpret);
4982 SCIPwarningMessage(scip,
"computed cut does not underestimate concave function in refpoint\n");
4985 assert( doupper ||
SCIPisFeasLE(scip, lpobj, funcval) );
4986 assert(!doupper ||
SCIPisFeasLE(scip, funcval, lpobj) );
5095 for( c = 0; c < nchildren; ++c )
5162 assert( consdata !=
NULL );
5163 assert( exprtreeidx >= 0 );
5164 assert( exprtreeidx < consdata->nexprtrees );
5165 assert( consdata->exprtrees !=
NULL );
5166 assert( rowprep !=
NULL );
5167 assert( success !=
NULL );
5169 exprtree = consdata->exprtrees[exprtreeidx];
5170 assert( exprtree !=
NULL );
5189 for( i = 0; i < nvars; ++i )
5203 for( i = 0; i < nchildren; ++i )
5220 treecoef = consdata->nonlincoefs[exprtreeidx];
5221 constant *= treecoef;
5223 for( i = 0; i < nchildren; ++i )
5272 assert(scip !=
NULL);
5273 assert(cons !=
NULL);
5275 assert(rowprep !=
NULL);
5276 assert(success !=
NULL);
5279 assert(consdata !=
NULL);
5280 assert(exprtreeidx >= 0);
5281 assert(exprtreeidx < consdata->nexprtrees);
5282 assert(consdata->exprtrees !=
NULL);
5284 exprtree = consdata->exprtrees[exprtreeidx];
5285 assert(exprtree !=
NULL);
5304 for( i = 0; i < nvars; ++i )
5313 goto INTGRADESTIMATOR_CLEANUP;
5322 x[i] = (2.0*x[i] < lb+ub) ? lb : ub;
5339 SCIPdebugMsg(scip,
"Got nonfinite function value from evaluation of constraint %s tree %d. skipping interval gradient estimator.\n",
SCIPconsGetName(cons), exprtreeidx);
5340 goto INTGRADESTIMATOR_CLEANUP;
5343 treecoef = consdata->nonlincoefs[exprtreeidx];
5357 for( i = 0; i < nvars; ++i )
5367 else if( (overestimate && val == ub) ||
5368 (!overestimate && val == lb) )
5378 SCIPdebugMsg(scip,
"skip intgrad estimator because of infinite interval bound\n");
5379 goto INTGRADESTIMATOR_CLEANUP;
5382 constant -= coefs[i] * val;
5389 INTGRADESTIMATOR_CLEANUP:
5421 assert(scip !=
NULL);
5422 assert(cons !=
NULL);
5423 assert(row !=
NULL);
5430 assert(consdata !=
NULL);
5432 if( consdata->nexprtrees == 0 )
5455 for( i = 0; i < consdata->nexprtrees; ++i )
5472 else if( (side ==
SCIP_SIDETYPE_LEFT && (consdata->curvatures[i] & SCIP_EXPRCURV_CONVEX)) ||
5491 SCIPdebugMsg(scip,
"failed to generate polyhedral estimator for %d-dim concave function in exprtree %d, fall back to intervalgradient cut\n",
SCIPexprtreeGetNVars(consdata->exprtrees[i]), i);
5531 success = coefrange <= maxrange;
5580 assert(scip !=
NULL);
5581 assert(conshdlr !=
NULL);
5582 assert(conss !=
NULL || nconss == 0);
5583 assert(nusefulconss <= nconss);
5584 assert(result !=
NULL);
5591 if( bestefficacy !=
NULL )
5592 *bestefficacy = 0.0;
5596 assert(conss !=
NULL);
5604 assert(consdata !=
NULL);
5617 SCIP_CALL(
generateCut(scip,
conshdlrdata->exprinterpreter, conss[c],
NULL, sol, newsol ||
SCIPisInfinity(scip, consdata->activity), violside, &row, minefficacy,
conshdlrdata->cutmaxrange,
conshdlrdata->checkconvexexpensive,
conshdlrdata->assumeconvex) );
5630 efficacy = -feasibility;
5639 efficacy = -feasibility /
MAX(1.0, norm);
5648 efficacy = -feasibility /
MAX(1.0, minval);
5658 if( (
SCIPisGT(scip, efficacy, minefficacy) ||
5678 SCIPdebugMsg(scip,
"add cut with efficacy %g for constraint <%s> violated by %g\n", efficacy,
SCIPconsGetName(conss[c]),
MAX(consdata->lhsviol, consdata->rhsviol));
5681 if( bestefficacy !=
NULL && efficacy > *bestefficacy )
5682 *bestefficacy = efficacy;
5685 if( inenforcement && !
conshdlrdata->enfocutsremovable )
5690 SCIPdebugMsg(scip,
"drop cut since efficacy %g is too small (< %g)\n", efficacy, minefficacy);
5730 assert(scip !=
NULL);
5731 assert(conshdlr !=
NULL);
5732 assert(conss !=
NULL || nconss == 0);
5737 if( separatedlpsol !=
NULL )
5738 *separatedlpsol =
FALSE;
5740 for( c = 0; c < nconss; ++c )
5742 assert(conss[c] !=
NULL);
5750 assert(consdata !=
NULL);
5767 if( separatedlpsol !=
NULL )
5784 efficacy /=
MAX(1.0, norm);
5793 efficacy /=
MAX(1.0, minval);
5802 if( efficacy >= minefficacy )
5806 *separatedlpsol =
TRUE;
5809 assert( ! infeasible );
5834 assert(scip !=
NULL);
5835 assert(event !=
NULL);
5836 assert(eventdata !=
NULL);
5837 assert(eventhdlr !=
NULL);
5849 assert(sol !=
NULL);
5852 assert(conshdlrdata !=
NULL);
5862 assert(conss !=
NULL);
5887 assert(scip !=
NULL);
5888 assert(conshdlr !=
NULL);
5889 assert(conss !=
NULL || nconss == 0);
5893 for( c = 0; c < nconss; ++c )
5895 assert(conss !=
NULL);
5897 assert(consdata !=
NULL);
5899 if( consdata->nexprtrees == 0 )
5908 for( i = 0; i < consdata->nexprtrees; ++i )
5918 assert(var !=
NULL);
5932 SCIPdebugMsg(scip,
"registered %d branching candidates\n", *nnotify);
5955 assert(scip !=
NULL);
5956 assert(conss !=
NULL || nconss == 0);
5961 for( c = 0; c < nconss; ++c )
5963 assert(conss !=
NULL);
5965 assert(consdata !=
NULL);
5970 for( j = 0; j < consdata->nexprtrees; ++j )
5981 brvarval = ABS(val);
5988 if( *brvar !=
NULL )
6017 assert(scip !=
NULL);
6018 assert(conss !=
NULL || nconss == 0);
6019 assert(addedcons !=
NULL);
6020 assert(reduceddom !=
NULL);
6021 assert(infeasible !=
NULL);
6024 *reduceddom =
FALSE;
6025 *infeasible =
FALSE;
6027 for( c = 0; c < nconss; ++c )
6029 assert(conss !=
NULL);
6031 assert(consdata !=
NULL);
6036 lhs = consdata->lhs;
6037 rhs = consdata->rhs;
6039 for( i = 0; i < consdata->nexprtrees; ++i )
6076 if ( consdata->nlinvars == 0 )
6080 else if ( consdata->nlinvars == 1 )
6085 coef = *consdata->lincoefs;
6086 SCIPdebugMsg(scip,
"Linear constraint with one variable: %g <= %g <%s> <= %g\n", lhs, coef,
SCIPvarGetName(*consdata->linvars), rhs);
6117 assert(consdata->linvars[0] !=
NULL);
6118 SCIPwarningMessage(scip,
"Activity of nonlinear part is beyond SCIP's value for infinity. To enforce " 6119 "the constraint %s SCIP needs to tight bounds of %s to a value beyond +/- infinity. Please check if " 6129 SCIPdebugMsg(scip,
"Lower bound leads to infeasibility.\n");
6145 SCIPdebugMsg(scip,
"Upper bound leads to infeasibility.\n");
6159 consdata->nlinvars, consdata->linvars, consdata->lincoefs, lhs, rhs,
6165 SCIPdebugMsg(scip,
"replace violated nonlinear constraint <%s> by linear constraint after all nonlinear vars have been fixed\n",
SCIPconsGetName(conss[c]) );
6173 SCIPdebugMsg(scip,
"linear constraint is feasible, thus do not add\n");
6202 assert(scip !=
NULL);
6204 assert(var !=
NULL);
6205 assert(result !=
NULL);
6207 assert(nchgbds !=
NULL);
6263 assert(scip !=
NULL);
6265 assert(var !=
NULL);
6266 assert(result !=
NULL);
6268 assert(nchgbds !=
NULL);
6331 assert(scip !=
NULL);
6332 assert(conshdlr !=
NULL);
6333 assert(cons !=
NULL);
6334 assert(result !=
NULL);
6335 assert(nchgbds !=
NULL);
6338 assert(consdata !=
NULL);
6357 assert(consdata->minlinactivityinf >= 0);
6358 assert(consdata->maxlinactivityinf >= 0);
6359 assert(consdata->exprgraphnode !=
NULL || consdata->nexprtrees == 0);
6362 if( consdata->exprgraphnode !=
NULL )
6382 SCIPdebugMsg(scip,
"found constraint <%s> to be redundant: sides: [%g, %g], activity: [%g, %g]\n",
6390 SCIPdebugMsg(scip,
"found constraint <%s> to be infeasible; sides: [%g, %g], activity: [%g, %g], infeas: %.20g\n",
6403 for( i = 0; i < consdata->nlinvars; ++i )
6405 coef = consdata->lincoefs[i];
6406 var = consdata->linvars[i];
6421 if( consdata->minlinactivityinf == 0 )
6428 bnd -= consdata->minlinactivity;
6443 bnd -= consdata->minlinactivity;
6457 if( consdata->maxlinactivityinf == 0 )
6464 bnd -= consdata->maxlinactivity;
6479 bnd -= consdata->maxlinactivity;
6491 assert(coef < 0.0 );
6496 if( consdata->maxlinactivityinf == 0 )
6502 bnd = consdata->maxlinactivity;
6517 bnd = consdata->maxlinactivity;
6532 if( consdata->minlinactivityinf == 0 )
6538 bnd = consdata->minlinactivity;
6553 bnd = consdata->minlinactivity;
6594 assert(scip !=
NULL);
6595 assert(conshdlr !=
NULL);
6596 assert(result !=
NULL);
6597 assert(nchgbds !=
NULL);
6605 SCIPdebugMsg(scip,
"start backward propagation in expression graph\n");
6610 file = fopen(
"exprgraph_propconss1.dot",
"w");
6621 for( c = 0; c < nconss; ++c )
6624 assert(consdata !=
NULL);
6626 if( consdata->exprgraphnode ==
NULL )
6636 if( !
SCIPisInfinity(scip, -consdata->lhs) && consdata->maxlinactivityinf == 0 )
6637 bounds.
inf = consdata->lhs - consdata->maxlinactivity -
SCIPfeastol(scip);
6641 if( !
SCIPisInfinity(scip, consdata->rhs) && consdata->minlinactivityinf == 0 )
6651 consdata->forcebackprop =
FALSE;
6667 file = fopen(
"exprgraph_propconss2.dot",
"w");
6689 for( i = 0; i < nvars && *result !=
SCIP_CUTOFF; ++i )
6728 assert(scip !=
NULL);
6729 assert(conshdlr !=
NULL);
6730 assert(conss !=
NULL || nconss == 0);
6731 assert(result !=
NULL);
6732 assert(nchgbds !=
NULL);
6733 assert(ndelconss !=
NULL);
6752 SCIPdebugMsg(scip,
"starting domain propagation round %d for %d constraints\n", roundnr, nconss);
6765 file = fopen(
"exprgraph_propvars.dot",
"w");
6776 SCIPdebugMsg(scip,
"current bounds out of domain for some expression, do cutoff\n");
6782 for( c = 0; c < nconss && *result !=
SCIP_CUTOFF; ++c )
6784 assert(conss !=
NULL);
6791 assert(consdata !=
NULL);
6798 *result = propresult;
6817 *result = propresult;
6822 while( success && *result !=
SCIP_CUTOFF && ++roundnr < conshdlrdata->maxproprounds );
6838 consdata->linvar_maydecrease = -1;
6839 consdata->linvar_mayincrease = -1;
6843 for( i = 0; i < consdata->nlinvars; ++i )
6846 assert(consdata->lincoefs[i] != 0.0);
6847 if( consdata->lincoefs[i] > 0.0 )
6862 if( (consdata->linvar_maydecrease < 0) ||
6863 (
SCIPvarGetObj(consdata->linvars[consdata->linvar_maydecrease]) / consdata->lincoefs[consdata->linvar_maydecrease] >
SCIPvarGetObj(consdata->linvars[i]) / consdata->lincoefs[i]) )
6864 consdata->linvar_maydecrease = i;
6871 if( (consdata->linvar_mayincrease < 0) ||
6872 (
SCIPvarGetObj(consdata->linvars[consdata->linvar_mayincrease]) / consdata->lincoefs[consdata->linvar_mayincrease] >
SCIPvarGetObj(consdata->linvars[i]) / consdata->lincoefs[i]) )
6873 consdata->linvar_mayincrease = i;
6878 if( consdata->linvar_mayincrease >= 0 )
6880 SCIPdebugMsg(scip,
"may increase <%s> to become feasible\n",
SCIPvarGetName(consdata->linvars[consdata->linvar_mayincrease]));
6882 if( consdata->linvar_maydecrease >= 0 )
6884 SCIPdebugMsg(scip,
"may decrease <%s> to become feasible\n",
SCIPvarGetName(consdata->linvars[consdata->linvar_maydecrease]));
6913 assert(scip !=
NULL);
6914 assert(conshdlr !=
NULL);
6915 assert(conss !=
NULL || nconss == 0);
6916 assert(success !=
NULL);
6938 for( c = 0; c < nconss; ++c )
6941 assert(consdata !=
NULL);
6948 assert(!solviolbounds);
6949 viol = consdata->lhs - consdata->activity;
6954 assert(!solviolbounds);
6955 viol = consdata->rhs - consdata->activity;
6960 assert(viol != 0.0);
6961 if( consdata->linvar_mayincrease >= 0 &&
6962 (( viol > 0.0 && consdata->lincoefs[consdata->linvar_mayincrease] > 0.0) ||
6963 (viol < 0.0 && consdata->lincoefs[consdata->linvar_mayincrease] < 0.0)) )
6966 var = consdata->linvars[consdata->linvar_mayincrease];
6968 delta = viol / consdata->lincoefs[consdata->linvar_mayincrease];
6969 assert(delta > 0.0);
6974 delta =
MIN(
MAX(0.0, gap), delta);
6986 viol -= consdata->lincoefs[consdata->linvar_mayincrease] * delta;
6992 assert(viol != 0.0);
6993 if( consdata->linvar_maydecrease >= 0 &&
6994 (( viol > 0.0 && consdata->lincoefs[consdata->linvar_maydecrease] < 0.0) ||
6995 (viol < 0.0 && consdata->lincoefs[consdata->linvar_maydecrease] > 0.0)) )
6998 var = consdata->linvars[consdata->linvar_maydecrease];
7000 delta = viol / consdata->lincoefs[consdata->linvar_maydecrease];
7001 assert(delta < 0.0);
7006 delta =
MAX(
MIN(0.0, gap), delta);
7017 viol -= consdata->lincoefs[consdata->linvar_maydecrease] * delta;
7068 assert(scip !=
NULL);
7069 assert(conshdlr !=
NULL);
7070 assert(conss !=
NULL || nconss == 0);
7077 if( maxviolcons ==
NULL )
7092 assert(solinfeasible);
7095 if( !solinfeasible )
7101 assert(consdata !=
NULL);
7103 maxviol = consdata->lhsviol + consdata->rhsviol;
7107 sol ==
NULL ?
"LP" :
"relaxation");
7147 *result = propresult;
7158 SCIP_CALL(
separatePoint(scip, conshdlr, conss, nconss, nusefulconss, sol,
TRUE , minefficacy,
TRUE, &separateresult, &sepaefficacy) );
7167 SCIPdebugMsg(scip,
"separation succeeded (bestefficacy = %g, minefficacy = %g)\n", sepaefficacy, minefficacy);
7176 SCIPdebugMsg(scip,
"separation failed (bestefficacy = %g < %g = minefficacy ); max viol: %g\n", sepaefficacy, minefficacy, maxviol);
7183 if( nnotify == 0 && !solinfeasible && minefficacy > leastpossibleefficacy )
7186 SCIP_CALL(
separatePoint(scip, conshdlr, conss, nconss, nusefulconss, sol,
FALSE, leastpossibleefficacy,
TRUE, &separateresult, &sepaefficacy) );
7189 *result = separateresult;
7194 if( nnotify == 0 && !solinfeasible )
7208 SCIPdebugMsg(scip,
"All nonlinear variables seem to be fixed. Replace remaining violated nonlinear constraints by linear constraints.\n");
7216 else if ( addedcons )
7218 else if ( reduceddom )
7223 SCIPwarningMessage(scip,
"could not enforce feasibility by separating or branching; declaring solution with viol %g as feasible\n", maxviol);
7230 SCIPdebugMsg(scip,
"Could not find any usual branching variable candidate. Proposed variable <%s> with LP value %g for branching.\n",
7248 assert(scip !=
NULL);
7249 assert(conshdlr !=
NULL);
7267 assert(scip !=
NULL);
7268 assert(conshdlr !=
NULL);
7271 assert(conshdlrdata !=
NULL);
7272 assert(conshdlrdata->exprinterpreter !=
NULL);
7273 assert(conshdlrdata->exprgraph !=
NULL);
7280 for( i = 0; i < conshdlrdata->nnlconsupgrades; ++i )
7282 assert(conshdlrdata->nlconsupgrades[i] !=
NULL);
7301 assert(scip !=
NULL);
7302 assert(conshdlr !=
NULL);
7305 assert(conshdlrdata !=
NULL);
7307 conshdlrdata->subnlpheur =
SCIPfindHeur(scip,
"subnlp");
7308 conshdlrdata->trysolheur =
SCIPfindHeur(scip,
"trysol");
7311 conshdlrdata->naddedreformconss = 0;
7316 file = fopen(
"exprgraph_init.dot",
"w");
7334 assert(scip !=
NULL);
7335 assert(conshdlr !=
NULL);
7338 assert(conshdlrdata !=
NULL);
7340 conshdlrdata->subnlpheur =
NULL;
7341 conshdlrdata->trysolheur =
NULL;
7354 assert(scip !=
NULL);
7355 assert(conshdlr !=
NULL);
7356 assert(conss !=
NULL || nconss == 0);
7358 for( c = 0; c < nconss; ++c )
7365 assert(consdata !=
NULL);
7368 assert(consdata->nexprtrees == 0 || consdata->exprgraphnode !=
NULL);
7394 assert(scip !=
NULL);
7395 assert(conshdlr !=
NULL);
7396 assert(conss !=
NULL || nconss == 0);
7399 assert(conshdlrdata !=
NULL);
7401 havegraphchange =
FALSE;
7403 if( !conshdlrdata->isremovedfixings )
7406 assert(conshdlrdata->isremovedfixings);
7408 havegraphchange =
TRUE;
7413 SCIPdebugMsg(scip,
"expression graph simplifier found %schange, domain error = %u\n", havechange ?
"" :
"no ", domainerror);
7414 havegraphchange |= havechange;
7420 for( c = 0; c < nconss; ++c )
7422 assert(conss !=
NULL);
7430 assert(consdata !=
NULL);
7432 if( !consdata->isremovedfixingslin )
7437 if( !consdata->ispresolved || havegraphchange )
7443 assert(!infeasible);
7448 assert(consdata->isremovedfixingslin);
7449 assert(consdata->linvarsmerged);
7451 for( i = 0; i < consdata->nlinvars; ++i )
7455 if( consdata->exprgraphnode !=
NULL )
7469 exprtreessize, &nexprtrees, exprtrees, coefs) );
7470 assert(nexprtrees > 0);
7477 assert(consdata->nexprtrees > 0 );
7479 for( j = 0; j < consdata->nexprtrees; ++j )
7501 assert(scip !=
NULL);
7502 assert(conshdlr !=
NULL);
7503 assert(conss !=
NULL || nconss == 0);
7506 assert(conshdlrdata !=
NULL);
7508 for( c = 0; c < nconss; ++c )
7510 assert(conss !=
NULL);
7512 assert(consdata !=
NULL);
7519 consdata->lincoefsmax = 0.0;
7520 for( i = 0; i < consdata->nlinvars; ++i )
7522 consdata->lincoefsmin =
MIN(consdata->lincoefsmin,
REALABS(consdata->lincoefs[i]));
7523 consdata->lincoefsmax =
MAX(consdata->lincoefsmax,
REALABS(consdata->lincoefs[i]));
7529 if( consdata->nlrow ==
NULL )
7535 assert(consdata->nlrow !=
NULL);
7541 conshdlrdata->newsoleventfilterpos = -1;
7547 assert(eventhdlr !=
NULL);
7553 conshdlrdata->sepanlp =
FALSE;
7554 conshdlrdata->lastenfonode =
NULL;
7555 conshdlrdata->nenforounds = 0;
7568 assert(scip !=
NULL);
7569 assert(conshdlr !=
NULL);
7570 assert(conss !=
NULL || nconss == 0);
7573 assert(conshdlrdata !=
NULL);
7575 if( conshdlrdata->newsoleventfilterpos >= 0 )
7580 assert(eventhdlr !=
NULL);
7583 conshdlrdata->newsoleventfilterpos = -1;
7586 for( c = 0; c < nconss; ++c )
7589 assert(consdata !=
NULL);
7592 if( consdata->nlrow !=
NULL )
7606 assert(scip !=
NULL);
7607 assert(conshdlr !=
NULL);
7608 assert(cons !=
NULL);
7610 assert(consdata !=
NULL);
7616 assert((*consdata)->exprgraphnode ==
NULL);
7620 assert(*consdata ==
NULL);
7634 assert(sourcedata !=
NULL);
7637 sourcedata->lhs, sourcedata->rhs,
7638 sourcedata->nlinvars, sourcedata->linvars, sourcedata->lincoefs,
7639 sourcedata->nexprtrees, sourcedata->exprtrees, sourcedata->nonlincoefs,
7643 if( sourcedata->iscurvchecked && sourcedata->nexprtrees > 0 )
7645 BMScopyMemoryArray(targetdata->curvatures, sourcedata->curvatures, sourcedata->nexprtrees);
7646 targetdata->curvature = sourcedata->curvature;
7647 targetdata->iscurvchecked =
TRUE;
7650 for( i = 0; i < targetdata->nlinvars; ++i )
7656 for( i = 0; i < targetdata->nexprtrees; ++i )
7668 SCIPdebugMsg(scip,
"created transformed nonlinear constraint ");
7689 assert(scip !=
NULL);
7690 assert(conshdlr !=
NULL);
7691 assert(conss !=
NULL || nconss == 0);
7694 assert(conshdlrdata !=
NULL);
7696 *infeasible =
FALSE;
7698 for( c = 0; c < nconss && !(*infeasible); ++c )
7700 assert(conss[c] !=
NULL);
7705 assert(consdata !=
NULL);
7709 if( consdata->nexprtrees == 0 )
7711 assert(consdata->exprgraphnode ==
NULL);
7723 haveunboundedvar =
FALSE;
7724 for( j = 0; j < consdata->nexprtrees; ++j )
7729 for( i = 0; i < nvars; ++i )
7732 assert(var !=
NULL);
7741 haveunboundedvar =
TRUE;
7793 for( j = 0; j < consdata->nexprtrees; ++j )
7811 assert(scip !=
NULL);
7812 assert(conshdlr !=
NULL);
7813 assert(conss !=
NULL || nconss == 0);
7814 assert(result !=
NULL);
7819 assert(conshdlrdata !=
NULL);
7828 if( maxviolcon ==
NULL )
7834 if(
SCIPgetDepth(scip) == 0 && !conshdlrdata->sepanlp &&
7851 for( c = 0; c < nconss; ++c )
7853 assert(conss[c] !=
NULL);
7856 assert(consdata !=
NULL);
7875 if( conshdlrdata->subnlpheur !=
NULL )
7890 SCIPdebugMsg(scip,
"solved NLP relax, solution status: %d\n", solstat);
7896 conshdlrdata->sepanlp =
TRUE;
7900 SCIPdebugMsg(scip,
"NLP relaxation is globally infeasible, thus can cutoff node\n");
7912 assert(nlpsol !=
NULL);
7915 if( solvednlp && conshdlrdata->trysolheur !=
NULL )
7925 if( nfracvars == 0 )
7936 if( lpsolseparated )
7938 SCIPdebugMsg(scip,
"linearization cuts separate LP solution\n");
7950 SCIP_CALL(
separatePoint(scip, conshdlr, conss, nconss, nusefulconss,
NULL,
TRUE, conshdlrdata->mincutefficacysepa,
FALSE, result,
NULL) );
7963 assert(scip !=
NULL);
7964 assert(conshdlr !=
NULL);
7965 assert(conss !=
NULL || nconss == 0);
7966 assert(sol !=
NULL);
7967 assert(result !=
NULL);
7970 assert(conshdlrdata !=
NULL);
7981 if( maxviolcon ==
NULL )
7987 SCIP_CALL(
separatePoint(scip, conshdlr, conss, nconss, nusefulconss, sol,
FALSE, conshdlrdata->mincutefficacysepa,
FALSE, result,
NULL) );
8025 assert(scip !=
NULL);
8026 assert(conss !=
NULL || nconss == 0);
8031 assert(!solviolbounds);
8033 if( maxviolcons ==
NULL )
8051 *result = propresult;
8058 for( c = 0; c < nconss; ++c )
8060 assert(conss !=
NULL);
8062 assert(consdata !=
NULL);
8067 for( i = 0; i < consdata->nlinvars; ++i )
8069 var = consdata->linvars[i];
8077 for( j = 0; j < consdata->nexprtrees; ++j )
8093 SCIPdebugMsg(scip,
"All variables in violated constraints fixed (up to epsilon). Cannot find branching candidate. Forcing solution of LP.\n");
8113 assert(scip !=
NULL);
8114 assert(conss !=
NULL || nconss == 0);
8115 assert(result !=
NULL);
8118 assert(conshdlrdata !=
NULL);
8127 assert(conshdlrdata->exprgraph !=
NULL);
8139 maypropfeasible = conshdlrdata->linfeasshift && (conshdlrdata->trysolheur !=
NULL) &&
8144 for( c = 0; c < nconss; ++c )
8146 assert(conss !=
NULL);
8148 assert(!solviolbounds);
8151 assert(consdata !=
NULL);
8162 SCIPinfoMessage(scip,
NULL,
"violation: left hand side is violated by %.15g (scaled: %.15g)\n", consdata->lhs - consdata->activity, consdata->lhsviol);
8166 SCIPinfoMessage(scip,
NULL,
"violation: right hand side is violated by %.15g (scaled: %.15g)\n", consdata->activity - consdata->rhs, consdata->rhsviol);
8170 if( (conshdlrdata->subnlpheur ==
NULL || sol ==
NULL) && !maypropfeasible && !completely )
8173 if( consdata->lhsviol > maxviol || consdata->rhsviol > maxviol )
8174 maxviol =
MAX(consdata->lhsviol, consdata->rhsviol);
8178 maypropfeasible =
FALSE;
8180 if( maypropfeasible )
8190 if( !(consdata->linvar_mayincrease >= 0 && consdata->lincoefs[consdata->linvar_mayincrease] > 0.0) &&
8191 ! (consdata->linvar_maydecrease >= 0 && consdata->lincoefs[consdata->linvar_maydecrease] < 0.0) )
8192 maypropfeasible =
FALSE;
8199 if( !(consdata->linvar_mayincrease >= 0 && consdata->lincoefs[consdata->linvar_mayincrease] < 0.0) &&
8200 ! (consdata->linvar_maydecrease >= 0 && consdata->lincoefs[consdata->linvar_maydecrease] > 0.0) )
8201 maypropfeasible =
FALSE;
8237 assert(scip !=
NULL);
8238 assert(conshdlr !=
NULL);
8239 assert(conss !=
NULL || nconss == 0);
8240 assert(result !=
NULL);
8261 assert(scip !=
NULL);
8262 assert(conshdlr !=
NULL);
8263 assert(conss !=
NULL || nconss == 0);
8264 assert(result !=
NULL);
8269 assert(conshdlrdata !=
NULL);
8270 assert(conshdlrdata->exprgraph !=
NULL);
8272 havegraphchange =
FALSE;
8274 if( !conshdlrdata->isremovedfixings )
8277 assert(conshdlrdata->isremovedfixings);
8279 havegraphchange =
TRUE;
8283 SCIPdebugMsg(scip,
"expression graph simplifier found %schange, domain error = %u\n", havechange ?
"" :
"no ", domainerror);
8292 havegraphchange |= havechange;
8295 tryupgrades = havegraphchange;
8300 for( c = 0; c < nconss; ++c )
8302 assert(conss !=
NULL);
8305 assert(consdata !=
NULL);
8312 if( !consdata->isremovedfixingslin )
8315 assert(consdata->isremovedfixingslin);
8325 if( !consdata->ispresolved || havegraphchange )
8338 if( consdata->nlinvars == 0 && consdata->exprgraphnode ==
NULL )
8364 consdata->ispresolved =
FALSE;
8367 if( !consdata->ispresolved )
8382 SCIPdebugMsg(scip,
"propagating variable bounds through expression graph found that some expressions cannot be evaluated w.r.t. current bounds, thus cutoff\n");
8387 for( c = 0; c < nconss; ++c )
8390 assert(consdata !=
NULL);
8393 if( !consdata->ispresolved || havegraphchange )
8405 consdata->ispresolved =
TRUE;
8413 switch( propresult )
8419 SCIPdebugMsg(scip,
"propagation says problem is infeasible in presolve\n");
8427 if( conshdlrdata->reformulate && !conshdlrdata->assumeconvex )
8435 int naddconssbefore;
8437 SCIPdebugMsg(scip,
"reformulating expression graph\n");
8439 naddconssbefore = conshdlrdata->naddedreformconss;
8442 if( conshdlrdata->naddedreformconss > naddconssbefore )
8445 *naddconss += conshdlrdata->naddedreformconss - naddconssbefore;
8448 for( c = 0; c < nconss; ++c )
8450 assert(conss[c] !=
NULL);
8453 assert(consdata !=
NULL);
8455 consdata->ispresolved =
FALSE;
8474 assert(scip !=
NULL);
8475 assert(cons !=
NULL);
8483 assert(consdata !=
NULL);
8488 for( i = 0; i < consdata->nlinvars; ++i )
8490 if( consdata->lincoefs[i] > 0 )
8524 assert(scip !=
NULL);
8525 assert(conshdlr !=
NULL);
8526 assert(cons !=
NULL);
8530 assert(conshdlrdata !=
NULL);
8531 assert(conshdlrdata->exprgraph !=
NULL);
8534 assert(consdata !=
NULL);
8538 if( consdata->nexprtrees > 0 )
8542 assert(consdata->exprgraphnode ==
NULL);
8546 assert(consdata->exprgraphnode !=
NULL);
8556 conshdlrdata->isreformulated =
FALSE;
8561 consdata->forcebackprop =
TRUE;
8563 else if( consdata->exprgraphnode !=
NULL )
8566 conshdlrdata->isreformulated =
FALSE;
8571 consdata->forcebackprop =
TRUE;
8584 assert(scip !=
NULL);
8585 assert(conshdlr !=
NULL);
8586 assert(cons !=
NULL);
8590 assert(conshdlrdata !=
NULL);
8591 assert(conshdlrdata->exprgraph !=
NULL);
8594 assert(consdata !=
NULL);
8595 assert(consdata->exprgraphnode !=
NULL || consdata->nexprtrees == 0);
8599 if( consdata->exprgraphnode !=
NULL )
8601 if( consdata->nexprtrees == 0 )
8628 assert(scip !=
NULL);
8629 assert(conshdlr !=
NULL);
8630 assert(cons !=
NULL);
8635 assert(conshdlrdata !=
NULL);
8636 assert(conshdlrdata->exprgraph !=
NULL);
8639 assert(consdata !=
NULL);
8643 if( consdata->exprgraphnode !=
NULL )
8650 consdata->isremovedfixingslin =
TRUE;
8651 for( i = 0; i < consdata->nlinvars; ++i )
8655 consdata->isremovedfixingslin = consdata->isremovedfixingslin &&
SCIPvarIsActive(consdata->linvars[i]);
8669 assert(scip !=
NULL);
8670 assert(conshdlr !=
NULL);
8671 assert(cons !=
NULL);
8675 assert(conshdlrdata !=
NULL);
8676 assert(conshdlrdata->exprgraph !=
NULL);
8679 assert(consdata !=
NULL);
8680 assert(consdata->lineventdata !=
NULL || consdata->nlinvars == 0);
8685 if( consdata->exprgraphnode !=
NULL )
8690 for( i = 0; i < consdata->nlinvars; ++i )
8706 assert(scip !=
NULL);
8707 assert(cons !=
NULL);
8710 assert(consdata !=
NULL);
8715 && !
SCIPisEQ(scip, consdata->lhs, consdata->rhs) )
8719 if( consdata->nlinvars == 0 && consdata->nexprtrees == 0 && consdata->exprgraphnode == 0 )
8725 if( consdata->nexprtrees > 0 )
8727 for( j = 0; j < consdata->nexprtrees; ++j )
8729 if( j > 0 || consdata->nonlincoefs[j] != 1.0 )
8734 else if( consdata->exprgraphnode !=
NULL )
8740 assert(conshdlrdata !=
NULL);
8748 for( j = 0; j < consdata->nlinvars; ++j )
8758 if(
SCIPisEQ(scip, consdata->lhs, consdata->rhs) )
8791 assert(scip !=
NULL);
8792 assert(cons !=
NULL);
8793 assert(sourcescip !=
NULL);
8794 assert(sourceconshdlr !=
NULL);
8795 assert(sourcecons !=
NULL);
8796 assert(varmap !=
NULL);
8797 assert(valid !=
NULL);
8800 assert(consdata !=
NULL);
8807 if( consdata->nlinvars != 0 )
8810 for( i = 0; i < consdata->nlinvars && *valid; ++i )
8812 SCIP_CALL(
SCIPgetVarCopy(sourcescip, scip, consdata->linvars[i], &linvars[i], varmap, consmap, global, valid) );
8813 assert(!*valid || linvars[i] !=
NULL);
8820 if( *valid && consdata->nexprtrees > 0 )
8824 nonlincoefs = consdata->nonlincoefs;
8825 nexprtrees = consdata->nexprtrees;
8831 for( j = 0; j < consdata->nexprtrees; ++j )
8837 assert(!*valid || nonlinvars[i] !=
NULL);
8852 if( *valid && consdata->nexprtrees == 0 && consdata->exprgraphnode !=
NULL )
8868 assert(!*valid || nonlinvars[i] !=
NULL);
8875 consdata->nlinvars, linvars, consdata->lincoefs,
8876 nexprtrees, exprtrees, nonlincoefs,
8877 consdata->lhs, consdata->rhs,
8878 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) );
8882 targetconsdata->curvature = consdata->curvature;
8883 targetconsdata->iscurvchecked = consdata->iscurvchecked && global;
8887 if( exprtrees !=
NULL )
8889 for( j = 0; j < nexprtrees; ++j )
8891 if( exprtrees[j] !=
NULL )
8909 assert(cons !=
NULL);
8912 assert(consdata !=
NULL);
8916 if( varssize < consdata->nlinvars )
8923 cnt = consdata->nlinvars;
8925 if( consdata->exprgraphnode !=
NULL )
8932 assert(conshdlrdata !=
NULL);
8940 if( varsusage[i] == 0 )
8943 if( cnt >= varssize )
8961 for( e = 0; e < consdata->nexprtrees; ++e )
8965 assert(exprvars !=
NULL || nexprvars == 0);
8967 if( cnt + nexprvars > varssize )
8988 assert(consdata !=
NULL);
8990 *nvars = consdata->nlinvars;
8992 if( consdata->exprgraphnode !=
NULL )
8999 assert(conshdlrdata !=
NULL);
9006 if( varsusage[i] > 0 )
9015 for( e = 0; e < consdata->nexprtrees; ++e )
9036 char* nonconstendptr;
9037 const char* exprstart;
9038 const char* exprlastchar;
9043 SCIPdebugMsg(scip,
"cons_nonlinear::consparse parsing %s\n",str);
9045 assert(scip !=
NULL);
9046 assert(success !=
NULL);
9047 assert(str !=
NULL);
9048 assert(name !=
NULL);
9049 assert(cons !=
NULL);
9067 if( isdigit((
unsigned char)str[0]) || ((str[0] ==
'-' || str[0] ==
'+') && isdigit((
unsigned char)str[1])) )
9075 endptr = nonconstendptr;
9078 while( isspace((
unsigned char)*endptr) )
9081 if( endptr[0] !=
'<' || endptr[1] !=
'=' )
9092 while( isspace((
unsigned char)*str) )
9098 while( !(strncmp(endptr,
"[free]", 6) == 0) &&
9099 !(endptr[0] ==
'<' && endptr[1] ==
'=') &&
9100 !(endptr[0] ==
'=' && endptr[1] ==
'=') &&
9101 !(endptr[0] ==
'>' && endptr[1] ==
'=') &&
9102 !(endptr[0] ==
'\0') )
9106 exprlastchar = endptr - 1;
9112 while( isspace((
unsigned char)*str) )
9116 if( strncmp(str,
"[free]", 6) == 0 )
9180 curvarname = varnames;
9181 for( i = 0; i < nvars; ++i )
9183 assert(*curvarname == i);
9186 exprvars[i] =
SCIPfindVar(scip, (
char*)curvarname);
9187 if( exprvars[i] ==
NULL )
9189 SCIPerrorMessage(
"Unknown SCIP variable <%s> encountered in expression.\n", (
char*)curvarname);
9194 curvarname += (strlen((
char*)curvarname) + 1)/
sizeof(
int) + 1;
9206 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) );
9239 consEnfolpNonlinear, consEnfopsNonlinear, consCheckNonlinear, consLockNonlinear,
9241 assert(conshdlr !=
NULL);
9272 "minimal efficacy for a cut to be added to the LP during separation; overwrites separating/efficacy",
9276 "minimal target efficacy of a cut in order to add it to relaxation during enforcement as a factor of the feasibility tolerance (may be ignored)",
9280 "whether scaling of infeasibility is 'o'ff, by sup-norm of function 'g'radient, or by left/right hand 's'ide",
9284 "maximal coef range of a cut (maximal coefficient divided by minimal coefficient) in order to be added to LP relaxation",
9288 "whether to try to make solutions in check function feasible by shifting a linear variable (esp. useful if constraint was actually objective function)",
9293 "whether to apply expensive curvature checking methods",
9298 "whether to assume that nonlinear functions in inequalities (<=) are convex (disables reformulation)",
9302 "limit on number of propagation rounds for a single constraint within one round of SCIP propagation",
9306 "whether to reformulate expression graph",
9310 "maximal exponent where still expanding non-monomial polynomials in expression simplification",
9314 "minimal required fraction of continuous variables in problem to use solution of NLP relaxation in root for separation",
9318 "are cuts added during enforcement removable from the LP in the same node?",
9323 processLinearVarEvent,
NULL) );
9332 processNewSolutionEvent,
NULL) );
9355 const char* conshdlrname
9365 assert(conshdlrname !=
NULL );
9368 if( nonlinconsupgd ==
NULL && nodereform ==
NULL )
9373 if( conshdlr ==
NULL )
9380 assert(conshdlrdata !=
NULL);
9383 for( i = conshdlrdata->nnlconsupgrades - 1; i >= 0; --i )
9385 if( conshdlrdata->nlconsupgrades[i]->nlconsupgd == nonlinconsupgd && conshdlrdata->nlconsupgrades[i]->nodereform == nodereform)
9388 SCIPwarningMessage(scip,
"Try to add already known upgrade method pair (%p,%p) for constraint handler <%s>.\n", nonlinconsupgd, nodereform, conshdlrname);
9396 nlconsupgrade->nlconsupgd = nonlinconsupgd;
9397 nlconsupgrade->nodereform = nodereform;
9398 nlconsupgrade->
priority = priority;
9402 assert(conshdlrdata->nnlconsupgrades <= conshdlrdata->nlconsupgradessize);
9403 if( conshdlrdata->nnlconsupgrades+1 > conshdlrdata->nlconsupgradessize )
9409 conshdlrdata->nlconsupgradessize = newsize;
9411 assert(conshdlrdata->nnlconsupgrades+1 <= conshdlrdata->nlconsupgradessize);
9413 for( i = conshdlrdata->nnlconsupgrades; i > 0 && conshdlrdata->nlconsupgrades[i-1]->priority < nlconsupgrade->
priority; --i )
9414 conshdlrdata->nlconsupgrades[i] = conshdlrdata->nlconsupgrades[i-1];
9415 assert(0 <= i && i <= conshdlrdata->nnlconsupgrades);
9416 conshdlrdata->nlconsupgrades[i] = nlconsupgrade;
9417 conshdlrdata->nnlconsupgrades++;
9423 paramname, paramdesc,
9475 assert(linvars !=
NULL || nlinvars == 0);
9476 assert(lincoefs !=
NULL || nlinvars == 0);
9477 assert(exprtrees !=
NULL || nexprtrees == 0);
9478 assert(modifiable ==
FALSE);
9482 if( conshdlr ==
NULL )
9491 consdata->lhs = lhs;
9492 consdata->rhs = rhs;
9495 SCIP_CALL(
SCIPcreateCons(scip, cons, name, conshdlr, consdata, initial, separate, enforce, check, propagate,
9496 local, modifiable, dynamic, removable, stickingatnode) );
9500 for( i = 0; i < nlinvars; ++i )
9541 assert(scip !=
NULL);
9544 nonlincoefs, lhs, rhs,
9596 assert(modifiable ==
FALSE);
9601 if( conshdlr ==
NULL )
9610 consdata->lhs = lhs;
9611 consdata->rhs = rhs;
9614 SCIP_CALL(
SCIPcreateCons(scip, cons, name, conshdlr, consdata, initial, separate, enforce, check, propagate,
9615 local, modifiable, dynamic, removable, stickingatnode) );
9619 for( i = 0; i < nlinvars; ++i )
9628 if( exprgraphnode !=
NULL )
9630 consdata->exprgraphnode = exprgraphnode;
9632 consdata->iscurvchecked =
FALSE;
9667 assert(scip !=
NULL);
9683 assert(scip !=
NULL);
9684 assert(cons !=
NULL);
9685 assert(var !=
NULL);
9704 assert(scip !=
NULL);
9705 assert(cons !=
NULL);
9708 assert(exprtrees !=
NULL || nexprtrees == 0);
9726 assert(scip !=
NULL);
9727 assert(cons !=
NULL);
9730 assert(exprtrees !=
NULL || nexprtrees == 0);
9746 assert(cons !=
NULL);
9747 assert(nlrow !=
NULL);
9750 assert(consdata !=
NULL);
9752 if( consdata->nlrow ==
NULL )
9756 assert(consdata->nlrow !=
NULL);
9757 *nlrow = consdata->nlrow;
9768 assert(cons !=
NULL);
9780 assert(cons !=
NULL);
9792 assert(cons !=
NULL);
9804 assert(cons !=
NULL);
9817 assert(cons !=
NULL);
9830 assert(cons !=
NULL);
9843 assert(cons !=
NULL);
9855 assert(cons !=
NULL);
9867 assert(cons !=
NULL);
9882 assert(scip !=
NULL);
9883 assert(cons !=
NULL);
9886 assert(conshdlr !=
NULL);
9907 assert(scip !=
NULL);
9908 assert(cons !=
NULL);
9909 assert(curvature !=
NULL);
9912 assert(consdata !=
NULL);
9915 assert(conshdlr !=
NULL);
9919 if( checkcurv && !consdata->iscurvchecked )
9924 *curvature = consdata->curvature;
9941 assert(scip !=
NULL);
9942 assert(cons !=
NULL);
9943 assert(curvatures !=
NULL);
9947 assert(consdata !=
NULL);
9950 assert(conshdlr !=
NULL);
9956 if( checkcurv && !consdata->iscurvchecked )
9961 *curvatures = consdata->curvatures;
9978 assert(scip !=
NULL);
9979 assert(cons !=
NULL);
9980 assert(violation !=
NULL);
9985 SCIPwarningMessage(scip,
"SCIPgetViolationNonlinear is not available for active constraints during presolve.\n");
9991 assert(conshdlr !=
NULL);
9997 SCIPerrorMessage(
"Solution passed to SCIPgetViolationNonlinear() does not satisfy variable bounds.\n");
10002 assert(consdata !=
NULL);
10004 *violation =
MAX(consdata->lhsviol, consdata->rhsviol);
10017 assert(scip !=
NULL);
10018 assert(cons !=
NULL);
10021 assert(consdata !=
NULL);
10023 if( consdata->linvar_mayincrease == -1 && consdata->linvar_maydecrease == -1 )
10026 return consdata->linvar_maydecrease;
10037 assert(scip !=
NULL);
10038 assert(cons !=
NULL);
10041 assert(consdata !=
NULL);
10043 if( consdata->linvar_mayincrease == -1 && consdata->linvar_maydecrease == -1 )
10046 return consdata->linvar_mayincrease;
10057 assert(scip !=
NULL);
10058 assert(conshdlr !=
NULL);
10089 assert(scip !=
NULL);
10090 assert(alpha !=
NULL);
10091 assert(beta !=
NULL);
10092 assert(gamma_ !=
NULL);
10093 assert(delta !=
NULL);
10095 *alpha = -b3*c2 + a3*(-b2+c2) + a2*(b3-c3) + b2*c3;
10096 *beta = -(-b3*c1 + a3*(-b1+c1) + a1*(b3-c3) + b1*c3);
10097 *gamma_ = -a2*b1 + a1*b2 + a2*c1 - b2*c1 - a1*c2 + b1*c2;
10098 *delta = -a3*b2*c1 + a2*b3*c1 + a3*b1*c2 - a1*b3*c2 - a2*b1*c3 + a1*b2*c3;
10101 if( !
SCIPisRelEQ(scip, *alpha * a1 + *beta * a2 + *gamma_ * a3, *delta) ||
10102 !
SCIPisRelEQ(scip, *alpha * b1 + *beta * b2 + *gamma_ * b3, *delta) ||
10103 !
SCIPisRelEQ(scip, *alpha * c1 + *beta * c2 + *gamma_ * c3, *delta) )
10125 SCIPdebugMsg(scip,
"numerical troubles - try to solve the linear system via an LU factorization\n");
10138 if( !success || !
SCIPisRelEQ(scip, *alpha * a1 + *beta * a2 + *gamma_ * a3, *delta) ||
10139 !
SCIPisRelEQ(scip, *alpha * b1 + *beta * b2 + *gamma_ * b3, *delta) ||
10140 !
SCIPisRelEQ(scip, *alpha * c1 + *beta * c2 + *gamma_ * c3, *delta) )
10142 SCIPdebugMsg(scip,
"could not resolve numerical difficulties\n");
10150 if( *gamma_ < 0.0 )
10154 *gamma_ = -*gamma_;
enum SCIP_Result SCIP_RESULT
static SCIP_DECL_CONSENABLE(consEnableNonlinear)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
static SCIP_DECL_EXPRGRAPHVARREMOVE(exprgraphVarRemove)
SCIP_Real SCIPexprgraphGetNodeVal(SCIP_EXPRGRAPHNODE *node)
int SCIPgetNIntVars(SCIP *scip)
static SCIP_RETCODE presolveUpgrade(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_Bool *upgraded, int *nupgdconss, int *naddconss)
SCIP_RETCODE SCIPexprgraphPropagateVarBounds(SCIP_EXPRGRAPH *exprgraph, SCIP_Real infinity, SCIP_Bool clearreverseprop, SCIP_Bool *domainerror)
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
SCIP_RETCODE SCIPsetConshdlrDelete(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSDELETE((*consdelete)))
SCIP_RETCODE SCIPexprgraphReplaceVarByLinearSum(SCIP_EXPRGRAPH *exprgraph, void *var, int ncoefs, SCIP_Real *coefs, void **vars, SCIP_Real constant)
static void consdataUpdateLinearActivityUbChange(SCIP *scip, SCIP_CONSDATA *consdata, SCIP_Real coef, SCIP_Real oldbnd, SCIP_Real newbnd)
SCIP_EXPRGRAPH * SCIPgetExprgraphNonlinear(SCIP *scip, SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPincludeNonlinconsUpgrade(SCIP *scip, SCIP_DECL_NONLINCONSUPGD((*nonlinconsupgd)), SCIP_DECL_EXPRGRAPHNODEREFORM((*nodereform)), int priority, SCIP_Bool active, const char *conshdlrname)
SCIP_Real SCIPfeastol(SCIP *scip)
void SCIPexprgraphSetVarNodeValue(SCIP_EXPRGRAPHNODE *varnode, SCIP_Real value)
SCIP_Bool SCIPconsIsEnabled(SCIP_CONS *cons)
SCIP_Bool SCIPintervalIsEmpty(SCIP_Real infinity, SCIP_INTERVAL operand)
SCIP_RETCODE SCIPexprgraphAddNode(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, int mindepth, int nchildren, SCIP_EXPRGRAPHNODE **children)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
primal heuristic that tries a given solution
SCIP_Bool SCIPisNLPConstructed(SCIP *scip)
static SCIP_RETCODE getGradientMaxElement(SCIP *scip, SCIP_EXPRINT *exprint, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool newsol, SCIP_Real *maxelem)
SCIP_RETCODE SCIPtightenVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened)
SCIP_RETCODE SCIPexprgraphGetSumTrees(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, int exprtreessize, int *nexprtrees, SCIP_EXPRTREE **exprtrees, SCIP_Real *exprtreecoefs)
SCIP_RETCODE SCIPlpiSolveDual(SCIP_LPI *lpi)
SCIP_NODE * SCIPgetCurrentNode(SCIP *scip)
SCIP_RETCODE SCIPexprgraphAddVars(SCIP_EXPRGRAPH *exprgraph, int nvars, void **vars, SCIP_EXPRGRAPHNODE **varnodes)
SCIP_STAGE SCIPgetStage(SCIP *scip)
static void consdataFindUnlockedLinearVar(SCIP *scip, SCIP_CONSDATA *consdata)
methods to interpret (evaluate) an expression tree "fast"
#define SCIP_EVENTTYPE_VARFIXED
SCIP_Bool SCIPconsIsDynamic(SCIP_CONS *cons)
SCIP_Real * SCIPvarGetMultaggrScalars(SCIP_VAR *var)
SCIP_RETCODE SCIPincSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real incval)
SCIP_RETCODE SCIPsetConshdlrTrans(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSTRANS((*constrans)))
int * SCIPexprGetMonomialChildIndices(SCIP_EXPRDATA_MONOMIAL *monomial)
static SCIP_RETCODE getCoeffsAndConstantFromLinearExpr(SCIP_EXPR *expr, SCIP_Real scalar, SCIP_Real *varcoeffs, SCIP_Real *constant)
SCIP_RETCODE SCIPexprgraphUpdateNodeBoundsCurvature(SCIP_EXPRGRAPHNODE *node, SCIP_Real infinity, SCIP_Real minstrength, SCIP_Bool clearreverseprop)
SCIP_Bool SCIPisRelEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_RETCODE addLinearizationCuts(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *ref, SCIP_Bool *separatedlpsol, SCIP_Real minefficacy)
static SCIP_DECL_CONSEXIT(consExitNonlinear)
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)
int SCIPexprgraphGetNodeNChildren(SCIP_EXPRGRAPHNODE *node)
SCIP_Real SCIPintervalNegateReal(SCIP_Real x)
static SCIP_DECL_CONSDISABLE(consDisableNonlinear)
SCIP_EXPROP SCIPexprGetOperator(SCIP_EXPR *expr)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
static SCIP_RETCODE unlockLinearVariable(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
int SCIPexprgraphGetNVars(SCIP_EXPRGRAPH *exprgraph)
SCIP_RETCODE SCIPsetConshdlrGetVars(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSGETVARS((*consgetvars)))
static SCIP_RETCODE addUserEstimator(SCIP *scip, SCIP_CONS *cons, int exprtreeidx, SCIP_Real *x, SCIP_Bool overestimate, SCIP_ROWPREP *rowprep, SCIP_Bool *success)
SCIP_RETCODE SCIPgetExprtreeCurvaturesNonlinear(SCIP *scip, SCIP_CONS *cons, SCIP_Bool checkcurv, SCIP_EXPRCURV **curvatures)
void SCIPsortPtrPtrReal(void **ptrarray1, void **ptrarray2, SCIP_Real *realarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
SCIP_RETCODE SCIPaddRowprepTerms(SCIP *scip, SCIP_ROWPREP *rowprep, int nvars, SCIP_VAR **vars, SCIP_Real *coefs)
static SCIP_RETCODE consdataAddExprtrees(SCIP *scip, SCIP_CONSDATA *consdata, int nexprtrees, SCIP_EXPRTREE **exprtrees, SCIP_Real *coefs, SCIP_Bool copytrees)
SCIP_RETCODE SCIPsetConshdlrEnforelax(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSENFORELAX((*consenforelax)))
SCIP_RETCODE SCIPresetConsAge(SCIP *scip, SCIP_CONS *cons)
SCIPInterval pow(const SCIPInterval &x, const SCIPInterval &y)
static SCIP_DECL_EXPRGRAPHVARADDED(exprgraphVarAdded)
SCIP_RETCODE SCIPdelCons(SCIP *scip, SCIP_CONS *cons)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
SCIP_VAR ** SCIPvarGetMultaggrVars(SCIP_VAR *var)
SCIP_RETCODE SCIPexprintGradInt(SCIP_EXPRINT *exprint, SCIP_EXPRTREE *tree, SCIP_Real infinity, SCIP_INTERVAL *varvals, SCIP_Bool new_varvals, SCIP_INTERVAL *val, SCIP_INTERVAL *gradient)
int SCIPexprgraphGetDepth(SCIP_EXPRGRAPH *exprgraph)
SCIP_RETCODE SCIPcleanupRowprep(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_SOL *sol, SCIP_Real maxcoefrange, SCIP_Real minviol, SCIP_Real *coefrange, SCIP_Real *viol)
SCIP_RETCODE SCIPsetExprtreesNonlinear(SCIP *scip, SCIP_CONS *cons, int nexprtrees, SCIP_EXPRTREE **exprtrees, SCIP_Real *coefs)
const char * SCIPexpropGetName(SCIP_EXPROP op)
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPaddRowprepTerm(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_VAR *var, SCIP_Real coef)
SCIP_RETCODE SCIPsetConshdlrDeactive(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSDEACTIVE((*consdeactive)))
SCIP_Bool SCIPlpiIsPrimalUnbounded(SCIP_LPI *lpi)
static SCIP_RETCODE checkCurvature(SCIP *scip, SCIP_CONS *cons, SCIP_Bool expensivechecks, SCIP_Bool assumeconvex)
SCIP_Bool SCIPconsIsAdded(SCIP_CONS *cons)
SCIP_RETCODE SCIPincludeEventhdlrBasic(SCIP *scip, SCIP_EVENTHDLR **eventhdlrptr, const char *name, const char *desc, SCIP_DECL_EVENTEXEC((*eventexec)), SCIP_EVENTHDLRDATA *eventhdlrdata)
SCIP_Real * SCIPexprtreeGetParamVals(SCIP_EXPRTREE *tree)
SCIP_NLPSOLSTAT SCIPgetNLPSolstat(SCIP *scip)
static SCIP_RETCODE consdataFree(SCIP *scip, SCIP_CONSDATA **consdata)
SCIP_RETCODE SCIPexprCreateMonomial(BMS_BLKMEM *blkmem, SCIP_EXPRDATA_MONOMIAL **monomial, SCIP_Real coef, int nfactors, int *childidxs, SCIP_Real *exponents)
void SCIPexprgraphSetVarNodeBounds(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *varnode, SCIP_INTERVAL varbounds)
static SCIP_RETCODE reformEnsureChildrenMinCurvature(SCIP *scip, SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, SCIP_EXPRCURV mincurv, SCIP_CONS **conss, int nconss, int *naddcons)
void SCIPexprgraphCaptureNode(SCIP_EXPRGRAPHNODE *node)
SCIP_RETCODE SCIPgetTransformedVar(SCIP *scip, SCIP_VAR *var, SCIP_VAR **transvar)
static SCIP_RETCODE splitOffLinearPart(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_Bool *infeasible)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
struct SCIP_EventhdlrData SCIP_EVENTHDLRDATA
SCIP_RETCODE SCIPsetConshdlrInitpre(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINITPRE((*consinitpre)))
#define SCIP_EXPRINTCAPABILITY_INTGRADIENT
SCIP_RETCODE SCIPexprgraphCreateNodeQuadratic(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE **node, int nchildren, SCIP_Real *lincoefs, int nquadelems, SCIP_QUADELEM *quadelems, SCIP_Real constant)
SCIP_Bool SCIPisFeasNegative(SCIP *scip, SCIP_Real val)
static SCIP_RETCODE consdataCreateEmpty(SCIP *scip, SCIP_CONSDATA **consdata)
int SCIPexprGetOpIndex(SCIP_EXPR *expr)
SCIP_RETCODE SCIPlpiAddCols(SCIP_LPI *lpi, int ncols, const SCIP_Real *obj, const SCIP_Real *lb, const SCIP_Real *ub, char **colnames, int nnonz, const int *beg, const int *ind, const SCIP_Real *val)
SCIP_Bool SCIPisFeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPgetRelaxFeastolFactor(SCIP *scip)
void SCIPintervalSetRoundingMode(SCIP_ROUNDMODE roundmode)
SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr)
void SCIPexprgraphPropagateNodeBounds(SCIP_EXPRGRAPH *exprgraph, SCIP_Real infinity, SCIP_Real minstrength, SCIP_Bool *cutoff)
SCIP_Real SCIProwGetLhs(SCIP_ROW *row)
SCIP_Real SCIPadjustedVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real ub)
static SCIP_DECL_CONSINITPRE(consInitpreNonlinear)
static SCIP_DECL_CONSENFOLP(consEnfolpNonlinear)
SCIP_EXPRGRAPHNODE ** SCIPexprgraphGetVarNodes(SCIP_EXPRGRAPH *exprgraph)
SCIP_RETCODE SCIPincludeConshdlrBasic(SCIP *scip, SCIP_CONSHDLR **conshdlrptr, const char *name, const char *desc, int enfopriority, int chckpriority, int eagerfreq, SCIP_Bool needscons, SCIP_DECL_CONSENFOLP((*consenfolp)), SCIP_DECL_CONSENFOPS((*consenfops)), SCIP_DECL_CONSCHECK((*conscheck)), SCIP_DECL_CONSLOCK((*conslock)), SCIP_CONSHDLRDATA *conshdlrdata)
SCIP_Real * SCIPgetLinearCoefsNonlinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPinfinity(SCIP *scip)
int SCIPsnprintf(char *t, int len, const char *s,...)
SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPexprgraphGetNodeSignPowerExponent(SCIP_EXPRGRAPHNODE *node)
SCIP_RETCODE SCIPgetNlRowNonlinear(SCIP *scip, SCIP_CONS *cons, SCIP_NLROW **nlrow)
SCIP_RETCODE SCIPunmarkConsPropagate(SCIP *scip, SCIP_CONS *cons)
enum SCIP_Retcode SCIP_RETCODE
SCIP_RETCODE SCIPlpiFree(SCIP_LPI **lpi)
SCIP_RETCODE SCIPsolveNLP(SCIP *scip)
static SCIP_RETCODE addLinearization(SCIP *scip, SCIP_EXPRINT *exprint, SCIP_CONS *cons, int exprtreeidx, SCIP_Real *x, SCIP_Bool newx, SCIP_ROWPREP *rowprep, SCIP_Bool *success)
SCIP_RETCODE SCIPaddVarLocks(SCIP *scip, SCIP_VAR *var, int nlocksdown, int nlocksup)
SCIP_Bool SCIPconsIsStickingAtNode(SCIP_CONS *cons)
#define SCIP_PRESOLTIMING_EXHAUSTIVE
static SCIP_RETCODE consdataSetExprtrees(SCIP *scip, SCIP_CONSDATA *consdata, int nexprtrees, SCIP_EXPRTREE **exprtrees, SCIP_Real *coefs, SCIP_Bool copytrees)
SCIP_RETCODE SCIPexprtreeCopy(BMS_BLKMEM *blkmem, SCIP_EXPRTREE **targettree, SCIP_EXPRTREE *sourcetree)
SCIP_RETCODE SCIPexprintCompile(SCIP_EXPRINT *exprint, SCIP_EXPRTREE *tree)
int SCIPexprgraphGetNodeNParents(SCIP_EXPRGRAPHNODE *node)
SCIP_INTERVAL SCIPexprgraphGetNodeBounds(SCIP_EXPRGRAPHNODE *node)
static SCIP_RETCODE addConcaveEstimatorUnivariate(SCIP *scip, SCIP_CONS *cons, int exprtreeidx, SCIP_ROWPREP *rowprep, SCIP_Bool *success)
SCIP_RETCODE SCIPgetCurvatureNonlinear(SCIP *scip, SCIP_CONS *cons, SCIP_Bool checkcurv, SCIP_EXPRCURV *curvature)
SCIP_RETCODE SCIPexprgraphEval(SCIP_EXPRGRAPH *exprgraph, SCIP_Real *varvals)
void SCIPintervalSetBounds(SCIP_INTERVAL *resultant, SCIP_Real inf, SCIP_Real sup)
int * SCIPexprgraphGetNNodes(SCIP_EXPRGRAPH *exprgraph)
SCIP_Real SCIPgetRhsNonlinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPconsIsTransformed(SCIP_CONS *cons)
SCIP_RETCODE SCIPexprEvalInt(SCIP_EXPR *expr, SCIP_Real infinity, SCIP_INTERVAL *varvals, SCIP_Real *param, SCIP_INTERVAL *val)
static GRAPHNODE ** active
SCIP_RETCODE SCIPexprtreeSetVars(SCIP_EXPRTREE *tree, int nvars, SCIP_VAR **vars)
SCIP_RETCODE SCIPtightenVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened)
#define SCIPfreeBlockMemory(scip, ptr)
#define CONSHDLR_SEPAFREQ
static SCIP_DECL_CONSSEPALP(consSepalpNonlinear)
SCIP_RETCODE SCIPsetConshdlrSepa(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSSEPALP((*conssepalp)), SCIP_DECL_CONSSEPASOL((*conssepasol)), int sepafreq, int sepapriority, SCIP_Bool delaysepa)
SCIP_EVENTHDLR * SCIPfindEventhdlr(SCIP *scip, const char *name)
SCIP_MESSAGEHDLR * SCIPgetMessagehdlr(SCIP *scip)
int SCIPgetLinvarMayDecreaseNonlinear(SCIP *scip, SCIP_CONS *cons)
static void consdataUpdateLinearActivityLbChange(SCIP *scip, SCIP_CONSDATA *consdata, SCIP_Real coef, SCIP_Real oldbnd, SCIP_Real newbnd)
SCIP_RETCODE SCIPexprgraphAddExprtreeSum(SCIP_EXPRGRAPH *exprgraph, int nexprtrees, SCIP_EXPRTREE **exprtrees, SCIP_Real *coefs, SCIP_EXPRGRAPHNODE **rootnode, SCIP_Bool *rootnodeisnew)
SCIP_EXPRTREE ** SCIPgetExprtreesNonlinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_DECL_CONSACTIVE(consActiveNonlinear)
SCIP_RETCODE SCIPcreateLPSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
SCIP_RETCODE SCIPexprtreeCreate(BMS_BLKMEM *blkmem, SCIP_EXPRTREE **tree, SCIP_EXPR *root, int nvars, int nparams, SCIP_Real *params)
static SCIP_DECL_CONSSEPASOL(consSepasolNonlinear)
#define SCIPfreeBufferArray(scip, ptr)
SCIP_Real SCIPadjustedVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real lb)
SCIP_RETCODE SCIPcreateConsBasicNonlinear2(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, SCIP_EXPRGRAPHNODE *exprgraphnode, SCIP_Real lhs, SCIP_Real rhs)
static SCIP_RETCODE reformReplaceNode(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE **node, SCIP_EXPRGRAPHNODE *replacement, SCIP_CONS **conss, int nconss)
#define SCIPallocBlockMemory(scip, ptr)
#define SCIPdebugPrintCons(x, y, z)
SCIP_RETCODE SCIPaddExprtreesNonlinear(SCIP *scip, SCIP_CONS *cons, int nexprtrees, SCIP_EXPRTREE **exprtrees, SCIP_Real *coefs)
SCIP_Bool SCIPconsIsRemovable(SCIP_CONS *cons)
#define SCIP_EVENTTYPE_BOUNDCHANGED
SCIP_Bool SCIPlpiIsObjlimExc(SCIP_LPI *lpi)
SCIP_RETCODE SCIPsetConshdlrInitlp(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINITLP((*consinitlp)))
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
#define SCIPdebugMsgPrint
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 SCIPsetConshdlrParse(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPARSE((*consparse)))
SCIP_RETCODE SCIPexprgraphFree(SCIP_EXPRGRAPH **exprgraph)
SCIP_Bool SCIPconsIsActive(SCIP_CONS *cons)
static SCIP_RETCODE enforceConstraint(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, int nusefulconss, SCIP_SOL *sol, SCIP_Bool solinfeasible, SCIP_RESULT *result)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
int SCIPgetNContVars(SCIP *scip)
SCIP_VAR ** SCIPexprtreeGetVars(SCIP_EXPRTREE *tree)
SCIP_RETCODE SCIPcreateCons(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_CONSHDLR *conshdlr, SCIP_CONSDATA *consdata, 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 SCIP_DECL_EXPRGRAPHNODEREFORM(x)
SCIP_Real SCIPepsilon(SCIP *scip)
int SCIPexprgraphGetNodePolynomialNMonomials(SCIP_EXPRGRAPHNODE *node)
#define SCIP_PRESOLTIMING_FAST
static SCIP_RETCODE removeFixedNonlinearVariables(SCIP *scip, SCIP_CONSHDLR *conshdlr)
SCIP_Real SCIPgetRowMaxCoef(SCIP *scip, SCIP_ROW *row)
int SCIPgetNExprtreesNonlinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPexprgraphMoveNodeParents(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE **srcnode, SCIP_EXPRGRAPHNODE *targetnode)
#define SCIP_EVENTTYPE_LBCHANGED
SCIP_EXPRCURV SCIPexprcurvMultiply(SCIP_Real factor, SCIP_EXPRCURV curvature)
int SCIPexprGetMonomialNFactors(SCIP_EXPRDATA_MONOMIAL *monomial)
SCIP_RETCODE SCIPexprtreePrintWithNames(SCIP_EXPRTREE *tree, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
SCIP_RETCODE SCIPheurPassSolTrySol(SCIP *scip, SCIP_HEUR *heur, SCIP_SOL *sol)
SCIP_RETCODE SCIPexprtreeCheckCurvature(SCIP_EXPRTREE *tree, SCIP_Real infinity, SCIP_INTERVAL *varbounds, SCIP_EXPRCURV *curv, SCIP_INTERVAL *bounds)
SCIP_EXPROP SCIPexprgraphGetNodeOperator(SCIP_EXPRGRAPHNODE *node)
SCIP_VAR * SCIPfindVar(SCIP *scip, const char *name)
SCIP_EXPRDATA_MONOMIAL ** SCIPexprgraphGetNodePolynomialMonomials(SCIP_EXPRGRAPHNODE *node)
SCIP_RETCODE SCIPexprgraphCreate(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPH **exprgraph, int varssizeinit, int depthinit, SCIP_DECL_EXPRGRAPHVARADDED((*exprgraphvaradded)), SCIP_DECL_EXPRGRAPHVARREMOVE((*exprgraphvarremove)), SCIP_DECL_EXPRGRAPHVARCHGIDX((*exprgraphvarchgidx)), void *userdata)
static SCIP_DECL_CONSGETVARS(consGetVarsNonlinear)
int SCIPgetLinvarMayIncreaseNonlinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
SCIP_RETCODE SCIPsetConshdlrInitsol(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINITSOL((*consinitsol)))
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
#define SCIP_EVENTTYPE_SOLFOUND
void SCIPfreeRowprep(SCIP *scip, SCIP_ROWPREP **rowprep)
const char * SCIPexprcurvGetName(SCIP_EXPRCURV curv)
SCIP_Real SCIPeventGetNewbound(SCIP_EVENT *event)
SCIP_RETCODE SCIPcreateSolCopy(SCIP *scip, SCIP_SOL **sol, SCIP_SOL *sourcesol)
static SCIP_DECL_CONSCHECK(consCheckNonlinear)
SCIP_Bool SCIPisPresolveFinished(SCIP *scip)
static SCIP_RETCODE addConcaveEstimatorMultivariate(SCIP *scip, SCIP_CONS *cons, int exprtreeidx, SCIP_Real *ref, SCIP_ROWPREP *rowprep, SCIP_Bool *success)
SCIP_Bool SCIPconsIsLocked(SCIP_CONS *cons)
SCIP_Real SCIPexprgraphGetNodePolynomialConstant(SCIP_EXPRGRAPHNODE *node)
void SCIPmarkRowNotRemovableLocal(SCIP *scip, SCIP_ROW *row)
SCIP_RETCODE SCIPsetConshdlrCopy(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), SCIP_DECL_CONSCOPY((*conscopy)))
static SCIP_RETCODE registerBranchingVariables(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, int *nnotify)
SCIP_RETCODE SCIPaddLinearConsToNlpHeurSubNlp(SCIP *scip, SCIP_HEUR *heur, SCIP_Bool addcombconss, SCIP_Bool addcontconss)
SCIP_Bool SCIPexprgraphHasNodeNonlinearAncestor(SCIP_EXPRGRAPHNODE *node)
SCIP_Bool SCIPlpiIsPrimalFeasible(SCIP_LPI *lpi)
SCIP_EXPRCURV SCIPexprgraphGetNodeCurvature(SCIP_EXPRGRAPHNODE *node)
const char * SCIPheurGetName(SCIP_HEUR *heur)
SCIP_Bool SCIPintervalIsEntire(SCIP_Real infinity, SCIP_INTERVAL operand)
SCIP_RETCODE SCIPexprEval(SCIP_EXPR *expr, SCIP_Real *varvals, SCIP_Real *param, SCIP_Real *val)
SCIP_HEUR * SCIPfindHeur(SCIP *scip, const char *name)
static SCIP_DECL_EVENTEXEC(processLinearVarEvent)
SCIP_RETCODE SCIPexprintEval(SCIP_EXPRINT *exprint, SCIP_EXPRTREE *tree, SCIP_Real *varvals, SCIP_Real *val)
static SCIP_RETCODE consdataEnsureLinearVarsSize(SCIP *scip, SCIP_CONSDATA *consdata, int num)
#define CONSHDLR_ENFOPRIORITY
static SCIP_DECL_CONSINITLP(consInitlpNonlinear)
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE propagateBoundsTightenVarLb(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real bnd, SCIP_RESULT *result, int *nchgbds)
static SCIP_RETCODE computeViolation(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool *solviolbounds)
SCIP_RETCODE SCIPexprintCreate(BMS_BLKMEM *blkmem, SCIP_EXPRINT **exprint)
SCIP_RETCODE SCIPaddConsLocal(SCIP *scip, SCIP_CONS *cons, SCIP_NODE *validnode)
SCIP_RETCODE SCIPaddNlRow(SCIP *scip, SCIP_NLROW *nlrow)
enum SCIP_NlpSolStat SCIP_NLPSOLSTAT
SCIP_EXPRGRAPHNODE *** SCIPexprgraphGetNodes(SCIP_EXPRGRAPH *exprgraph)
#define SCIP_DECL_NONLINCONSUPGD(x)
SCIP_RETCODE SCIPdelConsLocal(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPintervalGetInf(SCIP_INTERVAL interval)
int SCIPexprgraphGetSumTreesNSummands(SCIP_EXPRGRAPHNODE *node)
#define CONSHDLR_PROP_TIMING
SCIP_RETCODE SCIPgetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
static SCIP_RETCODE lockLinearVariable(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
SCIP_Bool SCIProwIsLocal(SCIP_ROW *row)
SCIP_RETCODE SCIPreleaseNlRow(SCIP *scip, SCIP_NLROW **nlrow)
SCIP_RETCODE SCIPgetViolationNonlinear(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Real *violation)
SCIP_RETCODE SCIPgetProbvarSum(SCIP *scip, SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
#define SCIPfreeBufferArrayNull(scip, ptr)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
SCIP_RETCODE SCIPcheckCons(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool printreason, SCIP_RESULT *result)
SCIP_Bool SCIPsortedvecFindPtr(void **ptrarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), void *val, int len, int *pos)
SCIP_RETCODE SCIPunlockVarCons(SCIP *scip, SCIP_VAR *var, SCIP_CONS *cons, SCIP_Bool lockdown, SCIP_Bool lockup)
static SCIP_DECL_CONSDEACTIVE(consDeactiveNonlinear)
static SCIP_RETCODE mergeAndCleanLinearVars(SCIP *scip, SCIP_CONS *cons)
const char * SCIPconsGetName(SCIP_CONS *cons)
SCIP_RETCODE SCIPmarkDoNotMultaggrVar(SCIP *scip, SCIP_VAR *var)
SCIP_EXPRCURV SCIPexprcurvPower(SCIP_INTERVAL basebounds, SCIP_EXPRCURV basecurv, SCIP_Real exponent)
SCIP_Bool SCIPconsIsPropagated(SCIP_CONS *cons)
void SCIPaddRowprepSide(SCIP_ROWPREP *rowprep, SCIP_Real side)
struct SCIP_EventData SCIP_EVENTDATA
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_RETCODE SCIPsetConshdlrFree(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSFREE((*consfree)))
SCIP_Real SCIPlpiInfinity(SCIP_LPI *lpi)
constraint handler for quadratic constraints
#define BOUNDTIGHTENING_MINSTRENGTH
static SCIP_RETCODE propagateBoundsTightenVarUb(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real bnd, SCIP_RESULT *result, int *nchgbds)
static SCIP_RETCODE propagateBounds(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_Bool needclear, SCIP_RESULT *result, int *nchgbds, int *ndelconss)
SCIP_CONSHDLRDATA * SCIPconshdlrGetData(SCIP_CONSHDLR *conshdlr)
SCIP_Real * SCIPgetExprtreeCoefsNonlinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateRowprep(SCIP *scip, SCIP_ROWPREP **rowprep, SCIP_SIDETYPE sidetype, SCIP_Bool local)
SCIP_RETCODE SCIPgetExprtreeTransformedVars(SCIP *scip, SCIP_EXPRTREE *tree)
SCIP_RETCODE SCIPmarkConsPropagate(SCIP *scip, SCIP_CONS *cons)
SCIP_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
SCIP_Real SCIPgetSolTransObj(SCIP *scip, SCIP_SOL *sol)
int SCIPgetNNlpis(SCIP *scip)
int SCIPexprtreeGetNVars(SCIP_EXPRTREE *tree)
SCIP_RETCODE SCIPsetNLPInitialGuessSol(SCIP *scip, SCIP_SOL *sol)
SCIP_RETCODE SCIPcreateChild(SCIP *scip, SCIP_NODE **node, SCIP_Real nodeselprio, SCIP_Real estimate)
SCIP_RETCODE SCIPexprgraphCreateNodeLinear(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE **node, int ncoefs, SCIP_Real *coefs, SCIP_Real constant)
static SCIP_RETCODE reformNode2Var(SCIP *scip, SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, SCIP_CONS **conss, int nconss, int *naddcons, SCIP_Bool donotmultaggr)
SCIP_Bool SCIPlpiIsOptimal(SCIP_LPI *lpi)
SCIP_Bool SCIPexprgraphIsNodeEnabled(SCIP_EXPRGRAPHNODE *node)
static SCIP_RETCODE chgLinearCoefPos(SCIP *scip, SCIP_CONS *cons, int pos, SCIP_Real newcoef)
SCIP_RETCODE SCIPexprParse(BMS_BLKMEM *blkmem, SCIP_MESSAGEHDLR *messagehdlr, SCIP_EXPR **expr, const char *str, const char *lastchar, int *nvars, int *varnames)
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_RETCODE addConcaveEstimatorBivariate(SCIP *scip, SCIP_CONS *cons, int exprtreeidx, SCIP_Real *ref, SCIP_ROWPREP *rowprep, SCIP_Bool *success)
SCIP_RETCODE SCIPgetProbvarLinearSum(SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, int varssize, SCIP_Real *constant, int *requiredsize, SCIP_Bool mergemultiples)
SCIP_Real SCIPvarGetMultaggrConstant(SCIP_VAR *var)
SCIP_EXPRINTCAPABILITY SCIPexprintGetCapability(void)
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
void SCIPintervalSet(SCIP_INTERVAL *resultant, SCIP_Real value)
SCIP_Real SCIProwGetRhs(SCIP_ROW *row)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
SCIP_Bool SCIPconsIsLocal(SCIP_CONS *cons)
void SCIPexprgraphTightenNodeBounds(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, SCIP_INTERVAL nodebounds, SCIP_Real minstrength, SCIP_Real infinity, SCIP_Bool *cutoff)
SCIP_RETCODE SCIPexprEstimateUser(SCIP_EXPR *expr, SCIP_Real infinity, SCIP_Real *argvals, SCIP_INTERVAL *argbounds, SCIP_Bool overestimate, SCIP_Real *coeffs, SCIP_Real *constant, SCIP_Bool *success)
#define SCIPdebugGetSolVal(scip, var, val)
SCIP_RETCODE SCIPaddCut(SCIP *scip, SCIP_SOL *sol, SCIP_ROW *cut, SCIP_Bool forcecut, SCIP_Bool *infeasible)
struct SCIP_ConsData SCIP_CONSDATA
#define SCIP_EVENTTYPE_BOUNDTIGHTENED
SCIP_EXPR * SCIPexprtreeGetRoot(SCIP_EXPRTREE *tree)
SCIP_Bool SCIPexprgraphHasNodeSibling(SCIP_EXPRGRAPHNODE *node)
SCIP_RETCODE SCIPexprgraphGetNodePolynomialMonomialCurvature(SCIP_EXPRGRAPHNODE *node, int monomialidx, SCIP_Real infinity, SCIP_EXPRCURV *curv)
#define SCIP_EVENTTYPE_UBCHANGED
int SCIPconshdlrGetNConss(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPlpiGetSol(SCIP_LPI *lpi, SCIP_Real *objval, SCIP_Real *primsol, SCIP_Real *dualsol, SCIP_Real *activity, SCIP_Real *redcost)
SCIP_RETCODE SCIPaddLinearVarNonlinear(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
static SCIP_RETCODE delLinearCoefPos(SCIP *scip, SCIP_CONS *cons, int pos)
static SCIP_RETCODE dropLinearVarEvents(SCIP *scip, SCIP_CONS *cons, int linvarpos)
static void consdataSortLinearVars(SCIP_CONSDATA *consdata)
static SCIP_RETCODE reformMonomial(SCIP *scip, SCIP_EXPRGRAPH *exprgraph, int nfactors, SCIP_EXPRGRAPHNODE **factors, SCIP_Real *exponents, SCIP_EXPRGRAPHNODE **resultnode, SCIP_Bool createauxcons, int mindepth, int *naddcons)
#define SCIPallocBufferArray(scip, ptr, num)
#define CONSHDLR_CHECKPRIORITY
static SCIP_RETCODE catchLinearVarEvents(SCIP *scip, SCIP_CONS *cons, int linvarpos)
SCIP_EXPR ** SCIPexprGetChildren(SCIP_EXPR *expr)
SCIP_VAR * SCIPeventGetVar(SCIP_EVENT *event)
#define infty2infty(infty1, infty2, val)
SCIP_RETCODE SCIPcatchEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
static SCIP_DECL_CONSENFORELAX(consEnforelaxNonlinear)
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
static SCIP_RETCODE createNlRow(SCIP *scip, SCIP_CONS *cons)
SCIP_EVENTTYPE SCIPeventGetType(SCIP_EVENT *event)
static SCIP_RETCODE reformulate(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, int *naddcons)
SCIP_RETCODE SCIPlpiSetIntpar(SCIP_LPI *lpi, SCIP_LPPARAM type, int ival)
static SCIP_RETCODE propagateConstraintSides(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_RESULT *result, int *nchgbds)
void SCIPexprgraphSetVarNodeLb(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *varnode, SCIP_Real lb)
static const char * paramname[]
static void consdataUpdateLinearActivity(SCIP *scip, SCIP_CONSDATA *consdata)
SCIP_RETCODE SCIPcreateEmptyRowCons(SCIP *scip, SCIP_ROW **row, SCIP_CONSHDLR *conshdlr, const char *name, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool removable)
SCIP_Real SCIPgetLhsNonlinear(SCIP *scip, SCIP_CONS *cons)
int SCIPgetDepth(SCIP *scip)
SCIP_RETCODE SCIPlpiSetRealpar(SCIP_LPI *lpi, SCIP_LPPARAM type, SCIP_Real dval)
SCIP_EXPRINTDATA * SCIPexprtreeGetInterpreterData(SCIP_EXPRTREE *tree)
constraint handler for nonlinear constraints
SCIP_RETCODE SCIPprintCons(SCIP *scip, SCIP_CONS *cons, FILE *file)
void SCIPmergeRowprepTerms(SCIP *scip, SCIP_ROWPREP *rowprep)
SCIP_Bool SCIPexprHasUserEstimator(SCIP_EXPR *expr)
SCIP_Bool SCIPstrToRealValue(const char *str, SCIP_Real *value, char **endptr)
SCIP_RETCODE SCIPaddPoolCut(SCIP *scip, SCIP_ROW *row)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
int SCIPexprGetNChildren(SCIP_EXPR *expr)
int SCIPvarCompare(SCIP_VAR *var1, SCIP_VAR *var2)
void SCIPexprgraphGetSubtreeVarsUsage(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, int *varsusage)
void SCIPexprgraphSetVarNodeUb(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *varnode, SCIP_Real ub)
#define CONSHDLR_PROPFREQ
SCIP_Bool SCIPconsIsDeleted(SCIP_CONS *cons)
#define CONSHDLR_NEEDSCONS
SCIP_RETCODE SCIPsetConshdlrDisable(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSDISABLE((*consdisable)))
SCIP_RETCODE SCIPdropEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
SCIP_RETCODE SCIPexprgraphNodeSplitOffLinear(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE **node, int linvarssize, int *nlinvars, void **linvars, SCIP_Real *lincoefs, SCIP_Real *constant)
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 SCIPexprtreeFree(SCIP_EXPRTREE **tree)
static SCIP_RETCODE proposeFeasibleSolution(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, SCIP_Bool *success)
SCIP_RETCODE SCIPdropVarEvent(SCIP *scip, SCIP_VAR *var, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
#define CONSHDLR_DELAYSEPA
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)
SCIP_RETCODE SCIPaddExternBranchCand(SCIP *scip, SCIP_VAR *var, SCIP_Real score, SCIP_Real solval)
void SCIPintervalAdd(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
static SCIP_RETCODE registerLargeRelaxValueVariableForBranching(SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, SCIP_VAR **brvar)
void SCIPexprgraphDisableNode(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node)
SCIP_Real SCIPintervalGetSup(SCIP_INTERVAL interval)
SCIP_Bool SCIPintervalAreDisjoint(SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
#define BMScopyMemoryArray(ptr, source, num)
SCIP_RETCODE SCIPlockVarCons(SCIP *scip, SCIP_VAR *var, SCIP_CONS *cons, SCIP_Bool lockdown, SCIP_Bool lockup)
SCIP_RETCODE SCIPsetConshdlrPrint(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPRINT((*consprint)))
Constraint handler for linear constraints in their most general form, .
SCIP_Bool SCIPisCutApplicable(SCIP *scip, SCIP_ROW *cut)
SCIP_RETCODE SCIPlpiAddRows(SCIP_LPI *lpi, int nrows, const SCIP_Real *lhs, const SCIP_Real *rhs, char **rownames, int nnonz, const int *beg, const int *ind, const SCIP_Real *val)
static SCIP_DECL_CONSHDLRCOPY(conshdlrCopyNonlinear)
int SCIPvarGetMultaggrNVars(SCIP_VAR *var)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
static SCIP_DECL_CONSPROP(consPropNonlinear)
#define BMSclearMemory(ptr)
SCIP_Real SCIPexprGetMonomialCoef(SCIP_EXPRDATA_MONOMIAL *monomial)
SCIP_RETCODE SCIPexprintGrad(SCIP_EXPRINT *exprint, SCIP_EXPRTREE *tree, SCIP_Real *varvals, SCIP_Bool new_varvals, SCIP_Real *val, SCIP_Real *gradient)
SCIP_RETCODE SCIPgetRowprepRowCons(SCIP *scip, SCIP_ROW **row, SCIP_ROWPREP *rowprep, SCIP_CONSHDLR *conshdlr)
char name[SCIP_MAXSTRLEN]
SCIP_RETCODE SCIPsetConshdlrEnable(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSENABLE((*consenable)))
int SCIPgetNBinVars(SCIP *scip)
SCIP_Bool SCIPinProbing(SCIP *scip)
int SCIPgetNVars(SCIP *scip)
#define CONSHDLR_SEPAPRIORITY
int SCIPexprgraphGetNodeIntPowerExponent(SCIP_EXPRGRAPHNODE *node)
SCIP_Real SCIPnodeGetEstimate(SCIP_NODE *node)
static SCIP_DECL_CONSDELETE(consDeleteNonlinear)
void SCIPenableNLP(SCIP *scip)
SCIP_EXPRGRAPHNODE ** SCIPexprgraphGetNodeParents(SCIP_EXPRGRAPHNODE *node)
static SCIP_RETCODE addLinearCoef(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
static SCIP_DECL_CONSTRANS(consTransNonlinear)
static SCIP_RETCODE removeFixedLinearVariables(SCIP *scip, SCIP_CONS *cons)
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)
SCIP_RETCODE SCIPsetConshdlrExitpre(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSEXITPRE((*consexitpre)))
enum SCIP_ExprCurv SCIP_EXPRCURV
#define CONSHDLR_PRESOLTIMING
SCIP_RETCODE SCIPsolveLinearProb(int N, SCIP_Real *A, SCIP_Real *b, SCIP_Real *x, SCIP_Bool *success)
SCIP_RETCODE SCIPreleaseRow(SCIP *scip, SCIP_ROW **row)
SCIP_RETCODE SCIPcreateNLPSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
SCIP_Bool SCIPlpiIsIterlimExc(SCIP_LPI *lpi)
static SCIP_RETCODE generateCut(SCIP *scip, SCIP_EXPRINT *exprint, SCIP_CONS *cons, SCIP_Real **ref, SCIP_SOL *sol, SCIP_Bool newsol, SCIP_SIDETYPE side, SCIP_ROW **row, SCIP_Real minviol, SCIP_Real maxrange, SCIP_Bool expensivecurvchecks, SCIP_Bool assumeconvex)
int SCIPvarGetNLocksDown(SCIP_VAR *var)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_DECL_CONSGETNVARS(consGetNVarsNonlinear)
SCIP_RETCODE SCIPcheckCurvatureNonlinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPisIntegral(SCIP *scip, SCIP_Real val)
SCIP_Real * SCIPexprGetLinearCoefs(SCIP_EXPR *expr)
SCIP_RETCODE SCIPaddCharParam(SCIP *scip, const char *name, const char *desc, char *valueptr, SCIP_Bool isadvanced, char defaultvalue, const char *allowedvalues, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
int SCIPgetNLinearVarsNonlinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPgetVarCopy(SCIP *sourcescip, SCIP *targetscip, SCIP_VAR *sourcevar, SCIP_VAR **targetvar, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, SCIP_Bool *success)
#define CONSHDLR_DELAYPROP
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
SCIP_Real SCIPexprGetOpReal(SCIP_EXPR *expr)
SCIP_CONSDATA * SCIPconsGetData(SCIP_CONS *cons)
SCIP_RETCODE SCIPsetConshdlrInit(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINIT((*consinit)))
int SCIPexprgraphGetNodePosition(SCIP_EXPRGRAPHNODE *node)
SCIP_RETCODE SCIPsetConshdlrExit(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSEXIT((*consexit)))
SCIP_RETCODE SCIPlpiCreate(SCIP_LPI **lpi, SCIP_MESSAGEHDLR *messagehdlr, const char *name, SCIP_OBJSEN objsen)
#define SCIP_EVENTTYPE_FORMAT
static SCIP_RETCODE propagateBoundsCons(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_RESULT *result, int *nchgbds, SCIP_Bool *redundant)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
void SCIPintervalSetRoundingModeUpwards(void)
SCIP_RETCODE SCIPexprgraphCreateNodePolynomial(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE **node, int nmonomials, SCIP_EXPRDATA_MONOMIAL **monomials, SCIP_Real constant, SCIP_Bool copymonomials)
SCIP_RETCODE SCIPsetConshdlrPresol(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPRESOL((*conspresol)), int maxprerounds, SCIP_PRESOLTIMING presoltiming)
SCIP_CONSHDLRDATA * conshdlrdata
static SCIP_RETCODE computeViolations(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, SCIP_Bool *solviolbounds, SCIP_CONS **maxviolcon)
SCIP_RETCODE SCIPexprgraphCreateNode(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE **node, SCIP_EXPROP op,...)
NLP local search primal heuristic using sub-SCIPs.
SCIP_RETCODE SCIPexprgraphReleaseNode(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE **node)
SCIP_Real SCIPgetRowLPFeasibility(SCIP *scip, SCIP_ROW *row)
static SCIP_RETCODE separatePoint(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, int nusefulconss, SCIP_SOL *sol, SCIP_Bool newsol, SCIP_Real minefficacy, SCIP_Bool inenforcement, SCIP_RESULT *result, SCIP_Real *bestefficacy)
SCIP_Real SCIPeventGetOldbound(SCIP_EVENT *event)
SCIP_Bool SCIPisFeasPositive(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPcreateConsNonlinear2(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, SCIP_EXPRGRAPHNODE *exprgraphnode, 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)
SCIP_RETCODE SCIPgetNLPFracVars(SCIP *scip, SCIP_VAR ***fracvars, SCIP_Real **fracvarssol, SCIP_Real **fracvarsfrac, int *nfracvars, int *npriofracvars)
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
SCIP_RETCODE SCIPexprgraphGetTree(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *rootnode, SCIP_EXPRTREE **exprtree)
SCIP_RETCODE SCIPincludeConshdlrNonlinear(SCIP *scip)
SCIP_RETCODE SCIPcaptureVar(SCIP *scip, SCIP_VAR *var)
SCIP_Bool SCIPconsIsModifiable(SCIP_CONS *cons)
SCIP_RETCODE SCIPaddVarsToRow(SCIP *scip, SCIP_ROW *row, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
#define CONSHDLR_EAGERFREQ
SCIP_VAR ** SCIPgetLinearVarsNonlinear(SCIP *scip, SCIP_CONS *cons)
static SCIP_DECL_CONSFREE(consFreeNonlinear)
static void consdataMoveLinearVar(SCIP_CONSDATA *consdata, int oldpos, int newpos)
SCIP_Bool SCIPisStopped(SCIP *scip)
SCIP_RETCODE SCIPsetConshdlrGetNVars(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSGETNVARS((*consgetnvars)))
void SCIPintervalMulScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
SCIP_RETCODE SCIPcreateConsNonlinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nexprtrees, SCIP_EXPRTREE **exprtrees, SCIP_Real *nonlincoefs, 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)
static SCIP_DECL_CONSENFOPS(consEnfopsNonlinear)
SCIP_Bool SCIPconsIsEnforced(SCIP_CONS *cons)
SCIP_EXPRGRAPHNODE ** SCIPexprgraphGetNodeChildren(SCIP_EXPRGRAPHNODE *node)
SCIP_Bool SCIPconsIsSeparated(SCIP_CONS *cons)
void SCIPsortPtrReal(void **ptrarray, SCIP_Real *realarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
SCIP_RETCODE SCIPprintRow(SCIP *scip, SCIP_ROW *row, FILE *file)
SCIP_Real * SCIPexprGetMonomialExponents(SCIP_EXPRDATA_MONOMIAL *monomial)
void SCIPexprgraphPrintNode(SCIP_EXPRGRAPHNODE *node, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
static SCIP_DECL_CONSINITSOL(consInitsolNonlinear)
SCIP_Real SCIPgetRowSolFeasibility(SCIP *scip, SCIP_ROW *row, SCIP_SOL *sol)
SCIP_RETCODE SCIPunlinkSol(SCIP *scip, SCIP_SOL *sol)
#define SCIPdebugAddSolVal(scip, var, val)
static SCIP_DECL_CONSEXITPRE(consExitpreNonlinear)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_RETCODE SCIPexprgraphSimplify(SCIP_EXPRGRAPH *exprgraph, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Real eps, int maxexpansionexponent, SCIP_Bool *havechange, SCIP_Bool *domainerror)
#define CONSHDLR_MAXPREROUNDS
static SCIP_DECL_CONSPRINT(consPrintNonlinear)
static SCIP_DECL_CONSINIT(consInitNonlinear)
void SCIPintervalSub(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
struct SCIP_ConshdlrData SCIP_CONSHDLRDATA
SCIP_RETCODE SCIPcomputeHyperplaneThreePoints(SCIP *scip, SCIP_Real a1, SCIP_Real a2, SCIP_Real a3, SCIP_Real b1, SCIP_Real b2, SCIP_Real b3, SCIP_Real c1, SCIP_Real c2, SCIP_Real c3, SCIP_Real *alpha, SCIP_Real *beta, SCIP_Real *gamma_, SCIP_Real *delta)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
SCIP_Bool SCIPvarIsTransformed(SCIP_VAR *var)
SCIP_RETCODE SCIPupdateStartpointHeurSubNlp(SCIP *scip, SCIP_HEUR *heur, SCIP_SOL *solcand, SCIP_Real violation)
SCIP_Bool SCIPconsIsMarkedPropagate(SCIP_CONS *cons)
SCIP_Real SCIPexprgraphGetNodeRealPowerExponent(SCIP_EXPRGRAPHNODE *node)
SCIP_Real SCIPgetUpperbound(SCIP *scip)
SCIP_RETCODE SCIPexprintFree(SCIP_EXPRINT **exprint)
#define BMSclearMemoryArray(ptr, num)
static SCIP_RETCODE addIntervalGradientEstimator(SCIP *scip, SCIP_EXPRINT *exprint, SCIP_CONS *cons, int exprtreeidx, SCIP_Real *x, SCIP_Bool newx, SCIP_Bool overestimate, SCIP_ROWPREP *rowprep, SCIP_Bool *success)
SCIP_Bool SCIPisSumLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPsetConshdlrActive(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSACTIVE((*consactive)))
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)
SCIP_EXPRGRAPHNODE * SCIPgetExprgraphNodeNonlinear(SCIP *scip, SCIP_CONS *cons)
static SCIP_DECL_CONSLOCK(consLockNonlinear)
SCIP_Real SCIPceil(SCIP *scip, SCIP_Real val)
void ** SCIPexprgraphGetVars(SCIP_EXPRGRAPH *exprgraph)
SCIP_EVENTHDLRDATA * SCIPeventhdlrGetData(SCIP_EVENTHDLR *eventhdlr)
void SCIPprintRowprep(SCIP *scip, SCIP_ROWPREP *rowprep, FILE *file)
static SCIP_DECL_CONSPRESOL(consPresolNonlinear)
SCIP_RETCODE SCIPsetConshdlrExitsol(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSEXITSOL((*consexitsol)))
static SCIP_DECL_CONSPARSE(consParseNonlinear)
SCIP_Real SCIPexprGetLinearConstant(SCIP_EXPR *expr)
SCIP_RETCODE SCIPcreateConsBasicNonlinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nexprtrees, SCIP_EXPRTREE **exprtrees, SCIP_Real *nonlincoefs, SCIP_Real lhs, SCIP_Real rhs)
SCIP_Real SCIPround(SCIP *scip, SCIP_Real val)
SCIP_EXPRCURV SCIPexprcurvAdd(SCIP_EXPRCURV curv1, SCIP_EXPRCURV curv2)
SCIP_Bool SCIPvarIsIntegral(SCIP_VAR *var)
SCIP_ROUNDMODE SCIPintervalGetRoundingMode(void)
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
static SCIP_RETCODE consdataCreate(SCIP *scip, SCIP_CONSDATA **consdata, SCIP_Real lhs, SCIP_Real rhs, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nexprtrees, SCIP_EXPRTREE **exprtrees, SCIP_Real *nonlincoefs, SCIP_Bool capturevars)
SCIP_SOL * SCIPeventGetSol(SCIP_EVENT *event)
SCIP_RETCODE SCIPexprgraphPrintDot(SCIP_EXPRGRAPH *exprgraph, SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char **varnames)
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)
void SCIPintervalSetRoundingModeDownwards(void)
SCIP_Real SCIPfloor(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPevalExprtreeLocalBounds(SCIP *scip, SCIP_EXPRTREE *tree, SCIP_Real infinity, SCIP_INTERVAL *val)
int SCIPexprgraphGetNodeDepth(SCIP_EXPRGRAPHNODE *node)
static SCIP_DECL_CONSCOPY(consCopyNonlinear)
SCIP_EXPRCURV SCIPexprcurvNegate(SCIP_EXPRCURV curvature)
SCIP_Bool SCIPintervalIsSubsetEQ(SCIP_Real infinity, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
SCIP_RETCODE SCIPexprtreeEval(SCIP_EXPRTREE *tree, SCIP_Real *varvals, SCIP_Real *val)
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)
#define SCIPreallocBufferArray(scip, ptr, num)
void SCIPaddRowprepConstant(SCIP_ROWPREP *rowprep, SCIP_Real constant)
static SCIP_RETCODE replaceViolatedByLinearConstraints(SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_Bool *addedcons, SCIP_Bool *reduceddom, SCIP_Bool *infeasible)
SCIP_RETCODE SCIPsetConshdlrProp(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPROP((*consprop)), int propfreq, SCIP_Bool delayprop, SCIP_PROPTIMING proptiming)
static SCIP_DECL_CONSEXITSOL(consExitsolNonlinear)
void SCIPexprgraphEnableNode(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node)
enum SCIP_SideType SCIP_SIDETYPE