38 #define CONSHDLR_NAME "nonlinear" 39 #define CONSHDLR_DESC "constraint handler for nonlinear constraints" 40 #define CONSHDLR_SEPAPRIORITY 10 41 #define CONSHDLR_ENFOPRIORITY -60 42 #define CONSHDLR_CHECKPRIORITY -4000010 43 #define CONSHDLR_SEPAFREQ 1 44 #define CONSHDLR_PROPFREQ 1 45 #define CONSHDLR_EAGERFREQ 100 47 #define CONSHDLR_MAXPREROUNDS -1 48 #define CONSHDLR_DELAYSEPA FALSE 49 #define CONSHDLR_DELAYPROP FALSE 50 #define CONSHDLR_NEEDSCONS TRUE 52 #define CONSHDLR_PROP_TIMING SCIP_PROPTIMING_BEFORELP 53 #define CONSHDLR_PRESOLTIMING SCIP_PRESOLTIMING_ALWAYS 55 #define INTERVALINFTY 1E+43 56 #define BOUNDTIGHTENING_MINSTRENGTH 0.05 57 #define INITLPMAXVARVAL 1000.0 94 unsigned int linvarssorted:1;
95 unsigned int linvarsmerged:1;
97 unsigned int iscurvchecked:1;
98 unsigned int isremovedfixingslin:1;
99 unsigned int ispresolved:1;
100 unsigned int forcebackprop:1;
104 int minlinactivityinf;
105 int maxlinactivityinf;
110 int linvar_maydecrease;
111 int linvar_mayincrease;
129 struct SCIP_ConshdlrData
142 int maxexpansionexponent;
150 int newsoleventfilterpos;
153 int nlconsupgradessize;
158 unsigned int isremovedfixings:1;
159 unsigned int ispropagated:1;
160 unsigned int isreformulated:1;
161 unsigned int sepanlp:1;
162 int naddedreformconss;
175 #define infty2infty(infty1, infty2, val) ((val) >= (infty1) ? (infty2) : (val)) 190 assert(scip !=
NULL);
191 assert(cons !=
NULL);
197 assert(conshdlrdata !=
NULL);
198 assert(conshdlrdata->linvareventhdlr !=
NULL);
201 assert(consdata !=
NULL);
203 assert(linvarpos >= 0);
204 assert(linvarpos < consdata->nlinvars);
212 if( consdata->lincoefs[linvarpos] > 0.0 )
220 if( consdata->lincoefs[linvarpos] > 0.0 )
228 eventdata->
varidx = linvarpos;
232 if( consdata->lineventdata ==
NULL )
237 consdata->lineventdata[linvarpos] = eventdata;
261 assert(scip !=
NULL);
262 assert(cons !=
NULL);
271 assert(consdata !=
NULL);
273 assert(linvarpos >= 0);
274 assert(linvarpos < consdata->nlinvars);
275 assert(consdata->lineventdata !=
NULL);
276 assert(consdata->lineventdata[linvarpos] !=
NULL);
277 assert(consdata->lineventdata[linvarpos]->cons == cons);
278 assert(consdata->lineventdata[linvarpos]->varidx == linvarpos);
279 assert(consdata->lineventdata[linvarpos]->filterpos >= 0);
285 if( consdata->lincoefs[linvarpos] > 0.0 )
293 if( consdata->lincoefs[linvarpos] > 0.0 )
317 assert(scip !=
NULL);
318 assert(cons !=
NULL);
323 assert(consdata !=
NULL);
348 assert(scip !=
NULL);
349 assert(cons !=
NULL);
354 assert(consdata !=
NULL);
383 assert(scip !=
NULL);
384 assert(consdata !=
NULL);
389 assert(consdata->minlinactivityinf >= 0);
390 assert(consdata->maxlinactivityinf >= 0);
394 consdata->minlinactivityinf = 0;
395 consdata->maxlinactivityinf = 0;
403 if( consdata->nlinvars == 0 )
408 assert(consdata->lineventdata !=
NULL);
417 for( i = 0; i < consdata->nlinvars; ++i )
420 assert(consdata->lineventdata[i] !=
NULL);
421 if( consdata->lincoefs[i] >= 0.0 )
426 ++consdata->minlinactivityinf;
436 ++consdata->minlinactivityinf;
441 consdata->minlinactivity += consdata->lincoefs[i] * bnd;
450 for( i = 0; i < consdata->nlinvars; ++i )
452 assert(consdata->lineventdata[i] !=
NULL);
454 if( consdata->lincoefs[i] >= 0.0 )
459 ++consdata->maxlinactivityinf;
469 ++consdata->maxlinactivityinf;
474 consdata->maxlinactivity += consdata->lincoefs[i] * bnd;
477 assert(consdata->minlinactivity <= consdata->maxlinactivity || consdata->minlinactivityinf > 0 || consdata->maxlinactivityinf > 0);
494 assert(scip !=
NULL);
495 assert(consdata !=
NULL);
522 --consdata->minlinactivityinf;
523 assert(consdata->minlinactivityinf >= 0);
532 ++consdata->minlinactivityinf;
536 consdata->minlinactivity += coef * newbnd;
558 --consdata->maxlinactivityinf;
559 assert(consdata->maxlinactivityinf >= 0);
568 ++consdata->maxlinactivityinf;
572 consdata->maxlinactivity += coef * newbnd;
591 assert(scip !=
NULL);
592 assert(consdata !=
NULL);
618 --consdata->maxlinactivityinf;
619 assert(consdata->maxlinactivityinf >= 0);
628 ++consdata->maxlinactivityinf;
632 consdata->maxlinactivity += coef * newbnd;
654 --consdata->minlinactivityinf;
655 assert(consdata->minlinactivityinf >= 0);
664 ++consdata->minlinactivityinf;
668 consdata->minlinactivity += coef * newbnd;
684 assert(scip !=
NULL);
685 assert(event !=
NULL);
686 assert(eventdata !=
NULL);
687 assert(eventhdlr !=
NULL);
690 assert(cons !=
NULL);
693 assert(consdata !=
NULL);
697 assert(varidx < consdata->nlinvars);
703 consdata->isremovedfixingslin =
FALSE;
734 assert(scip !=
NULL);
735 assert(event !=
NULL);
736 assert(eventdata !=
NULL);
737 assert(eventhdlr !=
NULL);
740 assert(conshdlrdata !=
NULL);
741 assert(conshdlrdata->exprgraph !=
NULL);
750 SCIPdebugMsg(scip,
"changed %s bound on expression graph variable <%s> from %g to %g\n",
755 conshdlrdata->ispropagated =
FALSE;
759 if( eventtype & SCIP_EVENTTYPE_LBCHANGED )
784 conshdlrdata->isremovedfixings =
FALSE;
798 assert(exprgraph !=
NULL);
800 assert(varnode !=
NULL);
805 assert(conshdlrdata !=
NULL);
806 assert(conshdlrdata->exprgraph == exprgraph);
826 conshdlrdata->ispropagated =
FALSE;
838 assert(exprgraph !=
NULL);
840 assert(varnode !=
NULL);
845 assert(conshdlrdata !=
NULL);
846 assert(conshdlrdata->exprgraph == exprgraph);
873 assert(scip !=
NULL);
874 assert(consdata !=
NULL);
875 assert(consdata->exprtrees !=
NULL || consdata->nexprtrees == 0);
877 if( nexprtrees == 0 )
884 if( consdata->nlrow !=
NULL )
889 consdata->ispresolved =
FALSE;
891 consdata->iscurvchecked =
FALSE;
893 if( consdata->nexprtrees == 0 )
895 assert(consdata->exprtrees ==
NULL);
896 assert(consdata->nonlincoefs ==
NULL);
903 assert(consdata->exprtrees !=
NULL);
904 assert(consdata->nonlincoefs !=
NULL);
910 for( i = 0; i < nexprtrees; ++i )
912 assert(exprtrees[i] !=
NULL);
922 consdata->exprtrees[consdata->nexprtrees + i] = exprtrees[i];
925 consdata->nonlincoefs[consdata->nexprtrees + i] = (coefs !=
NULL ? coefs[i] : 1.0);
928 consdata->nexprtrees += nexprtrees;
946 assert(scip !=
NULL);
947 assert(consdata !=
NULL);
948 assert(consdata->exprtrees !=
NULL || consdata->nexprtrees == 0);
951 if( consdata->nexprtrees > 0 )
953 for( i = 0; i < consdata->nexprtrees; ++i )
955 assert(consdata->exprtrees[i] !=
NULL);
963 if( consdata->nlrow !=
NULL )
968 consdata->ispresolved =
FALSE;
970 consdata->iscurvchecked =
TRUE;
975 consdata->nexprtrees = 0;
991 assert(scip !=
NULL);
992 assert(consdata !=
NULL);
993 assert(consdata->nlinvars <= consdata->linvarssize);
995 if( num > consdata->linvarssize )
1002 if( consdata->lineventdata !=
NULL )
1006 consdata->linvarssize = newsize;
1008 assert(num <= consdata->linvarssize);
1031 assert(scip !=
NULL);
1032 assert(consdata !=
NULL);
1034 assert(nlinvars == 0 || linvars !=
NULL);
1035 assert(nlinvars == 0 || lincoefs !=
NULL);
1036 assert(nexprtrees == 0 || exprtrees !=
NULL);
1037 assert(nexprtrees == 0 || nonlincoefs !=
NULL);
1044 (*consdata)->minlinactivityinf = -1;
1045 (*consdata)->maxlinactivityinf = -1;
1047 (*consdata)->lhs = lhs;
1048 (*consdata)->rhs = rhs;
1054 (*consdata)->nlinvars = nlinvars;
1055 (*consdata)->linvarssize = nlinvars;
1058 for( i = 0; i < nlinvars; ++i )
1065 (*consdata)->linvarssorted =
TRUE;
1066 (*consdata)->linvarsmerged =
TRUE;
1071 (*consdata)->linvar_maydecrease = -1;
1072 (*consdata)->linvar_mayincrease = -1;
1088 assert(scip !=
NULL);
1089 assert(consdata !=
NULL);
1097 (*consdata)->linvarssorted =
TRUE;
1098 (*consdata)->linvarsmerged =
TRUE;
1100 (*consdata)->isremovedfixingslin =
TRUE;
1102 (*consdata)->linvar_maydecrease = -1;
1103 (*consdata)->linvar_mayincrease = -1;
1107 (*consdata)->minlinactivityinf = -1;
1108 (*consdata)->maxlinactivityinf = -1;
1111 (*consdata)->iscurvchecked =
TRUE;
1113 (*consdata)->ncuts = 0;
1127 assert(scip !=
NULL);
1128 assert(consdata !=
NULL);
1129 assert(*consdata !=
NULL);
1132 if( (*consdata)->linvarssize > 0 )
1134 for( i = 0; i < (*consdata)->nlinvars; ++i )
1136 assert((*consdata)->lineventdata ==
NULL || (*consdata)->lineventdata[i] ==
NULL);
1143 assert((*consdata)->linvars ==
NULL);
1144 assert((*consdata)->lincoefs ==
NULL);
1145 assert((*consdata)->lineventdata ==
NULL);
1147 if( (*consdata)->nexprtrees > 0 )
1149 assert((*consdata)->exprtrees !=
NULL);
1150 assert((*consdata)->nonlincoefs !=
NULL);
1151 assert((*consdata)->curvatures !=
NULL);
1152 for( i = 0; i < (*consdata)->nexprtrees; ++i )
1154 assert((*consdata)->exprtrees[i] !=
NULL);
1156 assert((*consdata)->exprtrees[i] ==
NULL);
1162 assert((*consdata)->exprtrees ==
NULL);
1163 assert((*consdata)->nonlincoefs ==
NULL);
1164 assert((*consdata)->curvatures ==
NULL);
1167 if( (*consdata)->nlrow !=
NULL )
1184 assert(consdata !=
NULL);
1186 if( consdata->linvarssorted )
1189 if( consdata->nlinvars <= 1 )
1191 consdata->linvarssorted =
TRUE;
1195 if( consdata->lineventdata ==
NULL )
1197 SCIPsortPtrReal((
void**)consdata->linvars, consdata->lincoefs, SCIPvarComp, consdata->nlinvars);
1203 SCIPsortPtrPtrReal((
void**)consdata->linvars, (
void**)consdata->lineventdata, consdata->lincoefs, SCIPvarComp, consdata->nlinvars);
1206 for( i = 0; i < consdata->nlinvars; ++i )
1207 if( consdata->lineventdata[i] !=
NULL )
1208 consdata->lineventdata[i]->varidx = i;
1211 consdata->linvarssorted =
TRUE;
1215 #ifdef SCIP_DISABLED_CODE 1218 int consdataFindLinearVar(
1225 assert(consdata !=
NULL);
1226 assert(var !=
NULL);
1228 if( consdata->nlinvars == 0 )
1233 if( !
SCIPsortedvecFindPtr((
void**)consdata->linvars, SCIPvarComp, (
void*)var, consdata->nlinvars, &pos) )
1248 assert(consdata !=
NULL);
1249 assert(oldpos >= 0);
1250 assert(oldpos < consdata->nlinvars);
1251 assert(newpos >= 0);
1252 assert(newpos < consdata->linvarssize);
1254 if( newpos == oldpos )
1257 consdata->linvars [newpos] = consdata->linvars [oldpos];
1258 consdata->lincoefs[newpos] = consdata->lincoefs[oldpos];
1260 if( consdata->lineventdata !=
NULL )
1262 assert(newpos >= consdata->nlinvars || consdata->lineventdata[newpos] ==
NULL);
1264 consdata->lineventdata[newpos] = consdata->lineventdata[oldpos];
1265 consdata->lineventdata[newpos]->varidx = newpos;
1267 consdata->lineventdata[oldpos] =
NULL;
1270 consdata->linvarssorted =
FALSE;
1285 assert(scip !=
NULL);
1286 assert(cons !=
NULL);
1287 assert(var !=
NULL);
1294 assert(consdata !=
NULL);
1304 assert(var !=
NULL);
1308 consdata->linvars [consdata->nlinvars] = var;
1309 consdata->lincoefs[consdata->nlinvars] = coef;
1311 ++consdata->nlinvars;
1324 consdata->minlinactivityinf = -1;
1325 consdata->maxlinactivityinf = -1;
1328 if( consdata->nlrow !=
NULL )
1339 consdata->ispresolved =
FALSE;
1340 consdata->isremovedfixingslin = consdata->isremovedfixingslin &&
SCIPvarIsActive(var);
1341 if( consdata->nlinvars == 1 )
1342 consdata->linvarssorted =
TRUE;
1344 consdata->linvarssorted = consdata->linvarssorted &&
1345 (
SCIPvarCompare(consdata->linvars[consdata->nlinvars-2], consdata->linvars[consdata->nlinvars-1]) == -1);
1347 consdata->linvarsmerged =
FALSE;
1364 assert(scip !=
NULL);
1365 assert(cons !=
NULL);
1368 assert(consdata !=
NULL);
1369 assert(0 <= pos && pos < consdata->nlinvars);
1371 var = consdata->linvars[pos];
1372 coef = consdata->lincoefs[pos];
1373 assert(var !=
NULL);
1391 --consdata->nlinvars;
1397 consdata->minlinactivityinf = -1;
1398 consdata->maxlinactivityinf = -1;
1401 if( consdata->nlrow !=
NULL )
1406 consdata->ispresolved =
FALSE;
1424 assert(scip !=
NULL);
1425 assert(cons !=
NULL);
1429 assert(consdata !=
NULL);
1431 assert(pos < consdata->nlinvars);
1434 var = consdata->linvars[pos];
1435 coef = consdata->lincoefs[pos];
1436 assert(var !=
NULL);
1443 consdata->minlinactivityinf = -1;
1444 consdata->maxlinactivityinf = -1;
1447 if( consdata->nlrow !=
NULL )
1453 if( newcoef * coef < 0.0 )
1471 consdata->lincoefs[pos] = newcoef;
1474 if( newcoef * coef < 0.0 )
1489 consdata->ispresolved =
FALSE;
1507 assert(scip !=
NULL);
1508 assert(cons !=
NULL);
1512 if( consdata->linvarsmerged )
1515 if( consdata->nlinvars == 0 )
1517 consdata->linvarsmerged =
TRUE;
1522 while( i < consdata->nlinvars )
1528 newcoef = consdata->lincoefs[i];
1529 for( j = i+1; j < consdata->nlinvars && consdata->linvars[i] == consdata->linvars[j]; ++j )
1530 newcoef += consdata->lincoefs[j];
1532 for( j = j-1; j > i; --j )
1549 consdata->linvarsmerged =
TRUE;
1568 assert(scip !=
NULL);
1569 assert(cons !=
NULL);
1573 if( !consdata->isremovedfixingslin )
1576 while( i < consdata->nlinvars )
1578 var = consdata->linvars[i];
1586 coef = consdata->lincoefs[i];
1601 consdata->lhs -= offset;
1606 consdata->rhs -= offset;
1637 for( j = 0; j < naggrs; ++j )
1642 if( aggrconstant != 0.0 )
1646 consdata->lhs -= coef * aggrconstant;
1651 consdata->rhs -= coef * aggrconstant;
1660 consdata->isremovedfixingslin =
TRUE;
1667 for( i = 0; i < consdata->nlinvars; ++i )
1721 if( requsize > varssize )
1725 varssize = requsize;
1734 for( j = 0; j < nvars; ++j )
1772 assert(scip !=
NULL);
1773 assert(conshdlr !=
NULL);
1774 assert(cons !=
NULL);
1777 assert(consdata !=
NULL);
1779 if( consdata->exprgraphnode ==
NULL )
1795 if( constant != 0.0 )
1799 consdata->lhs -= constant;
1804 consdata->rhs -= constant;
1809 for( i = 0; i < nlinvars; ++i )
1831 assert(scip !=
NULL);
1832 assert(cons !=
NULL);
1835 assert(consdata !=
NULL);
1837 if( consdata->nlrow !=
NULL )
1842 if( consdata->nexprtrees == 0 )
1845 consdata->nlinvars, consdata->linvars, consdata->lincoefs,
1847 NULL, consdata->lhs, consdata->rhs,
1848 consdata->curvature) );
1850 else if( consdata->nexprtrees == 1 && consdata->nonlincoefs[0] == 1.0 )
1852 assert(consdata->exprtrees[0] !=
NULL);
1854 consdata->nlinvars, consdata->linvars, consdata->lincoefs,
1856 consdata->exprtrees[0], consdata->lhs, consdata->rhs,
1857 consdata->curvature) );
1867 assert(consdata->exprgraphnode !=
NULL);
1869 assert(conshdlrdata !=
NULL);
1873 consdata->nlinvars, consdata->linvars, consdata->lincoefs,
1875 exprtree, consdata->lhs, consdata->rhs,
1876 consdata->curvature) );
1900 assert(scip !=
NULL);
1901 assert(conshdlr !=
NULL);
1902 assert(cons !=
NULL);
1904 assert(upgraded !=
NULL);
1905 assert(nupgdconss !=
NULL);
1906 assert(naddconss !=
NULL);
1920 #ifdef SCIP_DEBUG_SOLUTION 1921 if( SCIPdebugIsMainscip(scip) )
1941 SCIPdebugMsg(scip,
"upgrading nonlinear constraint <%s> (up to %d upgrade methods):\n",
1953 SCIP_CALL(
conshdlrdata->nlconsupgrades[i]->nlconsupgd(scip, cons, &nupgdconss_, upgdconss, upgdconsssize) );
1955 while( nupgdconss_ < 0 )
1958 assert(-nupgdconss_ > upgdconsssize);
1959 upgdconsssize = -nupgdconss_;
1962 SCIP_CALL(
conshdlrdata->nlconsupgrades[i]->nlconsupgd(scip, cons, &nupgdconss_, upgdconss, upgdconsssize) );
1964 assert(nupgdconss_ != 0);
1967 if( nupgdconss_ > 0 )
1972 SCIPdebugMsg(scip,
" -> upgraded to %d constraints:\n", nupgdconss_);
1975 for( j = 0; j < nupgdconss_; ++j )
1986 *naddconss += nupgdconss_ - 1;
2018 assert(scip !=
NULL);
2019 assert(cons !=
NULL);
2022 assert(consdata !=
NULL);
2024 if( consdata->iscurvchecked )
2030 consdata->iscurvchecked =
TRUE;
2035 for( i = 0; i < consdata->nexprtrees; ++i )
2037 assert(consdata->exprtrees[i] !=
NULL);
2052 if( varboundssize == 0 )
2062 assert(varbounds !=
NULL);
2073 consdata->curvatures[i] =
SCIPexprcurvMultiply(consdata->nonlincoefs[i], consdata->curvatures[i]);
2085 consdata->curvature =
SCIPexprcurvAdd(consdata->curvature, consdata->curvatures[i]);
2112 assert(exprgraph !=
NULL);
2113 assert(node !=
NULL);
2114 assert(*node !=
NULL);
2115 assert(replacement !=
NULL);
2116 assert(conss !=
NULL || nconss == 0);
2129 for( c = 0; c < nconss; ++c )
2131 assert(conss[c] !=
NULL);
2134 assert(consdata !=
NULL);
2136 if( consdata->exprgraphnode == *node )
2139 consdata->exprgraphnode = replacement;
2143 consdata->ispresolved =
FALSE;
2173 assert(scip !=
NULL);
2174 assert(exprgraph !=
NULL);
2175 assert(node !=
NULL);
2176 assert(naddcons !=
NULL);
2188 #ifdef SCIP_DEBUG_SOLUTION 2189 if( SCIPdebugIsMainscip(scip) )
2210 SCIP_CALL(
SCIPcreateConsNonlinear2(scip, &auxcons, name, 1, &auxvar, &minusone, node, 0.0, 0.0,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
2242 assert(scip !=
NULL);
2243 assert(exprgraph !=
NULL);
2244 assert(node !=
NULL);
2245 assert(naddcons !=
NULL);
2254 assert(child !=
NULL);
2258 SCIPdebugMsg(scip,
"add auxiliary variable for child %p(%d,%d) with curvature %s\n",
2300 assert(scip !=
NULL);
2301 assert(exprgraph !=
NULL);
2302 assert(nfactors > 0);
2303 assert(factors !=
NULL);
2304 assert(resultnode !=
NULL);
2305 assert(naddcons !=
NULL);
2308 if( nfactors == 1 && (exponents ==
NULL || exponents[0] == 1.0) )
2310 *resultnode = factors[0];
2324 SCIPdebugMsg(scip,
"add auxiliary variable and constraint %s\n", name);
2331 #ifdef SCIP_DEBUG_SOLUTION 2333 if( SCIPdebugIsMainscip(scip) )
2348 reformfactors[0] = *resultnode;
2349 reformfactors[1] = factors[0];
2351 reformexp[1] = -exponents[0];
2372 assert(exponents !=
NULL);
2392 if( expnode ==
NULL )
2408 SCIPdebugMsg(scip,
"add auxiliary variable and constraint %s\n", name);
2415 #ifdef SCIP_DEBUG_SOLUTION 2416 if( SCIPdebugIsMainscip(scip) )
2425 SCIP_CALL(
SCIPcreateConsNonlinear2(scip, &auxcons, name, 1, &auxvar, &minusone, expnode, 0.0, 0.0,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
2436 *resultnode = expnode;
2442 if( nfactors == 2 && exponents !=
NULL && exponents[0] != 1.0 && exponents[0] == exponents[1] )
2451 SCIP_CALL(
reformMonomial(scip, exprgraph, 1, &productnode, &exponents[0], resultnode, createauxcons, mindepth, naddcons) );
2456 if( nfactors == 2 && exponents !=
NULL && exponents[0] == -exponents[1] )
2467 SCIPdebugMsg(scip,
"add auxiliary variable and constraint %s\n", name);
2474 #ifdef SCIP_DEBUG_SOLUTION 2476 if( SCIPdebugIsMainscip(scip) )
2479 if( exponents[0] > 0.0 )
2489 leftright[0] = auxvarnode;
2490 leftright[1] = exponents[0] > 0.0 ? factors[1] : factors[0];
2495 leftright[0] = auxconsnode;
2496 leftright[1] = exponents[0] > 0.0 ? factors[0] : factors[1];
2512 absexp = fabs(exponents[0]);
2513 SCIP_CALL(
reformMonomial(scip, exprgraph, 1, &auxvarnode, &absexp, resultnode, createauxcons, mindepth, naddcons) );
2531 half = nfactors / 2;
2533 assert(half < nfactors);
2550 productnode = parent;
2554 if( productnode == NULL )
2567 SCIPdebugMsg(scip,
"add auxiliary variable and constraint %s\n", name);
2574 #ifdef SCIP_DEBUG_SOLUTION 2575 if( SCIPdebugIsMainscip(scip) )
2584 SCIP_CALL(
SCIPcreateConsNonlinear2(scip, &auxcons, name, 1, &auxvar, &minusone, productnode, 0.0, 0.0,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
2595 *resultnode = productnode;
2631 assert(scip !=
NULL);
2632 assert(conshdlr !=
NULL);
2633 assert(conss !=
NULL || nconss == 0);
2634 assert(naddcons !=
NULL);
2643 SCIPdebugMsg(scip,
"skip reformulation, already done\n");
2651 assert(!domainerror);
2654 #ifdef SCIP_DEBUG_SOLUTION 2655 if( SCIPdebugIsMainscip(scip) )
2676 assert(node !=
NULL);
2694 SCIP_CALL(
conshdlrdata->nlconsupgrades[u]->nodereform(scip, exprgraph, node, naddcons, &reformnode) );
2695 if( reformnode ==
NULL )
2698 SCIPdebugMsg(scip,
"external nodereform reformulated node %p(%d,%d), replace by %p\n",
2709 if( u < conshdlrdata->nnlconsupgrades )
2736 assert(children !=
NULL || nchildren == 0);
2742 for( j = 0; j < nchildren; ++j )
2744 assert(children[j] !=
NULL);
2745 if( havenonlinparent ||
2771 if( havenonlinparent )
2774 assert(node !=
NULL);
2797 assert(child !=
NULL);
2801 SCIPdebugMessage(
"add auxiliary variable for child %p(%d,%d) with curvature %s operator %s\n",
2834 assert(node !=
NULL);
2858 assert(children !=
NULL);
2859 assert(nchildren == 2);
2871 #ifdef SCIP_DEBUG_SOLUTION 2872 if( SCIPdebugIsMainscip(scip) )
2882 auxchildren[0] = children[0];
2883 auxchildren[1] = children[1];
2884 auxchildren[2] = auxvarnode;
2892 quadelem.
coef = 1.0;
2934 assert(nchildren == 1);
2965 assert(nchildren == 1);
2993 if( havenonlinparent )
2996 assert(node !=
NULL);
3056 assert(nmonomials >= 1);
3058 if( nmonomials > 1 )
3091 for( m = 0; m < nmonomials; ++m )
3093 monomial = monomials[m];
3094 assert(monomial !=
NULL);
3100 assert(nfactors >= 1);
3101 assert(coef != 0.0);
3103 if( nfactors == 1 && exponents[0] == 1.0 )
3106 if( lincoefs ==
NULL )
3111 assert(0 <= childidxs[0] && childidxs[0] < nchildren);
3112 assert(lincoefs[childidxs[0]] == 0.0);
3113 lincoefs[childidxs[0]] = coef;
3115 else if( nfactors == 1 && exponents[0] == 2.0 )
3118 if( quadelems ==
NULL )
3122 quadelems[nquadelems].
idx1 = childidxs[0];
3123 quadelems[nquadelems].
idx2 = childidxs[0];
3124 quadelems[nquadelems].
coef = coef;
3127 else if( nfactors == 2 && exponents[0] == 1.0 && exponents[1] == 1.0 )
3130 if( quadelems ==
NULL )
3134 if( childidxs[0] < childidxs[1] )
3136 quadelems[nquadelems].
idx1 = childidxs[0];
3137 quadelems[nquadelems].
idx2 = childidxs[1];
3141 quadelems[nquadelems].
idx1 = childidxs[1];
3142 quadelems[nquadelems].
idx2 = childidxs[0];
3144 quadelems[nquadelems].
coef = coef;
3157 if( childrennew ==
NULL )
3161 assert(nfactors <= nchildren);
3162 for( f = 0; f < nfactors; ++f )
3163 childrennew[f] = children[childidxs[f]];
3173 assert(lincoefs !=
NULL || nquadelems > 0 || nmonomialnodes > 0);
3175 if( nquadelems > 0 )
3183 else if( lincoefs !=
NULL )
3191 assert(constant == 0.0);
3197 assert(nmonomialnodes > 0);
3198 if( nmonomialnodes > 1 )
3208 sumnode = monomialnodes[0];
3215 SCIPdebugMsg(scip,
"splitup polynomial into sum of %d nodes\n", nmonomialnodes);
3222 monomial = monomials[0];
3223 assert(monomial !=
NULL);
3229 assert(nfactors >= 1);
3230 assert(coef != 0.0);
3231 assert(children !=
NULL);
3290 for( f = 0; f < nfactors; ++f )
3295 if( childbounds.
inf < 0.0 && childbounds.
sup > 0.0 )
3298 if( exponents[f] < 0.0 )
3302 sum += exponents[f];
3305 if( childbounds.
inf < 0.0 )
3333 if( nnegative == nfactors || (nnegative == nfactors-1 &&
SCIPisGE(scip, sum, 1.0)) )
3336 SCIPdebugMsg(scip,
"%d-variate monomial is convex (modulo sign), child curv fits = %u\n", nfactors, expcurvpos);
3338 assert(!expcurvpos);
3341 else if( npositive == nfactors &&
SCIPisLE(scip, sum, 1.0) )
3344 SCIPdebugMsg(scip,
"%d-variate monomial is concave (modulo sign), child curv fits = %u\n", nfactors, expcurvneg);
3346 assert(!expcurvneg);
3359 for( f = 0; f < nfactors; ++f )
3364 assert(childbounds.
inf >= 0.0 || childbounds.
sup <= 0.0);
3367 if( childbounds.
inf < 0.0 )
3375 SCIPdebugMsg(scip,
"reform child %d (factor %d) with curv %s into var\n",
3399 assert(nfactors > 1 ||
3405 assert(!(nfactors == 2 && exponents[0] == 1.0 && exponents[1] == 1.0));
3409 if( nfactors > 1 || havenonlinparent || exponents[0] < 0.0 )
3417 for( f = 0; f < nfactors; ++f )
3418 factors[f] = children[childidxs[f]];
3421 factors = &children[childidxs[0]];
3423 SCIPdebugMsg(scip,
"reform monomial node, create auxvar = %u\n", havenonlinparent);
3454 SCIPdebugMsg(scip,
"no reformulation of monomial node, assume signpower will take care of it\n");
3489 for( c = 0; c < nconss; ++c )
3494 assert(conss[c] !=
NULL);
3501 assert(consdata !=
NULL);
3503 if( consdata->exprgraphnode ==
NULL )
3510 consdata->forcebackprop =
TRUE;
3523 assert(monomial !=
NULL);
3552 SCIPdebugMsg(scip,
"replace linear multivariate node %p(%d,%d) in expression of cons <%s> by auxvar\n",
3572 multivarnode = consdata->exprgraphnode;
3584 if( multivarnode == consdata->exprgraphnode )
3592 SCIPdebugMsg(scip,
"replace linear multivariate node %p(%d,%d) in expression of cons <%s> by auxvar\n",
3620 assert(scip !=
NULL);
3621 assert(cons !=
NULL);
3622 assert(maxelem !=
NULL);
3625 assert(consdata !=
NULL);
3626 assert(exprint !=
NULL);
3627 assert(consdata->nexprtrees != 0 || consdata->exprgraphnode ==
NULL);
3632 for( i = 0; i < consdata->nlinvars; ++i )
3633 if(
REALABS(consdata->lincoefs[i]) > *maxelem )
3634 *maxelem =
REALABS(consdata->lincoefs[i]);
3638 *maxelem = consdata->lincoefsmax;
3641 for( j = 0; j < consdata->nexprtrees; ++j )
3646 assert(consdata->exprtrees[j] !=
NULL);
3666 if(
REALABS(grad) > *maxelem )
3680 for( i = 0; i < nvars; ++i )
3682 grad[i] *= consdata->nonlincoefs[j];
3683 if(
REALABS(grad[i]) > *maxelem )
3700 if(
REALABS(grad) > *maxelem )
3711 for( i = 0; i < nvars; ++i )
3713 grad[i] *= consdata->nonlincoefs[j];
3714 if(
REALABS(grad[i]) > *maxelem )
3747 assert(scip !=
NULL);
3748 assert(conshdlr !=
NULL);
3749 assert(cons !=
NULL);
3750 assert(solviolbounds !=
NULL);
3757 assert(consdata !=
NULL);
3759 consdata->activity = 0.0;
3761 *solviolbounds =
FALSE;
3763 for( i = 0; i < consdata->nlinvars; ++i )
3765 var = consdata->linvars[i];
3783 *solviolbounds =
TRUE;
3789 consdata->activity += consdata->lincoefs[i] * varval;
3792 for( i = 0; i < consdata->nexprtrees; ++i )
3817 *solviolbounds =
TRUE;
3832 for( j = 0; j < nvars; ++j )
3843 *solviolbounds =
TRUE;
3867 consdata->activity += consdata->nonlincoefs[i] * val;
3870 if( consdata->nexprtrees == 0 && consdata->exprgraphnode !=
NULL )
3888 consdata->activity += val;
3892 consdata->lhsviol = consdata->lhs - consdata->activity;
3894 consdata->lhsviol = 0.0;
3897 consdata->rhsviol = consdata->activity - consdata->rhs;
3899 consdata->rhsviol = 0.0;
3911 if( (consdata->lhsviol > 0.0 || consdata->rhsviol > 0.0) && (consdata->exprgraphnode ==
NULL || consdata->nexprtrees > 0) )
3919 consdata->lhsviol /= norm;
3920 consdata->rhsviol /= norm;
3927 if( consdata->lhsviol > 0.0 )
3928 consdata->lhsviol /=
MAX(1.0,
REALABS(consdata->lhs));
3930 if( consdata->rhsviol > 0.0 )
3931 consdata->rhsviol /=
MAX(1.0,
REALABS(consdata->rhs));
3964 assert(scip !=
NULL);
3965 assert(conshdlr !=
NULL);
3966 assert(conss !=
NULL || nconss == 0);
3967 assert(maxviolcon !=
NULL);
3968 assert(solviolbounds !=
NULL);
3976 assert(conshdlrdata !=
NULL);
3977 assert(conshdlrdata->exprgraph !=
NULL);
3991 for( c = 0; c < nconss; ++c )
3993 assert(conss !=
NULL);
3994 assert(conss[c] !=
NULL);
3999 if( *solviolbounds )
4003 assert(consdata !=
NULL);
4005 viol =
MAX(consdata->lhsviol, consdata->rhsviol);
4009 *maxviolcon = conss[c];
4041 assert(scip !=
NULL);
4042 assert(cons !=
NULL);
4044 assert(row !=
NULL);
4045 assert(success !=
NULL);
4048 assert(consdata !=
NULL);
4049 assert(exprtreeidx >= 0);
4050 assert(exprtreeidx < consdata->nexprtrees);
4051 assert(consdata->exprtrees !=
NULL);
4053 exprtree = consdata->exprtrees[exprtreeidx];
4054 assert(exprtree !=
NULL);
4057 treecoef = consdata->nonlincoefs[exprtreeidx];
4080 for( i = 0; i < nvars; ++i )
4085 grad[i] *= treecoef;
4086 constant -= grad[i] * x[i];
4093 if( grad[i] != 0.0 &&
SCIPisZero(scip, grad[i]) )
4110 SCIPdebugMsg(scip,
"var <%s> [%g,%g] has tiny gradient %g, replace coefficient by constant %g\n",
4112 constant += grad[i] * xbnd;
4118 SCIPdebugMsg(scip,
"skipping linearization, var <%s> [%g,%g] has tiny gradient %g but no finite bound in this direction\n",
4137 for( i = 0; i < nvars; ++i )
4143 else if(
SCIPisEQ(scip, x[i], ub) )
4146 x[i] += MIN3(0.9*(ub-x[i]), 0.9*(x[i]-lb), i*
SCIPfeastol(scip)) * (i%2 != 0 ? -1.0 : 1.0);
4216 assert(scip !=
NULL);
4217 assert(cons !=
NULL);
4218 assert(row !=
NULL);
4219 assert(success !=
NULL);
4222 assert(consdata !=
NULL);
4223 assert(exprtreeidx >= 0);
4224 assert(exprtreeidx < consdata->nexprtrees);
4225 assert(consdata->exprtrees !=
NULL);
4227 exprtree = consdata->exprtrees[exprtreeidx];
4228 assert(exprtree !=
NULL);
4231 treecoef = consdata->nonlincoefs[exprtreeidx];
4242 SCIPdebugMsg(scip,
"skip secant for tree %d of constraint <%s> since variable is unbounded\n", exprtreeidx,
SCIPconsGetName(cons));
4250 SCIPdebugMsg(scip,
"skip secant for tree %d of constraint <%s> since function cannot be evaluated in lower bound\n", exprtreeidx,
SCIPconsGetName(cons));
4258 SCIPdebugMsg(scip,
"skip secant for tree %d of constraint <%s> since function cannot be evaluated in upper bound\n", exprtreeidx,
SCIPconsGetName(cons));
4268 constant =
MAX(vallb, valub);
4270 constant =
MIN(vallb, valub);
4274 slope = (valub - vallb) / (xub - xlb);
4275 constant = vallb - slope * xlb;
4347 assert(scip !=
NULL);
4348 assert(cons !=
NULL);
4349 assert(ref !=
NULL);
4350 assert(row !=
NULL);
4351 assert(success !=
NULL);
4354 assert(consdata !=
NULL);
4355 assert(exprtreeidx >= 0);
4356 assert(exprtreeidx < consdata->nexprtrees);
4357 assert(consdata->exprtrees !=
NULL);
4359 exprtree = consdata->exprtrees[exprtreeidx];
4360 assert(exprtree !=
NULL);
4363 treecoef = consdata->nonlincoefs[exprtreeidx];
4383 ref[0] =
MIN(xub,
MAX(xlb, ref[0]));
4386 ref[1] =
MIN(yub,
MAX(ylb, ref[1]));
4410 SCIPdebugMsg(scip,
"skip secant for tree %d of constraint <%s> since function cannot be evaluated\n", exprtreeidx,
SCIPconsGetName(cons));
4420 else if(
SCIPisEQ(scip, xlb, xub) )
4429 SCIPdebugMsg(scip,
"skip secant for tree %d of constraint <%s> since function cannot be evaluated\n", exprtreeidx,
SCIPconsGetName(cons));
4436 coefy = (p4val - p1val) / (yub - ylb);
4437 constant = p1val - coefy * ylb;
4439 else if(
SCIPisEQ(scip, ylb, yub) )
4448 SCIPdebugMsg(scip,
"skip secant for tree %d of constraint <%s> since function cannot be evaluated\n", exprtreeidx,
SCIPconsGetName(cons));
4455 coefx = (p2val - p1val) / (xub - xlb);
4457 constant = p1val - coefx * xlb;
4476 SCIPdebugMsg(scip,
"skip secant for tree %d of constraint <%s> since function cannot be evaluated\n", exprtreeidx,
SCIPconsGetName(cons));
4493 SCIPdebugMsg(scip,
"p1 = (%g, %g), f(p1) = %g\n", p1[0], p1[1], p1val);
4494 SCIPdebugMsg(scip,
"p2 = (%g, %g), f(p2) = %g\n", p2[0], p2[1], p2val);
4495 SCIPdebugMsg(scip,
"p3 = (%g, %g), f(p3) = %g\n", p3[0], p3[1], p3val);
4496 SCIPdebugMsg(scip,
"p4 = (%g, %g), f(p4) = %g\n", p4[0], p4[1], p4val);
4509 if( ref[1] <= ylb + (yub - ylb)/(xub - xlb) * (ref[0] - xlb) )
4511 SCIP_CALL(
SCIPcomputeHyperplaneThreePoints(scip, p1[0], p1[1], p1val, p2[0], p2[1], p2val, p3[0], p3[1], p3val,
4512 &alpha, &beta, &gamma_, &delta) );
4514 assert(
SCIPisRelEQ(scip, alpha * p1[0] + beta * p1[1] + gamma_ * p1val, delta));
4515 assert(
SCIPisRelEQ(scip, alpha * p2[0] + beta * p2[1] + gamma_ * p2val, delta));
4516 assert(
SCIPisRelEQ(scip, alpha * p3[0] + beta * p3[1] + gamma_ * p3val, delta));
4519 if( alpha * p4[0] + beta * p4[1] + gamma_ * p4val > delta )
4526 p4val, &alpha, &beta, &gamma_, &delta) );
4528 assert(
SCIPisRelEQ(scip, alpha * p1[0] + beta * p1[1] + gamma_ * p1val, delta));
4529 assert(
SCIPisRelEQ(scip, alpha * p3[0] + beta * p3[1] + gamma_ * p3val, delta));
4530 assert(
SCIPisRelEQ(scip, alpha * p4[0] + beta * p4[1] + gamma_ * p4val, delta));
4533 if( alpha * p2[0] + beta * p2[1] + gamma_ * p2val > delta )
4539 SCIP_CALL(
SCIPcomputeHyperplaneThreePoints(scip, p1[0], p1[1], p1val, p3[0], p3[1], p3val, p4[0], p4[1], p4val,
4540 &alpha, &beta, &gamma_, &delta) );
4542 assert(
SCIPisRelEQ(scip, alpha * p1[0] + beta * p1[1] + gamma_ * p1val, delta));
4543 assert(
SCIPisRelEQ(scip, alpha * p3[0] + beta * p3[1] + gamma_ * p3val, delta));
4544 assert(
SCIPisRelEQ(scip, alpha * p4[0] + beta * p4[1] + gamma_ * p4val, delta));
4547 if( alpha * p2[0] + beta * p2[1] + gamma_ * p2val > delta )
4554 p3val, &alpha, &beta, &gamma_, &delta) );
4556 assert(
SCIPisRelEQ(scip, alpha * p1[0] + beta * p1[1] + gamma_ * p1val, delta));
4557 assert(
SCIPisRelEQ(scip, alpha * p2[0] + beta * p2[1] + gamma_ * p2val, delta));
4558 assert(
SCIPisRelEQ(scip, alpha * p3[0] + beta * p3[1] + gamma_ * p3val, delta));
4561 if( alpha * p4[0] + beta * p4[1] + gamma_ * p4val > delta )
4568 if( ref[1] <= yub + (ylb - yub)/(xub - xlb) * (ref[0] - xlb) )
4571 p4val, &alpha, &beta, &gamma_, &delta) );
4574 assert(
SCIPisRelEQ(scip, alpha * p1[0] + beta * p1[1] + gamma_ * p1val, delta));
4575 assert(
SCIPisRelEQ(scip, alpha * p2[0] + beta * p2[1] + gamma_ * p2val, delta));
4576 assert(
SCIPisRelLE(scip, alpha * p3[0] + beta * p3[1] + gamma_ * p3val, delta));
4577 assert(
SCIPisRelEQ(scip, alpha * p4[0] + beta * p4[1] + gamma_ * p4val, delta));
4584 p4val, &alpha, &beta, &gamma_, &delta) );
4587 assert(
SCIPisRelLE(scip, alpha * p1[0] + beta * p1[1] + gamma_ * p1val, delta));
4588 assert(
SCIPisRelEQ(scip, alpha * p2[0] + beta * p2[1] + gamma_ * p2val, delta));
4589 assert(
SCIPisRelEQ(scip, alpha * p3[0] + beta * p3[1] + gamma_ * p3val, delta));
4590 assert(
SCIPisRelEQ(scip, alpha * p4[0] + beta * p4[1] + gamma_ * p4val, delta));
4596 p4val, &alpha, &beta, &gamma_, &delta) );
4599 assert(
SCIPisRelLE(scip, alpha * p1[0] + beta * p1[1] + gamma_ * p1val, delta));
4600 assert(
SCIPisRelEQ(scip, alpha * p2[0] + beta * p2[1] + gamma_ * p2val, delta));
4601 assert(
SCIPisRelEQ(scip, alpha * p3[0] + beta * p3[1] + gamma_ * p3val, delta));
4602 assert(
SCIPisRelEQ(scip, alpha * p4[0] + beta * p4[1] + gamma_ * p4val, delta));
4609 p4val, &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(
SCIPisRelLE(scip, alpha * p3[0] + beta * p3[1] + gamma_ * p3val, delta));
4615 assert(
SCIPisRelEQ(scip, alpha * p4[0] + beta * p4[1] + gamma_ * p4val, delta));
4620 SCIPdebugMsg(scip,
"alpha = %g, beta = %g, gamma = %g, delta = %g\n", alpha, beta, gamma_, delta);
4631 coefx = -alpha / gamma_;
4632 coefy = -beta / gamma_;
4633 constant = delta / gamma_;
4729 assert(scip !=
NULL);
4730 assert(cons !=
NULL);
4731 assert(ref !=
NULL);
4732 assert(row !=
NULL);
4733 assert(success !=
NULL);
4736 assert(consdata !=
NULL);
4737 assert(exprtreeidx >= 0);
4738 assert(exprtreeidx < consdata->nexprtrees);
4739 assert(consdata->exprtrees !=
NULL);
4741 exprtree = consdata->exprtrees[exprtreeidx];
4742 assert(exprtree !=
NULL);
4752 if( !warned_highdim_concave )
4755 warned_highdim_concave =
TRUE;
4760 treecoef = consdata->nonlincoefs[exprtreeidx];
4767 for( j = 0; j < nvars; ++j )
4771 SCIPdebugMsg(scip,
"cannot compute underestimator for concave because variable <%s> is unbounded\n",
SCIPvarGetName(vars[j]));
4796 nrows = (int)(1u << nvars);
4801 nnonz = nrows * ncols;
4807 for( i = 0; i < nrows; ++i )
4812 for( j = 0; j < nvars; ++j )
4816 if( ((
unsigned int)i >> j) & 0x1 )
4823 ind[i * ncols + j] = j;
4832 SCIPdebugMsg(scip,
"cannot compute underestimator for concave because constaint <%s> cannot be evaluated\n",
SCIPconsGetName(cons));
4836 funcval *= treecoef;
4850 val[i * ncols + nvars] = 1.0;
4851 ind[i * ncols + nvars] = nvars;
4855 for( j = 0; j < ncols; ++j )
4867 funcval *= treecoef;
4886 SCIPwarningMessage(scip,
"solving auxiliary LP for underestimator of concave function returned %d\n", lpret);
4906 SCIPwarningMessage(scip,
"computed cut does not underestimate concave function in refpoint\n");
4909 assert( doupper ||
SCIPisFeasLE(scip, lpobj, funcval) );
4910 assert(!doupper ||
SCIPisFeasLE(scip, funcval, lpobj) );
5039 for( c = 0; c < nchildren; ++c )
5106 assert( consdata !=
NULL );
5107 assert( exprtreeidx >= 0 );
5108 assert( exprtreeidx < consdata->nexprtrees );
5109 assert( consdata->exprtrees !=
NULL );
5110 assert( success !=
NULL );
5112 exprtree = consdata->exprtrees[exprtreeidx];
5113 assert( exprtree !=
NULL );
5132 for( i = 0; i < nvars; ++i )
5146 for( i = 0; i < nchildren; ++i )
5163 treecoef = consdata->nonlincoefs[exprtreeidx];
5164 constant *= treecoef;
5166 for( i = 0; i < nchildren; ++i )
5237 assert(scip !=
NULL);
5238 assert(cons !=
NULL);
5240 assert(row !=
NULL);
5241 assert(success !=
NULL);
5244 assert(consdata !=
NULL);
5245 assert(exprtreeidx >= 0);
5246 assert(exprtreeidx < consdata->nexprtrees);
5247 assert(consdata->exprtrees !=
NULL);
5249 exprtree = consdata->exprtrees[exprtreeidx];
5250 assert(exprtree !=
NULL);
5269 for( i = 0; i < nvars; ++i )
5278 goto INTGRADESTIMATOR_CLEANUP;
5287 x[i] = (2.0*x[i] < lb+ub) ? lb : ub;
5304 SCIPdebugMsg(scip,
"Got nonfinite function value from evaluation of constraint %s tree %d. skipping interval gradient estimator.\n",
SCIPconsGetName(cons), exprtreeidx);
5305 goto INTGRADESTIMATOR_CLEANUP;
5308 treecoef = consdata->nonlincoefs[exprtreeidx];
5322 for( i = 0; i < nvars; ++i )
5332 else if( (overestimate && val == ub) ||
5333 (!overestimate && val == lb) )
5343 SCIPdebugMsg(scip,
"skip intgrad estimator because of infinite interval bound\n");
5344 goto INTGRADESTIMATOR_CLEANUP;
5347 constant -= coefs[i] * val;
5375 INTGRADESTIMATOR_CLEANUP:
5406 assert(scip !=
NULL);
5407 assert(cons !=
NULL);
5408 assert(row !=
NULL);
5415 assert(consdata !=
NULL);
5417 if( consdata->nexprtrees == 0 )
5441 for( i = 0; i < consdata->nexprtrees; ++i )
5458 else if( (side ==
SCIP_SIDETYPE_LEFT && (consdata->curvatures[i] & SCIP_EXPRCURV_CONVEX)) ||
5477 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);
5513 mincoef =
MIN(mincoef, consdata->lincoefsmin);
5514 maxcoef =
MAX(maxcoef, consdata->lincoefsmax);
5516 while( maxcoef / mincoef > maxrange )
5524 SCIPdebugMsg(scip,
"cut coefficients for constraint <%s> have very large range: mincoef = %g maxcoef = %g\n",
SCIPconsGetName(cons), mincoef, maxcoef);
5527 if( mincoef == consdata->lincoefsmin )
5529 SCIPdebugMsg(scip,
"could not eliminate small coefficient, since it comes from linear part\n");
5541 assert(var !=
NULL);
5569 SCIPdebugMsg(scip,
"could not eliminate small coefficient\n");
5601 mincoef =
MIN(mincoef, consdata->lincoefsmin);
5602 maxcoef =
MAX(maxcoef, consdata->lincoefsmax);
5606 if( maxcoef / mincoef > maxrange )
5608 SCIPdebugMsg(scip,
"drop row for constraint <%s> because range of coefficients is too large: mincoef = %g, maxcoef = %g -> range = %g\n",
5662 assert(scip !=
NULL);
5663 assert(conshdlr !=
NULL);
5664 assert(conss !=
NULL || nconss == 0);
5665 assert(nusefulconss <= nconss);
5666 assert(result !=
NULL);
5673 if( bestefficacy !=
NULL )
5674 *bestefficacy = 0.0;
5676 for( c = 0; c < nconss; ++c )
5678 assert(conss !=
NULL);
5686 assert(consdata !=
NULL);
5699 SCIP_CALL(
generateCut(scip,
conshdlrdata->exprinterpreter, conss[c],
NULL, sol, newsol ||
SCIPisInfinity(scip, consdata->activity), violside, &row,
conshdlrdata->cutmaxrange,
conshdlrdata->checkconvexexpensive,
conshdlrdata->assumeconvex) );
5712 efficacy = -feasibility;
5721 efficacy = -feasibility /
MAX(1.0, norm);
5730 efficacy = -feasibility /
MAX(1.0, minval);
5740 if( (
SCIPisGT(scip, efficacy, minefficacy) ||
5760 SCIPdebugMsg(scip,
"add cut with efficacy %g for constraint <%s> violated by %g\n", efficacy,
SCIPconsGetName(conss[c]),
MAX(consdata->lhsviol, consdata->rhsviol));
5763 if( bestefficacy !=
NULL && efficacy > *bestefficacy )
5764 *bestefficacy = efficacy;
5767 if( inenforcement && !
conshdlrdata->enfocutsremovable )
5772 SCIPdebugMsg(scip,
"drop cut since efficacy %g is too small (< %g)\n", efficacy, minefficacy);
5813 assert(scip !=
NULL);
5814 assert(conshdlr !=
NULL);
5815 assert(conss !=
NULL || nconss == 0);
5820 if( separatedlpsol !=
NULL )
5821 *separatedlpsol =
FALSE;
5823 for( c = 0; c < nconss; ++c )
5825 assert(conss[c] !=
NULL);
5833 assert(consdata !=
NULL);
5850 if( separatedlpsol !=
NULL )
5867 efficacy /=
MAX(1.0, norm);
5876 efficacy /=
MAX(1.0, minval);
5885 if( efficacy >= minefficacy )
5889 *separatedlpsol =
TRUE;
5892 assert( ! infeasible );
5917 assert(scip !=
NULL);
5918 assert(event !=
NULL);
5919 assert(eventdata !=
NULL);
5920 assert(eventhdlr !=
NULL);
5932 assert(sol !=
NULL);
5935 assert(conshdlrdata !=
NULL);
5945 assert(conss !=
NULL);
5970 assert(scip !=
NULL);
5971 assert(conshdlr !=
NULL);
5972 assert(conss !=
NULL || nconss == 0);
5976 for( c = 0; c < nconss; ++c )
5978 assert(conss !=
NULL);
5980 assert(consdata !=
NULL);
5982 if( consdata->nexprtrees == 0 )
5991 for( i = 0; i < consdata->nexprtrees; ++i )
6001 assert(var !=
NULL);
6015 SCIPdebugMsg(scip,
"registered %d branching candidates\n", *nnotify);
6038 assert(scip !=
NULL);
6039 assert(conss !=
NULL || nconss == 0);
6044 for( c = 0; c < nconss; ++c )
6046 assert(conss !=
NULL);
6048 assert(consdata !=
NULL);
6053 for( j = 0; j < consdata->nexprtrees; ++j )
6064 brvarval = ABS(val);
6071 if( *brvar !=
NULL )
6100 assert(scip !=
NULL);
6101 assert(conss !=
NULL || nconss == 0);
6102 assert(addedcons !=
NULL);
6103 assert(reduceddom !=
NULL);
6104 assert(infeasible !=
NULL);
6107 *reduceddom =
FALSE;
6108 *infeasible =
FALSE;
6110 for( c = 0; c < nconss; ++c )
6112 assert(conss !=
NULL);
6114 assert(consdata !=
NULL);
6119 lhs = consdata->lhs;
6120 rhs = consdata->rhs;
6122 for( i = 0; i < consdata->nexprtrees; ++i )
6159 if ( consdata->nlinvars == 0 )
6163 else if ( consdata->nlinvars == 1 )
6168 coef = *consdata->lincoefs;
6169 SCIPdebugMsg(scip,
"Linear constraint with one variable: %g <= %g <%s> <= %g\n", lhs, coef,
SCIPvarGetName(*consdata->linvars), rhs);
6200 assert(consdata->linvars[0] !=
NULL);
6201 SCIPwarningMessage(scip,
"Activity of nonlinear part is beyond SCIP's value for infinity. To enforce " 6202 "the constraint %s SCIP needs to tight bounds of %s to a value beyond +/- infinity. Please check if " 6212 SCIPdebugMsg(scip,
"Lower bound leads to infeasibility.\n");
6228 SCIPdebugMsg(scip,
"Upper bound leads to infeasibility.\n");
6242 consdata->nlinvars, consdata->linvars, consdata->lincoefs, lhs, rhs,
6248 SCIPdebugMsg(scip,
"replace violated nonlinear constraint <%s> by linear constraint after all nonlinear vars have been fixed\n",
SCIPconsGetName(conss[c]) );
6256 SCIPdebugMsg(scip,
"linear constraint is feasible, thus do not add\n");
6285 assert(scip !=
NULL);
6287 assert(var !=
NULL);
6288 assert(result !=
NULL);
6290 assert(nchgbds !=
NULL);
6346 assert(scip !=
NULL);
6348 assert(var !=
NULL);
6349 assert(result !=
NULL);
6351 assert(nchgbds !=
NULL);
6414 assert(scip !=
NULL);
6415 assert(conshdlr !=
NULL);
6416 assert(cons !=
NULL);
6417 assert(result !=
NULL);
6418 assert(nchgbds !=
NULL);
6421 assert(consdata !=
NULL);
6440 assert(consdata->minlinactivityinf >= 0);
6441 assert(consdata->maxlinactivityinf >= 0);
6442 assert(consdata->exprgraphnode !=
NULL || consdata->nexprtrees == 0);
6445 if( consdata->exprgraphnode !=
NULL )
6465 SCIPdebugMsg(scip,
"found constraint <%s> to be redundant: sides: [%g, %g], activity: [%g, %g]\n",
6473 SCIPdebugMsg(scip,
"found constraint <%s> to be infeasible; sides: [%g, %g], activity: [%g, %g], infeas: %.20g\n",
6486 for( i = 0; i < consdata->nlinvars; ++i )
6488 coef = consdata->lincoefs[i];
6489 var = consdata->linvars[i];
6504 if( consdata->minlinactivityinf == 0 )
6511 bnd -= consdata->minlinactivity;
6526 bnd -= consdata->minlinactivity;
6540 if( consdata->maxlinactivityinf == 0 )
6547 bnd -= consdata->maxlinactivity;
6562 bnd -= consdata->maxlinactivity;
6574 assert(coef < 0.0 );
6579 if( consdata->maxlinactivityinf == 0 )
6585 bnd = consdata->maxlinactivity;
6600 bnd = consdata->maxlinactivity;
6615 if( consdata->minlinactivityinf == 0 )
6621 bnd = consdata->minlinactivity;
6636 bnd = consdata->minlinactivity;
6677 assert(scip !=
NULL);
6678 assert(conshdlr !=
NULL);
6679 assert(result !=
NULL);
6680 assert(nchgbds !=
NULL);
6688 SCIPdebugMsg(scip,
"start backward propagation in expression graph\n");
6693 file = fopen(
"exprgraph_propconss1.dot",
"w");
6704 for( c = 0; c < nconss; ++c )
6707 assert(consdata !=
NULL);
6709 if( consdata->exprgraphnode ==
NULL )
6719 if( !
SCIPisInfinity(scip, -consdata->lhs) && consdata->maxlinactivityinf == 0 )
6720 bounds.
inf = consdata->lhs - consdata->maxlinactivity -
SCIPfeastol(scip);
6724 if( !
SCIPisInfinity(scip, consdata->rhs) && consdata->minlinactivityinf == 0 )
6734 consdata->forcebackprop =
FALSE;
6750 file = fopen(
"exprgraph_propconss2.dot",
"w");
6772 for( i = 0; i < nvars && *result !=
SCIP_CUTOFF; ++i )
6811 assert(scip !=
NULL);
6812 assert(conshdlr !=
NULL);
6813 assert(conss !=
NULL || nconss == 0);
6814 assert(result !=
NULL);
6815 assert(nchgbds !=
NULL);
6816 assert(ndelconss !=
NULL);
6835 SCIPdebugMsg(scip,
"starting domain propagation round %d for %d constraints\n", roundnr, nconss);
6848 file = fopen(
"exprgraph_propvars.dot",
"w");
6859 SCIPdebugMsg(scip,
"current bounds out of domain for some expression, do cutoff\n");
6865 for( c = 0; c < nconss && *result !=
SCIP_CUTOFF; ++c )
6867 assert(conss !=
NULL);
6874 assert(consdata !=
NULL);
6881 *result = propresult;
6900 *result = propresult;
6905 while( success && *result !=
SCIP_CUTOFF && ++roundnr < conshdlrdata->maxproprounds );
6921 consdata->linvar_maydecrease = -1;
6922 consdata->linvar_mayincrease = -1;
6926 for( i = 0; i < consdata->nlinvars; ++i )
6929 assert(consdata->lincoefs[i] != 0.0);
6930 if( consdata->lincoefs[i] > 0.0 )
6945 if( (consdata->linvar_maydecrease < 0) ||
6946 (
SCIPvarGetObj(consdata->linvars[consdata->linvar_maydecrease]) / consdata->lincoefs[consdata->linvar_maydecrease] >
SCIPvarGetObj(consdata->linvars[i]) / consdata->lincoefs[i]) )
6947 consdata->linvar_maydecrease = i;
6954 if( (consdata->linvar_mayincrease < 0) ||
6955 (
SCIPvarGetObj(consdata->linvars[consdata->linvar_mayincrease]) / consdata->lincoefs[consdata->linvar_mayincrease] >
SCIPvarGetObj(consdata->linvars[i]) / consdata->lincoefs[i]) )
6956 consdata->linvar_mayincrease = i;
6961 if( consdata->linvar_mayincrease >= 0 )
6963 SCIPdebugMsg(scip,
"may increase <%s> to become feasible\n",
SCIPvarGetName(consdata->linvars[consdata->linvar_mayincrease]));
6965 if( consdata->linvar_maydecrease >= 0 )
6967 SCIPdebugMsg(scip,
"may decrease <%s> to become feasible\n",
SCIPvarGetName(consdata->linvars[consdata->linvar_maydecrease]));
6996 assert(scip !=
NULL);
6997 assert(conshdlr !=
NULL);
6998 assert(conss !=
NULL || nconss == 0);
6999 assert(success !=
NULL);
7021 for( c = 0; c < nconss; ++c )
7024 assert(consdata !=
NULL);
7031 assert(!solviolbounds);
7032 viol = consdata->lhs - consdata->activity;
7037 assert(!solviolbounds);
7038 viol = consdata->rhs - consdata->activity;
7043 assert(viol != 0.0);
7044 if( consdata->linvar_mayincrease >= 0 &&
7045 (( viol > 0.0 && consdata->lincoefs[consdata->linvar_mayincrease] > 0.0) ||
7046 (viol < 0.0 && consdata->lincoefs[consdata->linvar_mayincrease] < 0.0)) )
7049 var = consdata->linvars[consdata->linvar_mayincrease];
7051 delta = viol / consdata->lincoefs[consdata->linvar_mayincrease];
7052 assert(delta > 0.0);
7057 delta =
MIN(
MAX(0.0, gap), delta);
7069 viol -= consdata->lincoefs[consdata->linvar_mayincrease] * delta;
7075 assert(viol != 0.0);
7076 if( consdata->linvar_maydecrease >= 0 &&
7077 (( viol > 0.0 && consdata->lincoefs[consdata->linvar_maydecrease] < 0.0) ||
7078 (viol < 0.0 && consdata->lincoefs[consdata->linvar_maydecrease] > 0.0)) )
7081 var = consdata->linvars[consdata->linvar_maydecrease];
7083 delta = viol / consdata->lincoefs[consdata->linvar_maydecrease];
7084 assert(delta < 0.0);
7089 delta =
MAX(
MIN(0.0, gap), delta);
7100 viol -= consdata->lincoefs[consdata->linvar_maydecrease] * delta;
7151 assert(scip !=
NULL);
7152 assert(conshdlr !=
NULL);
7153 assert(conss !=
NULL || nconss == 0);
7160 if( maxviolcons ==
NULL )
7175 assert(solinfeasible);
7180 assert(consdata !=
NULL);
7182 maxviol = consdata->lhsviol + consdata->rhsviol;
7186 sol ==
NULL ?
"LP" :
"relaxation");
7226 *result = propresult;
7237 SCIP_CALL(
separatePoint(scip, conshdlr, conss, nconss, nusefulconss, sol,
FALSE, minefficacy,
TRUE, &separateresult, &sepaefficacy) );
7246 SCIPdebugMsg(scip,
"separation succeeded (bestefficacy = %g, minefficacy = %g)\n", sepaefficacy, minefficacy);
7255 SCIPdebugMsg(scip,
"separation failed (bestefficacy = %g < %g = minefficacy ); max viol: %g\n", sepaefficacy, minefficacy, maxviol);
7262 if( nnotify == 0 && !solinfeasible && minefficacy > leastpossibleefficacy )
7265 SCIP_CALL(
separatePoint(scip, conshdlr, conss, nconss, nusefulconss, sol,
FALSE, leastpossibleefficacy,
TRUE, &separateresult, &sepaefficacy) );
7268 *result = separateresult;
7273 if( nnotify == 0 && !solinfeasible )
7287 SCIPdebugMsg(scip,
"All nonlinear variables seem to be fixed. Replace remaining violated nonlinear constraints by linear constraints.\n");
7295 else if ( addedcons )
7297 else if ( reduceddom )
7302 SCIPwarningMessage(scip,
"could not enforce feasibility by separating or branching; declaring solution with viol %g as feasible\n", maxviol);
7309 SCIPdebugMsg(scip,
"Could not find any usual branching variable candidate. Proposed variable <%s> with LP value %g for branching.\n",
7327 assert(scip !=
NULL);
7328 assert(conshdlr !=
NULL);
7346 assert(scip !=
NULL);
7347 assert(conshdlr !=
NULL);
7350 assert(conshdlrdata !=
NULL);
7351 assert(conshdlrdata->exprinterpreter !=
NULL);
7352 assert(conshdlrdata->exprgraph !=
NULL);
7359 for( i = 0; i < conshdlrdata->nnlconsupgrades; ++i )
7361 assert(conshdlrdata->nlconsupgrades[i] !=
NULL);
7380 assert(scip !=
NULL);
7381 assert(conshdlr !=
NULL);
7384 assert(conshdlrdata !=
NULL);
7386 conshdlrdata->subnlpheur =
SCIPfindHeur(scip,
"subnlp");
7387 conshdlrdata->trysolheur =
SCIPfindHeur(scip,
"trysol");
7390 conshdlrdata->naddedreformconss = 0;
7395 file = fopen(
"exprgraph_init.dot",
"w");
7413 assert(scip !=
NULL);
7414 assert(conshdlr !=
NULL);
7417 assert(conshdlrdata !=
NULL);
7419 conshdlrdata->subnlpheur =
NULL;
7420 conshdlrdata->trysolheur =
NULL;
7433 assert(scip !=
NULL);
7434 assert(conshdlr !=
NULL);
7435 assert(conss !=
NULL || nconss == 0);
7437 for( c = 0; c < nconss; ++c )
7444 assert(consdata !=
NULL);
7447 assert(consdata->nexprtrees == 0 || consdata->exprgraphnode !=
NULL);
7473 assert(scip !=
NULL);
7474 assert(conshdlr !=
NULL);
7475 assert(conss !=
NULL || nconss == 0);
7478 assert(conshdlrdata !=
NULL);
7480 havegraphchange =
FALSE;
7482 if( !conshdlrdata->isremovedfixings )
7485 assert(conshdlrdata->isremovedfixings);
7487 havegraphchange =
TRUE;
7492 SCIPdebugMsg(scip,
"expression graph simplifier found %schange, domain error = %u\n", havechange ?
"" :
"no ", domainerror);
7493 havegraphchange |= havechange;
7499 for( c = 0; c < nconss; ++c )
7501 assert(conss !=
NULL);
7509 assert(consdata !=
NULL);
7511 if( !consdata->isremovedfixingslin )
7516 if( !consdata->ispresolved || havegraphchange )
7523 assert(consdata->isremovedfixingslin);
7524 assert(consdata->linvarsmerged);
7526 for( i = 0; i < consdata->nlinvars; ++i )
7530 if( consdata->exprgraphnode !=
NULL )
7544 exprtreessize, &nexprtrees, exprtrees, coefs) );
7545 assert(nexprtrees > 0);
7552 assert(consdata->nexprtrees > 0 );
7554 for( j = 0; j < consdata->nexprtrees; ++j )
7576 assert(scip !=
NULL);
7577 assert(conshdlr !=
NULL);
7578 assert(conss !=
NULL || nconss == 0);
7581 assert(conshdlrdata !=
NULL);
7583 for( c = 0; c < nconss; ++c )
7585 assert(conss !=
NULL);
7587 assert(consdata !=
NULL);
7594 consdata->lincoefsmax = 0.0;
7595 for( i = 0; i < consdata->nlinvars; ++i )
7597 consdata->lincoefsmin =
MIN(consdata->lincoefsmin,
REALABS(consdata->lincoefs[i]));
7598 consdata->lincoefsmax =
MAX(consdata->lincoefsmax,
REALABS(consdata->lincoefs[i]));
7604 if( consdata->nlrow ==
NULL )
7610 assert(consdata->nlrow !=
NULL);
7616 conshdlrdata->newsoleventfilterpos = -1;
7622 assert(eventhdlr !=
NULL);
7628 conshdlrdata->sepanlp =
FALSE;
7629 conshdlrdata->lastenfonode =
NULL;
7630 conshdlrdata->nenforounds = 0;
7643 assert(scip !=
NULL);
7644 assert(conshdlr !=
NULL);
7645 assert(conss !=
NULL || nconss == 0);
7648 assert(conshdlrdata !=
NULL);
7650 if( conshdlrdata->newsoleventfilterpos >= 0 )
7655 assert(eventhdlr !=
NULL);
7658 conshdlrdata->newsoleventfilterpos = -1;
7661 for( c = 0; c < nconss; ++c )
7664 assert(consdata !=
NULL);
7667 if( consdata->nlrow !=
NULL )
7681 assert(scip !=
NULL);
7682 assert(conshdlr !=
NULL);
7683 assert(cons !=
NULL);
7685 assert(consdata !=
NULL);
7691 assert((*consdata)->exprgraphnode ==
NULL);
7695 assert(*consdata ==
NULL);
7709 assert(sourcedata !=
NULL);
7712 sourcedata->lhs, sourcedata->rhs,
7713 sourcedata->nlinvars, sourcedata->linvars, sourcedata->lincoefs,
7714 sourcedata->nexprtrees, sourcedata->exprtrees, sourcedata->nonlincoefs,
7718 if( sourcedata->iscurvchecked && sourcedata->nexprtrees > 0 )
7720 BMScopyMemoryArray(targetdata->curvatures, sourcedata->curvatures, sourcedata->nexprtrees);
7721 targetdata->curvature = sourcedata->curvature;
7722 targetdata->iscurvchecked =
TRUE;
7725 for( i = 0; i < targetdata->nlinvars; ++i )
7731 for( i = 0; i < targetdata->nexprtrees; ++i )
7743 SCIPdebugMsg(scip,
"created transformed nonlinear constraint ");
7764 assert(scip !=
NULL);
7765 assert(conshdlr !=
NULL);
7766 assert(conss !=
NULL || nconss == 0);
7769 assert(conshdlrdata !=
NULL);
7771 *infeasible =
FALSE;
7773 for( c = 0; c < nconss && !(*infeasible); ++c )
7775 assert(conss[c] !=
NULL);
7780 assert(consdata !=
NULL);
7784 if( consdata->nexprtrees == 0 )
7786 assert(consdata->exprgraphnode ==
NULL);
7798 haveunboundedvar =
FALSE;
7799 for( j = 0; j < consdata->nexprtrees; ++j )
7804 for( i = 0; i < nvars; ++i )
7807 assert(var !=
NULL);
7816 haveunboundedvar =
TRUE;
7868 for( j = 0; j < consdata->nexprtrees; ++j )
7887 assert(scip !=
NULL);
7888 assert(conshdlr !=
NULL);
7889 assert(conss !=
NULL || nconss == 0);
7890 assert(result !=
NULL);
7895 assert(conshdlrdata !=
NULL);
7904 if( maxviolcon ==
NULL )
7912 if(
SCIPgetDepth(scip) == 0 && !conshdlrdata->sepanlp &&
7929 for( c = 0; c < nconss; ++c )
7931 assert(conss[c] !=
NULL);
7934 assert(consdata !=
NULL);
7953 if( conshdlrdata->subnlpheur !=
NULL )
7968 SCIPdebugMsg(scip,
"solved NLP relax, solution status: %d\n", solstat);
7974 conshdlrdata->sepanlp =
TRUE;
7978 SCIPdebugMsg(scip,
"NLP relaxation is globally infeasible, thus can cutoff node\n");
7990 assert(nlpsol !=
NULL);
7993 if( solvednlp && conshdlrdata->trysolheur !=
NULL )
8003 if( nfracvars == 0 )
8015 if( lpsolseparated )
8017 SCIPdebugMsg(scip,
"linearization cuts separate LP solution\n");
8029 SCIP_CALL(
separatePoint(scip, conshdlr, conss, nconss, nusefulconss,
NULL, newsol, conshdlrdata->mincutefficacysepa,
FALSE, result,
NULL) );
8042 assert(scip !=
NULL);
8043 assert(conshdlr !=
NULL);
8044 assert(conss !=
NULL || nconss == 0);
8045 assert(sol !=
NULL);
8046 assert(result !=
NULL);
8049 assert(conshdlrdata !=
NULL);
8060 if( maxviolcon ==
NULL )
8063 SCIP_CALL(
separatePoint(scip, conshdlr, conss, nconss, nusefulconss, sol,
FALSE, conshdlrdata->mincutefficacysepa,
FALSE, result,
NULL) );
8101 assert(scip !=
NULL);
8102 assert(conss !=
NULL || nconss == 0);
8107 assert(!solviolbounds);
8109 if( maxviolcons ==
NULL )
8127 *result = propresult;
8136 for( c = 0; c < nconss; ++c )
8138 assert(conss !=
NULL);
8140 assert(consdata !=
NULL);
8145 for( i = 0; i < consdata->nlinvars; ++i )
8147 var = consdata->linvars[i];
8155 for( j = 0; j < consdata->nexprtrees; ++j )
8169 SCIPdebugMsg(scip,
"All variables in violated constraints fixed (up to epsilon). Cannot find branching candidate. Forcing solution of LP.\n");
8189 assert(scip !=
NULL);
8190 assert(conss !=
NULL || nconss == 0);
8191 assert(result !=
NULL);
8194 assert(conshdlrdata !=
NULL);
8203 assert(conshdlrdata->exprgraph !=
NULL);
8215 maypropfeasible = conshdlrdata->linfeasshift && (conshdlrdata->trysolheur !=
NULL) &&
8220 for( c = 0; c < nconss; ++c )
8222 assert(conss !=
NULL);
8224 assert(!solviolbounds);
8227 assert(consdata !=
NULL);
8238 SCIPinfoMessage(scip,
NULL,
"violation: left hand side is violated by %.15g (scaled: %.15g)\n", consdata->lhs - consdata->activity, consdata->lhsviol);
8242 SCIPinfoMessage(scip,
NULL,
"violation: right hand side is violated by %.15g (scaled: %.15g)\n", consdata->activity - consdata->rhs, consdata->rhsviol);
8246 if( (conshdlrdata->subnlpheur ==
NULL || sol ==
NULL) && !maypropfeasible && !completely )
8249 if( consdata->lhsviol > maxviol || consdata->rhsviol > maxviol )
8250 maxviol =
MAX(consdata->lhsviol, consdata->rhsviol);
8254 maypropfeasible =
FALSE;
8256 if( maypropfeasible )
8266 if( !(consdata->linvar_mayincrease >= 0 && consdata->lincoefs[consdata->linvar_mayincrease] > 0.0) &&
8267 ! (consdata->linvar_maydecrease >= 0 && consdata->lincoefs[consdata->linvar_maydecrease] < 0.0) )
8268 maypropfeasible =
FALSE;
8275 if( !(consdata->linvar_mayincrease >= 0 && consdata->lincoefs[consdata->linvar_mayincrease] < 0.0) &&
8276 ! (consdata->linvar_maydecrease >= 0 && consdata->lincoefs[consdata->linvar_maydecrease] > 0.0) )
8277 maypropfeasible =
FALSE;
8313 assert(scip !=
NULL);
8314 assert(conshdlr !=
NULL);
8315 assert(conss !=
NULL || nconss == 0);
8316 assert(result !=
NULL);
8337 assert(scip !=
NULL);
8338 assert(conshdlr !=
NULL);
8339 assert(conss !=
NULL || nconss == 0);
8340 assert(result !=
NULL);
8345 assert(conshdlrdata !=
NULL);
8346 assert(conshdlrdata->exprgraph !=
NULL);
8348 havegraphchange =
FALSE;
8350 if( !conshdlrdata->isremovedfixings )
8353 assert(conshdlrdata->isremovedfixings);
8355 havegraphchange =
TRUE;
8359 SCIPdebugMsg(scip,
"expression graph simplifier found %schange, domain error = %u\n", havechange ?
"" :
"no ", domainerror);
8368 havegraphchange |= havechange;
8371 tryupgrades = havegraphchange;
8376 for( c = 0; c < nconss; ++c )
8378 assert(conss !=
NULL);
8381 assert(consdata !=
NULL);
8388 if( !consdata->isremovedfixingslin )
8391 assert(consdata->isremovedfixingslin);
8401 if( !consdata->ispresolved || havegraphchange )
8406 if( consdata->nlinvars == 0 && consdata->exprgraphnode ==
NULL )
8432 consdata->ispresolved =
FALSE;
8435 if( !consdata->ispresolved )
8450 SCIPdebugMsg(scip,
"propagating variable bounds through expression graph found that some expressions cannot be evaluated w.r.t. current bounds, thus cutoff\n");
8455 for( c = 0; c < nconss; ++c )
8458 assert(consdata !=
NULL);
8461 if( !consdata->ispresolved || havegraphchange )
8473 consdata->ispresolved =
TRUE;
8481 switch( propresult )
8487 SCIPdebugMsg(scip,
"propagation says problem is infeasible in presolve\n");
8495 if( conshdlrdata->reformulate && !conshdlrdata->assumeconvex )
8503 int naddconssbefore;
8505 SCIPdebugMsg(scip,
"reformulating expression graph\n");
8507 naddconssbefore = conshdlrdata->naddedreformconss;
8510 if( conshdlrdata->naddedreformconss > naddconssbefore )
8513 *naddconss += conshdlrdata->naddedreformconss - naddconssbefore;
8516 for( c = 0; c < nconss; ++c )
8518 assert(conss[c] !=
NULL);
8521 assert(consdata !=
NULL);
8523 consdata->ispresolved =
FALSE;
8542 assert(scip !=
NULL);
8543 assert(cons !=
NULL);
8551 assert(consdata !=
NULL);
8556 for( i = 0; i < consdata->nlinvars; ++i )
8558 if( consdata->lincoefs[i] > 0 )
8592 assert(scip !=
NULL);
8593 assert(conshdlr !=
NULL);
8594 assert(cons !=
NULL);
8598 assert(conshdlrdata !=
NULL);
8599 assert(conshdlrdata->exprgraph !=
NULL);
8602 assert(consdata !=
NULL);
8606 if( consdata->nexprtrees > 0 )
8610 assert(consdata->exprgraphnode ==
NULL);
8614 assert(consdata->exprgraphnode !=
NULL);
8624 conshdlrdata->isreformulated =
FALSE;
8629 consdata->forcebackprop =
TRUE;
8631 else if( consdata->exprgraphnode !=
NULL )
8634 conshdlrdata->isreformulated =
FALSE;
8639 consdata->forcebackprop =
TRUE;
8652 assert(scip !=
NULL);
8653 assert(conshdlr !=
NULL);
8654 assert(cons !=
NULL);
8658 assert(conshdlrdata !=
NULL);
8659 assert(conshdlrdata->exprgraph !=
NULL);
8662 assert(consdata !=
NULL);
8663 assert(consdata->exprgraphnode !=
NULL || consdata->nexprtrees == 0);
8667 if( consdata->exprgraphnode !=
NULL )
8669 if( consdata->nexprtrees == 0 )
8696 assert(scip !=
NULL);
8697 assert(conshdlr !=
NULL);
8698 assert(cons !=
NULL);
8703 assert(conshdlrdata !=
NULL);
8704 assert(conshdlrdata->exprgraph !=
NULL);
8707 assert(consdata !=
NULL);
8711 if( consdata->exprgraphnode !=
NULL )
8718 consdata->isremovedfixingslin =
TRUE;
8719 for( i = 0; i < consdata->nlinvars; ++i )
8723 consdata->isremovedfixingslin = consdata->isremovedfixingslin &&
SCIPvarIsActive(consdata->linvars[i]);
8737 assert(scip !=
NULL);
8738 assert(conshdlr !=
NULL);
8739 assert(cons !=
NULL);
8743 assert(conshdlrdata !=
NULL);
8744 assert(conshdlrdata->exprgraph !=
NULL);
8747 assert(consdata !=
NULL);
8748 assert(consdata->lineventdata !=
NULL || consdata->nlinvars == 0);
8753 if( consdata->exprgraphnode !=
NULL )
8758 for( i = 0; i < consdata->nlinvars; ++i )
8774 assert(scip !=
NULL);
8775 assert(cons !=
NULL);
8778 assert(consdata !=
NULL);
8783 && !
SCIPisEQ(scip, consdata->lhs, consdata->rhs) )
8787 if( consdata->nlinvars == 0 && consdata->nexprtrees == 0 && consdata->exprgraphnode == 0 )
8793 if( consdata->nexprtrees > 0 )
8795 for( j = 0; j < consdata->nexprtrees; ++j )
8797 if( j > 0 || consdata->nonlincoefs[j] != 1.0 )
8802 else if( consdata->exprgraphnode !=
NULL )
8808 assert(conshdlrdata !=
NULL);
8816 for( j = 0; j < consdata->nlinvars; ++j )
8826 if(
SCIPisEQ(scip, consdata->lhs, consdata->rhs) )
8859 assert(scip !=
NULL);
8860 assert(cons !=
NULL);
8861 assert(sourcescip !=
NULL);
8862 assert(sourceconshdlr !=
NULL);
8863 assert(sourcecons !=
NULL);
8864 assert(varmap !=
NULL);
8865 assert(valid !=
NULL);
8868 assert(consdata !=
NULL);
8875 if( consdata->nlinvars != 0 )
8878 for( i = 0; i < consdata->nlinvars && *valid; ++i )
8880 SCIP_CALL(
SCIPgetVarCopy(sourcescip, scip, consdata->linvars[i], &linvars[i], varmap, consmap, global, valid) );
8881 assert(!*valid || linvars[i] !=
NULL);
8888 if( *valid && consdata->nexprtrees > 0 )
8892 nonlincoefs = consdata->nonlincoefs;
8893 nexprtrees = consdata->nexprtrees;
8899 for( j = 0; j < consdata->nexprtrees; ++j )
8905 assert(!*valid || nonlinvars[i] !=
NULL);
8920 if( *valid && consdata->nexprtrees == 0 && consdata->exprgraphnode !=
NULL )
8936 assert(!*valid || nonlinvars[i] !=
NULL);
8943 consdata->nlinvars, linvars, consdata->lincoefs,
8944 nexprtrees, exprtrees, nonlincoefs,
8945 consdata->lhs, consdata->rhs,
8946 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) );
8950 targetconsdata->curvature = consdata->curvature;
8951 targetconsdata->iscurvchecked = consdata->iscurvchecked && global;
8955 if( exprtrees !=
NULL )
8957 for( j = 0; j < nexprtrees; ++j )
8959 if( exprtrees[j] !=
NULL )
8977 assert(cons !=
NULL);
8980 assert(consdata !=
NULL);
8984 if( varssize < consdata->nlinvars )
8991 cnt = consdata->nlinvars;
8993 if( consdata->exprgraphnode !=
NULL )
9000 assert(conshdlrdata !=
NULL);
9008 if( varsusage[i] == 0 )
9011 if( cnt >= varssize )
9029 for( e = 0; e < consdata->nexprtrees; ++e )
9033 assert(exprvars !=
NULL || nexprvars == 0);
9035 if( cnt + nexprvars > varssize )
9056 assert(consdata !=
NULL);
9058 *nvars = consdata->nlinvars;
9060 if( consdata->exprgraphnode !=
NULL )
9067 assert(conshdlrdata !=
NULL);
9074 if( varsusage[i] > 0 )
9083 for( e = 0; e < consdata->nexprtrees; ++e )
9104 char* nonconstendptr;
9105 const char* exprstart;
9106 const char* exprlastchar;
9111 SCIPdebugMsg(scip,
"cons_nonlinear::consparse parsing %s\n",str);
9113 assert(scip !=
NULL);
9114 assert(success !=
NULL);
9115 assert(str !=
NULL);
9116 assert(name !=
NULL);
9117 assert(cons !=
NULL);
9135 if( isdigit((
unsigned char)str[0]) || ((str[0] ==
'-' || str[0] ==
'+') && isdigit((
unsigned char)str[1])) )
9143 endptr = nonconstendptr;
9146 while( isspace((
unsigned char)*endptr) )
9149 if( endptr[0] !=
'<' || endptr[1] !=
'=' )
9160 while( isspace((
unsigned char)*str) )
9166 while( !(strncmp(endptr,
"[free]", 6) == 0) &&
9167 !(endptr[0] ==
'<' && endptr[1] ==
'=') &&
9168 !(endptr[0] ==
'=' && endptr[1] ==
'=') &&
9169 !(endptr[0] ==
'>' && endptr[1] ==
'=') &&
9170 !(endptr[0] ==
'\0') )
9174 exprlastchar = endptr - 1;
9180 while( isspace((
unsigned char)*str) )
9184 if( strncmp(str,
"[free]", 6) == 0 )
9248 curvarname = varnames;
9249 for( i = 0; i < nvars; ++i )
9251 assert(*curvarname == i);
9254 exprvars[i] =
SCIPfindVar(scip, (
char*)curvarname);
9255 if( exprvars[i] ==
NULL )
9257 SCIPerrorMessage(
"Unknown SCIP variable <%s> encountered in expression.\n", (
char*)curvarname);
9262 curvarname += (strlen((
char*)curvarname) + 1)/
sizeof(
int) + 1;
9274 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) );
9307 consEnfolpNonlinear, consEnfopsNonlinear, consCheckNonlinear, consLockNonlinear,
9309 assert(conshdlr !=
NULL);
9340 "minimal efficacy for a cut to be added to the LP during separation; overwrites separating/efficacy",
9344 "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)",
9348 "whether scaling of infeasibility is 'o'ff, by sup-norm of function 'g'radient, or by left/right hand 's'ide",
9352 "maximal coef range of a cut (maximal coefficient divided by minimal coefficient) in order to be added to LP relaxation",
9356 "whether to try to make solutions in check function feasible by shifting a linear variable (esp. useful if constraint was actually objective function)",
9361 "whether to apply expensive curvature checking methods",
9366 "whether to assume that nonlinear functions in inequalities (<=) are convex (disables reformulation)",
9370 "limit on number of propagation rounds for a single constraint within one round of SCIP propagation",
9374 "whether to reformulate expression graph",
9378 "maximal exponent where still expanding non-monomial polynomials in expression simplification",
9382 "minimal required fraction of continuous variables in problem to use solution of NLP relaxation in root for separation",
9386 "are cuts added during enforcement removable from the LP in the same node?",
9391 processLinearVarEvent,
NULL) );
9400 processNewSolutionEvent,
NULL) );
9423 const char* conshdlrname
9433 assert(conshdlrname !=
NULL );
9436 if( nonlinconsupgd ==
NULL && nodereform ==
NULL )
9441 if( conshdlr ==
NULL )
9448 assert(conshdlrdata !=
NULL);
9451 for( i = conshdlrdata->nnlconsupgrades - 1; i >= 0; --i )
9453 if( conshdlrdata->nlconsupgrades[i]->nlconsupgd == nonlinconsupgd && conshdlrdata->nlconsupgrades[i]->nodereform == nodereform)
9456 SCIPwarningMessage(scip,
"Try to add already known upgrade method pair (%p,%p) for constraint handler <%s>.\n", nonlinconsupgd, nodereform, conshdlrname);
9464 nlconsupgrade->nlconsupgd = nonlinconsupgd;
9465 nlconsupgrade->nodereform = nodereform;
9466 nlconsupgrade->
priority = priority;
9470 assert(conshdlrdata->nnlconsupgrades <= conshdlrdata->nlconsupgradessize);
9471 if( conshdlrdata->nnlconsupgrades+1 > conshdlrdata->nlconsupgradessize )
9477 conshdlrdata->nlconsupgradessize = newsize;
9479 assert(conshdlrdata->nnlconsupgrades+1 <= conshdlrdata->nlconsupgradessize);
9481 for( i = conshdlrdata->nnlconsupgrades; i > 0 && conshdlrdata->nlconsupgrades[i-1]->priority < nlconsupgrade->
priority; --i )
9482 conshdlrdata->nlconsupgrades[i] = conshdlrdata->nlconsupgrades[i-1];
9483 assert(0 <= i && i <= conshdlrdata->nnlconsupgrades);
9484 conshdlrdata->nlconsupgrades[i] = nlconsupgrade;
9485 conshdlrdata->nnlconsupgrades++;
9491 paramname, paramdesc,
9543 assert(linvars !=
NULL || nlinvars == 0);
9544 assert(lincoefs !=
NULL || nlinvars == 0);
9545 assert(exprtrees !=
NULL || nexprtrees == 0);
9546 assert(modifiable ==
FALSE);
9550 if( conshdlr ==
NULL )
9559 consdata->lhs = lhs;
9560 consdata->rhs = rhs;
9563 SCIP_CALL(
SCIPcreateCons(scip, cons, name, conshdlr, consdata, initial, separate, enforce, check, propagate,
9564 local, modifiable, dynamic, removable, stickingatnode) );
9568 for( i = 0; i < nlinvars; ++i )
9609 assert(scip !=
NULL);
9612 nonlincoefs, lhs, rhs,
9664 assert(modifiable ==
FALSE);
9669 if( conshdlr ==
NULL )
9678 consdata->lhs = lhs;
9679 consdata->rhs = rhs;
9682 SCIP_CALL(
SCIPcreateCons(scip, cons, name, conshdlr, consdata, initial, separate, enforce, check, propagate,
9683 local, modifiable, dynamic, removable, stickingatnode) );
9687 for( i = 0; i < nlinvars; ++i )
9696 if( exprgraphnode !=
NULL )
9698 consdata->exprgraphnode = exprgraphnode;
9700 consdata->iscurvchecked =
FALSE;
9735 assert(scip !=
NULL);
9751 assert(scip !=
NULL);
9752 assert(cons !=
NULL);
9753 assert(var !=
NULL);
9772 assert(scip !=
NULL);
9773 assert(cons !=
NULL);
9776 assert(exprtrees !=
NULL || nexprtrees == 0);
9794 assert(scip !=
NULL);
9795 assert(cons !=
NULL);
9798 assert(exprtrees !=
NULL || nexprtrees == 0);
9814 assert(cons !=
NULL);
9815 assert(nlrow !=
NULL);
9818 assert(consdata !=
NULL);
9820 if( consdata->nlrow ==
NULL )
9824 assert(consdata->nlrow !=
NULL);
9825 *nlrow = consdata->nlrow;
9836 assert(cons !=
NULL);
9848 assert(cons !=
NULL);
9860 assert(cons !=
NULL);
9872 assert(cons !=
NULL);
9885 assert(cons !=
NULL);
9898 assert(cons !=
NULL);
9911 assert(cons !=
NULL);
9923 assert(cons !=
NULL);
9935 assert(cons !=
NULL);
9950 assert(scip !=
NULL);
9951 assert(cons !=
NULL);
9954 assert(conshdlr !=
NULL);
9975 assert(scip !=
NULL);
9976 assert(cons !=
NULL);
9977 assert(curvature !=
NULL);
9980 assert(consdata !=
NULL);
9983 assert(conshdlr !=
NULL);
9987 if( checkcurv && !consdata->iscurvchecked )
9992 *curvature = consdata->curvature;
10009 assert(scip !=
NULL);
10010 assert(cons !=
NULL);
10011 assert(curvatures !=
NULL);
10015 assert(consdata !=
NULL);
10018 assert(conshdlr !=
NULL);
10024 if( checkcurv && !consdata->iscurvchecked )
10029 *curvatures = consdata->curvatures;
10046 assert(scip !=
NULL);
10047 assert(cons !=
NULL);
10048 assert(violation !=
NULL);
10053 SCIPwarningMessage(scip,
"SCIPgetViolationNonlinear is not available for active constraints during presolve.\n");
10059 assert(conshdlr !=
NULL);
10063 if( solviolbounds )
10065 SCIPerrorMessage(
"Solution passed to SCIPgetViolationNonlinear() does not satisfy variable bounds.\n");
10070 assert(consdata !=
NULL);
10072 *violation =
MAX(consdata->lhsviol, consdata->rhsviol);
10085 assert(scip !=
NULL);
10086 assert(cons !=
NULL);
10089 assert(consdata !=
NULL);
10091 if( consdata->linvar_mayincrease == -1 && consdata->linvar_maydecrease == -1 )
10094 return consdata->linvar_maydecrease;
10105 assert(scip !=
NULL);
10106 assert(cons !=
NULL);
10109 assert(consdata !=
NULL);
10111 if( consdata->linvar_mayincrease == -1 && consdata->linvar_maydecrease == -1 )
10114 return consdata->linvar_mayincrease;
10125 assert(scip !=
NULL);
10126 assert(conshdlr !=
NULL);
10157 assert(scip !=
NULL);
10158 assert(alpha !=
NULL);
10159 assert(beta !=
NULL);
10160 assert(gamma_ !=
NULL);
10161 assert(delta !=
NULL);
10163 *alpha = -b3*c2 + a3*(-b2+c2) + a2*(b3-c3) + b2*c3;
10164 *beta = -(-b3*c1 + a3*(-b1+c1) + a1*(b3-c3) + b1*c3);
10165 *gamma_ = -a2*b1 + a1*b2 + a2*c1 - b2*c1 - a1*c2 + b1*c2;
10166 *delta = -a3*b2*c1 + a2*b3*c1 + a3*b1*c2 - a1*b3*c2 - a2*b1*c3 + a1*b2*c3;
10169 if( !
SCIPisRelEQ(scip, *alpha * a1 + *beta * a2 + *gamma_ * a3, *delta) ||
10170 !
SCIPisRelEQ(scip, *alpha * b1 + *beta * b2 + *gamma_ * b3, *delta) ||
10171 !
SCIPisRelEQ(scip, *alpha * c1 + *beta * c2 + *gamma_ * c3, *delta) )
10193 SCIPdebugMsg(scip,
"numerical troubles - try to solve the linear system via an LU factorization\n");
10206 if( !success || !
SCIPisRelEQ(scip, *alpha * a1 + *beta * a2 + *gamma_ * a3, *delta) ||
10207 !
SCIPisRelEQ(scip, *alpha * b1 + *beta * b2 + *gamma_ * b3, *delta) ||
10208 !
SCIPisRelEQ(scip, *alpha * c1 + *beta * c2 + *gamma_ * c3, *delta) )
10210 SCIPdebugMsg(scip,
"could not resolve numerical difficulties\n");
10218 if( *gamma_ < 0.0 )
10222 *gamma_ = -*gamma_;
enum SCIP_Result SCIP_RESULT
static SCIP_DECL_CONSENABLE(consEnableNonlinear)
static SCIP_RETCODE addLinearization(SCIP *scip, SCIP_EXPRINT *exprint, SCIP_CONS *cons, int exprtreeidx, SCIP_Real *x, SCIP_Bool newx, SCIP_ROW *row, SCIP_Bool *success)
#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)))
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)
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 SCIPaddVarToRow(SCIP *scip, SCIP_ROW *row, SCIP_VAR *var, SCIP_Real val)
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)
int SCIProwGetNNonz(SCIP_ROW *row)
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 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)
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)
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 maxrange, SCIP_Bool expensivecurvchecks, SCIP_Bool assumeconvex)
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)
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)
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)
static SCIP_RETCODE addIntervalGradientEstimator(SCIP *scip, SCIP_EXPRINT *exprint, SCIP_CONS *cons, int exprtreeidx, SCIP_Real *x, SCIP_Bool newx, SCIP_Bool overestimate, SCIP_ROW *row, SCIP_Bool *success)
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
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)
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_Real SCIPgetRowMinCoef(SCIP *scip, SCIP_ROW *row)
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)
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)
#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 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)
static SCIP_RETCODE splitOffLinearPart(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
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)
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_COL ** SCIProwGetCols(SCIP_ROW *row)
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)
static SCIP_RETCODE addConcaveEstimatorMultivariate(SCIP *scip, SCIP_CONS *cons, int exprtreeidx, SCIP_Real *ref, SCIP_ROW *row, SCIP_Bool *success)
#define SCIPallocBufferArray(scip, ptr, num)
SCIP_Real * SCIProwGetVals(SCIP_ROW *row)
#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 SCIPchgRowRhs(SCIP *scip, SCIP_ROW *row, SCIP_Real rhs)
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
static SCIP_RETCODE addConcaveEstimatorBivariate(SCIP *scip, SCIP_CONS *cons, int exprtreeidx, SCIP_Real *ref, SCIP_ROW *row, SCIP_Bool *success)
SCIP_RETCODE SCIPprintCons(SCIP *scip, SCIP_CONS *cons, FILE *file)
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)
static SCIP_RETCODE addUserEstimator(SCIP *scip, SCIP_CONS *cons, int exprtreeidx, SCIP_Real *x, SCIP_Bool overestimate, SCIP_ROW *row, SCIP_Bool *success)
SCIP_RETCODE SCIPchgRowLhs(SCIP *scip, SCIP_ROW *row, SCIP_Real lhs)
#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 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)
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)
SCIP_VAR * SCIPcolGetVar(SCIP_COL *col)
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)
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)
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)
static SCIP_RETCODE addConcaveEstimatorUnivariate(SCIP *scip, SCIP_CONS *cons, int exprtreeidx, SCIP_ROW *row, SCIP_Bool *success)
#define SCIPreallocBufferArray(scip, ptr, num)
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