39 #define SCIP_PRIVATE_ROWPREP 55 #define CONSHDLR_NAME "quadratic" 56 #define CONSHDLR_DESC "quadratic constraints of the form lhs <= b' x + x' A x <= rhs" 57 #define CONSHDLR_SEPAPRIORITY 10 58 #define CONSHDLR_ENFOPRIORITY -50 59 #define CONSHDLR_CHECKPRIORITY -4000000 60 #define CONSHDLR_SEPAFREQ 1 61 #define CONSHDLR_PROPFREQ 1 62 #define CONSHDLR_EAGERFREQ 100 64 #define CONSHDLR_MAXPREROUNDS -1 65 #define CONSHDLR_DELAYSEPA FALSE 66 #define CONSHDLR_DELAYPROP FALSE 67 #define CONSHDLR_NEEDSCONS TRUE 69 #define CONSHDLR_PROP_TIMING SCIP_PROPTIMING_BEFORELP 70 #define CONSHDLR_PRESOLTIMING SCIP_PRESOLTIMING_ALWAYS 72 #define MAXDNOM 10000LL 73 #define NONLINCONSUPGD_PRIORITY 40000 74 #define INITLPMAXVARVAL 1000.0 87 #define INTERIOR_EPS 1e-1 90 #define GAUGESCALE 0.99999 92 #define ROWPREP_SCALEUP_VIOLNONZERO (10.0*SCIPepsilon(scip)) 93 #define ROWPREP_SCALEUP_MINVIOLFACTOR 2.0 94 #define ROWPREP_SCALEUP_MAXMINCOEF (1.0 / SCIPfeastol(scip)) 95 #define ROWPREP_SCALEUP_MAXMAXCOEF SCIPgetHugeValue(scip) 96 #define ROWPREP_SCALEUP_MAXSIDE SCIPgetHugeValue(scip) 97 #define ROWPREP_SCALEDOWN_MINMAXCOEF (1.0 / SCIPfeastol(scip)) 98 #define ROWPREP_SCALEDOWN_MINCOEF SCIPfeastol(scip) 105 struct SCIP_QuadVarEventData
134 unsigned int linvarssorted:1;
135 unsigned int linvarsmerged:1;
136 unsigned int quadvarssorted:1;
137 unsigned int quadvarsmerged:1;
138 unsigned int bilinsorted:1;
139 unsigned int bilinmerged:1;
141 unsigned int isconvex:1;
142 unsigned int isconcave:1;
143 unsigned int iscurvchecked:1;
144 unsigned int isremovedfixings:1;
145 unsigned int ispropagated:1;
146 unsigned int ispresolved:1;
147 unsigned int initialmerge:1;
148 #ifdef CHECKIMPLINBILINEAR 149 unsigned int isimpladded:1;
151 unsigned int isgaugeavailable:1;
152 unsigned int isedavailable:1;
156 int minlinactivityinf;
157 int maxlinactivityinf;
163 int linvar_maydecrease;
164 int linvar_mayincrease;
167 int* sepabilinvar2pos;
194 struct SCIP_ConshdlrData
196 int replacebinaryprodlength;
207 char checkquadvarlocks;
211 int maxproproundspresolve;
216 char interiorcomputation;
228 int newsoleventfilterpos;
233 int quadconsupgradessize;
234 int nquadconsupgrades;
249 const char* conshdlrname
254 assert(scip !=
NULL);
255 assert(conshdlrdata !=
NULL);
256 assert(quadconsupgd !=
NULL);
257 assert(conshdlrname !=
NULL);
259 for( i = conshdlrdata->nquadconsupgrades - 1; i >= 0; --i )
261 if( conshdlrdata->quadconsupgrades[i]->quadconsupgd == quadconsupgd )
263 SCIPwarningMessage(scip,
"Try to add already known upgrade message for constraint handler <%s>.\n", conshdlrname);
279 #define infty2infty(infty1, infty2, val) ((val) >= (infty1) ? (infty2) : (val)) 294 assert(scip !=
NULL);
295 assert(eventhdlr !=
NULL);
296 assert(cons !=
NULL);
299 assert(consdata !=
NULL);
301 assert(linvarpos >= 0);
302 assert(linvarpos < consdata->nlinvars);
303 assert(consdata->lineventdata !=
NULL);
307 eventdata->cons = cons;
308 eventdata->varidx = linvarpos;
315 if( consdata->lincoefs[linvarpos] > 0.0 )
324 if( consdata->lincoefs[linvarpos] > 0.0 )
332 consdata->lineventdata[linvarpos] = eventdata;
340 consdata->minlinactivityinf = -1;
341 consdata->maxlinactivityinf = -1;
358 assert(scip !=
NULL);
359 assert(eventhdlr !=
NULL);
360 assert(cons !=
NULL);
363 assert(consdata !=
NULL);
365 assert(linvarpos >= 0);
366 assert(linvarpos < consdata->nlinvars);
367 assert(consdata->lineventdata !=
NULL);
368 assert(consdata->lineventdata[linvarpos] !=
NULL);
369 assert(consdata->lineventdata[linvarpos]->cons == cons);
370 assert(consdata->lineventdata[linvarpos]->varidx == linvarpos);
371 assert(consdata->lineventdata[linvarpos]->filterpos >= 0);
378 if( consdata->lincoefs[linvarpos] > 0.0 )
387 if( consdata->lincoefs[linvarpos] > 0.0 )
413 assert(scip !=
NULL);
414 assert(eventhdlr !=
NULL);
415 assert(cons !=
NULL);
418 assert(consdata !=
NULL);
420 assert(quadvarpos >= 0);
421 assert(quadvarpos < consdata->nquadvars);
422 assert(consdata->quadvarterms[quadvarpos].eventdata ==
NULL);
427 #ifdef CHECKIMPLINBILINEAR 430 eventdata->cons = cons;
431 eventdata->varidx = -quadvarpos-1;
434 consdata->quadvarterms[quadvarpos].eventdata = eventdata;
457 assert(scip !=
NULL);
458 assert(eventhdlr !=
NULL);
459 assert(cons !=
NULL);
462 assert(consdata !=
NULL);
464 assert(quadvarpos >= 0);
465 assert(quadvarpos < consdata->nquadvars);
466 assert(consdata->quadvarterms[quadvarpos].eventdata !=
NULL);
467 assert(consdata->quadvarterms[quadvarpos].eventdata->cons == cons);
468 assert(consdata->quadvarterms[quadvarpos].eventdata->varidx == -quadvarpos-1);
469 assert(consdata->quadvarterms[quadvarpos].eventdata->filterpos >= 0);
472 #ifdef CHECKIMPLINBILINEAR 476 SCIP_CALL(
SCIPdropVarEvent(scip, consdata->quadvarterms[quadvarpos].var, eventtype, eventhdlr, (
SCIP_EVENTDATA*)consdata->quadvarterms[quadvarpos].eventdata, consdata->quadvarterms[quadvarpos].eventdata->filterpos) );
495 assert(scip !=
NULL);
496 assert(cons !=
NULL);
497 assert(eventhdlr !=
NULL);
500 assert(consdata !=
NULL);
501 assert(consdata->lineventdata ==
NULL);
504 consdata->isremovedfixings =
TRUE;
507 for( i = 0; i < consdata->nlinvars; ++i )
511 var = consdata->linvars[i];
512 consdata->isremovedfixings = consdata->isremovedfixings &&
SCIPvarIsActive(var)
516 for( i = 0; i < consdata->nquadvars; ++i )
518 assert(consdata->quadvarterms[i].eventdata ==
NULL);
522 var = consdata->quadvarterms[i].var;
523 consdata->isremovedfixings = consdata->isremovedfixings &&
SCIPvarIsActive(var)
527 consdata->ispropagated =
FALSE;
543 assert(scip !=
NULL);
544 assert(eventhdlr !=
NULL);
545 assert(cons !=
NULL);
548 assert(consdata !=
NULL);
550 if( consdata->lineventdata !=
NULL )
552 for( i = 0; i < consdata->nlinvars; ++i )
554 if( consdata->lineventdata[i] !=
NULL )
562 for( i = 0; i < consdata->nquadvars; ++i )
564 if( consdata->quadvarterms[i].eventdata !=
NULL )
584 assert(scip !=
NULL);
585 assert(cons !=
NULL);
590 assert(consdata !=
NULL);
615 assert(scip !=
NULL);
616 assert(cons !=
NULL);
621 assert(consdata !=
NULL);
678 assert(scip !=
NULL);
679 assert(consdata !=
NULL);
685 (consdata->minlinactivityinf > 0 || consdata->maxlinactivityinf > 0 || consdata->minlinactivity <= consdata->maxlinactivity) )
688 assert(consdata->minlinactivityinf >= 0);
689 assert(consdata->maxlinactivityinf >= 0);
693 consdata->minlinactivityinf = 0;
694 consdata->maxlinactivityinf = 0;
699 consdata->minlinactivity =
SCIPisInfinity(scip, consdata->rhs) ? -intervalinfty : 0.0;
700 consdata->maxlinactivity =
SCIPisInfinity(scip, -consdata->lhs) ? intervalinfty : 0.0;
702 if( consdata->nlinvars == 0 )
707 assert(consdata->lineventdata !=
NULL);
716 for( i = 0; i < consdata->nlinvars; ++i )
718 assert(consdata->lineventdata[i] !=
NULL);
719 if( consdata->lincoefs[i] >= 0.0 )
724 ++consdata->minlinactivityinf;
734 ++consdata->minlinactivityinf;
739 consdata->minlinactivity += consdata->lincoefs[i] * bnd;
748 for( i = 0; i < consdata->nlinvars; ++i )
750 assert(consdata->lineventdata[i] !=
NULL);
751 if( consdata->lincoefs[i] >= 0.0 )
756 ++consdata->maxlinactivityinf;
766 ++consdata->maxlinactivityinf;
771 consdata->maxlinactivity += consdata->lincoefs[i] * bnd;
777 assert(consdata->minlinactivityinf > 0 || consdata->maxlinactivityinf > 0 || consdata->minlinactivity <= consdata->maxlinactivity);
792 assert(scip !=
NULL);
793 assert(consdata !=
NULL);
820 --consdata->minlinactivityinf;
821 assert(consdata->minlinactivityinf >= 0);
827 consdata->minlinactivity += minuscoef * oldbnd;
832 ++consdata->minlinactivityinf;
836 consdata->minlinactivity += coef * newbnd;
856 --consdata->maxlinactivityinf;
857 assert(consdata->maxlinactivityinf >= 0);
863 consdata->maxlinactivity += minuscoef * oldbnd;
868 ++consdata->maxlinactivityinf;
872 consdata->maxlinactivity += coef * newbnd;
891 assert(scip !=
NULL);
892 assert(consdata !=
NULL);
919 --consdata->maxlinactivityinf;
920 assert(consdata->maxlinactivityinf >= 0);
926 consdata->maxlinactivity += minuscoef * oldbnd;
931 ++consdata->maxlinactivityinf;
935 consdata->maxlinactivity += coef * newbnd;
955 --consdata->minlinactivityinf;
956 assert(consdata->minlinactivityinf >= 0);
962 consdata->minlinactivity += minuscoef * oldbnd;
967 ++consdata->minlinactivityinf;
971 consdata->minlinactivity += coef * newbnd;
994 assert(scip !=
NULL);
995 assert(consdata !=
NULL);
996 assert(idx >= 0 && idx < consdata->nquadvars);
998 var = consdata->quadvarterms[idx].var;
1001 quadcoef = consdata->quadvarterms[idx].sqrcoef;
1018 assert(scip !=
NULL);
1019 assert(event !=
NULL);
1020 assert(eventdata !=
NULL);
1021 assert(eventhdlr !=
NULL);
1024 assert(cons !=
NULL);
1026 assert(consdata !=
NULL);
1029 assert(varidx < 0 || varidx < consdata->nlinvars);
1030 assert(varidx >= 0 || -varidx-1 < consdata->nquadvars);
1041 quadvarterm = &consdata->quadvarterms[-varidx-1];
1042 var = quadvarterm->
var;
1053 consdata->quadvarsmerged =
FALSE;
1054 consdata->initialmerge =
FALSE;
1074 consdata->ispropagated =
FALSE;
1076 var = varidx < 0 ? consdata->quadvarterms[-varidx-1].var : consdata->linvars[varidx];
1077 assert(var !=
NULL);
1080 consdata->isremovedfixings =
FALSE;
1086 consdata->isremovedfixings =
FALSE;
1089 #ifdef CHECKIMPLINBILINEAR 1095 consdata->isimpladded =
TRUE;
1110 assert(scip !=
NULL);
1111 assert(consdata !=
NULL);
1112 assert(consdata->nlinvars <= consdata->linvarssize);
1114 if( num > consdata->linvarssize )
1121 if( consdata->lineventdata !=
NULL )
1125 consdata->linvarssize = newsize;
1127 assert(num <= consdata->linvarssize);
1140 assert(scip !=
NULL);
1141 assert(consdata !=
NULL);
1142 assert(consdata->nquadvars <= consdata->quadvarssize);
1144 if( num > consdata->quadvarssize )
1150 consdata->quadvarssize = newsize;
1152 assert(num <= consdata->quadvarssize);
1165 assert(scip !=
NULL);
1166 assert(quadvarterm !=
NULL);
1177 assert(num <= quadvarterm->adjbilinsize);
1190 assert(scip !=
NULL);
1191 assert(consdata !=
NULL);
1192 assert(consdata->nbilinterms <= consdata->bilintermssize);
1194 if( num > consdata->bilintermssize )
1200 consdata->bilintermssize = newsize;
1202 assert(num <= consdata->bilintermssize);
1214 assert(scip !=
NULL);
1215 assert(consdata !=
NULL);
1223 (*consdata)->linvarssorted =
TRUE;
1224 (*consdata)->linvarsmerged =
TRUE;
1225 (*consdata)->quadvarssorted =
TRUE;
1226 (*consdata)->quadvarsmerged =
TRUE;
1227 (*consdata)->bilinsorted =
TRUE;
1228 (*consdata)->bilinmerged =
TRUE;
1230 (*consdata)->isremovedfixings =
TRUE;
1231 (*consdata)->ispropagated =
TRUE;
1232 (*consdata)->initialmerge =
FALSE;
1234 (*consdata)->linvar_maydecrease = -1;
1235 (*consdata)->linvar_mayincrease = -1;
1239 (*consdata)->minlinactivityinf = -1;
1240 (*consdata)->maxlinactivityinf = -1;
1242 (*consdata)->isgaugeavailable =
FALSE;
1243 (*consdata)->isedavailable =
FALSE;
1267 assert(scip !=
NULL);
1268 assert(consdata !=
NULL);
1270 assert(nlinvars == 0 || linvars !=
NULL);
1271 assert(nlinvars == 0 || lincoefs !=
NULL);
1272 assert(nquadvars == 0 || quadvarterms !=
NULL);
1273 assert(nbilinterms == 0 || bilinterms !=
NULL);
1280 (*consdata)->minlinactivityinf = -1;
1281 (*consdata)->maxlinactivityinf = -1;
1283 (*consdata)->lhs = lhs;
1284 (*consdata)->rhs = rhs;
1290 (*consdata)->nlinvars = nlinvars;
1291 (*consdata)->linvarssize = nlinvars;
1294 for( i = 0; i < nlinvars; ++i )
1301 (*consdata)->linvarssorted =
TRUE;
1302 (*consdata)->linvarsmerged =
TRUE;
1303 (*consdata)->minlinactivity = 0.0;
1304 (*consdata)->maxlinactivity = 0.0;
1305 (*consdata)->minlinactivityinf = 0;
1306 (*consdata)->maxlinactivityinf = 0;
1313 for( i = 0; i < nquadvars; ++i )
1315 (*consdata)->quadvarterms[i].eventdata =
NULL;
1316 if( quadvarterms[i].nadjbilin )
1319 (*consdata)->quadvarterms[i].adjbilinsize = quadvarterms[i].
nadjbilin;
1323 assert((*consdata)->quadvarterms[i].nadjbilin == 0);
1324 (*consdata)->quadvarterms[i].adjbilin =
NULL;
1325 (*consdata)->quadvarterms[i].adjbilinsize = 0;
1333 (*consdata)->nquadvars = nquadvars;
1334 (*consdata)->quadvarssize = nquadvars;
1339 (*consdata)->quadvarssorted =
TRUE;
1340 (*consdata)->quadvarsmerged =
TRUE;
1344 if( nbilinterms > 0 )
1347 (*consdata)->nbilinterms = nbilinterms;
1348 (*consdata)->bilintermssize = nbilinterms;
1352 (*consdata)->bilinsorted =
TRUE;
1353 (*consdata)->bilinmerged =
TRUE;
1356 (*consdata)->linvar_maydecrease = -1;
1357 (*consdata)->linvar_mayincrease = -1;
1363 (*consdata)->isgaugeavailable =
FALSE;
1377 assert(scip !=
NULL);
1378 assert(consdata !=
NULL);
1379 assert(*consdata !=
NULL);
1386 if( (*consdata)->linvarssize > 0 )
1388 for( i = 0; i < (*consdata)->nlinvars; ++i )
1390 assert((*consdata)->lineventdata ==
NULL || (*consdata)->lineventdata[i] ==
NULL);
1397 assert((*consdata)->linvars ==
NULL);
1398 assert((*consdata)->lincoefs ==
NULL);
1399 assert((*consdata)->lineventdata ==
NULL);
1402 for( i = 0; i < (*consdata)->nquadvars; ++i )
1404 assert((*consdata)->quadvarterms[i].eventdata ==
NULL);
1414 if( (*consdata)->nlrow !=
NULL )
1440 assert(consdata !=
NULL);
1442 if( consdata->linvarssorted )
1445 if( consdata->nlinvars <= 1 )
1447 consdata->linvarssorted =
TRUE;
1451 if( consdata->lineventdata ==
NULL )
1453 SCIPsortPtrReal((
void**)consdata->linvars, consdata->lincoefs, SCIPvarComp, consdata->nlinvars);
1459 SCIPsortPtrPtrReal((
void**)consdata->linvars, (
void**)consdata->lineventdata, consdata->lincoefs, SCIPvarComp, consdata->nlinvars);
1462 for( i = 0; i < consdata->nlinvars; ++i )
1463 if( consdata->lineventdata[i] !=
NULL )
1464 consdata->lineventdata[i]->varidx = i;
1467 consdata->linvarssorted =
TRUE;
1470 #ifdef SCIP_DISABLED_CODE 1473 int consdataFindLinearVar(
1480 assert(consdata !=
NULL);
1481 assert(var !=
NULL);
1483 if( consdata->nlinvars == 0 )
1488 if( !
SCIPsortedvecFindPtr((
void**)consdata->linvars, SCIPvarComp, (
void*)var, consdata->nlinvars, &pos) )
1501 assert(consdata !=
NULL);
1502 assert(0 <= ind1 && ind1 < consdata->nquadvars);
1503 assert(0 <= ind2 && ind2 < consdata->nquadvars);
1505 return SCIPvarCompare(consdata->quadvarterms[ind1].var, consdata->quadvarterms[ind2].var);
1521 assert(scip !=
NULL);
1522 assert(consdata !=
NULL);
1524 if( consdata->quadvarssorted )
1527 if( consdata->nquadvars == 0 )
1529 consdata->quadvarssorted =
TRUE;
1537 SCIPsort(perm, quadVarTermComp, (
void*)consdata, consdata->nquadvars);
1540 for( v = 0; v < consdata->nquadvars; ++v )
1544 quadterm = consdata->quadvarterms[v];
1549 assert(0 <= perm[i] && perm[i] < consdata->nquadvars);
1550 assert(perm[i] != i);
1551 consdata->quadvarterms[i] = consdata->quadvarterms[perm[i]];
1552 if( consdata->quadvarterms[i].eventdata !=
NULL )
1554 consdata->quadvarterms[i].eventdata->varidx = -i-1;
1560 while( perm[i] != v );
1561 consdata->quadvarterms[i] = quadterm;
1562 if( consdata->quadvarterms[i].eventdata !=
NULL )
1564 consdata->quadvarterms[i].
eventdata->varidx = -i-1;
1569 consdata->quadvarssorted =
TRUE;
1590 assert(consdata !=
NULL);
1591 assert(var !=
NULL);
1592 assert(pos !=
NULL);
1594 if( consdata->nquadvars == 0 )
1603 right = consdata->nquadvars - 1;
1604 while( left <= right )
1608 middle = (left+right)/2;
1609 assert(0 <= middle && middle < consdata->nquadvars);
1611 cmpres =
SCIPvarCompare(var, consdata->quadvarterms[middle].var);
1615 else if( cmpres > 0 )
1623 assert(left == right+1);
1637 assert(consdata !=
NULL);
1638 assert(0 <= ind1 && ind1 < consdata->nbilinterms);
1639 assert(0 <= ind2 && ind2 < consdata->nbilinterms);
1641 var1cmp =
SCIPvarCompare(consdata->bilinterms[ind1].var1, consdata->bilinterms[ind2].var1);
1645 return SCIPvarCompare(consdata->bilinterms[ind1].var2, consdata->bilinterms[ind2].var2);
1657 assert(consdata !=
NULL);
1660 if( !consdata->bilinsorted )
1663 for( i = 0; i < consdata->nbilinterms - 1; ++i )
1665 if( bilinTermComp(consdata, i, i+1) > 0 )
1686 assert(scip !=
NULL);
1687 assert(consdata !=
NULL);
1689 if( consdata->bilinsorted )
1692 if( consdata->nbilinterms == 0 )
1694 consdata->bilinsorted =
TRUE;
1703 SCIPsort(perm, bilinTermComp, (
void*)consdata, consdata->nbilinterms);
1706 for( v = 0; v < consdata->nbilinterms; ++v )
1708 assert(0 <= perm[v] && perm[v] < consdata->nbilinterms);
1709 invperm[perm[v]] = v;
1713 for( v = 0; v < consdata->nbilinterms; ++v )
1717 bilinterm = consdata->bilinterms[v];
1722 assert(0 <= perm[i] && perm[i] < consdata->nbilinterms);
1723 assert(perm[i] != i);
1724 consdata->bilinterms[i] = consdata->bilinterms[perm[i]];
1729 while( perm[i] != v );
1730 consdata->bilinterms[i] = bilinterm;
1736 for( v = 0; v < consdata->nquadvars; ++v )
1737 for( i = 0; i < consdata->quadvarterms[v].nadjbilin; ++i )
1738 consdata->quadvarterms[v].adjbilin[i] = invperm[consdata->quadvarterms[v].adjbilin[i]];
1740 consdata->bilinsorted =
TRUE;
1758 assert(consdata !=
NULL);
1759 assert(oldpos >= 0);
1760 assert(oldpos < consdata->nlinvars);
1761 assert(newpos >= 0);
1762 assert(newpos < consdata->linvarssize);
1764 if( newpos == oldpos )
1767 consdata->linvars [newpos] = consdata->linvars [oldpos];
1768 consdata->lincoefs[newpos] = consdata->lincoefs[oldpos];
1770 if( consdata->lineventdata !=
NULL )
1772 assert(newpos >= consdata->nlinvars || consdata->lineventdata[newpos] ==
NULL);
1774 consdata->lineventdata[newpos] = consdata->lineventdata[oldpos];
1775 consdata->lineventdata[newpos]->varidx = newpos;
1777 consdata->lineventdata[oldpos] =
NULL;
1780 consdata->linvarssorted =
FALSE;
1791 assert(consdata !=
NULL);
1792 assert(oldpos >= 0);
1793 assert(oldpos < consdata->nquadvars);
1794 assert(newpos >= 0);
1795 assert(newpos < consdata->quadvarssize);
1797 if( newpos == oldpos )
1800 assert(newpos >= consdata->nquadvars || consdata->quadvarterms[newpos].eventdata ==
NULL);
1802 consdata->quadvarterms[newpos] = consdata->quadvarterms[oldpos];
1804 if( consdata->quadvarterms[newpos].eventdata !=
NULL )
1806 consdata->quadvarterms[newpos].eventdata->varidx = -newpos-1;
1807 consdata->quadvarterms[oldpos].eventdata =
NULL;
1810 consdata->quadvarssorted =
FALSE;
1825 assert(scip !=
NULL);
1826 assert(cons !=
NULL);
1827 assert(var !=
NULL);
1834 assert(consdata !=
NULL);
1844 assert(var !=
NULL);
1848 consdata->linvars [consdata->nlinvars] = var;
1849 consdata->lincoefs[consdata->nlinvars] = coef;
1851 ++consdata->nlinvars;
1862 assert(conshdlrdata !=
NULL);
1863 assert(conshdlrdata->eventhdlr !=
NULL);
1865 assert(consdata->lineventdata !=
NULL);
1866 consdata->lineventdata[consdata->nlinvars-1] =
NULL;
1876 consdata->minlinactivityinf = -1;
1877 consdata->maxlinactivityinf = -1;
1880 if( consdata->nlrow !=
NULL )
1891 consdata->ispropagated =
FALSE;
1892 consdata->ispresolved =
FALSE;
1893 consdata->isremovedfixings = consdata->isremovedfixings &&
SCIPvarIsActive(var)
1895 if( consdata->nlinvars == 1 )
1896 consdata->linvarssorted =
TRUE;
1898 consdata->linvarssorted = consdata->linvarssorted && (
SCIPvarCompare(consdata->linvars[consdata->nlinvars-2], consdata->linvars[consdata->nlinvars-1]) == -1);
1900 consdata->linvarsmerged =
FALSE;
1917 assert(scip !=
NULL);
1918 assert(cons !=
NULL);
1921 assert(consdata !=
NULL);
1922 assert(0 <= pos && pos < consdata->nlinvars);
1924 var = consdata->linvars[pos];
1925 coef = consdata->lincoefs[pos];
1926 assert(var !=
NULL);
1932 if( consdata->lineventdata !=
NULL )
1940 assert(conshdlrdata !=
NULL);
1941 assert(conshdlrdata->eventhdlr !=
NULL);
1953 --consdata->nlinvars;
1959 consdata->minlinactivityinf = -1;
1960 consdata->maxlinactivityinf = -1;
1963 if( consdata->nlrow !=
NULL )
1968 consdata->ispropagated =
FALSE;
1969 consdata->ispresolved =
FALSE;
1989 assert(scip !=
NULL);
1990 assert(cons !=
NULL);
1993 conshdlrdata =
NULL;
1996 assert(consdata !=
NULL);
1998 assert(pos < consdata->nlinvars);
2001 var = consdata->linvars[pos];
2002 coef = consdata->lincoefs[pos];
2003 assert(var !=
NULL);
2010 consdata->minlinactivityinf = -1;
2011 consdata->maxlinactivityinf = -1;
2014 if( consdata->nlrow !=
NULL )
2020 if( newcoef * coef < 0.0 )
2030 if( consdata->lineventdata[pos] !=
NULL )
2035 assert(conshdlrdata !=
NULL);
2036 assert(conshdlrdata->eventhdlr !=
NULL);
2044 consdata->lincoefs[pos] = newcoef;
2047 if( newcoef * coef < 0.0 )
2055 if( conshdlrdata !=
NULL )
2064 consdata->ispropagated =
FALSE;
2065 consdata->ispresolved =
FALSE;
2084 assert(scip !=
NULL);
2085 assert(cons !=
NULL);
2086 assert(var !=
NULL);
2089 assert(consdata !=
NULL);
2099 assert(var !=
NULL);
2104 quadvarterm = &consdata->quadvarterms[consdata->nquadvars];
2105 quadvarterm->
var = var;
2106 quadvarterm->
lincoef = lincoef;
2107 quadvarterm->
sqrcoef = sqrcoef;
2113 ++consdata->nquadvars;
2127 assert(conshdlrdata !=
NULL);
2128 assert(conshdlrdata->eventhdlr !=
NULL);
2139 if( consdata->nlrow !=
NULL )
2147 consdata->ispropagated =
FALSE;
2148 consdata->ispresolved =
FALSE;
2149 consdata->isremovedfixings = consdata->isremovedfixings &&
SCIPvarIsActive(var)
2151 if( consdata->nquadvars == 1 )
2152 consdata->quadvarssorted =
TRUE;
2154 consdata->quadvarssorted = consdata->quadvarssorted &&
2155 (
SCIPvarCompare(consdata->quadvarterms[consdata->nquadvars-2].var, consdata->quadvarterms[consdata->nquadvars-1].var) == -1);
2157 consdata->quadvarsmerged =
FALSE;
2159 consdata->iscurvchecked =
FALSE;
2175 assert(scip !=
NULL);
2176 assert(cons !=
NULL);
2179 assert(consdata !=
NULL);
2180 assert(0 <= pos && pos < consdata->nquadvars);
2182 var = consdata->quadvarterms[pos].var;
2183 assert(var !=
NULL);
2184 assert(consdata->quadvarterms[pos].nadjbilin == 0);
2190 if( consdata->quadvarterms[pos].eventdata !=
NULL )
2198 assert(conshdlrdata !=
NULL);
2199 assert(conshdlrdata->eventhdlr !=
NULL);
2214 --consdata->nquadvars;
2221 if( consdata->nlrow !=
NULL )
2226 consdata->ispropagated =
FALSE;
2227 consdata->ispresolved =
FALSE;
2228 consdata->iscurvchecked =
FALSE;
2257 assert(consdata !=
NULL);
2259 assert(pos < consdata->nquadvars);
2261 quadvarterm = &consdata->quadvarterms[pos];
2275 assert(conshdlrdata !=
NULL);
2276 assert(conshdlrdata->eventhdlr !=
NULL);
2278 eventhdlr = conshdlrdata->eventhdlr;
2289 constant = quadvarterm->
lincoef * offset + quadvarterm->
sqrcoef * offset * offset;
2290 if( constant != 0.0 )
2294 consdata->lhs -= constant;
2296 consdata->rhs -= constant;
2301 quadvarterm->
lincoef += 2.0 * quadvarterm->
sqrcoef * coef * offset;
2302 quadvarterm->
sqrcoef *= coef * coef;
2305 for( i = 0; i < quadvarterm->
nadjbilin; ++i )
2307 bilinterm = &consdata->bilinterms[quadvarterm->
adjbilin[i]];
2309 if( bilinterm->
var1 == quadvarterm->
var )
2311 bilinterm->
var1 = var;
2312 var2 = bilinterm->
var2;
2316 assert(bilinterm->
var2 == quadvarterm->
var);
2317 bilinterm->
var2 = var;
2318 var2 = bilinterm->
var1;
2328 bilinterm->
coef = 0.0;
2336 tmp = bilinterm->
var1;
2338 bilinterm->
var2 = tmp;
2348 while( consdata->quadvarterms[var2pos].var != var2 )
2351 assert(var2pos < consdata->nquadvars);
2354 consdata->quadvarterms[var2pos].lincoef += bilinterm->
coef * offset;
2357 bilinterm->
coef *= coef;
2364 quadvarterm->
var = var;
2370 if( eventhdlr !=
NULL )
2383 if( consdata->nlrow !=
NULL )
2391 consdata->isremovedfixings = consdata->isremovedfixings &&
SCIPvarIsActive(var)
2393 consdata->quadvarssorted = (consdata->nquadvars == 1);
2394 consdata->quadvarsmerged =
FALSE;
2395 consdata->bilinsorted &= (quadvarterm->
nadjbilin == 0);
2396 consdata->bilinmerged &= (quadvarterm->
nadjbilin == 0);
2398 consdata->ispropagated =
FALSE;
2399 consdata->ispresolved =
FALSE;
2400 consdata->iscurvchecked =
FALSE;
2418 assert(scip !=
NULL);
2419 assert(cons !=
NULL);
2421 if( var1pos == var2pos )
2423 SCIPerrorMessage(
"tried to add bilinear term where both variables are the same\n");
2428 assert(consdata !=
NULL);
2433 assert(var1pos >= 0);
2434 assert(var1pos < consdata->nquadvars);
2435 assert(var2pos >= 0);
2436 assert(var2pos < consdata->nquadvars);
2440 bilinterm = &consdata->bilinterms[consdata->nbilinterms];
2441 if(
SCIPvarCompare(consdata->quadvarterms[var1pos].var, consdata->quadvarterms[var2pos].var) < 0 )
2443 bilinterm->
var1 = consdata->quadvarterms[var1pos].var;
2444 bilinterm->
var2 = consdata->quadvarterms[var2pos].var;
2448 bilinterm->
var1 = consdata->quadvarterms[var2pos].var;
2449 bilinterm->
var2 = consdata->quadvarterms[var1pos].var;
2451 bilinterm->
coef = coef;
2453 if( bilinterm->
var1 == bilinterm->
var2 )
2455 SCIPerrorMessage(
"tried to add bilinear term where both variables are the same, but appear at different positions in quadvarterms array\n");
2463 consdata->quadvarterms[var1pos].adjbilin[consdata->quadvarterms[var1pos].nadjbilin] = consdata->nbilinterms;
2464 consdata->quadvarterms[var2pos].adjbilin[consdata->quadvarterms[var2pos].nadjbilin] = consdata->nbilinterms;
2465 ++consdata->quadvarterms[var1pos].nadjbilin;
2466 ++consdata->quadvarterms[var2pos].nadjbilin;
2468 ++consdata->nbilinterms;
2475 if( consdata->nlrow !=
NULL )
2480 consdata->ispropagated =
FALSE;
2481 consdata->ispresolved =
FALSE;
2482 if( consdata->nbilinterms == 1 )
2484 consdata->bilinsorted =
TRUE;
2487 consdata->bilinmerged = !
SCIPisZero(scip, consdata->bilinterms[0].coef);
2491 consdata->bilinsorted = consdata->bilinsorted
2492 && (bilinTermComp(consdata, consdata->nbilinterms-2, consdata->nbilinterms-1) <= 0);
2493 consdata->bilinmerged =
FALSE;
2496 consdata->iscurvchecked =
FALSE;
2522 assert(scip !=
NULL);
2523 assert(cons !=
NULL);
2524 assert(nterms == 0 || termposs !=
NULL);
2530 assert(consdata !=
NULL);
2538 for( j = 0; j < consdata->nbilinterms; ++j )
2541 if( i < nterms && j == termposs[i] )
2551 consdata->bilinterms[j-offset] = consdata->bilinterms[j];
2552 newpos[j] = j - offset;
2554 assert(offset == nterms);
2557 for( i = 0; i < consdata->nquadvars; ++i )
2560 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
2562 assert(consdata->quadvarterms[i].adjbilin[j] < consdata->nbilinterms);
2563 if( newpos[consdata->quadvarterms[i].adjbilin[j]] == -1 )
2571 consdata->quadvarterms[i].adjbilin[j-offset] = newpos[consdata->quadvarterms[i].adjbilin[j]];
2574 consdata->quadvarterms[i].nadjbilin -= offset;
2578 consdata->nbilinterms -= nterms;
2583 consdata->quadvarsmerged =
FALSE;
2585 consdata->ispropagated =
FALSE;
2586 consdata->ispresolved =
FALSE;
2587 consdata->iscurvchecked =
FALSE;
2594 if( consdata->nlrow !=
NULL )
2618 assert(scip !=
NULL);
2619 assert(cons !=
NULL);
2623 if( consdata->quadvarsmerged )
2626 if( consdata->nquadvars == 0 )
2628 consdata->quadvarsmerged =
TRUE;
2633 while( i < consdata->nquadvars )
2638 quadvarterm = &consdata->quadvarterms[i];
2640 for( j = i+1; j < consdata->nquadvars && consdata->quadvarterms[j].var == quadvarterm->
var; ++j )
2643 quadvarterm->
lincoef += consdata->quadvarterms[j].lincoef;
2644 quadvarterm->
sqrcoef += consdata->quadvarterms[j].sqrcoef;
2645 if( consdata->quadvarterms[j].nadjbilin > 0 )
2650 quadvarterm->
nadjbilin += consdata->quadvarterms[j].nadjbilin;
2651 consdata->quadvarterms[j].nadjbilin = 0;
2653 consdata->quadvarterms[j].lincoef = 0.0;
2654 consdata->quadvarterms[j].sqrcoef = 0.0;
2659 for( j = j-1; j > i; --j )
2674 if( consdata->nlrow !=
NULL )
2697 consdata->quadvarsmerged =
TRUE;
2716 assert(scip !=
NULL);
2717 assert(cons !=
NULL);
2721 if( consdata->linvarsmerged )
2724 if( consdata->nlinvars == 0 )
2726 consdata->linvarsmerged =
TRUE;
2731 while( i < consdata->nlinvars )
2737 newcoef = consdata->lincoefs[i];
2738 for( j = i+1; j < consdata->nlinvars && consdata->linvars[i] == consdata->linvars[j]; ++j )
2739 newcoef += consdata->lincoefs[j];
2741 for( j = j-1; j > i; --j )
2751 assert(qvarpos < consdata->nquadvars);
2752 assert(consdata->quadvarterms[qvarpos].var == consdata->linvars[i]);
2753 consdata->quadvarterms[qvarpos].lincoef += newcoef;
2770 consdata->linvarsmerged =
TRUE;
2789 assert(scip !=
NULL);
2790 assert(cons !=
NULL);
2797 if( consdata->bilinmerged )
2800 if( consdata->nbilinterms == 0 )
2802 consdata->bilinmerged =
TRUE;
2814 while( i < consdata->nbilinterms )
2816 bilinterm = &consdata->bilinterms[i];
2819 for( j = i+1; j < consdata->nbilinterms && bilinterm->
var1 == consdata->bilinterms[j].var1 && bilinterm->
var2 == consdata->bilinterms[j].var2; ++j )
2821 bilinterm->
coef += consdata->bilinterms[j].coef;
2822 todelete[ntodelete++] = j;
2828 todelete[ntodelete++] = i;
2840 consdata->bilinmerged =
TRUE;
2869 assert(scip !=
NULL);
2870 assert(cons !=
NULL);
2874 have_change =
FALSE;
2876 while( i < consdata->nlinvars )
2878 var = consdata->linvars[i];
2888 coef = consdata->lincoefs[i];
2901 SCIPdebugMsg(scip,
" linear term %g*<%s> is replaced by %g * <%s> + %g\n", consdata->lincoefs[i],
SCIPvarGetName(consdata->linvars[i]),
2911 consdata->lhs -= offset;
2913 consdata->rhs -= offset;
2942 for( j = 0; j < naggrs; ++j )
2947 if( aggrconstant != 0.0 )
2950 consdata->lhs -= coef * aggrconstant;
2952 consdata->rhs -= coef * aggrconstant;
2958 while( i < consdata->nquadvars )
2960 var = consdata->quadvarterms[i].var;
2983 SCIPdebugMsg(scip,
" quadratic variable <%s> with status %d is replaced by %g * <%s> + %g\n",
SCIPvarGetName(consdata->quadvarterms[i].var),
2992 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
2994 bilinterm = &consdata->bilinterms[consdata->quadvarterms[i].adjbilin[j]];
2996 var2 = bilinterm->
var1 == consdata->quadvarterms[i].var ? bilinterm->
var2 : bilinterm->
var1;
2997 assert(var2 != consdata->quadvarterms[i].var);
3000 while( consdata->quadvarterms[var2pos].var != var2 )
3003 assert(var2pos < consdata->nquadvars);
3005 consdata->quadvarterms[var2pos].lincoef += bilinterm->
coef * offset;
3008 offset = consdata->quadvarterms[i].lincoef * offset + consdata->quadvarterms[i].sqrcoef * offset * offset;
3010 consdata->lhs -= offset;
3012 consdata->rhs -= offset;
3024 assert(var !=
NULL);
3061 lcoef = consdata->quadvarterms[i].lincoef;
3062 scoef = consdata->quadvarterms[i].sqrcoef;
3064 nquadtermsold = consdata->nquadvars;
3069 if( aggrconstant != 0.0 || offset != 0.0 )
3072 constant = (aggrconstant * coef + offset) * (lcoef + (aggrconstant * coef + offset) * scoef);
3074 consdata->lhs -= constant;
3076 consdata->rhs -= constant;
3080 for( j = 0; j < naggrs; ++j )
3083 coef * aggrscalars[j] * (lcoef + 2.0 * scoef * (coef * aggrconstant + offset)),
3084 coef * coef * aggrscalars[j] * aggrscalars[j] * scoef) );
3088 SCIP_CALL(
consdataEnsureBilinSize(scip, consdata, consdata->nquadvars + (scoef != 0.0 ? (naggrs * (naggrs-1))/2 : 0) + consdata->quadvarterms[j].nadjbilin * naggrs) );
3093 for( j = 0; j < naggrs; ++j )
3094 for( k = 0; k < j; ++k )
3096 assert(aggrvars[j] != aggrvars[k]);
3098 2.0 * aggrscalars[j] * aggrscalars[k] * coef * coef * scoef) );
3103 for( k = 0; k < consdata->quadvarterms[i].nadjbilin; ++k )
3105 bilinterm = &consdata->bilinterms[consdata->quadvarterms[i].adjbilin[k]];
3106 bilincoef = bilinterm->
coef;
3107 var2 = (bilinterm->
var1 == consdata->quadvarterms[i].var) ? bilinterm->
var2 : bilinterm->
var1;
3108 assert(var2 != consdata->quadvarterms[i].var);
3112 while( consdata->quadvarterms[var2pos].var != var2 )
3115 assert(var2pos < consdata->nquadvars);
3118 for( j = 0; j < naggrs; ++j )
3120 if( aggrvars[j] == var2 )
3122 consdata->quadvarterms[var2pos].sqrcoef += bilincoef * coef * aggrscalars[j];
3130 consdata->quadvarterms[var2pos].lincoef += bilincoef * (aggrconstant * coef + offset);
3141 consdata->isremovedfixings =
TRUE;
3147 for( i = 0; i < consdata->nlinvars; ++i )
3150 for( i = 0; i < consdata->nquadvars; ++i )
3160 consdata->linvarsmerged =
FALSE;
3167 for( i = 0; i < consdata->nbilinterms; ++i )
3169 assert(consdata->bilinterms[i].var1 != consdata->bilinterms[i].var2);
3170 assert(consdata->bilinterms[i].coef != 0.0);
3171 assert(
SCIPvarCompare(consdata->bilinterms[i].var1, consdata->bilinterms[i].var2) < 0);
3202 assert(scip !=
NULL);
3203 assert(cons !=
NULL);
3206 assert(consdata !=
NULL);
3208 if( consdata->nlrow !=
NULL )
3213 nquadvars = consdata->nquadvars;
3214 nquadelems = consdata->nbilinterms;
3216 for( i = 0; i < nquadvars; ++i )
3218 if( consdata->quadvarterms[i].sqrcoef != 0.0 )
3220 if( !
SCIPisZero(scip, consdata->quadvarterms[i].lincoef) )
3231 for( i = 0; i < nquadvars; ++i )
3233 quadvars[i] = consdata->quadvarterms[i].var;
3235 if( consdata->quadvarterms[i].sqrcoef != 0.0 )
3237 assert(elcnt < nquadelems);
3238 quadelems[elcnt].
idx1 = i;
3239 quadelems[elcnt].
idx2 = i;
3240 quadelems[elcnt].
coef = consdata->quadvarterms[i].sqrcoef;
3244 if( !
SCIPisZero(scip, consdata->quadvarterms[i].lincoef) )
3246 assert(lincnt < nquadlinterms);
3247 quadlinvars [lincnt] = consdata->quadvarterms[i].var;
3248 quadlincoefs[lincnt] = consdata->quadvarterms[i].lincoef;
3252 assert(lincnt == nquadlinterms);
3258 for( i = 0; i < consdata->nbilinterms; ++i )
3260 if( lastvar == consdata->bilinterms[i].var1 )
3262 assert(lastvaridx >= 0);
3263 assert(consdata->quadvarterms[lastvaridx].var == consdata->bilinterms[i].var1);
3267 lastvar = consdata->bilinterms[i].var1;
3274 assert(elcnt < nquadelems);
3275 quadelems[elcnt].
idx1 =
MIN(idx1, idx2);
3276 quadelems[elcnt].
idx2 =
MAX(idx1, idx2);
3277 quadelems[elcnt].
coef = consdata->bilinterms[i].coef;
3280 assert(elcnt == nquadelems);
3283 if( consdata->isconcave && consdata->isconvex )
3285 assert(consdata->nbilinterms == 0 && consdata->nquadvars == 0);
3288 else if( consdata->isconcave )
3290 else if( consdata->isconvex )
3296 consdata->nlinvars, consdata->linvars, consdata->lincoefs,
3297 nquadvars, quadvars, nquadelems, quadelems,
3298 NULL, consdata->lhs, consdata->rhs,
3323 assert(scip !=
NULL);
3324 assert(cons !=
NULL);
3325 assert(result !=
NULL);
3326 assert(redundant !=
NULL);
3332 assert(consdata !=
NULL);
3336 if(
SCIPisEQ(scip, consdata->lhs, consdata->rhs) && consdata->nlinvars == 0 && consdata->nquadvars == 2 &&
3337 ((
SCIPvarIsBinary(consdata->quadvarterms[0].var) && consdata->quadvarterms[1].sqrcoef == 0.0) ||
3338 (
SCIPvarIsBinary(consdata->quadvarterms[1].var) && consdata->quadvarterms[0].sqrcoef == 0.0)) )
3356 binvaridx = (
SCIPvarIsBinary(consdata->quadvarterms[0].var) && consdata->quadvarterms[1].sqrcoef == 0.0) ? 0 : 1;
3358 x = consdata->quadvarterms[binvaridx].var;
3359 a = consdata->quadvarterms[binvaridx].sqrcoef + consdata->quadvarterms[binvaridx].lincoef;
3361 y = consdata->quadvarterms[1-binvaridx].var;
3362 b = consdata->quadvarterms[1-binvaridx].lincoef;
3364 assert(consdata->nbilinterms <= 1);
3365 c = (consdata->nbilinterms == 1) ? consdata->bilinterms[0].coef : 0.0;
3371 SCIPdebugMsg(scip,
"=> attempt aggregation <%s> = %g*<%s> + %g\n",
SCIPvarGetName(y), (consdata->rhs-a)/(b+c) - consdata->rhs/b,
3374 SCIP_CALL(
SCIPaggregateVars(scip, x, y, (consdata->rhs-a)/(b+c) - consdata->rhs/b, -1.0, -consdata->rhs/b, &infeasible, redundant, &aggregated) );
3377 else if( *redundant || aggregated )
3417 assert(scip !=
NULL);
3418 assert(conshdlr !=
NULL);
3419 assert(cons !=
NULL);
3420 assert(naddconss !=
NULL);
3423 assert(conshdlrdata !=
NULL);
3426 if( conshdlrdata->empathy4and < 2 )
3430 assert(consdata !=
NULL);
3432 if( consdata->nbilinterms == 0 )
3439 for( i = 0; i < consdata->nbilinterms; ++i )
3441 vars[0] = consdata->bilinterms[i].var1;
3445 vars[1] = consdata->bilinterms[i].var2;
3454 #ifdef SCIP_DEBUG_SOLUTION 3455 if( SCIPdebugIsMainscip(scip) )
3483 assert(ntodelete < consdata->nbilinterms);
3484 todelete[ntodelete++] = i;
3510 assert(scip !=
NULL);
3513 assert(resultant !=
NULL);
3547 assert(implvars !=
NULL);
3548 assert(impltypes !=
NULL);
3549 assert(implbounds !=
NULL);
3556 while( pos > 0 && implvars[pos-1] == y )
3562 while( pos < nimpls && implvars[pos] == y )
3565 resultant->
inf =
MAX(resultant->
inf,
MIN(resultant->
sup, implbounds[pos]));
3567 resultant->
sup =
MIN(resultant->
sup,
MAX(resultant->
inf, implbounds[pos]));
3571 assert(resultant->
sup >= resultant->
inf);
3624 assert(scip !=
NULL);
3625 assert(conshdlr !=
NULL);
3626 assert(cons !=
NULL);
3627 assert(naddconss !=
NULL);
3630 assert(conshdlrdata !=
NULL);
3632 maxnrvar = conshdlrdata->replacebinaryprodlength;
3637 assert(consdata !=
NULL);
3644 for( i = 0; i < consdata->nquadvars; ++i )
3646 y = consdata->quadvarterms[i].var;
3650 nbilinterms = consdata->quadvarterms[i].nadjbilin;
3651 if( nbilinterms == 0 )
3680 for( ; j < nbilinterms && nxvars < maxnrvar; ++j )
3682 bilinidx = consdata->quadvarterms[i].adjbilin[j];
3683 assert(bilinidx >= 0);
3684 assert(bilinidx < consdata->nbilinterms);
3686 bvar = consdata->bilinterms[bilinidx].var1;
3688 bvar = consdata->bilinterms[bilinidx].var2;
3694 SCIPdebugMsg(scip,
"skip reform of <%s><%s> due to unbounded second variable [%g,%g]\n",
3699 bilincoef = consdata->bilinterms[bilinidx].coef;
3700 assert(bilincoef != 0.0);
3713 SCIPdebugMsg(scip,
"skip reform of %g<%s><%s> due to huge activity [%g,%g] for <%s> = 0.0\n",
3719 SCIPdebugMsg(scip,
"skip reform of %g<%s><%s> due to huge activity [%g,%g] for <%s> = 1.0\n",
3739 xvars[nxvars] = bvar;
3740 xcoef[nxvars] = bilincoef;
3747 if(
REALABS(bilincoef) < mincoef )
3748 mincoef = ABS(bilincoef);
3749 if(
REALABS(bilincoef) > maxcoef )
3750 maxcoef = ABS(bilincoef);
3769 assert(ntodelete < nbilinterms);
3770 todelete[ntodelete++] = bilinidx;
3785 SCIPdebugMsg(scip,
"got different bounds for y = 0: [%g, %g] and y = 1: [%g, %g]\n", xbndszero.
inf, xbndszero.
sup, xbndsone.
inf, xbndsone.
sup);
3789 if( nxvars == 1 && conshdlrdata->empathy4and >= 1 &&
SCIPvarIsBinary(xvars[0]) )
3798 #ifdef SCIP_DEBUG_SOLUTION 3799 if( SCIPdebugIsMainscip(scip) )
3841 assert(scale >= 1.0);
3843 else if( nxvars == 1 )
3846 assert(mincoef == maxcoef);
3860 assert(scale > 0.0);
3867 SCIPdebugMsg(scip,
"binary reformulation using scale %g, nxvars = %d, integral = %u\n", scale, nxvars, integral);
3872 for( k = 0; k < nxvars; ++k )
3887 #ifdef SCIP_DEBUG_SOLUTION 3888 if( SCIPdebugIsMainscip(scip) )
3900 assert(
SCIPisEQ(scip, varval, 1.0));
3903 for( k = 0; k < nxvars; ++k )
3906 debugval += xcoef[k] * varval;
3958 xvars[nxvars+1] = auxvar;
3960 xcoef[nxvars+1] = -1;
4002 while( j < nbilinterms );
4007 SCIPdebugMsg(scip,
"resulting quadratic constraint: ");
4051 assert(scip !=
NULL);
4052 assert(conshdlr !=
NULL);
4053 assert(cons !=
NULL);
4055 assert(upgraded !=
NULL);
4056 assert(nupgdconss !=
NULL);
4057 assert(naddconss !=
NULL);
4064 assert(conshdlrdata !=
NULL);
4067 if( conshdlrdata->nquadconsupgrades == 0 )
4074 assert(consdata !=
NULL);
4086 for( i = 0; i < consdata->nlinvars; ++i )
4088 var = consdata->linvars[i];
4089 lincoef = consdata->lincoefs[i];
4121 for( i = 0; i < consdata->nquadvars; ++i )
4123 var = consdata->quadvarterms[i].var;
4124 lincoef = consdata->quadvarterms[i].lincoef;
4125 quadcoef = consdata->quadvarterms[i].sqrcoef;
4158 for( i = 0; i < consdata->nbilinterms && integral; ++i )
4161 integral = integral &&
SCIPisIntegral(scip, consdata->bilinterms[i].coef);
4169 SCIPdebugMsg(scip,
"upgrading quadratic constraint <%s> (%d upgrade methods):\n",
4171 SCIPdebugMsg(scip,
" binlin=%d binquad=%d intlin=%d intquad=%d impllin=%d implquad=%d contlin=%d contquad=%d integral=%u\n",
4172 nbinlin, nbinquad, nintlin, nintquad, nimpllin, nimplquad, ncontlin, ncontquad, integral);
4176 for( i = 0; i < conshdlrdata->nquadconsupgrades; ++i )
4178 if( !conshdlrdata->quadconsupgrades[i]->active )
4181 SCIP_CALL( conshdlrdata->quadconsupgrades[i]->quadconsupgd(scip, cons,
4182 nbinlin, nbinquad, nintlin, nintquad, nimpllin, nimplquad, ncontlin, ncontquad, integral,
4183 &nupgdconss_, upgdconss, upgdconsssize, presoltiming) );
4185 while( nupgdconss_ < 0 )
4188 assert(-nupgdconss_ > upgdconsssize);
4189 upgdconsssize = -nupgdconss_;
4192 SCIP_CALL( conshdlrdata->quadconsupgrades[i]->quadconsupgd(scip, cons,
4193 nbinlin, nbinquad, nintlin, nintquad, nimpllin, nimplquad, ncontlin, ncontquad, integral,
4194 &nupgdconss_, upgdconss, upgdconsssize, presoltiming) );
4196 assert(nupgdconss_ != 0);
4199 if( nupgdconss_ > 0 )
4203 SCIPdebugMsg(scip,
" -> upgraded to %d constraints:\n", nupgdconss_);
4206 for( j = 0; j < nupgdconss_; ++j )
4217 *naddconss += nupgdconss_ - 1;
4248 assert(consdata !=
NULL);
4249 assert(quadvaridx >= 0);
4250 assert(quadvaridx < consdata->nquadvars);
4251 assert(var2component !=
NULL);
4252 assert(componentnr >= 0);
4254 quadvarterm = &consdata->quadvarterms[quadvaridx];
4267 for( i = 0; i < quadvarterm->
nadjbilin; ++i )
4269 othervar = consdata->bilinterms[quadvarterm->
adjbilin[i]].var1 == quadvarterm->
var ?
4270 consdata->bilinterms[quadvarterm->
adjbilin[i]].var2 : consdata->bilinterms[quadvarterm->
adjbilin[i]].var1;
4272 assert(othervaridx >= 0);
4298 assert(scip !=
NULL);
4299 assert(conshdlr !=
NULL);
4300 assert(cons !=
NULL);
4301 assert(naddconss !=
NULL);
4304 assert(consdata !=
NULL);
4310 if( consdata->nquadvars <= 1 )
4320 for( i = 0; i < consdata->nquadvars; ++i )
4329 assert(ncomponents >= 1);
4334 if( ncomponents == 1 )
4345 for( comp = 0; comp < ncomponents; ++comp )
4352 SCIP_CALL(
SCIPcreateConsQuadratic2(scip, &auxconss[comp], name, 0,
NULL,
NULL, 0,
NULL, 0,
NULL,
4364 for( i = 0; i < consdata->nquadvars; ++i )
4368 assert(comp < ncomponents);
4371 SCIP_CALL(
SCIPaddQuadVarQuadratic(scip, auxconss[comp], consdata->quadvarterms[i].var, consdata->quadvarterms[i].lincoef, consdata->quadvarterms[i].sqrcoef) );
4374 if( !
SCIPisZero(scip, consdata->quadvarterms[i].lincoef) && ABS(consdata->quadvarterms[i].lincoef) < auxcoefs[comp] )
4375 auxcoefs[comp] =
REALABS(consdata->quadvarterms[i].lincoef);
4376 if( !
SCIPisZero(scip, consdata->quadvarterms[i].sqrcoef) && ABS(consdata->quadvarterms[i].sqrcoef) < auxcoefs[comp] )
4377 auxcoefs[comp] =
REALABS(consdata->quadvarterms[i].sqrcoef);
4380 consdata->quadvarterms[i].nadjbilin = 0;
4381 consdata->quadvarterms[i].adjbilinsize = 0;
4385 for( i = 0; i < consdata->nbilinterms; ++i )
4388 assert(comp == (
int)(
size_t)
SCIPhashmapGetImage(var2component, consdata->bilinterms[i].var2));
4389 assert(!
SCIPisZero(scip, consdata->bilinterms[i].coef));
4392 consdata->bilinterms[i].var1, consdata->bilinterms[i].var2, consdata->bilinterms[i].coef) );
4394 if( ABS(consdata->bilinterms[i].coef) < auxcoefs[comp] )
4395 auxcoefs[comp] = ABS(consdata->bilinterms[i].coef);
4400 consdata->nbilinterms = 0;
4401 consdata->bilintermssize = 0;
4404 for( i = consdata->nquadvars - 1; i >= 0; --i )
4408 assert(consdata->nquadvars == 0);
4417 for( comp = 0; comp < ncomponents; ++comp )
4431 *naddconss += ncomponents;
4443 #ifdef CHECKIMPLINBILINEAR 4463 assert(scip !=
NULL);
4464 assert(cons !=
NULL);
4465 assert(nbilinremoved !=
NULL);
4470 assert(consdata !=
NULL);
4477 for( i = 0; i < consdata->nquadvars; ++i )
4479 x = consdata->quadvarterms[i].var;
4482 if( consdata->quadvarterms[i].nadjbilin == 0 )
4494 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
4496 k = consdata->quadvarterms[i].adjbilin[j];
4498 assert(k < consdata->nbilinterms);
4500 if( consdata->bilinterms[k].coef == 0.0 )
4503 y = consdata->bilinterms[k].var1 == x ? consdata->bilinterms[k].var2 : consdata->bilinterms[k].var1;
4512 consdata->bilinterms[k].coef = 0.0;
4513 consdata->bilinmerged =
FALSE;
4524 assert(consdata->quadvarssorted);
4526 consdata->bilinterms[k].coef = 0.0;
4527 consdata->bilinmerged =
FALSE;
4533 if( *nbilinremoved > 0 )
4538 if( consdata->nlrow !=
NULL )
4543 consdata->ispropagated =
FALSE;
4544 consdata->ispresolved =
FALSE;
4545 consdata->iscurvchecked =
FALSE;
4548 consdata->isimpladded =
FALSE;
4566 assert(scip !=
NULL);
4567 assert(cons !=
NULL);
4568 assert(determined !=
NULL);
4571 assert(consdata !=
NULL);
4573 nquadvars = consdata->nquadvars;
4576 if( consdata->iscurvchecked )
4581 if( nquadvars == 1 )
4583 assert(consdata->nbilinterms == 0);
4584 consdata->isconvex = !
SCIPisNegative(scip, consdata->quadvarterms[0].sqrcoef);
4585 consdata->isconcave = !
SCIPisPositive(scip, consdata->quadvarterms[0].sqrcoef);
4586 consdata->iscurvchecked =
TRUE;
4588 else if( nquadvars == 0 )
4590 consdata->isconvex =
TRUE;
4591 consdata->isconcave =
TRUE;
4592 consdata->iscurvchecked =
TRUE;
4594 else if( consdata->nbilinterms == 0 )
4598 consdata->isconvex =
TRUE;
4599 consdata->isconcave =
TRUE;
4601 for( v = nquadvars - 1; v >= 0; --v )
4603 consdata->isconvex = consdata->isconvex && !
SCIPisNegative(scip, consdata->quadvarterms[v].sqrcoef);
4604 consdata->isconcave = consdata->isconcave && !
SCIPisPositive(scip, consdata->quadvarterms[v].sqrcoef);
4607 consdata->iscurvchecked =
TRUE;
4609 else if( !checkmultivariate )
4611 consdata->isconvex =
FALSE;
4612 consdata->isconcave =
FALSE;
4613 consdata->iscurvchecked =
TRUE;
4616 *determined =
FALSE;
4638 assert(scip !=
NULL);
4639 assert(cons !=
NULL);
4642 assert(consdata !=
NULL);
4644 n = consdata->nquadvars;
4646 if( consdata->iscurvchecked )
4663 assert(consdata->nbilinterms == 1);
4664 consdata->isconvex =
4665 consdata->quadvarterms[0].sqrcoef >= 0 &&
4666 consdata->quadvarterms[1].sqrcoef >= 0 &&
4667 4 * consdata->quadvarterms[0].sqrcoef * consdata->quadvarterms[1].sqrcoef >= consdata->bilinterms[0].coef * consdata->bilinterms[0].coef;
4668 consdata->isconcave =
4669 consdata->quadvarterms[0].sqrcoef <= 0 &&
4670 consdata->quadvarterms[1].sqrcoef <= 0 &&
4671 4 * consdata->quadvarterms[0].sqrcoef * consdata->quadvarterms[1].sqrcoef >= consdata->bilinterms[0].coef * consdata->bilinterms[0].coef;
4673 consdata->iscurvchecked =
TRUE;
4679 if( nn < 0 || (
unsigned) (
int) nn > UINT_MAX /
sizeof(
SCIP_Real) )
4682 consdata->isconvex =
FALSE;
4683 consdata->isconcave =
FALSE;
4684 consdata->iscurvchecked =
TRUE;
4692 consdata->isconvex =
TRUE;
4693 consdata->isconcave =
TRUE;
4696 for( i = 0; i < n; ++i )
4698 if( consdata->quadvarterms[i].nadjbilin > 0 )
4701 matrix[i*n + i] = consdata->quadvarterms[i].sqrcoef;
4705 consdata->isconvex =
FALSE;
4707 consdata->isconcave =
FALSE;
4710 if( !consdata->isconvex && !consdata->isconcave )
4714 consdata->iscurvchecked =
TRUE;
4720 for( i = 0; i < consdata->nbilinterms; ++i )
4727 matrix[row * n + col] = consdata->bilinterms[i].coef/2;
4729 matrix[col * n + row] = consdata->bilinterms[i].coef/2;
4739 SCIPwarningMessage(scip,
"Failed to compute eigenvalues of quadratic coefficient matrix of constraint %s. Assuming matrix is indefinite.\n",
SCIPconsGetName(cons));
4740 consdata->isconvex =
FALSE;
4741 consdata->isconcave =
FALSE;
4751 printf(
"cons <%s>[%g,%g] spectrum = [%g,%g]\n",
SCIPconsGetName(cons), consdata->lhs, consdata->rhs, alleigval[0], alleigval[n-1]);
4755 consdata->iscurvchecked =
TRUE;
4757 for( i = 0; i < consdata->nquadvars; ++i )
4760 allbinary = i == consdata->nquadvars;
4762 if( !
SCIPisInfinity(scip, consdata->rhs) && alleigval[0] > 0.1 && allbinary )
4764 printf(
"deconvexify cons <%s> by shifting hessian by %g\n",
SCIPconsGetName(cons), alleigval[0]);
4765 for( i = 0; i < consdata->nquadvars; ++i )
4767 consdata->quadvarterms[i].sqrcoef -= alleigval[0];
4768 consdata->quadvarterms[i].lincoef += alleigval[0];
4772 if( !
SCIPisInfinity(scip, consdata->lhs) && alleigval[n-1] < -0.1 && allbinary )
4774 printf(
"deconcavify cons <%s> by shifting hessian by %g\n",
SCIPconsGetName(cons), alleigval[n-1]);
4775 for( i = 0; i < consdata->nquadvars; ++i )
4777 consdata->quadvarterms[i].sqrcoef -= alleigval[n-1];
4778 consdata->quadvarterms[i].lincoef += alleigval[n-1];
4788 consdata->isconvex =
FALSE;
4789 consdata->isconcave =
FALSE;
4790 consdata->iscurvchecked =
TRUE;
4820 assert(scip !=
NULL);
4821 assert(cons !=
NULL);
4824 assert(consdata !=
NULL);
4825 assert(consdata->factorleft ==
NULL);
4826 assert(consdata->factorright ==
NULL);
4829 if( consdata->nbilinterms == 0 )
4843 if( consdata->iscurvchecked && (consdata->isconvex || consdata->isconcave) )
4846 n = consdata->nquadvars + 1;
4864 for( i = 0; i < consdata->nbilinterms; ++i )
4866 bilinterm = &consdata->bilinterms[i];
4872 assert(idx1 != idx2);
4874 a[
MIN(idx1,idx2) * n +
MAX(idx1,idx2)] = bilinterm->
coef / 2.0;
4878 for( i = 0; i < consdata->nquadvars; ++i )
4880 a[i*n + i] = consdata->quadvarterms[i].sqrcoef;
4881 a[i*n + n-1] = consdata->quadvarterms[i].lincoef / 2.0;
4887 SCIPdebugMsg(scip,
"Failed to compute eigenvalues and eigenvectors of augmented quadratic form matrix for constraint <%s>.\n",
SCIPconsGetName(cons));
4894 for( i = 0; i < n; ++i )
4911 if( i < n || posidx == -1 || negidx == -1 )
4926 sigma1 =
sqrt( eigvals[posidx]);
4927 sigma2 =
sqrt(-eigvals[negidx]);
4928 for( i = 0; i < n; ++i )
4930 consdata->factorleft[i] = sigma1 * a[posidx * n + i] - sigma2 * a[negidx * n + i];
4931 consdata->factorright[i] = sigma1 * a[posidx * n + i] + sigma2 * a[negidx * n + i];
4933 if(
SCIPisZero(scip, consdata->factorleft[i]) )
4934 consdata->factorleft[i] = 0.0;
4935 if(
SCIPisZero(scip, consdata->factorright[i]) )
4936 consdata->factorright[i] = 0.0;
4941 for( i = 0; i < consdata->nquadvars; ++i )
4943 if( consdata->factorleft[i] != 0.0 )
4947 for( i = 0; i < consdata->nquadvars; ++i )
4949 if( consdata->factorright[i] != 0.0 )
4961 for( i = 0; i < consdata->nbilinterms; ++i )
4963 bilinterm = &consdata->bilinterms[i];
4968 if( !
SCIPisRelEQ(scip, consdata->factorleft[idx1] * consdata->factorright[idx2] + consdata->factorleft[idx2] * consdata->factorright[idx1], bilinterm->
coef) )
4976 for( i = 0; i < consdata->nquadvars; ++i )
4978 if( !
SCIPisRelEQ(scip, consdata->factorleft[i] * consdata->factorright[i], consdata->quadvarterms[i].sqrcoef) )
4984 if( !
SCIPisRelEQ(scip, consdata->factorleft[n-1] * consdata->factorright[i] + consdata->factorleft[i] * consdata->factorright[n-1], consdata->quadvarterms[i].lincoef) )
4993 SCIPdebugMsg(scip,
"Factorization not accurate enough. Dropping it.\n");
5019 assert(scip !=
NULL);
5020 assert(cons !=
NULL);
5023 assert(consdata !=
NULL);
5028 for( i = 0; i < consdata->nlinvars; ++i )
5029 if(
REALABS(consdata->lincoefs[i]) > maxelem )
5030 maxelem =
REALABS(consdata->lincoefs[i]);
5033 maxelem = consdata->lincoefsmax;
5035 for( i = 0; i < consdata->nquadvars; ++i )
5037 var = consdata->quadvarterms[i].var;
5040 g = consdata->quadvarterms[i].lincoef;
5041 g += 2.0 * consdata->quadvarterms[i].sqrcoef *
SCIPgetSolVal(scip, sol, var);
5042 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
5044 k = consdata->quadvarterms[i].adjbilin[j];
5045 if( consdata->bilinterms[k].var1 == var )
5046 g += consdata->bilinterms[k].coef *
SCIPgetSolVal(scip, sol, consdata->bilinterms[k].var2);
5048 g += consdata->bilinterms[k].coef *
SCIPgetSolVal(scip, sol, consdata->bilinterms[k].var1);
5079 assert(scip !=
NULL);
5080 assert(cons !=
NULL);
5081 assert(solviolbounds !=
NULL);
5084 assert(conshdlrdata !=
NULL);
5087 assert(consdata !=
NULL);
5089 *solviolbounds =
FALSE;
5090 consdata->activity = 0.0;
5091 consdata->lhsviol = 0.0;
5092 consdata->rhsviol = 0.0;
5094 for( i = 0; i < consdata->nlinvars; ++i )
5098 var = consdata->linvars[i];
5100 activity = consdata->lincoefs[i] * varval;
5122 consdata->activity += activity;
5125 for( j = 0; j < consdata->nquadvars; ++j )
5129 var = consdata->quadvarterms[j].var;
5131 activity = (consdata->quadvarterms[j].lincoef + consdata->quadvarterms[j].sqrcoef * varval) * varval;
5159 *solviolbounds =
TRUE;
5163 activity = (consdata->quadvarterms[j].lincoef + consdata->quadvarterms[j].sqrcoef * varval) * varval;
5167 consdata->activity += activity;
5170 for( j = 0; j < consdata->nbilinterms; ++j )
5174 var = consdata->bilinterms[j].var1;
5175 var2 = consdata->bilinterms[j].var2;
5185 *solviolbounds =
TRUE;
5192 *solviolbounds =
TRUE;
5197 activity = consdata->bilinterms[j].coef * varval * varval2;
5217 consdata->activity += activity;
5221 if( consdata->activity < consdata->lhs && !
SCIPisInfinity(scip, -consdata->lhs) )
5222 consdata->lhsviol = consdata->lhs - consdata->activity;
5224 consdata->lhsviol = 0.0;
5227 if( consdata->activity > consdata->rhs && !
SCIPisInfinity(scip, consdata->rhs) )
5228 consdata->rhsviol = consdata->activity - consdata->rhs;
5230 consdata->rhsviol = 0.0;
5232 switch( conshdlrdata->scaling )
5240 if( consdata->lhsviol > 0.0 || consdata->rhsviol > 0.0 )
5246 consdata->lhsviol /= norm;
5247 consdata->rhsviol /= norm;
5254 if( consdata->lhsviol > 0.0 )
5255 consdata->lhsviol /=
MAX(1.0,
REALABS(consdata->lhs));
5257 if( consdata->rhsviol > 0.0 )
5258 consdata->rhsviol /=
MAX(1.0,
REALABS(consdata->rhs));
5289 assert(scip !=
NULL);
5290 assert(conss !=
NULL || nconss == 0);
5291 assert(solviolbounds !=
NULL);
5292 assert(maxviolcon !=
NULL);
5294 *solviolbounds =
FALSE;
5299 for( c = 0; c < nconss; ++c )
5301 assert(conss !=
NULL);
5302 assert(conss[c] !=
NULL);
5305 *solviolbounds |= solviolbounds1;
5308 assert(consdata !=
NULL);
5310 viol =
MAX(consdata->lhsviol, consdata->rhsviol);
5314 *maxviolcon = conss[c];
5343 assert(rowprep !=
NULL);
5344 assert(rightminactivity * multright > 0.0);
5345 assert(rightmaxactivity * multright > 0.0);
5346 assert(multright == 1.0 || multright == -1.0);
5349 assert(consdata !=
NULL);
5373 assert(
SCIPisFeasLE(scip, rightminactivity, rightmaxactivity));
5375 constant = multleft * multright * coefleft[consdata->nquadvars];
5376 constant -= rhs * multright * (1.0 / rightminactivity + 1.0 / rightmaxactivity);
5377 constant += rhs * multright * coefright[consdata->nquadvars] / (rightminactivity * rightmaxactivity);
5381 for( i = 0; i < consdata->nquadvars; ++i )
5383 coef = multleft * multright * coefleft[i];
5384 coef += rhs * multright / (rightminactivity * rightmaxactivity) * coefright[i];
5403 refvalue = coefright[consdata->nquadvars];
5404 for( i = 0; i < consdata->nquadvars; ++i )
5405 refvalue += coefright[i] * ref[i];
5410 constant = multleft * multright * coefleft[consdata->nquadvars];
5411 constant -= 2.0 * rhs / (multright * refvalue);
5412 constant += rhs / (refvalue * refvalue) * multright * coefright[consdata->nquadvars];
5416 for( i = 0; i < consdata->nquadvars; ++i )
5418 coef = multleft * multright * coefleft[i];
5419 coef += rhs / (refvalue * refvalue) * multright * coefright[i];
5456 assert(scip !=
NULL);
5457 assert(cons !=
NULL);
5458 assert(ref !=
NULL);
5459 assert(rowprep !=
NULL);
5460 assert(success !=
NULL);
5463 assert(consdata !=
NULL);
5464 assert(consdata->nlinvars == 0);
5465 assert(consdata->factorleft !=
NULL);
5466 assert(consdata->factorright !=
NULL);
5470 leftminactivity = consdata->factorleft[consdata->nquadvars];
5471 leftmaxactivity = consdata->factorleft[consdata->nquadvars];
5472 rightminactivity = consdata->factorright[consdata->nquadvars];
5473 rightmaxactivity = consdata->factorright[consdata->nquadvars];
5474 for( i = 0; i < consdata->nquadvars; ++i )
5478 if( consdata->factorleft[i] > 0.0 )
5483 leftminactivity += consdata->factorleft[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
5485 else if( consdata->factorleft[i] < 0.0 )
5490 leftminactivity += consdata->factorleft[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
5495 if( consdata->factorleft[i] > 0.0 )
5500 leftmaxactivity += consdata->factorleft[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
5502 else if( consdata->factorleft[i] < 0.0 )
5507 leftmaxactivity += consdata->factorleft[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
5513 if( consdata->factorright[i] > 0.0 )
5518 rightminactivity += consdata->factorright[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
5520 else if( consdata->factorright[i] < 0.0 )
5525 rightminactivity += consdata->factorright[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
5530 if( consdata->factorright[i] > 0.0 )
5535 rightmaxactivity += consdata->factorright[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
5537 else if( consdata->factorright[i] < 0.0 )
5542 rightmaxactivity += consdata->factorright[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
5550 rhs = consdata->rhs;
5555 rhs = -consdata->lhs;
5579 if( rightminactivity < 0.0 )
5585 SCIP_CALL(
generateCutFactorableDo(scip, cons, ref, multleft, consdata->factorleft, multright, consdata->factorright, rightminactivity, rightmaxactivity, rhs, rowprep, success) );
5597 if( leftminactivity < 0.0 )
5603 SCIP_CALL(
generateCutFactorableDo(scip, cons, ref, multleft, consdata->factorright, multright, consdata->factorleft, leftminactivity, leftmaxactivity, rhs, rowprep, success) );
5606 (!
SCIPisInfinity(scip, -rightminactivity) && !
SCIPisInfinity(scip, rightmaxactivity) && rightmaxactivity - rightminactivity < leftmaxactivity - leftminactivity) )
5613 if( rightminactivity < 0.0 )
5619 SCIP_CALL(
generateCutFactorableDo(scip, cons, ref, multleft, consdata->factorleft, multright, consdata->factorright, rightminactivity, rightmaxactivity, rhs, rowprep, success) );
5628 if( leftminactivity < 0.0 )
5634 SCIP_CALL(
generateCutFactorableDo(scip, cons, ref, multleft, consdata->factorright, multright, consdata->factorleft, leftminactivity, leftmaxactivity, rhs, rowprep, success) );
5684 a = (x1 - x0) * (y1_ - y0_);
5686 b = x0 * y1_ + y0_ * x1 - 2.0 * c;
5700 if( b * b - 4.0 * a * (c - wl) < 0.0 )
5702 SCIPdebugMsg(scip,
"probable numerical difficulties, give up\n");
5706 denom =
sqrt(b * b - 4.0 * a * (c - wl));
5707 q = -0.5 * (b + COPYSIGN(denom, b));
5712 tl = (tl1 >= 0.0 && (tl2 < 0.0 || tl1 < tl2)) ? tl1 : tl2;
5722 if( b * b - 4.0 * a * (c - wu) < 0.0 )
5724 SCIPdebugMsg(scip,
"probable numerical difficulties, give up\n");
5728 denom =
sqrt(b * b - 4.0 * a * (c - wu));
5729 q = -0.5 * (b + COPYSIGN(denom, b));
5734 tu = (tu1 >= 0.0 && (tu2 < 0.0 || tu1 < tu2)) ? tu1 : tu2;
5752 *xl = (
SCIP_Real)(x0 + tl * (x1 - x0 ));
5753 *yl = (
SCIP_Real)(y0_ + tl * (y1_ - y0_));
5757 SCIPdebugMsg(scip,
"probable numerical difficulties, give up\n");
5765 *yu = (
SCIP_Real)(y0_ + tu * (y1_ - y0_));
5769 SCIPdebugMsg(scip,
"probable numerical difficulties, give up\n");
5778 SCIPdebugMsg(scip,
"probable numerical difficulties, give up\n");
5839 *cw = (2.0 * xd * yd - (*cx * xo + *cy * yo)) / (xo * yo - xd * yd);
5880 assert(scip !=
NULL);
5885 assert(success !=
NULL);
5894 SCIPdebugMsg(scip,
"x: %9g\t[%9g\t%9g]\n", x0, xl, xu);
5895 SCIPdebugMsg(scip,
"y: %9g\t[%9g\t%9g]\n", y0_, yl, yu);
5896 SCIPdebugMsg(scip,
"w: %9g\t[%9g\t%9g]\n", w0, wl, wu);
5899 assert(wl >= 0.0 || wu <= 0.0);
5911 if( xl >= 0.0 || yl >= 0.0 ||
SCIPisLT(scip, xl * yl, wl) )
5916 else if( xu <= 0.0 || yu <= 0.0 ||
SCIPisLT(scip, xu * yu, wl) )
5931 if( xl >= 0.0 || yu <= 0.0 ||
SCIPisGT(scip, xl * yu, wu) )
5936 else if( xu <= 0.0 || yl >= 0.0 ||
SCIPisGT(scip, xu * yl, wu))
5989 x0 =
MIN(xu,
MAX(x0, xl));
5990 y0_ =
MIN(yu,
MAX(y0_, yl));
5991 w0 =
MIN(wu,
MAX(w0, wl));
5994 SCIPdebugMsg(scip,
"x: %9g\t[%9g\t%9g]\n", x0, xl, xu);
5995 SCIPdebugMsg(scip,
"y: %9g\t[%9g\t%9g]\n", y0_, yl, yu);
5996 SCIPdebugMsg(scip,
"w: %9g\t[%9g\t%9g]\n", w0, wl, wu);
6000 SCIPdebugMsg(scip,
"box for x and y inside feasible region -> nothing to separate\n");
6005 SCIPdebugMsg(scip,
"point to separate not below curve -> cannot separate\n");
6012 if(
generateCutLTIfindIntersection(scip, 0.0, 0.0, x0, y0_, wl, wu, &xlow, &ylow, &xupp, &yupp) )
6016 SCIPdebugMsg(scip,
"lower: %9g\t%9g\tprod %9g\n", xlow, ylow, xlow*ylow);
6017 SCIPdebugMsg(scip,
"upper: %9g\t%9g\tprod %9g\n", xupp, yupp, xupp*yupp);
6020 if( (xlow <= xl && yupp >= yu) || (ylow <= yl && xupp >= xu) )
6024 if( xlow >= xl && xupp <= xu && ylow >= yl && yupp <= yu )
6034 else if( xlow >= xl && ylow >= yl && (xupp > xu || yupp > yu) )
6053 if(
generateCutLTIfindIntersection(scip, xupp, yupp, x0, y0_, wl,
SCIP_INVALID, &xlow, &ylow,
NULL,
NULL) )
6057 if( xlow < xl || ylow < yl )
6068 else if( xupp <= xu && yupp <= yu && (xlow < xl || ylow < yl) )
6087 if(
generateCutLTIfindIntersection(scip, xlow, ylow, x0, y0_,
SCIP_INVALID, wu,
NULL,
NULL, &xupp, &yupp) )
6091 if( xupp > xu || yupp > yu )
6102 else if( (xlow < xl && xupp > xu) || (ylow < yl && yupp > yu) )
6134 SCIPdebugMsg(scip,
"lower: %9g\t%9g\tprod %9g\n", xlow, ylow, xlow*ylow);
6135 SCIPdebugMsg(scip,
"upper: %9g\t%9g\tprod %9g\n", xupp, yupp, xupp*yupp);
6159 if(
generateCutLTIfindIntersection(scip, xlow, ylow, x0, y0_,
SCIP_INVALID, wu,
NULL,
NULL, &xupp2, &yupp2) ||
6162 if(
generateCutLTIfindIntersection(scip, xupp, yupp, x0, y0_, wl,
SCIP_INVALID, &xlow2, &ylow2,
NULL,
NULL) ||
6180 SCIPdebugMsg(scip,
"points are in a weird position:\n");
6181 SCIPdebugMsg(scip,
"lower: %9g\t%9g\tprod %9g\n", xlow, ylow, xlow*ylow);
6182 SCIPdebugMsg(scip,
"upper: %9g\t%9g\tprod %9g\n", xupp, yupp, xupp*yupp);
6187 SCIPdebugMsg(scip,
"cut w.r.t. reduced points: %gx-%g %+gy-%g %+gw-%g >= 0\n",
6188 *cx, c0x, *cy, c0y, *cw, c0w);
6198 *c0 = c0x + c0y + c0w;
6235 assert(scip !=
NULL);
6236 assert(cons !=
NULL);
6237 assert(ref !=
NULL);
6238 assert(rowprep !=
NULL);
6239 assert(success !=
NULL);
6244 assert(consdata !=
NULL);
6245 assert(consdata->nlinvars > 0);
6246 assert(consdata->factorleft !=
NULL);
6247 assert(consdata->factorright !=
NULL);
6255 rhsminactivity = consdata->lhs;
6256 rhsmaxactivity = consdata->rhs;
6259 for( i = 0; i < consdata->nlinvars; ++i )
6263 if( consdata->lincoefs[i] < 0.0 )
6268 rhsminactivity -= consdata->lincoefs[i] *
SCIPvarGetLbLocal(consdata->linvars[i]);
6272 assert(consdata->lincoefs[i] > 0.0);
6276 rhsminactivity -= consdata->lincoefs[i] *
SCIPvarGetUbLocal(consdata->linvars[i]);
6281 if( consdata->lincoefs[i] < 0.0 )
6286 rhsmaxactivity -= consdata->lincoefs[i] *
SCIPvarGetUbLocal(consdata->linvars[i]);
6290 assert(consdata->lincoefs[i] > 0.0);
6294 rhsmaxactivity -= consdata->lincoefs[i] *
SCIPvarGetLbLocal(consdata->linvars[i]);
6297 rhsrefactivity -= consdata->lincoefs[i] *
SCIPgetSolVal(scip, sol, consdata->linvars[i]);
6314 leftminactivity = consdata->factorleft[consdata->nquadvars];
6315 leftmaxactivity = consdata->factorleft[consdata->nquadvars];
6316 leftrefactivity = consdata->factorleft[consdata->nquadvars];
6317 rightminactivity = consdata->factorright[consdata->nquadvars];
6318 rightmaxactivity = consdata->factorright[consdata->nquadvars];
6319 rightrefactivity = consdata->factorright[consdata->nquadvars];
6320 for( i = 0; i < consdata->nquadvars; ++i )
6324 if( consdata->factorleft[i] > 0.0 )
6329 leftminactivity += consdata->factorleft[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
6331 else if( consdata->factorleft[i] < 0.0 )
6336 leftminactivity += consdata->factorleft[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
6341 if( consdata->factorleft[i] > 0.0 )
6346 leftmaxactivity += consdata->factorleft[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
6348 else if( consdata->factorleft[i] < 0.0 )
6353 leftmaxactivity += consdata->factorleft[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
6356 leftrefactivity += consdata->factorleft[i] * ref[i];
6360 if( consdata->factorright[i] > 0.0 )
6365 rightminactivity += consdata->factorright[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
6367 else if( consdata->factorright[i] < 0.0 )
6372 rightminactivity += consdata->factorright[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
6377 if( consdata->factorright[i] > 0.0 )
6382 rightmaxactivity += consdata->factorright[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
6384 else if( consdata->factorright[i] < 0.0 )
6389 rightmaxactivity += consdata->factorright[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
6392 rightrefactivity += consdata->factorright[i] * ref[i];
6401 if(
SCIPisRelEQ(scip, leftminactivity, leftmaxactivity) ||
SCIPisRelEQ(scip, rightminactivity, rightmaxactivity) )
6409 leftminactivity, leftmaxactivity, leftrefactivity,
6410 rightminactivity, rightmaxactivity, rightrefactivity,
6411 rhsminactivity, rhsmaxactivity, rhsrefactivity,
6412 &coefleft, &coefright, &coefrhs, &cutlhs,
6418 SCIPdebugMsg(scip,
"LTI for x[%g,%g] * y[%g,%g] = w[%g,%g]: %gx %+gy %+gw >= %g; feas: %g\n",
6419 leftminactivity, leftmaxactivity, rightminactivity, rightmaxactivity, rhsminactivity, rhsmaxactivity,
6420 coefleft, coefright, coefrhs, cutlhs,
6421 coefleft * leftrefactivity + coefright * rightrefactivity + coefrhs * rhsrefactivity - cutlhs
6424 if( coefleft * leftrefactivity + coefright * rightrefactivity + coefrhs * rhsrefactivity >= cutlhs )
6434 for( i = 0; i < consdata->nquadvars; ++i )
6436 SCIP_CALL(
SCIPaddRowprepTerm(scip, rowprep, consdata->quadvarterms[i].var, coefleft * consdata->factorleft[i] + coefright * consdata->factorright[i]) );
6438 SCIPaddRowprepConstant(rowprep, coefleft * consdata->factorleft[i] + coefright * consdata->factorright[i]);
6440 for( i = 0; i < consdata->nlinvars; ++i )
6488 assert(scip !=
NULL);
6489 assert(cons !=
NULL);
6490 assert(ref !=
NULL);
6491 assert(success !=
NULL);
6494 assert(consdata !=
NULL);
6499 for( j = 0; j < consdata->nquadvars && *success; ++j )
6501 var = consdata->quadvarterms[j].var;
6515 for( k = 0; k < consdata->quadvarterms[j].nadjbilin && *success; ++k )
6517 bilinterm = &consdata->bilinterms[consdata->quadvarterms[j].adjbilin[k]];
6518 if( bilinterm->
var1 != var )
6520 assert(bilinterm->
var2 != var);
6521 assert(consdata->sepabilinvar2pos !=
NULL);
6523 var2pos = consdata->sepabilinvar2pos[consdata->quadvarterms[j].adjbilin[k]];
6524 assert(var2pos >= 0);
6525 assert(var2pos < consdata->nquadvars);
6526 assert(consdata->quadvarterms[var2pos].var == bilinterm->
var2);
6574 assert(scip !=
NULL);
6575 assert(cons !=
NULL);
6576 assert(ref !=
NULL);
6577 assert(success !=
NULL);
6580 assert(consdata !=
NULL);
6586 for( j = 0; j < consdata->nquadvars && *success; ++j )
6588 var = consdata->quadvarterms[j].var;
6593 sqrcoef = consdata->quadvarterms[j].sqrcoef;
6594 if( sqrcoef != 0.0 )
6602 &constant, success);
6608 &constant, success);
6614 for( k = 0; k < consdata->quadvarterms[j].nadjbilin && *success; ++k )
6616 bilinterm = &consdata->bilinterms[consdata->quadvarterms[j].adjbilin[k]];
6617 if( bilinterm->
var1 != var )
6619 assert(bilinterm->
var2 != var);
6620 assert(consdata->sepabilinvar2pos !=
NULL);
6622 var2pos = consdata->sepabilinvar2pos[consdata->quadvarterms[j].adjbilin[k]];
6623 assert(var2pos >= 0);
6624 assert(var2pos < consdata->nquadvars);
6625 assert(consdata->quadvarterms[var2pos].var == bilinterm->
var2);
6676 assert(scip !=
NULL);
6677 assert(conshdlr !=
NULL);
6678 assert(cons !=
NULL);
6679 assert(ref !=
NULL);
6680 assert(row !=
NULL);
6683 assert(conshdlrdata !=
NULL);
6686 assert(consdata !=
NULL);
6696 if( consdata->factorleft !=
NULL )
6698 if( consdata->nlinvars == 0 )
6733 SCIPdebugMsg(scip,
"skip cut for constraint <%s> because efficacy %g too low (< %g)\n",
SCIPconsGetName(cons), viol, minefficacy);
6748 success = coefrange <= conshdlrdata->cutmaxrange;
6758 if( success && conshdlrdata->scaling !=
'o' && (!
SCIPisInfinity(scip, -minefficacy) || efficacy !=
NULL) )
6765 if( success && !
SCIPisInfinity(scip, -minefficacy) && viol < minefficacy )
6767 SCIPdebugMsg(scip,
"skip cut for constraint <%s> because efficacy %g too low (< %g)\n",
SCIPconsGetName(cons), viol, minefficacy);
6776 SCIPdebugMsg(scip,
"found cut <%s>, lhs=%g, rhs=%g, mincoef=%g, maxcoef=%g, range=%g, nnz=%d, efficacy=%g\n",
6781 if( efficacy !=
NULL )
6825 assert(scip !=
NULL);
6826 assert(conshdlr !=
NULL);
6827 assert(cons !=
NULL);
6830 assert(consdata !=
NULL);
6833 assert((consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs)) ||
6839 consdata->isedavailable =
FALSE;
6847 n = consdata->nquadvars;
6851 if( nn < 0 || (
unsigned) (
int) nn > UINT_MAX /
sizeof(
SCIP_Real) )
6853 SCIPdebugMsg(scip,
"n is too large to compute eigendecomposition\n");
6854 consdata->isedavailable =
FALSE;
6860 matrix = consdata->eigenvectors;
6866 for( i = 0; i < n; ++i )
6869 matrix[i*n + i] = consdata->quadvarterms[i].sqrcoef;
6871 printf(
"inserting in position %d, value %g\n", i*n + i, consdata->quadvarterms[i].sqrcoef);
6875 for( i = 0; i < consdata->nbilinterms; ++i )
6883 matrix[row * n + col] = consdata->bilinterms[i].coef/2;
6885 printf(
"inserting in position %d, value %g\n", row*n + col, consdata->bilinterms[i].coef/2);
6890 matrix[col * n + row] = consdata->bilinterms[i].coef/2;
6892 printf(
"inserting in position %d, value %g\n", col*n + row, consdata->bilinterms[i].coef/2);
6898 printf(
"matrix built:\n");
6899 for( i = 0; i < n; i++ )
6901 for( j = 0; j < n; j++ )
6902 printf(
"%g ", matrix[i*n + j]);
6913 consdata->isedavailable =
FALSE;
6917 consdata->isedavailable =
TRUE;
6921 for( i = 0; i < n; i++ )
6922 for( j = 0; j < n; j++ )
6923 consdata->bp[i] += consdata->quadvarterms[j].lincoef * matrix[i*n + j];
6926 printf(
"eigenvalues:\n");
6927 for( j = 0; j < n; j++ )
6928 printf(
"%g ", consdata->eigenvalues[j]);
6930 printf(
"\neigenvectors (P^T):\n");
6931 for( i = 0; i < n; i++ )
6933 for( j = 0; j < n; j++ )
6934 printf(
"%g ", matrix[i*n + j]);
6939 for( j = 0; j < n; j++ )
6940 printf(
"%g ", consdata->bp[j]);
6941 printf(
"svd computed successfully\n");
6978 int nlrownquadelems;
6982 assert(scip !=
NULL);
6983 assert(cons !=
NULL);
6985 assert(success !=
NULL);
6989 assert(consdata !=
NULL);
6991 assert((consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs)) ||
7005 #ifdef SCIP_DEBUG_INT 7015 if( consdata->isconvex )
7019 for( i = 0; i < consdata->nlinvars; ++i )
7021 if( consdata->lincoefs[i] >= 0.0 )
7038 SCIPdebugMsg(scip,
"maximum activity is infinity: there is no interior point for fun <= rhs - maxlinactivity!\n");
7043 if( consdata->nlinvars == 0 )
7046 nlpiside = consdata->rhs - nlpiside;
7052 for( i = 0; i < consdata->nlinvars; ++i )
7054 if( consdata->lincoefs[i] >= 0.0 )
7071 SCIPdebugMsg(scip,
"minimum activity is -infinity: there is no interior point for fun >= lhs - minlinactivity!\n");
7076 if( consdata->nlinvars == 0 )
7079 nlpiside = consdata->lhs - nlpiside;
7082 nquadvars = consdata->nquadvars;
7085 if( method ==
'a' && ((consdata->isconvex &&
SCIPisGE(scip, nlpiside, 0.0))
7086 || (consdata->isconcave &&
SCIPisLE(scip, nlpiside, 0.0))) )
7095 if( consdata->nlrow ==
NULL )
7098 assert(consdata->nlrow !=
NULL);
7102 assert(nlpi !=
NULL);
7107 assert(prob !=
NULL);
7109 #ifdef SCIP_DEBUG_INT 7121 for( i = 0; i < nquadvars; i++ )
7126 lincoefs[i] = consdata->quadvarterms[i].lincoef;
7142 for( i = 0; i < nlrownquadelems; i++ )
7144 assert(nlrowquadvars[nlrowquadelems[i].idx1] == consdata->quadvarterms[nlrowquadelems[i].
idx1].var);
7145 assert(nlrowquadvars[nlrowquadelems[i].idx2] == consdata->quadvarterms[nlrowquadelems[i].
idx2].var);
7156 if( consdata->isconvex )
7159 &nlrownquadelems, &nlrowquadelems,
NULL,
NULL,
NULL) );
7164 &nlrownquadelems, &nlrowquadelems,
NULL,
NULL,
NULL) );
7170 if( consdata->isconvex )
7173 nlrownquadelems, nlrowquadelems,
NULL,
NULL, 0.0) );
7178 for( i = 0; i < nquadvars; i++ )
7182 for( i = 0; i < nlrownquadelems; i++ )
7183 nlrowquadelems->
coef *= -1;
7186 nlrownquadelems, nlrowquadelems,
NULL,
NULL, 0.0) );
7189 for( i = 0; i < nlrownquadelems; i++ )
7190 nlrowquadelems->
coef *= -1;
7195 SCIPerrorMessage(
"undefined method for computing interior point: %c\n", method);
7205 SCIPdebugMsg(scip,
"cons <%s>: NLP Solver termination status not okay: %d\n",
7218 SCIPdebugMsg(scip,
"cons <%s>: found an interior point. solution status: %d, termination status: %d\n",
7226 SCIPdebugMsg(scip,
"cons <%s>: failed to find an interior point. solution status: %d, termination status: %d\n",
7234 SCIPerrorMessage(
"cons <%s>: undefined behaviour of NLP Solver. solution status: %d, termination status: %d\n",
7248 for( i = 0; i < nquadvars; i++ )
7251 consdata->interiorpoint[i] = 0.0;
7253 consdata->interiorpoint[i] = interiorpoint[i];
7260 #ifdef SCIP_DEBUG_INT 7261 printf(
"Computation of interior point for cons <%s>:\n",
SCIPconsGetName(cons));
7262 printf(
" - has %d linear variables\n", consdata->nlinvars);
7263 if( consdata->isconvex )
7265 printf(
" - is convex. rhs: %g maximum activity of linear variables: %g\n", consdata->rhs, consdata->rhs - nlpiside);
7266 printf(
" - searched for point whose quadratic part is <= %g\n", nlpiside);
7270 printf(
" - is concave. lhs: %g minimum activity of linear variables: %g\n", consdata->lhs, consdata->lhs - nlpiside);
7271 printf(
" - searched for point whose quadratic part is >= %g\n", nlpiside);
7278 printf(
"Computation successful, 0 is interior point.\n");
7279 for( i = 0; i < nquadvars; i++ )
7281 assert(consdata->interiorpoint[i] == 0.0);
7286 printf(
"Computation successful, NLP soltat: %d, termstat: %d\nPoint found:\n",
7288 for( i = 0; i < nquadvars; i++ )
7290 printf(
"%s = %g\n",
SCIPvarGetName(consdata->quadvarterms[i].var), consdata->interiorpoint[i]);
7296 printf(
"Computation failed. NLP soltat: %d, termstat: %d\n",
7298 printf(
"run with SCIP_DEBUG for more info\n");
7350 assert(scip !=
NULL);
7351 assert(conshdlr !=
NULL);
7352 assert(cons !=
NULL);
7355 assert(consdata !=
NULL);
7358 assert(conshdlrdata !=
NULL);
7359 assert(conshdlrdata->gaugecuts);
7362 convex = consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs);
7363 assert(convex || (consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs)));
7373 SCIPdebugMsg(scip,
"failed to compute gauge function\n");
7374 consdata->isgaugeavailable =
FALSE;
7387 consdata->interiorpointval = 0;
7388 consdata->gaugeconst = 0;
7389 for( i = 0; i < consdata->nquadvars; i++ )
7394 val = consdata->interiorpoint[i];
7395 quadvarterm = &consdata->quadvarterms[i];
7397 consdata->interiorpointval += (quadvarterm->
lincoef + quadvarterm->
sqrcoef * val) * val;
7398 consdata->gaugeconst += quadvarterm->
sqrcoef * val * val;
7400 for( j = 0; j < quadvarterm->
nadjbilin; ++j )
7404 bilintermidx = quadvarterm->
adjbilin[j];
7405 bilinterm = &consdata->bilinterms[bilintermidx];
7407 if( bilinterm->
var1 != quadvarterm->
var )
7411 assert(consdata->sepabilinvar2pos !=
NULL);
7412 assert(consdata->quadvarterms[consdata->sepabilinvar2pos[bilintermidx]].var == bilinterm->
var2);
7414 val2 = consdata->interiorpoint[consdata->sepabilinvar2pos[bilintermidx]];
7416 consdata->interiorpointval += bilinterm->
coef * val * val2;
7417 consdata->gaugeconst += bilinterm->
coef * val * val2;
7422 for( i = 0; i < consdata->nquadvars; i++ )
7424 quadvarterm = &consdata->quadvarterms[i];
7425 consdata->gaugecoefs[i] += quadvarterm->
lincoef + 2.0 * quadvarterm->
sqrcoef * consdata->interiorpoint[i];
7427 for( j = 0; j < quadvarterm->
nadjbilin; j++ )
7432 bilintermidx = quadvarterm->
adjbilin[j];
7433 bilinterm = &consdata->bilinterms[bilintermidx];
7435 if( bilinterm->
var1 == quadvarterm->
var )
7437 varpos = consdata->sepabilinvar2pos[bilintermidx];
7440 assert(consdata->quadvarterms[varpos].var == bilinterm->
var2);
7442 consdata->gaugecoefs[i] += bilinterm->
coef * consdata->interiorpoint[varpos];
7443 consdata->gaugecoefs[varpos] += bilinterm->
coef * consdata->interiorpoint[i];
7448 #ifdef SCIP_DEBUG_INT 7449 printf(
"quadratic part at interior point: %g\n", consdata->interiorpointval);
7451 for( j = 0; j < consdata->nquadvars; j++ )
7453 printf(
"b_gauge[%s] = %g\n",
SCIPvarGetName(consdata->quadvarterms[j].var), consdata->gaugecoefs[j]);
7455 printf(
"c_gauge = %g\n", consdata->gaugeconst);
7458 SCIPdebugMsg(scip,
"gauge function computed successfully\n");
7459 consdata->isgaugeavailable =
TRUE;
7489 assert(scip !=
NULL);
7490 assert(conshdlr !=
NULL);
7491 assert(cons !=
NULL);
7494 assert(consdata !=
NULL);
7495 assert(consdata->isgaugeavailable);
7499 convex = consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs);
7509 side = consdata->rhs;
7510 for( i = 0; i < consdata->nlinvars; i++ )
7511 side -=
SCIPgetSolVal(scip, refsol, consdata->linvars[i]) * consdata->lincoefs[i];
7513 aterm = side - consdata->interiorpointval;
7523 #ifdef SCIP_DEBUG_GAUGE 7526 printf(
"For current level, there is no interior point. ");
7527 printf(
"rhs: %g level: %15.20g interiorpointval: %15.20g\n", consdata->rhs, side, consdata->interiorpointval);
7528 if( consdata->nlinvars == 1 )
7532 var = consdata->linvars[0];
7533 printf(
"var <%s> = %g in [%15.20g, %15.20g] is linpart\n",
SCIPvarGetName(var),
7539 printf(
"For current level, there is interior point. ");
7540 printf(
"rhs: %g level: %15.20g interiorpointval: %15.20g\n", consdata->rhs, side, consdata->interiorpointval);
7551 side = consdata->lhs;
7552 for( i = 0; i < consdata->nlinvars; i++ )
7553 side -=
SCIPgetSolVal(scip, refsol, consdata->linvars[i]) * consdata->lincoefs[i];
7555 aterm = side - consdata->interiorpointval;
7557 #ifdef SCIP_DEBUG_GAUGE 7560 printf(
"For current level, there is no interior point. ");
7561 printf(
"lhs: %g level: %15.20g interiorpointval: %15.20g\n", consdata->lhs, side, consdata->interiorpointval);
7562 if( consdata->nlinvars == 1 )
7566 var = consdata->linvars[0];
7567 printf(
"var <%s> = %g in [%15.20g, %15.20g] is linpart\n",
SCIPvarGetName(var),
7573 printf(
"For current level, there is interior point. ");
7574 printf(
"lhs: %g level: %15.20g interiorpointval: %15.20g\n", consdata->lhs, side, consdata->interiorpointval);
7586 bterm = -consdata->interiorpointval - consdata->gaugeconst;
7587 cterm = consdata->gaugeconst;
7588 for( i = 0; i < consdata->nquadvars; i++ )
7592 val =
SCIPgetSolVal(scip, refsol, consdata->quadvarterms[i].var);
7593 bterm += consdata->gaugecoefs[i] * val;
7594 cterm -= consdata->gaugecoefs[i] * val;
7595 cterm += (consdata->quadvarterms[i].lincoef + consdata->quadvarterms[i].sqrcoef * val) * val;
7598 for( i = 0; i < consdata->nbilinterms; i++ )
7603 var1 = consdata->bilinterms[i].var1;
7604 var2 = consdata->bilinterms[i].var2;
7609 if( convex && cterm < 0.0 )
7614 else if( !convex && cterm > 0.0 )
7619 assert(bterm*bterm + 4*aterm*cterm >= 0);
7623 *gaugeval = bterm +
sqrt(bterm*bterm + 4 * aterm * cterm);
7624 *gaugeval = *gaugeval / (2 * aterm);
7628 *gaugeval = bterm -
sqrt(bterm*bterm + 4 * aterm * cterm);
7629 *gaugeval = *gaugeval / (2 * aterm);
7634 #ifdef SCIP_DEBUG_GAUGE 7635 printf(
"Gauge's aterm = %g, bterm = %g, cterm = %g\n", aterm, bterm, cterm);
7691 assert(scip !=
NULL);
7692 assert(conshdlr !=
NULL);
7693 assert(cons !=
NULL);
7696 assert(consdata !=
NULL);
7697 assert(consdata->isedavailable);
7702 pt = consdata->eigenvectors;
7703 D = consdata->eigenvalues;
7704 n = consdata->nquadvars;
7709 for( i = 0; i < consdata->nlinvars; i++ )
7711 c1 += consdata->lincoefs[i] *
SCIPgetSolVal(scip, refsol, consdata->linvars[i]);
7712 c2 -= consdata->lincoefs[i] * consdata->lincoefs[i];
7717 isconcave = consdata->isconcave;
7729 for( i = 0; i < n; i++ )
7737 for( i = 0; i < n; i++ )
7738 for( j = 0; j < n; j++ )
7739 y0_[i] +=
SCIPgetSolVal(scip, refsol, consdata->quadvarterms[j].var) * pt[i*n + j];
7744 for( i = 0; i < n; i++ )
7746 for( j = 0; j < n; j++ )
7747 printf(
"%g ", pt[i*n + j]);
7751 for( i = 0; i < n; i++ )
7752 printf(
"%g ",
SCIPgetSolVal(scip, refsol, consdata->quadvarterms[i].var));
7754 printf(
"P^T x_0: ");
7755 for( i = 0; i < n; i++ )
7756 printf(
"%g ", y0_[i]);
7759 for( i = 0; i < n; i++ )
7760 printf(
"%g ", bp[i]);
7762 printf(
"<d,linvars> = %g\n", c1);
7763 printf(
"-norm(d)^2/2 = %g\n", c2);
7770 for( iter = 0; iter < 9; iter++ )
7772 assert(phirhoprime != 0.0);
7773 rho = rho - (phirho - c)/ phirhoprime;
7786 for( i = 0; i < n; i++ )
7788 assert(1.0 + rho * D[i] != 0.0);
7789 yrho[i] = (y0_[i] - rho * bp[i]/2.0) / (1.0 + rho * D[i]);
7790 yrhoprime[i] = -(D[i] * y0_[i] + bp[i]/2.0) / ( (1.0 + rho * D[i])*(1.0 + rho * D[i]) );
7791 phirho += yrho[i] * (yrho[i] * D[i] + bp[i]);
7792 phirhoprime += yrhoprime[i] * (2 * D[i] * yrho[i] + bp[i]);
7794 phirho += c2 * rho + c1;
7797 printf(
"iteration %d: rho = %g, phirho = %g, phirho' = %g\n", iter, rho, phirho, phirhoprime);
7802 for( i = 0; i < n; i++ )
7806 for( j = 0; j < n; j++ )
7807 ref[i] += pt[j*n + i] * yrho[j];
7813 for( i = 0; i < n; i++ )
7820 #ifdef SCIP_DISABLED_CODE 7822 for( j = 0; j < consdata->nquadvars; ++j )
7828 var = consdata->quadvarterms[j].var;
7835 ref[j] =
MIN(ub,
MAX(lb, ref[j]));
7840 printf(
"modified reference point by a projection:\n");
7841 for( j = 0; j < consdata->nquadvars; ++j )
7843 printf(
"%s = %g\n",
SCIPvarGetName(consdata->quadvarterms[j].var), ref[j]);
7873 assert(scip !=
NULL);
7874 assert(conshdlr !=
NULL);
7875 assert(cons !=
NULL);
7878 assert(consdata !=
NULL);
7879 assert(consdata->isgaugeavailable);
7886 #ifdef SCIP_DEBUG_GAUGE 7887 printf(
"Couldn't evaluate gauge!\n");
7892 #ifdef SCIP_DEBUG_GAUGE 7896 level = consdata->rhs;
7897 for( j = 0; j < consdata->nlinvars; j++ )
7898 level -=
SCIPgetSolVal(scip, refsol, consdata->linvars[j]) * consdata->lincoefs[j];
7900 printf(
"Summary:\n");
7901 printf(
"For cons <%s>: gauge at level %g evaluated at (refsol - intpoint) is %.10f\n",
7903 printf(
"refsol - intpoint:\n");
7905 for( j = 0; j < consdata->nquadvars; ++j )
7908 vvar = consdata->quadvarterms[j].var;
7910 consdata->interiorpoint[j],
SCIPgetSolVal(scip, refsol, vvar) - consdata->interiorpoint[j]);
7913 printf(
"refsol is in the closure of the region (gaugeval <= 1), don't modify reference point\n");
7931 for( j = 0; j < consdata->nquadvars; ++j )
7933 var = consdata->quadvarterms[j].var;
7940 intpoint = consdata->interiorpoint[j];
7941 ref[j] = (
SCIPgetSolVal(scip, refsol, var) - intpoint) / gaugeval + intpoint;
7942 ref[j] =
MIN(ub,
MAX(lb, ref[j]));
7945 #ifdef SCIP_DEBUG_GAUGE 7946 printf(
"successful application of guage: %g\n", gaugeval);
7947 printf(
"modified reference point:\n");
7948 for( j = 0; j < consdata->nquadvars; ++j )
7950 printf(
"%s = % 20.15g\n",
SCIPvarGetName(consdata->quadvarterms[j].var), ref[j]);
7985 assert(scip !=
NULL);
7986 assert(conshdlr !=
NULL);
7987 assert(cons !=
NULL);
7990 assert(consdata !=
NULL);
7993 assert(conshdlrdata !=
NULL);
7995 if( refsol ==
NULL )
8007 if( conshdlrdata->gaugecuts && consdata->isgaugeavailable )
8011 else if( conshdlrdata->projectedcuts && consdata->isedavailable )
8013 SCIPdebugMessage(
"use the projection of refsol onto the region defined by the constraint as reference point\n");
8021 SCIP_CALL(
generateCut(scip, conshdlr, cons, ref, sol, violside, row, efficacy, checkcurvmultivar, minefficacy) );
8026 SCIPdebugMsg(scip,
"%s cut fail, try without modifying\n", conshdlrdata->gaugecuts ?
"gauge" :
"projected");
8034 for( j = 0; j < consdata->nquadvars; ++j )
8036 var = consdata->quadvarterms[j].var;
8044 ref[j] =
MIN(ub,
MAX(lb, ref[j]));
8047 SCIP_CALL(
generateCut(scip, conshdlr, cons, ref, sol, violside, row, efficacy, checkcurvmultivar, minefficacy) );
8054 if( conshdlrdata->gaugecuts && consdata->isgaugeavailable )
8060 SCIP_CALL(
generateCut(scip, conshdlr, cons, ref, sol, violside, row, efficacy, checkcurvmultivar, minefficacy) );
8067 if( conshdlrdata->projectedcuts && consdata->isedavailable )
8070 SCIP_CALL(
generateCut(scip, conshdlr, cons, ref, sol, violside, row, efficacy, checkcurvmultivar, minefficacy) );
8077 for( j = 0; j < consdata->nquadvars; ++j )
8079 var = consdata->quadvarterms[j].var;
8087 ref[j] =
MIN(ub,
MAX(lb, ref[j]));
8089 SCIP_CALL(
generateCut(scip, conshdlr, cons, ref, sol, violside, row, efficacy, checkcurvmultivar, minefficacy) );
8124 assert(scip !=
NULL);
8125 assert(conshdlr !=
NULL);
8126 assert(cons !=
NULL);
8127 assert(row !=
NULL);
8131 assert(consdata !=
NULL);
8137 SCIPdebugMsg(scip,
"do not have primal ray, thus cannot resolve unboundedness\n");
8146 SCIP_CALL(
generateCutSol(scip, conshdlr, cons,
NULL,
NULL, violside, row,
NULL,
FALSE, -
SCIPinfinity(scip),
'd') );
8149 if( *row !=
NULL && rowrayprod !=
NULL )
8156 assert(var !=
NULL);
8176 for( i = 0; i < consdata->nquadvars; ++i )
8178 var = consdata->quadvarterms[i].var;
8182 matrixrayprod = 2.0 * consdata->quadvarterms[i].sqrcoef * rayval;
8183 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
8185 bilinterm = &consdata->bilinterms[consdata->quadvarterms[i].adjbilin[j]];
8196 quadrayprod += matrixrayprod * ref[i];
8197 linrayprod += consdata->quadvarterms[i].lincoef * rayval;
8209 for( i = 0; i < consdata->nlinvars; ++i )
8212 SCIPdebugMsg(scip,
"initially have <b,ray> = %g and <ref, 2*A*ref> = %g\n", linrayprod, quadrayprod);
8224 scale = 2*
REALABS(linrayprod/quadrayprod);
8226 scale = 1.0/
REALABS(quadrayprod);
8229 for( i = 0; i < consdata->nquadvars; ++i )
8231 quadrayprod *= scale;
8234 if( rowrayprod !=
NULL )
8235 *rowrayprod = quadrayprod + linrayprod;
8237 SCIPdebugMsg(scip,
"calling generateCut, expecting ray product %g\n", quadrayprod + linrayprod);
8263 assert(scip !=
NULL);
8264 assert(row !=
NULL);
8265 assert(conshdlr !=
NULL);
8266 assert(result !=
NULL);
8267 assert(cons !=
NULL);
8274 assert(conshdlrdata !=
NULL);
8277 assert(consdata !=
NULL);
8292 SCIPdebugMessage(
"add cut with efficacy %g for constraint <%s> violated by %g\n", efficacy,
8299 if( inenforcement && !conshdlrdata->enfocutsremovable )
8302 if( bestefficacy !=
NULL && efficacy > *bestefficacy )
8303 *bestefficacy = efficacy;
8334 assert(scip !=
NULL);
8335 assert(conshdlr !=
NULL);
8336 assert(conss !=
NULL || nconss == 0);
8337 assert(nusefulconss <= nconss);
8338 assert(result !=
NULL);
8343 assert(conshdlrdata !=
NULL);
8345 if( bestefficacy !=
NULL )
8346 *bestefficacy = 0.0;
8352 assert(conss !=
NULL);
8354 assert(consdata !=
NULL);
8389 efficacy = -rayprod;
8393 switch( conshdlrdata->scaling )
8404 efficacy /=
MAX(1.0, norm);
8413 efficacy /=
MAX(1.0, minval);
8423 SCIP_CALL(
processCut(scip, &row, conshdlr, conss[c], sol, efficacy, actminefficacy, inenforcement, bestefficacy, result) );
8430 conshdlrdata->checkcurvature, actminefficacy,
'd') );
8432 SCIP_CALL(
processCut(scip, &row, conshdlr, conss[c], sol, efficacy, actminefficacy, inenforcement, bestefficacy, result) );
8472 assert(scip !=
NULL);
8473 assert(conshdlr !=
NULL);
8474 assert(conss !=
NULL || nconss == 0);
8477 assert(conshdlrdata !=
NULL);
8479 if( separatedlpsol !=
NULL )
8480 *separatedlpsol =
FALSE;
8482 for( c = 0; c < nconss; ++c )
8484 assert(conss[c] !=
NULL);
8492 assert(consdata !=
NULL);
8497 conshdlrdata->checkcurvature, -
SCIPinfinity(scip),
'l') );
8499 else if( consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs) )
8502 conshdlrdata->checkcurvature, -
SCIPinfinity(scip),
'l') );
8513 if( separatedlpsol !=
NULL )
8519 switch( conshdlrdata->scaling )
8530 efficacy /=
MAX(1.0, norm);
8539 efficacy /=
MAX(1.0, minval);
8549 if( efficacy >= minefficacy )
8553 *separatedlpsol =
TRUE;
8556 assert( ! infeasible );
8583 assert(scip !=
NULL);
8584 assert(event !=
NULL);
8585 assert(eventdata !=
NULL);
8586 assert(eventhdlr !=
NULL);
8598 assert(sol !=
NULL);
8601 assert(conshdlrdata !=
NULL);
8611 assert(conss !=
NULL);
8654 assert(scip !=
NULL);
8655 assert(conshdlr !=
NULL);
8656 assert(conss !=
NULL || nconss == 0);
8662 for( c = 0; c < nconss; ++c )
8664 assert(conss !=
NULL);
8666 assert(consdata !=
NULL);
8668 if( !consdata->nquadvars )
8674 SCIPdebugMsg(scip,
"cons %s violation: %g %g convex: %u %u\n",
SCIPconsGetName(conss[c]), consdata->lhsviol, consdata->rhsviol, consdata->isconvex, consdata->isconcave);
8677 for( j = 0; j < consdata->nquadvars; ++j )
8679 x = consdata->quadvarterms[j].var;
8680 if( (
SCIPisGT(scip, consdata->rhsviol,
SCIPfeastol(scip)) && consdata->quadvarterms[j].sqrcoef < 0) ||
8681 (
SCIPisGT(scip, consdata->lhsviol,
SCIPfeastol(scip)) && consdata->quadvarterms[j].sqrcoef > 0) )
8700 gap = (xval-xlb)*(xub-xval)/(1+2*ABS(xval));
8708 for( j = 0; j < consdata->nbilinterms; ++j )
8711 x = consdata->bilinterms[j].var1;
8717 y = consdata->bilinterms[j].var2;
8728 if( !xunbounded && !yunbounded )
8738 xval =
MAX(xlb,
MIN(xval, xub));
8739 yval =
MAX(ylb,
MIN(yval, yub));
8741 coef_ =
SCIPisGT(scip, consdata->lhsviol,
SCIPfeastol(scip)) ? -consdata->bilinterms[j].coef : consdata->bilinterms[j].coef;
8744 if( (xub-xlb)*yval + (yub-ylb)*xval <= xub*yub - xlb*ylb )
8745 gap = (xval*yval - xlb*yval - ylb*xval + xlb*ylb) / (1+
sqrt(xval*xval + yval*yval));
8747 gap = (xval*yval - xval*yub - yval*xub + xub*yub) / (1+
sqrt(xval*xval + yval*yval));
8751 if( (xub-xlb)*yval - (yub-ylb)*xval <= xub*ylb - xlb*yub )
8752 gap = -(xval*yval - xval*ylb - yval*xub + xub*ylb) / (1+
sqrt(xval*xval + yval*yval));
8754 gap = -(xval*yval - xval*yub - yval*xlb + xlb*yub) / (1+
sqrt(xval*xval + yval*yval));
8775 if( xbinary || ybinary )
8789 if( xunbounded || yunbounded )
8795 #ifdef BRANCHTOLINEARITY 8798 if(
SCIPisLT(scip, xub-xlb, yub-ylb) )
8804 if(
SCIPisGT(scip, xub-xlb, yub-ylb) )
8828 SCIPdebugMsg(scip,
"registered %d branching candidates\n", *nnotify);
8860 assert(scip !=
NULL);
8861 assert(conshdlr !=
NULL);
8862 assert(conss !=
NULL || nconss == 0);
8866 for( c = 0; c < nconss; ++c )
8868 assert(conss !=
NULL);
8870 assert(consdata !=
NULL);
8872 if( !consdata->nquadvars )
8878 SCIPdebugMsg(scip,
"cons %s violation: %g %g convex: %u %u\n",
SCIPconsGetName(conss[c]), consdata->lhsviol, consdata->rhsviol, consdata->isconvex, consdata->isconcave);
8880 for( j = 0; j < consdata->nquadvars; ++j )
8882 quadvarterm = &consdata->quadvarterms[j];
8887 x = quadvarterm->
var;
8912 SCIPdebugMsg(scip,
"registered %d branching candidates\n", *nnotify);
8946 assert(scip !=
NULL);
8947 assert(conshdlr !=
NULL);
8948 assert(conss !=
NULL || nconss == 0);
8952 for( c = 0; c < nconss; ++c )
8954 assert(conss !=
NULL);
8956 assert(consdata !=
NULL);
8958 if( !consdata->nquadvars )
8964 SCIPdebugMsg(scip,
"cons %s violation: %g %g convex: %u %u\n",
SCIPconsGetName(conss[c]), consdata->lhsviol, consdata->rhsviol, consdata->isconvex, consdata->isconcave);
8966 for( j = 0; j < consdata->nquadvars; ++j )
8968 quadvarterm = &consdata->quadvarterms[j];
8973 x = quadvarterm->
var;
8984 xval =
MAX(xlb,
MIN(xub, xval));
8999 score = 4.0 * (xval - xlb) * (xub - xval) / ((xub - xlb) * (xub - xlb));
9008 SCIPdebugMsg(scip,
"registered %d branching candidates\n", *nnotify);
9027 assert(conshdlrdata !=
NULL);
9029 switch( conshdlrdata->branchscoring )
9069 assert(scip !=
NULL);
9070 assert(conss !=
NULL || nconss == 0);
9075 for( c = 0; c < nconss; ++c )
9077 assert(conss !=
NULL);
9079 assert(consdata !=
NULL);
9084 for( i = 0; i < consdata->nquadvars; ++i )
9089 val =
SCIPgetSolVal(scip, sol, consdata->quadvarterms[i].var);
9090 if( ABS(val) > brvarval )
9092 brvarval = ABS(val);
9093 *brvar = consdata->quadvarterms[i].var;
9098 if( *brvar !=
NULL )
9126 assert(scip !=
NULL);
9127 assert(conss !=
NULL || nconss == 0);
9128 assert(addedcons !=
NULL);
9129 assert(reduceddom !=
NULL);
9130 assert(infeasible !=
NULL);
9133 *reduceddom =
FALSE;
9134 *infeasible =
FALSE;
9136 for( c = 0; c < nconss; ++c )
9138 assert(conss !=
NULL);
9140 assert(consdata !=
NULL);
9147 for( i = 0; i < consdata->nquadvars; ++i )
9153 constant += (consdata->quadvarterms[i].lincoef + consdata->quadvarterms[i].sqrcoef * val1) * val1;
9156 for( i = 0; i < consdata->nbilinterms; ++i )
9160 constant += consdata->bilinterms[i].coef * val1 * val2;
9164 if ( consdata->nlinvars == 1 )
9171 coef = *consdata->lincoefs;
9177 lhs = consdata->lhs - constant;
9182 rhs = consdata->rhs - constant;
9184 SCIPdebugMsg(scip,
"Linear constraint with one variable: %g <= %g <%s> <= %g\n", lhs, coef,
SCIPvarGetName(*consdata->linvars), rhs);
9213 SCIPdebugMsg(scip,
"node will marked as infeasible since lb/ub of %s is +/-infinity\n",
9225 SCIPdebugMsg(scip,
"Lower bound leads to infeasibility.\n");
9241 SCIPdebugMsg(scip,
"Upper bound leads to infeasibility.\n");
9255 consdata->nlinvars, consdata->linvars, consdata->lincoefs,
9263 SCIPdebugMsg(scip,
"replace quadratic constraint <%s> by linear constraint after all quadratic vars have been fixed\n",
SCIPconsGetName(conss[c]) );
9270 SCIPdebugMsg(scip,
"linear constraint is feasible and LP optimal, thus do not add\n");
9300 assert(scip !=
NULL);
9301 assert(cons !=
NULL);
9302 assert(intervalinfty > 0.0);
9303 assert(bnd > -intervalinfty);
9304 assert(var !=
NULL);
9305 assert(result !=
NULL);
9307 assert(nchgbds !=
NULL);
9328 SCIPdebugMsg(scip,
"%s found constraint <%s> infeasible due to tightened lower bound %g for variable <%s>\n",
9336 SCIPdebugMsg(scip,
"%s tightened lower bound of variable <%s> in constraint <%s> to %g\n",
9361 assert(scip !=
NULL);
9362 assert(cons !=
NULL);
9363 assert(intervalinfty > 0.0);
9364 assert(bnd < intervalinfty);
9365 assert(var !=
NULL);
9366 assert(result !=
NULL);
9368 assert(nchgbds !=
NULL);
9389 SCIPdebugMsg(scip,
"%s found constraint <%s> infeasible due to tightened upper bound %g for variable <%s>\n",
9397 SCIPdebugMsg(scip,
"%s tightened upper bound of variable <%s> in constraint <%s> to %g\n",
9423 assert(scip !=
NULL);
9424 assert(cons !=
NULL);
9425 assert(var !=
NULL);
9426 assert(result !=
NULL);
9427 assert(nchgbds !=
NULL);
9479 SCIPdebugMsg(scip,
"found <%s> infeasible because propagated domain of quadratic variable <%s> is outside of (-infty, +infty)\n",
9514 #ifndef PROPBILINNEW 9540 assert(scip !=
NULL);
9541 assert(cons !=
NULL);
9545 assert(result !=
NULL);
9547 assert(nchgbds !=
NULL);
9548 assert(bilincoef != 0.0);
9627 assert(scip !=
NULL);
9628 assert(cons !=
NULL);
9632 assert(result !=
NULL);
9634 assert(nchgbds !=
NULL);
9635 assert(bilincoef != 0.0);
9688 int* minactivityinf,
9689 int* maxactivityinf,
9702 assert(scip !=
NULL);
9703 assert(consdata !=
NULL);
9704 assert(minquadactivity !=
NULL);
9705 assert(maxquadactivity !=
NULL);
9706 assert(minactivityinf !=
NULL);
9707 assert(maxactivityinf !=
NULL);
9708 assert(quadactcontr !=
NULL);
9713 *minquadactivity =
SCIPisInfinity(scip, consdata->rhs) ? -intervalinfty : 0.0;
9714 *maxquadactivity =
SCIPisInfinity(scip, -consdata->lhs) ? intervalinfty : 0.0;
9716 *minactivityinf = 0;
9717 *maxactivityinf = 0;
9719 if( consdata->nquadvars == 0 )
9725 for( i = 0; i < consdata->nquadvars; ++i )
9738 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
9740 k = consdata->quadvarterms[i].adjbilin[j];
9741 if( consdata->bilinterms[k].var1 != consdata->quadvarterms[i].var )
9765 *maxquadactivity += bnd;
9766 quadactcontr[i].
sup = bnd;
9772 *maxquadactivity += bnd;
9774 quadactcontr[i].
sup = bnd;
9794 *minquadactivity += bnd;
9795 quadactcontr[i].
inf = bnd;
9801 *minquadactivity += bnd;
9803 quadactcontr[i].
inf = bnd;
9810 (*minactivityinf > 0 ? -intervalinfty : *minquadactivity),
9811 (*maxactivityinf > 0 ? intervalinfty : *maxquadactivity));
9843 assert(scip !=
NULL);
9844 assert(conshdlr !=
NULL);
9845 assert(cons !=
NULL);
9846 assert(result !=
NULL);
9847 assert(nchgbds !=
NULL);
9848 assert(redundant !=
NULL);
9851 assert(consdata !=
NULL);
9860 quadactcontr =
NULL;
9870 assert(consdata->minlinactivityinf >= 0);
9871 assert(consdata->maxlinactivityinf >= 0);
9876 if( consdata->nbilinterms > 0 )
9890 SCIPdebugMsg(scip,
"linear activity: [%g, %g] quadratic activity: [%g, %g]\n",
9891 (consdata->minlinactivityinf > 0 ? -
SCIPinfinity(scip) : consdata->minlinactivity),
9892 (consdata->maxlinactivityinf > 0 ?
SCIPinfinity(scip) : consdata->maxlinactivity),
9893 consdata->quadactivitybounds.inf, consdata->quadactivitybounds.sup);
9901 SCIPintervalSetBounds(&consactivity, consdata->minlinactivityinf > 0 ? -intervalinfty : consdata->minlinactivity,
9902 consdata->maxlinactivityinf > 0 ? intervalinfty : consdata->maxlinactivity);
9903 SCIPintervalAdd(intervalinfty, &consactivity, consactivity, consdata->quadactivitybounds);
9906 SCIPdebugMsg(scip,
"found constraint <%s> to be redundant: sides: [%g, %g], activity: [%g, %g]\n",
9917 SCIPdebugMsg(scip,
"found constraint <%s> to be infeasible; sides: [%g, %g], activity: [%g, %g], infeas: %g\n",
9925 SCIPintervalSub(intervalinfty, &rhs, consbounds, consdata->quadactivitybounds);
9930 for( i = 0; i < consdata->nlinvars; ++i )
9932 coef = consdata->lincoefs[i];
9933 var = consdata->linvars[i];
9953 if( consdata->minlinactivityinf == 0 && !
SCIPisInfinity(scip, -consdata->minlinactivity) )
9960 bnd -= consdata->minlinactivity;
9975 bnd -= consdata->minlinactivity;
9989 if( consdata->maxlinactivityinf == 0 && !
SCIPisInfinity(scip, consdata->maxlinactivity) )
9996 bnd -= consdata->maxlinactivity;
10011 bnd -= consdata->maxlinactivity;
10023 assert(coef < 0.0 );
10028 if( consdata->maxlinactivityinf == 0 && !
SCIPisInfinity(scip, consdata->maxlinactivity) )
10034 bnd = consdata->maxlinactivity;
10049 bnd = consdata->maxlinactivity;
10064 if( consdata->minlinactivityinf == 0 && !
SCIPisInfinity(scip, -consdata->minlinactivity) )
10070 bnd = consdata->minlinactivity;
10085 bnd = consdata->minlinactivity;
10105 assert(consdata->minlinactivityinf > 0 || consdata->maxlinactivityinf > 0 || consdata->minlinactivity <= consdata->maxlinactivity);
10107 (consdata->minlinactivityinf > 0 ? -intervalinfty : consdata->minlinactivity),
10108 (consdata->maxlinactivityinf > 0 ? intervalinfty : consdata->maxlinactivity));
10112 if( consdata->nquadvars == 1 )
10117 assert(consdata->nbilinterms == 0);
10119 var = consdata->quadvarterms[0].var;
10125 else if( consdata->nbilinterms == 1 && consdata->nquadvars == 2 )
10128 assert(consdata->bilinterms[0].var1 == consdata->quadvarterms[0].var || consdata->bilinterms[0].var1 == consdata->quadvarterms[1].var);
10129 assert(consdata->bilinterms[0].var2 == consdata->quadvarterms[0].var || consdata->bilinterms[0].var2 == consdata->quadvarterms[1].var);
10133 consdata->quadvarterms[0].var, consdata->quadvarterms[0].sqrcoef, consdata->quadvarterms[0].lincoef,
10134 consdata->quadvarterms[1].var, consdata->quadvarterms[1].sqrcoef, consdata->quadvarterms[1].lincoef,
10135 consdata->bilinterms[0].coef,
10136 rhs, result, nchgbds) );
10141 consdata->quadvarterms[1].var, consdata->quadvarterms[1].sqrcoef, consdata->quadvarterms[1].lincoef,
10142 consdata->quadvarterms[0].var, consdata->quadvarterms[0].sqrcoef, consdata->quadvarterms[0].lincoef,
10143 consdata->bilinterms[0].coef,
10144 rhs, result, nchgbds) );
10152 if( quadminactinf == -1 )
10154 assert(quadactcontr ==
NULL);
10156 propagateBoundsGetQuadActivity(scip, consdata, intervalinfty, &minquadactivity, &maxquadactivity, &quadminactinf, &quadmaxactinf, quadactcontr);
10158 assert(quadactcontr !=
NULL);
10159 assert(quadminactinf >= 0);
10160 assert(quadmaxactinf >= 0);
10171 for( i = 0; i < consdata->nquadvars; ++i )
10173 var = consdata->quadvarterms[i].var;
10189 if( quadminactinf == 0 || (quadminactinf == 1 &&
SCIPintervalGetInf(quadactcontr[i]) <= -intervalinfty) )
10193 rhs2.
sup = rhs.
sup - minquadactivity;
10202 rhs2.
sup = intervalinfty;
10207 rhs2.
sup = intervalinfty;
10213 if( quadmaxactinf == 0 || (quadmaxactinf == 1 &&
SCIPintervalGetSup(quadactcontr[i]) >= intervalinfty) )
10217 rhs2.
inf = rhs.
inf - maxquadactivity;
10226 rhs2.
inf = -intervalinfty;
10231 rhs2.
inf = -intervalinfty;
10241 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
10243 k = consdata->quadvarterms[i].adjbilin[j];
10245 if( consdata->bilinterms[k].var1 == var )
10271 assert(consdata->bilinterms[k].var2 == var);
10273 assert(consdata->quadvarssorted);
10275 assert(otherpos >= 0);
10276 assert(consdata->quadvarterms[otherpos].var == consdata->bilinterms[k].var1);
10278 if( (consdata->quadvarterms[otherpos].sqrcoef != 0.0) || consdata->quadvarterms[otherpos].lincoef != 0.0 ||
10279 consdata->quadvarterms[otherpos].nadjbilin > 1 )
10297 if( rhs2.
inf > -intervalinfty )
10303 if( bilinbounds.
sup < intervalinfty )
10307 if( rhs2.
sup < intervalinfty )
10313 if( bilinbounds.
inf > -intervalinfty )
10323 if( consdata->bilinterms[k].var1 != var )
10368 assert(scip !=
NULL);
10369 assert(conshdlr !=
NULL);
10370 assert(conss !=
NULL || nconss == 0);
10371 assert(result !=
NULL);
10372 assert(nchgbds !=
NULL);
10377 assert(conshdlrdata !=
NULL);
10382 maxproprounds = conshdlrdata->maxproproundspresolve;
10384 maxproprounds = conshdlrdata->maxproprounds;
10391 SCIPdebugMsg(scip,
"starting domain propagation round %d of %d for %d constraints\n", roundnr, maxproprounds, nconss);
10393 for( c = 0; c < nconss && *result !=
SCIP_CUTOFF; ++c )
10395 assert(conss !=
NULL);
10407 *result = propresult;
10419 while( success && *result !=
SCIP_CUTOFF && roundnr < maxproprounds );
10435 consdata->linvar_maydecrease = -1;
10436 consdata->linvar_mayincrease = -1;
10439 for( i = 0; i < consdata->nlinvars; ++i )
10442 assert(consdata->lincoefs[i] != 0.0);
10443 if( consdata->lincoefs[i] > 0.0 )
10458 if( (consdata->linvar_maydecrease < 0) ||
10459 (
SCIPvarGetObj(consdata->linvars[consdata->linvar_maydecrease]) / consdata->lincoefs[consdata->linvar_maydecrease] >
SCIPvarGetObj(consdata->linvars[i]) / consdata->lincoefs[i]) )
10460 consdata->linvar_maydecrease = i;
10467 if( (consdata->linvar_mayincrease < 0) ||
10468 (
SCIPvarGetObj(consdata->linvars[consdata->linvar_mayincrease]) / consdata->lincoefs[consdata->linvar_mayincrease] >
SCIPvarGetObj(consdata->linvars[i]) / consdata->lincoefs[i]) )
10469 consdata->linvar_mayincrease = i;
10474 if( consdata->linvar_mayincrease >= 0 )
10476 SCIPdebugMsg(scip,
"may increase <%s> to become feasible\n",
SCIPvarGetName(consdata->linvars[consdata->linvar_mayincrease]));
10478 if( consdata->linvar_maydecrease >= 0 )
10480 SCIPdebugMsg(scip,
"may decrease <%s> to become feasible\n",
SCIPvarGetName(consdata->linvars[consdata->linvar_maydecrease]));
10511 assert(scip !=
NULL);
10512 assert(conshdlr !=
NULL);
10513 assert(conss !=
NULL || nconss == 0);
10514 assert(success !=
NULL);
10523 assert(conshdlrdata !=
NULL);
10534 SCIPdebugMsg(scip,
"attempt to make solution from <%s> feasible by shifting linear variable\n",
10537 origscaling = conshdlrdata->scaling;
10538 for( c = 0; c < nconss; ++c )
10541 assert(consdata !=
NULL);
10547 conshdlrdata->scaling =
'o';
10551 assert(!solviolbounds);
10552 viol = consdata->lhs - consdata->activity;
10557 assert(!solviolbounds);
10558 viol = consdata->rhs - consdata->activity;
10563 assert(viol != 0.0);
10564 if( consdata->linvar_mayincrease >= 0 &&
10565 ((viol > 0.0 && consdata->lincoefs[consdata->linvar_mayincrease] > 0.0) || (viol < 0.0 && consdata->lincoefs[consdata->linvar_mayincrease] < 0.0)) )
10568 var = consdata->linvars[consdata->linvar_mayincrease];
10570 delta = viol / consdata->lincoefs[consdata->linvar_mayincrease];
10571 assert(delta > 0.0);
10576 delta =
MIN(
MAX(0.0, gap), delta);
10589 viol -= consdata->lincoefs[consdata->linvar_mayincrease] * delta;
10595 assert(viol != 0.0);
10596 if( consdata->linvar_maydecrease >= 0 &&
10597 ((viol > 0.0 && consdata->lincoefs[consdata->linvar_maydecrease] < 0.0) || (viol < 0.0 && consdata->lincoefs[consdata->linvar_maydecrease] > 0.0)) )
10600 var = consdata->linvars[consdata->linvar_maydecrease];
10602 delta = viol / consdata->lincoefs[consdata->linvar_maydecrease];
10603 assert(delta < 0.0);
10608 delta =
MAX(
MIN(0.0, gap), delta);
10620 viol -= consdata->lincoefs[consdata->linvar_maydecrease] * delta;
10629 conshdlrdata->scaling = origscaling;
10638 assert(conshdlrdata->trysolheur !=
NULL);
10675 assert(scip !=
NULL);
10676 assert(conshdlr !=
NULL);
10677 assert(conss !=
NULL || nconss == 0);
10678 assert(nconss >= 0);
10679 assert(nusefulconss >= 0);
10680 assert(result !=
NULL);
10683 assert(conshdlrdata !=
NULL);
10687 if( maxviolcon ==
NULL )
10695 if( solviolbounds )
10702 assert(solinfeasible);
10706 if( !solinfeasible )
10712 assert(consdata !=
NULL);
10713 maxviol = consdata->lhsviol + consdata->rhsviol;
10717 sol ==
NULL ?
"LP" :
"relaxation");
10728 if( conshdlrdata->nenforounds > 100 )
10741 ++conshdlrdata->nenforounds;
10747 if( conshdlrdata->enfolplimit != -1 && conshdlrdata->nenforounds > conshdlrdata->enfolplimit )
10750 "cut off subtree because enforcement limit was reached; this might lead to incorrect results\n");
10758 conshdlrdata->nenforounds = 0;
10767 *result = propresult;
10776 minefficacy =
MIN(0.75*maxviol, conshdlrdata->mincutefficacyenfofac *
SCIPfeastol(scip));
10778 SCIP_CALL(
separatePoint(scip, conshdlr, conss, nconss, nusefulconss, sol, minefficacy,
TRUE, &separateresult, &sepaefficacy) );
10787 SCIPdebugMsg(scip,
"separation succeeded (bestefficacy = %g, minefficacy = %g)\n", sepaefficacy, minefficacy);
10796 SCIPdebugMsg(scip,
"separation failed (bestefficacy = %g < %g = minefficacy ); max viol: %g\n", sepaefficacy, minefficacy, maxviol);
10803 if( nnotify == 0 && !solinfeasible && minefficacy > leastpossibleefficacy )
10806 SCIP_CALL(
separatePoint(scip, conshdlr, conss, nconss, nusefulconss, sol, leastpossibleefficacy,
TRUE, &separateresult, &sepaefficacy) );
10815 SCIPdebugMsg(scip,
"separation fallback succeeded, efficacy = %g\n", sepaefficacy);
10821 if( nnotify == 0 && !solinfeasible )
10828 if( brvar ==
NULL )
10842 else if ( addedcons )
10844 else if ( reduceddom )
10849 SCIPwarningMessage(scip,
"could not enforce feasibility by separating or branching; declaring solution with viol %g as feasible\n", maxviol);
10856 SCIPdebugMsg(scip,
"Could not find any usual branching variable candidate. Proposed variable <%s> with LP value %g for branching.\n",
10862 assert(*result ==
SCIP_INFEASIBLE && (solinfeasible || nnotify > 0));
10874 assert(nupgdconss !=
NULL);
10875 assert(upgdconss !=
NULL);
10937 if( upgdconsssize < 1 )
10999 if( lincoefs !=
NULL )
11001 if( lincoefs[i] != 0.0 )
11009 for( i = 0; i < nquadelems; ++i )
11014 if( quadelems[i].idx1 == quadelems[i].idx2 )
11019 quadelems[i].coef) );
11027 quadelems[i].coef) );
11050 assert(scip !=
NULL);
11051 assert(conshdlr !=
NULL);
11069 assert(scip !=
NULL);
11070 assert(conshdlr !=
NULL);
11073 assert(conshdlrdata !=
NULL);
11075 for( i = 0; i < conshdlrdata->nquadconsupgrades; ++i )
11077 assert(conshdlrdata->quadconsupgrades[i] !=
NULL);
11093 assert(scip !=
NULL);
11094 assert(conshdlr !=
NULL);
11097 assert(conshdlrdata !=
NULL);
11099 conshdlrdata->subnlpheur =
SCIPfindHeur(scip,
"subnlp");
11100 conshdlrdata->trysolheur =
SCIPfindHeur(scip,
"trysol");
11112 assert(scip !=
NULL);
11113 assert(conshdlr !=
NULL);
11116 assert(conshdlrdata !=
NULL);
11118 conshdlrdata->subnlpheur =
NULL;
11119 conshdlrdata->trysolheur =
NULL;
11133 assert(scip !=
NULL);
11134 assert(conshdlr !=
NULL);
11135 assert(conss !=
NULL || nconss == 0);
11138 assert(conshdlrdata !=
NULL);
11154 assert(scip !=
NULL);
11155 assert(conshdlr !=
NULL);
11156 assert(conss !=
NULL || nconss == 0);
11158 for( c = 0; c < nconss; ++c )
11160 assert(conss !=
NULL);
11162 assert(consdata !=
NULL);
11164 if( !consdata->isremovedfixings )
11174 assert(consdata->isremovedfixings);
11175 assert(consdata->linvarsmerged);
11176 assert(consdata->quadvarsmerged);
11177 assert(consdata->bilinmerged);
11180 for( i = 0; i < consdata->nlinvars; ++i )
11183 for( i = 0; i < consdata->nquadvars; ++i )
11207 assert(scip !=
NULL);
11208 assert(conshdlr !=
NULL);
11209 assert(conss !=
NULL || nconss == 0);
11212 assert(conshdlrdata !=
NULL);
11214 for( c = 0; c < nconss; ++c )
11216 assert(conss !=
NULL);
11218 assert(consdata !=
NULL);
11225 consdata->lincoefsmax = 0.0;
11226 for( i = 0; i < consdata->nlinvars; ++i )
11228 consdata->lincoefsmin =
MIN(consdata->lincoefsmin,
REALABS(consdata->lincoefs[i]));
11229 consdata->lincoefsmax =
MAX(consdata->lincoefsmax,
REALABS(consdata->lincoefs[i]));
11235 if( consdata->nlrow ==
NULL )
11241 assert(consdata->nlrow !=
NULL);
11247 assert(consdata->sepaquadvars ==
NULL);
11248 assert(consdata->sepabilinvar2pos ==
NULL);
11249 if( consdata->nquadvars > 0 )
11257 for( i = 0; i < consdata->nquadvars; ++i )
11258 consdata->sepaquadvars[i] = consdata->quadvarterms[i].var;
11260 for( i = 0; i < consdata->nbilinterms; ++i )
11266 if( conshdlrdata->checkfactorable )
11273 if( conshdlrdata->gaugecuts &&
SCIPgetSubscipDepth(scip) == 0 && consdata->nquadvars > 0 )
11276 if( (consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs)) ||
11277 (consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs)) )
11284 if( conshdlrdata->projectedcuts &&
SCIPgetSubscipDepth(scip) == 0 && consdata->nquadvars > 0 )
11287 if( (consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs)) ||
11288 (consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs)) )
11296 consdata->ispropagated =
FALSE;
11305 conshdlrdata->newsoleventfilterpos = -1;
11306 if( nconss != 0 && conshdlrdata->linearizeheursol )
11311 assert(eventhdlr !=
NULL);
11319 SCIPverbMessage(scip,
SCIP_VERBLEVEL_HIGH,
NULL,
"Quadratic constraint handler does not have LAPACK for eigenvalue computation. Will assume that matrices (with size > 2x2) are indefinite.\n");
11323 conshdlrdata->sepanlp =
FALSE;
11324 conshdlrdata->lastenfonode =
NULL;
11325 conshdlrdata->nenforounds = 0;
11341 assert(scip !=
NULL);
11342 assert(conshdlr !=
NULL);
11343 assert(conss !=
NULL || nconss == 0);
11346 assert(conshdlrdata !=
NULL);
11348 for( c = 0; c < nconss; ++c )
11351 assert(consdata !=
NULL);
11354 if( consdata->nlrow !=
NULL )
11359 assert(!
SCIPconsIsEnabled(conss[c]) || consdata->sepaquadvars !=
NULL || consdata->nquadvars == 0);
11360 assert(!
SCIPconsIsEnabled(conss[c]) || consdata->sepabilinvar2pos !=
NULL || consdata->nquadvars == 0);
11380 if( conshdlrdata->newsoleventfilterpos >= 0 )
11385 assert(eventhdlr !=
NULL);
11388 conshdlrdata->newsoleventfilterpos = -1;
11398 assert(scip !=
NULL);
11399 assert(conshdlr !=
NULL);
11400 assert(cons !=
NULL);
11401 assert(consdata !=
NULL);
11406 assert(*consdata ==
NULL);
11420 assert(sourcedata !=
NULL);
11423 sourcedata->lhs, sourcedata->rhs,
11424 sourcedata->nlinvars, sourcedata->linvars, sourcedata->lincoefs,
11425 sourcedata->nquadvars, sourcedata->quadvarterms,
11426 sourcedata->nbilinterms, sourcedata->bilinterms,
11429 for( i = 0; i < targetdata->nlinvars; ++i )
11435 for( i = 0; i < targetdata->nquadvars; ++i )
11441 for( i = 0; i < targetdata->nbilinterms; ++i )
11446 if(
SCIPvarCompare(targetdata->bilinterms[i].var1, targetdata->bilinterms[i].var2) > 0 )
11449 tmp = targetdata->bilinterms[i].var2;
11450 targetdata->bilinterms[i].var2 = targetdata->bilinterms[i].var1;
11451 targetdata->bilinterms[i].var1 = tmp;
11462 SCIPdebugMsg(scip,
"created transformed quadratic constraint ");
11480 assert(scip !=
NULL);
11481 assert(conshdlr !=
NULL);
11482 assert(conss !=
NULL || nconss == 0);
11485 assert(conshdlrdata !=
NULL);
11487 *infeasible =
FALSE;
11489 for( c = 0; c < nconss && !(*infeasible); ++c )
11491 assert(conss[c] !=
NULL);
11496 assert(consdata !=
NULL);
11500 if( consdata->nquadvars == 0 )
11515 if( (consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs)) ||
11516 (consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs)) )
11523 for( k = 0; k < 5; ++k )
11525 lambda = 0.1 * (k+1);
11526 for( i = 0; i < consdata->nquadvars; ++i )
11528 var = consdata->quadvarterms[i].var;
11544 x[i] = lambda * ub + (1.0 - lambda) * lb;
11546 x[i] = lambda * lb + (1.0 - lambda) * ub;
11563 if( !(*infeasible) && ((! consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs))
11564 || (! consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs))) )
11577 for( k = 0; k < 2; ++k )
11587 for( i = 0; i < consdata->nquadvars; ++i )
11589 var = consdata->quadvarterms[i].var;
11598 x[i] =
MIN(0.0, ub);
11605 x[i] =
MAX(0.0, lb);
11610 lambda = 0.4 + 0.2 * ((i+k)%2) + 0.01 * i / (double)consdata->nquadvars;
11615 possquare |= consdata->quadvarterms[i].sqrcoef > 0.0;
11616 negsquare |= consdata->quadvarterms[i].sqrcoef < 0.0;
11619 if( !consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs) )
11632 if( !(*infeasible) && !consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs) )
11649 (consdata->nbilinterms == 0 && (!possquare ||
SCIPisInfinity(scip, consdata->rhs))) ||
11650 (consdata->nbilinterms == 0 && (!negsquare ||
SCIPisInfinity(scip, -consdata->lhs))) )
11669 assert(scip !=
NULL);
11670 assert(conshdlr !=
NULL);
11671 assert(conss !=
NULL || nconss == 0);
11672 assert(result !=
NULL);
11677 assert(conshdlrdata !=
NULL);
11682 if( solviolbounds )
11686 if( maxviolcon ==
NULL )
11692 if(
SCIPgetDepth(scip) == 0 && !conshdlrdata->sepanlp &&
11709 for( c = 0; c < nconss; ++c )
11711 assert(conss[c] !=
NULL);
11714 assert(consdata !=
NULL);
11733 if( conshdlrdata->subnlpheur !=
NULL )
11748 SCIPdebugMsg(scip,
"solved NLP relax, solution status: %d\n", solstat);
11754 conshdlrdata->sepanlp =
TRUE;
11758 SCIPdebugMsg(scip,
"NLP relaxation is globally infeasible, thus can cutoff node\n");
11770 assert(nlpsol !=
NULL);
11773 if( solvednlp && conshdlrdata->trysolheur !=
NULL )
11783 if( nfracvars == 0 )
11795 if( lpsolseparated )
11797 SCIPdebugMsg(scip,
"linearization cuts separate LP solution\n");
11821 assert(scip !=
NULL);
11822 assert(conshdlr !=
NULL);
11823 assert(conss !=
NULL || nconss == 0);
11824 assert(sol !=
NULL);
11825 assert(result !=
NULL);
11828 assert(conshdlrdata !=
NULL);
11835 if( solviolbounds )
11839 if( maxviolcon ==
NULL )
11879 assert(scip !=
NULL);
11880 assert(conss !=
NULL || nconss == 0);
11885 assert(!solviolbounds);
11887 if( maxviolcon ==
NULL )
11902 *result = propresult;
11910 for( c = 0; c < nconss; ++c )
11912 assert(conss !=
NULL);
11914 assert(consdata !=
NULL);
11919 for( i = 0; i < consdata->nlinvars; ++i )
11921 var = consdata->linvars[i];
11929 for( i = 0; i < consdata->nquadvars; ++i )
11931 var = consdata->quadvarterms[i].var;
11942 SCIPdebugMsg(scip,
"All variables in violated constraints fixed (up to epsilon). Cannot find branching candidate. Forcing solution of LP.\n");
11956 assert(scip !=
NULL);
11957 assert(conshdlr !=
NULL);
11958 assert(conss !=
NULL || nconss == 0);
11959 assert(result !=
NULL);
11980 assert(scip !=
NULL);
11981 assert(conshdlr !=
NULL);
11982 assert(conss !=
NULL || nconss == 0);
11983 assert(result !=
NULL);
11993 SCIPdebugMsg(scip,
"presolving will %swait with reformulation\n", doreformulations ?
"not " :
"");
11996 assert(conshdlrdata !=
NULL);
11998 for( c = 0; c < nconss; ++c )
12000 assert(conss !=
NULL);
12002 assert(consdata !=
NULL);
12007 if( !consdata->initialmerge )
12012 consdata->initialmerge =
TRUE;
12015 havechange =
FALSE;
12016 #ifdef CHECKIMPLINBILINEAR 12020 SCIP_CALL( presolveApplyImplications(scip, conss[c], &nbilinremoved) );
12021 if( nbilinremoved > 0 )
12023 *nchgcoefs += nbilinremoved;
12027 assert(!consdata->isimpladded);
12033 if( !consdata->ispresolved || !consdata->ispropagated || nnewchgvartypes > 0 )
12045 if( !consdata->isremovedfixings )
12048 assert(consdata->isremovedfixings);
12075 if( doreformulations )
12079 naddconss_old = *naddconss;
12082 assert(*naddconss >= naddconss_old);
12084 if( *naddconss == naddconss_old )
12088 assert(*naddconss >= naddconss_old);
12091 if( conshdlrdata->disaggregate )
12097 if( *naddconss > naddconss_old )
12108 if( consdata->nlinvars == 0 && consdata->nquadvars == 0 )
12129 if( (presoltiming & SCIP_PRESOLTIMING_FAST) != 0 && !consdata->ispropagated )
12140 SCIPdebugMsg(scip,
"starting domain propagation round %d of %d\n", roundnr, conshdlrdata->maxproproundspresolve);
12142 if( !consdata->ispropagated )
12144 consdata->ispropagated =
TRUE;
12150 SCIPdebugMsg(scip,
"propagation on constraint <%s> says problem is infeasible in presolve\n",
12172 while( !consdata->ispropagated && roundnr < conshdlrdata->maxproproundspresolve );
12179 if( (nnewchgvartypes != 0 || havechange || !consdata->ispresolved)
12190 for( i = 0; !fail && i < consdata->nlinvars; ++i )
12200 else if(
SCIPisEQ(scip, ABS(consdata->lincoefs[i]), 1.0) )
12201 candidate = consdata->linvars[i];
12205 for( i = 0; !fail && i < consdata->nquadvars; ++i )
12209 for( i = 0; !fail && i < consdata->nbilinterms; ++i )
12212 if( !fail && candidate !=
NULL )
12259 if( !consdata->initialmerge )
12264 consdata->initialmerge =
TRUE;
12267 for( i = 0; i < consdata->nquadvars; ++i )
12273 var = consdata->quadvarterms[i].var;
12274 assert(var !=
NULL);
12316 consdata->ispresolved =
TRUE;
12331 assert(scip !=
NULL);
12332 assert(cons !=
NULL);
12335 assert(consdata !=
NULL);
12340 for( i = 0; i < consdata->nlinvars; ++i )
12342 if( consdata->lincoefs[i] > 0 )
12366 for( i = 0; i < consdata->nquadvars; ++i )
12381 assert(scip !=
NULL);
12382 assert(conshdlr !=
NULL);
12383 assert(cons !=
NULL);
12388 assert(conshdlrdata !=
NULL);
12406 SCIP_CALL( consInitsolQuadratic(scip, conshdlr, &cons, 1) );
12418 assert(scip !=
NULL);
12419 assert(conshdlr !=
NULL);
12420 assert(cons !=
NULL);
12424 assert(conshdlrdata !=
NULL);
12431 SCIP_CALL( consExitsolQuadratic(scip, conshdlr, &cons, 1,
FALSE) );
12446 assert(scip !=
NULL);
12447 assert(cons !=
NULL);
12450 assert(consdata !=
NULL);
12455 && !
SCIPisEQ(scip, consdata->lhs, consdata->rhs) )
12459 if( consdata->nlinvars == 0 && consdata->nquadvars == 0 )
12468 int* monomialnvars;
12473 monomialssize = consdata->nlinvars + 2 * consdata->nquadvars + consdata->nbilinterms;
12480 for( j = 0; j < consdata->nlinvars; ++j )
12482 assert(nmonomials < monomialssize);
12486 monomialvars[nmonomials][0] = consdata->linvars[j];
12487 monomialexps[nmonomials] =
NULL;
12488 monomialcoefs[nmonomials] = consdata->lincoefs[j];
12489 monomialnvars[nmonomials] = 1;
12493 for( j = 0; j < consdata->nquadvars; ++j )
12495 if( consdata->quadvarterms[j].lincoef != 0.0 )
12497 assert(nmonomials < monomialssize);
12501 monomialvars[nmonomials][0] = consdata->quadvarterms[j].var;
12502 monomialexps[nmonomials] =
NULL;
12503 monomialcoefs[nmonomials] = consdata->quadvarterms[j].lincoef;
12504 monomialnvars[nmonomials] = 1;
12508 if( consdata->quadvarterms[j].sqrcoef != 0.0 )
12510 assert(nmonomials < monomialssize);
12515 monomialvars[nmonomials][0] = consdata->quadvarterms[j].var;
12516 monomialexps[nmonomials][0] = 2.0;
12517 monomialcoefs[nmonomials] = consdata->quadvarterms[j].sqrcoef;
12518 monomialnvars[nmonomials] = 1;
12523 for( j = 0; j < consdata->nbilinterms; ++j )
12525 assert(nmonomials < monomialssize);
12529 monomialvars[nmonomials][0] = consdata->bilinterms[j].var1;
12530 monomialvars[nmonomials][1] = consdata->bilinterms[j].var2;
12531 monomialexps[nmonomials] =
NULL;
12532 monomialcoefs[nmonomials] = consdata->bilinterms[j].coef;
12533 monomialnvars[nmonomials] = 2;
12539 for( j = 0; j < nmonomials; ++j )
12552 if(
SCIPisEQ(scip, consdata->lhs, consdata->rhs) )
12584 assert(scip !=
NULL);
12585 assert(conss !=
NULL || nconss == 0);
12586 assert(result !=
NULL);
12589 assert(conshdlrdata !=
NULL);
12594 maypropfeasible = conshdlrdata->linfeasshift && (conshdlrdata->trysolheur !=
NULL) &&
12596 for( c = 0; c < nconss; ++c )
12598 assert(conss !=
NULL);
12600 assert(!solviolbounds);
12603 assert(consdata !=
NULL);
12614 SCIPinfoMessage(scip,
NULL,
"violation: left hand side is violated by %.15g (scaled: %.15g)\n", consdata->lhs - consdata->activity, consdata->lhsviol);
12618 SCIPinfoMessage(scip,
NULL,
"violation: right hand side is violated by %.15g (scaled: %.15g)\n", consdata->activity - consdata->rhs, consdata->rhsviol);
12621 if( (conshdlrdata->subnlpheur ==
NULL || sol ==
NULL) && !maypropfeasible && !completely )
12623 if( consdata->lhsviol > maxviol || consdata->rhsviol > maxviol )
12624 maxviol = consdata->lhsviol + consdata->rhsviol;
12628 maypropfeasible =
FALSE;
12630 if( maypropfeasible )
12640 if( !(consdata->linvar_mayincrease >= 0 && consdata->lincoefs[consdata->linvar_mayincrease] > 0.0) &&
12641 ! (consdata->linvar_maydecrease >= 0 && consdata->lincoefs[consdata->linvar_maydecrease] < 0.0) )
12642 maypropfeasible =
FALSE;
12649 if( !(consdata->linvar_mayincrease >= 0 && consdata->lincoefs[consdata->linvar_mayincrease] < 0.0) &&
12650 ! (consdata->linvar_maydecrease >= 0 && consdata->lincoefs[consdata->linvar_maydecrease] > 0.0) )
12651 maypropfeasible =
FALSE;
12689 assert(scip !=
NULL);
12690 assert(cons !=
NULL);
12691 assert(sourcescip !=
NULL);
12692 assert(sourceconshdlr !=
NULL);
12693 assert(sourcecons !=
NULL);
12694 assert(varmap !=
NULL);
12695 assert(valid !=
NULL);
12698 assert(consdata !=
NULL);
12701 quadvarterms =
NULL;
12706 if( consdata->nlinvars != 0 )
12709 for( i = 0; i < consdata->nlinvars; ++i )
12711 SCIP_CALL(
SCIPgetVarCopy(sourcescip, scip, consdata->linvars[i], &linvars[i], varmap, consmap, global, valid) );
12712 assert(!(*valid) || linvars[i] !=
NULL);
12720 if( consdata->nbilinterms != 0 )
12725 if( consdata->nquadvars != 0 )
12728 for( i = 0; i < consdata->nquadvars; ++i )
12730 SCIP_CALL(
SCIPgetVarCopy(sourcescip, scip, consdata->quadvarterms[i].var, &quadvarterms[i].
var, varmap, consmap, global, valid) );
12731 assert(!(*valid) || quadvarterms[i].var !=
NULL);
12737 quadvarterms[i].
lincoef = consdata->quadvarterms[i].lincoef;
12738 quadvarterms[i].
sqrcoef = consdata->quadvarterms[i].sqrcoef;
12740 quadvarterms[i].
nadjbilin = consdata->quadvarterms[i].nadjbilin;
12741 quadvarterms[i].
adjbilin = consdata->quadvarterms[i].adjbilin;
12743 assert(consdata->nbilinterms != 0 || consdata->quadvarterms[i].nadjbilin == 0);
12745 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
12747 assert(bilinterms !=
NULL);
12749 k = consdata->quadvarterms[i].adjbilin[j];
12750 assert(consdata->bilinterms[k].var1 !=
NULL);
12751 assert(consdata->bilinterms[k].var2 !=
NULL);
12752 if( consdata->bilinterms[k].var1 == consdata->quadvarterms[i].var )
12754 assert(consdata->bilinterms[k].var2 != consdata->quadvarterms[i].var);
12755 bilinterms[k].
var1 = quadvarterms[i].
var;
12759 assert(consdata->bilinterms[k].var2 == consdata->quadvarterms[i].var);
12760 bilinterms[k].
var2 = quadvarterms[i].
var;
12762 bilinterms[k].
coef = consdata->bilinterms[k].coef;
12767 assert(stickingatnode ==
FALSE);
12769 consdata->nlinvars, linvars, consdata->lincoefs,
12770 consdata->nquadvars, quadvarterms,
12771 consdata->nbilinterms, bilinterms,
12772 consdata->lhs, consdata->rhs,
12773 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable) );
12777 targetconsdata->isconvex = consdata->isconvex;
12778 targetconsdata->isconcave = consdata->isconcave;
12779 targetconsdata->iscurvchecked = consdata->iscurvchecked;
12797 int* monomialnvars;
12803 assert(scip !=
NULL);
12804 assert(success !=
NULL);
12805 assert(str !=
NULL);
12806 assert(name !=
NULL);
12807 assert(cons !=
NULL);
12813 (*success) =
FALSE;
12820 while( isspace((
unsigned char)*str) )
12824 if( isdigit((
unsigned char)str[0]) || ((str[0] ==
'-' || str[0] ==
'+') && isdigit((
unsigned char)str[1])) )
12834 while( isspace((
unsigned char)*endptr) )
12837 if( endptr[0] !=
'<' || endptr[1] !=
'=' )
12848 while( isspace((
unsigned char)*str) )
12861 while( isspace((
unsigned char)*str) )
12864 if( *str && str[0] ==
'<' && str[1] ==
'=' )
12875 else if( *str && str[0] ==
'>' && str[1] ==
'=' )
12889 else if( *str && str[0] ==
'=' && str[1] ==
'=' )
12914 assert(stickingatnode ==
FALSE);
12917 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable) );
12919 for( i = 0; i < nmonomials; ++i )
12921 if( monomialnvars[i] == 0 )
12926 else if( monomialnvars[i] == 1 && monomialexps[i][0] == 1.0 )
12931 else if( monomialnvars[i] == 1 && monomialexps[i][0] == 2.0 )
12936 else if( monomialnvars[i] == 2 && monomialexps[i][0] == 1.0 && monomialexps[i][1] == 1.0 )
12943 var1 = monomialvars[i][0];
12944 var2 = monomialvars[i][1];
12969 SCIPerrorMessage(
"polynomial in quadratic constraint does not have degree at most 2\n");
12988 assert(cons !=
NULL);
12989 assert(success !=
NULL);
12992 assert(consdata !=
NULL);
12994 if( varssize < consdata->nlinvars + consdata->nquadvars )
12995 (*success) =
FALSE;
13000 assert(vars !=
NULL);
13004 for( i = 0; i < consdata->nquadvars; ++i )
13005 vars[consdata->nlinvars+i] = consdata->quadvarterms[i].var;
13019 assert(cons !=
NULL);
13020 assert(success !=
NULL);
13023 assert(consdata !=
NULL);
13025 (*nvars) = consdata->nlinvars + consdata->nquadvars;
13051 consEnfolpQuadratic, consEnfopsQuadratic, consCheckQuadratic, consLockQuadratic,
13053 assert(conshdlr !=
NULL);
13082 "max. length of linear term which when multiplied with a binary variables is replaced by an auxiliary variable and a linear reformulation (0 to turn off)",
13083 &conshdlrdata->replacebinaryprodlength,
FALSE, INT_MAX, 0, INT_MAX,
NULL,
NULL) );
13086 "empathy level for using the AND constraint handler: 0 always avoid using AND; 1 use AND sometimes; 2 use AND as often as possible",
13090 "whether to make non-varbound linear constraints added due to replacing products with binary variables initial",
13094 "limit (as factor on 1/feastol) on coefficients and coef. range in linear constraints created when replacing products with binary variables",
13098 "minimal efficacy for a cut to be added to the LP during separation; overwrites separating/efficacy",
13102 "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)",
13106 "whether scaling of infeasibility is 'o'ff, by sup-norm of function 'g'radient, or by left/right hand 's'ide",
13107 &conshdlrdata->scaling,
TRUE,
'o',
"ogs",
NULL,
NULL) );
13110 "maximal coef range of a cut (maximal coefficient divided by minimal coefficient) in order to be added to LP relaxation",
13114 "whether linearizations of convex quadratic constraints should be added to cutpool in a solution found by some heuristic",
13118 "whether multivariate quadratic functions should be checked for convexity/concavity",
13122 "whether constraint functions should be checked to be factorable",
13126 "whether quadratic variables contained in a single constraint should be forced to be at their lower or upper bounds ('d'isable, change 't'ype, add 'b'ound disjunction)",
13127 &conshdlrdata->checkquadvarlocks,
TRUE,
't',
"bdt",
NULL,
NULL) );
13130 "whether to try to make solutions in check function feasible by shifting a linear variable (esp. useful if constraint was actually objective function)",
13134 "whether to disaggregate quadratic parts that decompose into a sum of non-overlapping quadratic terms",
13138 "limit on number of propagation rounds for a single constraint within one round of SCIP propagation during solve",
13139 &conshdlrdata->maxproprounds,
TRUE, 1, 0, INT_MAX,
NULL,
NULL) );
13142 "limit on number of propagation rounds for a single constraint within one round of SCIP presolve",
13143 &conshdlrdata->maxproproundspresolve,
TRUE, 10, 0, INT_MAX,
NULL,
NULL) );
13146 "maximum number of enforcement rounds before declaring the LP relaxation infeasible (-1: no limit); WARNING: changing this parameter might lead to incorrect results!",
13147 &conshdlrdata->enfolplimit,
TRUE, -1, -1, INT_MAX,
NULL,
NULL) );
13150 "minimal required fraction of continuous variables in problem to use solution of NLP relaxation in root for separation",
13151 &conshdlrdata->sepanlpmincont,
FALSE, 1.0, 0.0, 2.0,
NULL,
NULL) );
13154 "are cuts added during enforcement removable from the LP in the same node?",
13158 "should convex quadratics generated strong cuts via gauge function?",
13162 "how the interior point for gauge cuts should be computed: 'a'ny point per constraint, 'm'ost interior per constraint",
13163 &conshdlrdata->interiorcomputation,
TRUE,
'a',
"am",
NULL,
NULL) );
13166 "should convex quadratics generated strong cuts via projections?",
13170 "which score to give branching candidates: convexification 'g'ap, constraint 'v'iolation, 'c'entrality of variable value in domain",
13171 &conshdlrdata->branchscoring,
TRUE,
'g',
"cgv",
NULL,
NULL) );
13173 conshdlrdata->eventhdlr =
NULL;
13175 processVarEvent,
NULL) );
13176 assert(conshdlrdata->eventhdlr !=
NULL);
13179 processNewSolutionEvent,
NULL) );
13193 const char* conshdlrname
13203 assert(quadconsupgd !=
NULL);
13204 assert(conshdlrname !=
NULL );
13208 if( conshdlr ==
NULL )
13215 assert(conshdlrdata !=
NULL);
13221 quadconsupgrade->quadconsupgd = quadconsupgd;
13222 quadconsupgrade->
priority = priority;
13226 assert(conshdlrdata->nquadconsupgrades <= conshdlrdata->quadconsupgradessize);
13227 if( conshdlrdata->nquadconsupgrades+1 > conshdlrdata->quadconsupgradessize )
13233 conshdlrdata->quadconsupgradessize = newsize;
13235 assert(conshdlrdata->nquadconsupgrades+1 <= conshdlrdata->quadconsupgradessize);
13237 for( i = conshdlrdata->nquadconsupgrades; i > 0 && conshdlrdata->quadconsupgrades[i-1]->priority < quadconsupgrade->
priority; --i )
13238 conshdlrdata->quadconsupgrades[i] = conshdlrdata->quadconsupgrades[i-1];
13239 assert(0 <= i && i <= conshdlrdata->nquadconsupgrades);
13240 conshdlrdata->quadconsupgrades[i] = quadconsupgrade;
13241 conshdlrdata->nquadconsupgrades++;
13247 paramname, paramdesc,
13309 assert(linvars !=
NULL || nlinvars == 0);
13310 assert(lincoefs !=
NULL || nlinvars == 0);
13311 assert(quadvars1 !=
NULL || nquadterms == 0);
13312 assert(quadvars2 !=
NULL || nquadterms == 0);
13313 assert(quadcoefs !=
NULL || nquadterms == 0);
13315 assert(modifiable ==
FALSE);
13319 if( conshdlr ==
NULL )
13328 consdata->lhs = lhs;
13329 consdata->rhs = rhs;
13331 SCIP_CALL(
SCIPcreateCons(scip, cons, name, conshdlr, consdata, initial, separate, enforce, check, propagate,
13332 local, modifiable, dynamic, removable,
FALSE) );
13337 for( i = 0; i < nquadterms; ++i )
13344 if( quadvars1[i] == quadvars2[i] )
13345 sqrcoef = quadcoefs[i];
13353 assert(consdata->nquadvars >= 0);
13354 assert(consdata->quadvarterms[consdata->nquadvars-1].var == quadvars1[i]);
13362 assert(consdata->quadvarterms[var1pos].var == quadvars1[i]);
13363 consdata->quadvarterms[var1pos].sqrcoef += sqrcoef;
13367 if( quadvars1[i] == quadvars2[i] )
13373 assert(sqrcoef == 0.0);
13375 assert(consdata->nquadvars >= 0);
13376 assert(consdata->quadvarterms[consdata->nquadvars-1].var == quadvars2[i]);
13385 if( nbilinterms > 0 )
13388 for( i = 0; i < nquadterms; ++i )
13394 if( quadvars1[i] == quadvars2[i] )
13409 for( i = 0; i < nlinvars; ++i )
13418 assert(consdata->quadvarterms[var1pos].var == linvars[i]);
13419 consdata->quadvarterms[var1pos].lincoef += lincoefs[i];
13462 nquadterms, quadvars1, quadvars2, quadcoefs, lhs, rhs,
13504 assert(modifiable ==
FALSE);
13505 assert(nlinvars == 0 || (linvars !=
NULL && lincoefs !=
NULL));
13506 assert(nquadvarterms == 0 || quadvarterms !=
NULL);
13507 assert(nbilinterms == 0 || bilinterms !=
NULL);
13511 if( conshdlr ==
NULL )
13519 nlinvars, linvars, lincoefs, nquadvarterms, quadvarterms, nbilinterms, bilinterms,
13523 SCIP_CALL(
SCIPcreateCons(scip, cons, name, conshdlr, consdata, initial, separate, enforce, check, propagate,
13524 local, modifiable, dynamic, removable,
FALSE) );
13555 nquadvarterms, quadvarterms, nbilinterms, bilinterms, lhs, rhs,
13571 assert(scip !=
NULL);
13572 assert(cons !=
NULL);
13583 assert(consdata !=
NULL);
13584 assert(consdata->lhs <= consdata->rhs);
13587 consdata->lhs -= constant;
13589 consdata->rhs -= constant;
13591 if( consdata->lhs > consdata->rhs )
13593 assert(
SCIPisEQ(scip, consdata->lhs, consdata->rhs));
13594 consdata->lhs = consdata->rhs;
13606 assert(scip !=
NULL);
13607 assert(cons !=
NULL);
13608 assert(var !=
NULL);
13632 assert(scip !=
NULL);
13633 assert(cons !=
NULL);
13634 assert(var !=
NULL);
13664 assert(scip !=
NULL);
13665 assert(cons !=
NULL);
13666 assert(var !=
NULL);
13680 assert(consdata !=
NULL);
13688 assert(pos < consdata->nquadvars);
13689 assert(consdata->quadvarterms[pos].var == var);
13691 consdata->quadvarterms[pos].lincoef += coef;
13694 consdata->ispropagated =
FALSE;
13695 consdata->ispresolved = consdata->ispresolved && !
SCIPisZero(scip, consdata->quadvarterms[pos].lincoef);
13717 assert(scip !=
NULL);
13718 assert(cons !=
NULL);
13719 assert(var !=
NULL);
13733 assert(consdata !=
NULL);
13741 assert(pos < consdata->nquadvars);
13742 assert(consdata->quadvarterms[pos].var == var);
13744 consdata->quadvarterms[pos].sqrcoef += coef;
13747 consdata->isconvex =
FALSE;
13748 consdata->isconcave =
FALSE;
13749 consdata->iscurvchecked =
FALSE;
13750 consdata->ispropagated =
FALSE;
13751 consdata->ispresolved = consdata->ispresolved && !
SCIPisZero(scip, consdata->quadvarterms[pos].sqrcoef);
13776 assert(scip !=
NULL);
13777 assert(cons !=
NULL);
13778 assert(var1 !=
NULL);
13779 assert(var2 !=
NULL);
13796 assert(consdata !=
NULL);
13802 var1pos = consdata->nquadvars-1;
13805 if( !consdata->quadvarssorted )
13810 assert(var1pos >= 0);
13813 assert(consdata->quadvarssorted);
13818 var2pos = consdata->nquadvars-1;
13821 assert(consdata->quadvarterms[var1pos].var == var1);
13822 assert(consdata->quadvarterms[var2pos].var == var2);
13838 assert(cons !=
NULL);
13839 assert(nlrow !=
NULL);
13842 assert(consdata !=
NULL);
13844 if( consdata->nlrow ==
NULL )
13848 assert(consdata->nlrow !=
NULL);
13849 *nlrow = consdata->nlrow;
13860 assert(cons !=
NULL);
13874 assert(cons !=
NULL);
13888 assert(cons !=
NULL);
13901 assert(cons !=
NULL);
13915 assert(cons !=
NULL);
13927 assert(cons !=
NULL);
13946 assert(cons !=
NULL);
13948 assert(var !=
NULL);
13949 assert(pos !=
NULL);
13962 assert(cons !=
NULL);
13976 assert(cons !=
NULL);
13988 assert(cons !=
NULL);
14000 assert(cons !=
NULL);
14014 assert(cons !=
NULL);
14017 assert(consdata !=
NULL);
14022 return consdata->linvar_maydecrease;
14033 assert(cons !=
NULL);
14036 assert(consdata !=
NULL);
14041 return consdata->linvar_mayincrease;
14050 assert(cons !=
NULL);
14065 assert(cons !=
NULL);
14069 assert(determined);
14082 assert(cons !=
NULL);
14086 assert(determined);
14103 assert(scip !=
NULL);
14104 assert(cons !=
NULL);
14105 assert(violation !=
NULL);
14108 assert(conshdlr !=
NULL);
14114 assert(consdata !=
NULL);
14116 *violation =
MAX(consdata->lhsviol, consdata->rhsviol);
14135 assert(scip !=
NULL);
14136 assert(cons !=
NULL);
14139 assert(consdata !=
NULL);
14142 for( i = 0; i < consdata->nquadvars; ++i )
14144 if( consdata->quadvarterms[i].sqrcoef == 0.0 )
14147 var1 = consdata->quadvarterms[i].var;
14148 assert(var1 !=
NULL);
14154 for( i = 0; i < consdata->nbilinterms; ++i )
14156 var1 = consdata->bilinterms[i].var1;
14157 var2 = consdata->bilinterms[i].var2;
14159 assert(var1 !=
NULL);
14160 assert(var2 !=
NULL);
14195 assert(scip !=
NULL);
14196 assert(cons !=
NULL);
14197 assert(nlpi !=
NULL);
14198 assert(nlpiprob !=
NULL);
14199 assert(scipvar2nlpivar !=
NULL);
14202 assert(consdata !=
NULL);
14205 nlininds = consdata->nlinvars;
14206 nquadelems = consdata->nbilinterms;
14207 for( j = 0; j < consdata->nquadvars; ++j )
14209 if( consdata->quadvarterms[j].sqrcoef != 0.0 )
14211 if( consdata->quadvarterms[j].lincoef != 0.0 )
14224 for( j = 0; j < consdata->nlinvars; ++j )
14226 linvals[j] = consdata->lincoefs[j];
14231 lincnt = consdata->nlinvars;
14236 if( nquadelems > 0 )
14242 for( j = 0; j < consdata->nquadvars; ++j )
14246 if( consdata->quadvarterms[j].lincoef != 0.0 )
14248 assert(lininds !=
NULL);
14249 assert(linvals !=
NULL);
14250 lininds[lincnt] = idx1;
14251 linvals[lincnt] = consdata->quadvarterms[j].lincoef;
14255 if( consdata->quadvarterms[j].sqrcoef != 0.0 )
14257 assert(quadcnt < nquadelems);
14258 assert(quadelems !=
NULL);
14259 quadelems[quadcnt].
idx1 = idx1;
14260 quadelems[quadcnt].
idx2 = idx1;
14261 quadelems[quadcnt].
coef = consdata->quadvarterms[j].sqrcoef;
14265 for( l = 0; l < consdata->quadvarterms[j].nadjbilin; ++l )
14267 othervar = consdata->bilinterms[consdata->quadvarterms[j].adjbilin[l]].var2;
14269 if( othervar == consdata->quadvarterms[j].var )
14272 assert(quadcnt < nquadelems);
14273 assert(quadelems !=
NULL);
14276 quadelems[quadcnt].
idx1 =
MIN(idx1, idx2);
14277 quadelems[quadcnt].
idx2 =
MAX(idx1, idx2);
14278 quadelems[quadcnt].
coef = consdata->bilinterms[consdata->quadvarterms[j].adjbilin[l]].coef;
14283 assert(quadcnt == nquadelems);
14284 assert(lincnt == nlininds);
14289 &consdata->lhs, &consdata->rhs,
14290 &nlininds, &lininds, &linvals ,
14291 &nquadelems, &quadelems,
14314 assert(scip !=
NULL);
14315 assert(cons !=
NULL);
14326 SCIPerrorMessage(
"method may only be called during problem creation stage for original constraints\n");
14331 assert(consdata !=
NULL);
14339 if( !
SCIPisLE(scip, lhs, consdata->rhs) )
14342 consdata->lhs = lhs;
14359 assert(scip !=
NULL);
14360 assert(cons !=
NULL);
14371 SCIPerrorMessage(
"method may only be called during problem creation stage for original constraints\n");
14376 assert(consdata !=
NULL);
14384 if( !
SCIPisLE(scip, consdata->lhs, rhs) )
14387 consdata->rhs = rhs;
14403 assert(scip !=
NULL);
14404 assert(cons !=
NULL);
14405 assert(feasibility !=
NULL);
14416 assert(consdata !=
NULL);
14421 *feasibility = (consdata->rhs - consdata->activity);
14423 *feasibility = (consdata->activity - consdata->lhs);
14428 *feasibility =
MIN( consdata->rhs - consdata->activity, consdata->activity - consdata->lhs );
14445 assert(scip !=
NULL);
14446 assert(cons !=
NULL);
14447 assert(activity !=
NULL);
14458 assert(consdata !=
NULL);
14460 *activity = consdata->activity;
14481 assert(scip !=
NULL);
14482 assert(cons !=
NULL);
14483 assert(var !=
NULL);
14493 SCIPerrorMessage(
"method may only be called during problem creation stage for original constraints and variables\n");
14498 assert(consdata !=
NULL);
14502 for( i = 0; i < consdata->nquadvars; ++i )
14504 if( var == consdata->quadvarterms[i].var )
14508 consdata->quadvarterms[i].lincoef = 0.0;
14511 consdata->quadvarsmerged =
FALSE;
14514 consdata->quadvarterms[i].lincoef = coef;
14522 while( i < consdata->nlinvars )
14524 if( var == consdata->linvars[i] )
14549 consdata->ispropagated =
FALSE;
14550 consdata->ispresolved =
FALSE;
14574 assert(scip !=
NULL);
14575 assert(cons !=
NULL);
14576 assert(var !=
NULL);
14587 SCIPerrorMessage(
"method may only be called during problem creation stage for original constraints and variables\n");
14592 assert(consdata !=
NULL);
14596 for( i = 0; i < consdata->nquadvars; ++i )
14598 if( var == consdata->quadvarterms[i].var )
14600 consdata->quadvarterms[i].sqrcoef = (found ||
SCIPisZero(scip, coef)) ? 0.0 : coef;
14612 consdata->isconvex =
FALSE;
14613 consdata->isconcave =
FALSE;
14614 consdata->iscurvchecked =
FALSE;
14615 consdata->ispropagated =
FALSE;
14616 consdata->ispresolved =
FALSE;
14622 consdata->quadvarsmerged =
FALSE;
14644 assert(scip !=
NULL);
14645 assert(cons !=
NULL);
14646 assert(var1 !=
NULL);
14647 assert(var2 !=
NULL);
14658 SCIPerrorMessage(
"method may only be called during problem creation stage for original constraints and variables\n");
14669 assert(consdata !=
NULL);
14673 for( i = 0; i < consdata->nbilinterms; ++i )
14675 if( (consdata->bilinterms[i].var1 == var1 && consdata->bilinterms[i].var2 == var2) ||
14676 (consdata->bilinterms[i].var1 == var2 && consdata->bilinterms[i].var2 == var1) )
14680 consdata->bilinterms[i].coef = 0.0;
14683 consdata->bilinmerged =
FALSE;
14686 consdata->bilinterms[i].coef = coef;
14698 consdata->isconvex =
FALSE;
14699 consdata->isconcave =
FALSE;
14700 consdata->iscurvchecked =
FALSE;
14701 consdata->ispropagated =
FALSE;
14702 consdata->ispresolved =
FALSE;
14721 assert(scip !=
NULL);
14722 assert(rowprep !=
NULL);
14727 (*rowprep)->sidetype = sidetype;
14728 (*rowprep)->local = local;
14739 assert(scip !=
NULL);
14740 assert(rowprep !=
NULL);
14741 assert(*rowprep !=
NULL);
14755 assert(scip !=
NULL);
14756 assert(target !=
NULL);
14757 assert(source !=
NULL);
14784 assert(scip !=
NULL);
14785 assert(rowprep !=
NULL);
14810 assert(scip !=
NULL);
14811 assert(rowprep !=
NULL);
14813 if( *rowprep->
name !=
'\0' )
14818 for( i = 0; i < rowprep->
nvars; ++i )
14834 assert(scip !=
NULL);
14835 assert(rowprep !=
NULL);
14836 assert(var !=
NULL);
14860 assert(scip !=
NULL);
14861 assert(rowprep !=
NULL);
14862 assert(vars !=
NULL || nvars == 0);
14863 assert(coefs !=
NULL || nvars == 0);
14874 rowprep->
nvars += nvars;
14880 #undef SCIPaddRowprepSide 14881 #undef SCIPaddRowprepConstant 14890 assert(rowprep !=
NULL);
14892 rowprep->
side += side;
14904 assert(rowprep !=
NULL);
14926 activity = -rowprep->
side;
14927 for( i = 0; i < rowprep->
nvars; ++i )
14940 viol =
MAX(activity, 0.0);
14943 viol =
MAX(-activity, 0.0);
14956 if( rowprep->
nvars > 0 )
14988 assert(scip !=
NULL);
14989 assert(rowprep !=
NULL);
14991 if( rowprep->
nvars <= 1 )
15000 while( j < rowprep->nvars )
15002 if( rowprep->
vars[i] == rowprep->
vars[j] )
15010 if( rowprep->
coefs[i] == 0.0 )
15014 rowprep->
vars[i] = rowprep->
vars[j];
15022 rowprep->
vars[i+1] = rowprep->
vars[j];
15030 if( rowprep->
coefs[i] == 0.0 )
15034 rowprep->
nvars = i+1;
15046 assert(scip !=
NULL);
15047 assert(rowprep !=
NULL);
15050 switch( rowprep->
nvars )
15063 tmp1 = rowprep->
coefs[0];
15065 rowprep->
coefs[1] = tmp1;
15067 tmp2 = rowprep->
vars[0];
15068 rowprep->
vars[0] = rowprep->
vars[1];
15069 rowprep->
vars[1] = tmp2;
15079 for( i = 0; i < rowprep->
nvars; ++i )
15087 while( rowprep->
nvars > 0 && rowprep->
coefs[rowprep->
nvars-1] == 0.0 )
15117 if( rowprep->
nvars > 0 )
15123 mincoef = maxcoef = 1.0;
15129 while( maxcoef / mincoef > maxcoefrange )
15131 SCIPdebugMsg(scip,
"cut coefficients have very large range: mincoef = %g maxcoef = %g\n", mincoef, maxcoef);
15136 assert(rowprep->
nvars > 1);
15152 for( pos = 0; pos < 2; ++pos )
15154 var = rowprep->
vars[pos ? rowprep->
nvars-1 : maxcoefidx];
15155 coef = rowprep->
coefs[pos ? rowprep->
nvars-1 : maxcoefidx];
15159 assert(coef != 0.0);
15164 ref =
MAX(lb,
MIN(ub, ref));
15173 loss[pos] =
REALABS(coef) * (ref - lb);
15182 loss[pos] =
REALABS(coef) * (ub - ref);
15184 assert(loss[pos] >= 0.0);
15186 SCIPdebugMsg(scip,
"aggregating %g*<%s> %c= ... with <%s>[%g] %c= %g looses %g\n",
15198 pos = (loss[1] ==
SCIP_INVALID || loss[1] > loss[0]) ? 0 : 1;
15201 var = rowprep->
vars[pos ? rowprep->
nvars-1 : maxcoefidx];
15202 coef = rowprep->
coefs[pos ? rowprep->
nvars-1 : maxcoefidx];
15225 rowprep->
coefs[maxcoefidx] = 0.0;
15246 if( maxcoefidx > 0 )
15249 for( i = maxcoefidx; i < rowprep->
nvars; ++i )
15251 rowprep->
vars[i-maxcoefidx] = rowprep->
vars[i];
15252 rowprep->
coefs[i-maxcoefidx] = rowprep->
coefs[i];
15254 rowprep->
nvars -= maxcoefidx;
15272 assert(scip !=
NULL);
15273 assert(rowprep !=
NULL);
15274 assert(viol !=
NULL);
15281 if( *viol >= minviol )
15301 *viol = ldexp(*viol, scaleexp);
15327 if( *viol > minviol && scalefactor * *viol < minviol )
15329 assert(minviol > 0.0);
15330 assert(*viol > 0.0);
15345 *viol = ldexp(*viol, scaleexp);
15364 assert(scip !=
NULL);
15365 assert(rowprep !=
NULL);
15366 assert(viol !=
NULL);
15379 for( i = 0; i < rowprep->
nvars; ++i )
15381 coef = rowprep->
coefs[i];
15383 if( coef != roundcoef &&
SCIPisEQ(scip, coef, roundcoef) )
15388 var = rowprep->
vars[i];
15390 if( rowprep->
local )
15395 if( rowprep->
local )
15403 SCIPdebugMsg(scip,
"var <%s> [%g,%g] has almost integral coef %.20g, round coefficient to %g and add constant %g\n",
15413 SCIPdebugMsg(scip,
"var <%s> [%g,%g] has almost integral coef %.20g, round coefficient to %g without relaxing side (!)\n",
15416 rowprep->
coefs[i] = coef = roundcoef;
15422 while( rowprep->
nvars > 0 && rowprep->
coefs[rowprep->
nvars-1] == 0.0 )
15445 rowprep->
side = 0.0;
15478 assert(maxcoefrange > 1.0);
15484 if( rowprep->
nvars > 0 )
15499 assert(myviol >= 0.0);
15502 if( rowprep->
nvars > 0 )
15508 SCIPinfoMessage(scip,
NULL,
"improved coefrange to %g, viol %g: ", maxcoef / mincoef, myviol);
15530 SCIPinfoMessage(scip,
NULL,
"adjusted almost-integral coefs and sides, viol %g: ", myviol);
15535 if( coefrange !=
NULL )
15537 if( rowprep->
nvars > 0 )
15568 assert(rowprep !=
NULL);
15569 assert(factor > 0.0);
15572 v = frexp(factor, &expon);
15578 for( i = 0; i < rowprep->
nvars; ++i )
15579 rowprep->
coefs[i] = ldexp(rowprep->
coefs[i], expon);
15582 rowprep->
side = ldexp(rowprep->
side, expon);
15595 assert(scip !=
NULL);
15596 assert(row !=
NULL);
15597 assert(rowprep !=
NULL);
15617 assert(scip !=
NULL);
15618 assert(row !=
NULL);
15619 assert(rowprep !=
NULL);
SCIP_RETCODE SCIPaddLinearCoefsToNlRow(SCIP *scip, SCIP_NLROW *nlrow, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
enum SCIP_Result SCIP_RESULT
static void rowprepCleanupImproveCoefrange(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_SOL *sol, SCIP_Real maxcoefrange)
SCIP_VAR ** SCIPgetLinearVarsQuadratic(SCIP *scip, SCIP_CONS *cons)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
SCIP_RETCODE SCIPchgSquareCoefQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
SCIP_RETCODE SCIPincludeConshdlrQuadratic(SCIP *scip)
enum SCIP_BoundType SCIP_BOUNDTYPE
void SCIPintervalDivScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
int SCIPgetNIntVars(SCIP *scip)
SCIP_RETCODE SCIPchgBilinCoefQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var1, SCIP_VAR *var2, SCIP_Real coef)
static SCIP_Bool conshdlrdataHasUpgrade(SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata, SCIP_DECL_QUADCONSUPGD((*quadconsupgd)), const char *conshdlrname)
SCIP_Bool SCIPisFeasZero(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisIpoptAvailableIpopt(void)
#define ROWPREP_SCALEUP_VIOLNONZERO
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
static SCIP_RETCODE mergeAndCleanLinearVars(SCIP *scip, SCIP_CONS *cons)
static SCIP_Bool generateCutLTIgenMulCoeff(SCIP *scip, SCIP_Real x1, SCIP_Real y1_, SCIP_Real x2, SCIP_Real y2, SCIP_Bool whichuse, SCIP_Real *cx, SCIP_Real *cy, SCIP_Real *cw)
SCIP_Real SCIPvarGetWorstBoundLocal(SCIP_VAR *var)
void SCIPintervalMulSup(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
static SCIP_RETCODE consdataCreate(SCIP *scip, SCIP_CONSDATA **consdata, SCIP_Real lhs, SCIP_Real rhs, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadvars, SCIP_QUADVARTERM *quadvarterms, int nbilinterms, SCIP_BILINTERM *bilinterms, SCIP_Bool capturevars)
SCIP_RETCODE SCIPsetConshdlrDelete(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSDELETE((*consdelete)))
static SCIP_RETCODE propagateBoundsQuadVar(SCIP *scip, SCIP_CONS *cons, SCIP_Real intervalinfty, SCIP_VAR *var, SCIP_Real a, SCIP_INTERVAL b, SCIP_INTERVAL rhs, SCIP_RESULT *result, int *nchgbds)
SCIP_EXPRGRAPH * SCIPgetExprgraphNonlinear(SCIP *scip, SCIP_CONSHDLR *conshdlr)
static SCIP_DECL_CONSENFOPS(consEnfopsQuadratic)
SCIP_RETCODE SCIPincludeNonlinconsUpgrade(SCIP *scip, SCIP_DECL_NONLINCONSUPGD((*nonlinconsupgd)), SCIP_DECL_EXPRGRAPHNODEREFORM((*nodereform)), int priority, SCIP_Bool active, const char *conshdlrname)
#define ROWPREP_SCALEDOWN_MINCOEF
static void consdataMoveLinearVar(SCIP_CONSDATA *consdata, int oldpos, int newpos)
SCIP_Real SCIPfeastol(SCIP *scip)
SCIP_Bool SCIPconsIsEnabled(SCIP_CONS *cons)
SCIP_Real SCIPgetRowprepViolation(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_SOL *sol, char scaling)
SCIP_Bool SCIPintervalIsEmpty(SCIP_Real infinity, SCIP_INTERVAL operand)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
static SCIP_RETCODE consdataSortBilinTerms(SCIP *scip, SCIP_CONSDATA *consdata)
primal heuristic that tries a given solution
SCIP_Bool SCIPisNLPConstructed(SCIP *scip)
SCIP_RETCODE SCIPaddQuadVarQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real lincoef, SCIP_Real sqrcoef)
SCIP_RETCODE SCIPtightenVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened)
static void rowprepCleanupScaleup(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_Real *viol, SCIP_Real minviol)
SCIP_NODE * SCIPgetCurrentNode(SCIP *scip)
SCIP_STAGE SCIPgetStage(SCIP *scip)
#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)
static SCIP_RETCODE separatePoint(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, int nusefulconss, SCIP_SOL *sol, SCIP_Real minefficacy, SCIP_Bool inenforcement, SCIP_RESULT *result, SCIP_Real *bestefficacy)
SCIP_RETCODE SCIPsetConshdlrTrans(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSTRANS((*constrans)))
#define CONSHDLR_PRESOLTIMING
static SCIP_DECL_CONSSEPASOL(consSepasolQuadratic)
void SCIPaddConstantQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_Real constant)
static SCIP_RETCODE consdataEnsureQuadVarTermsSize(SCIP *scip, SCIP_CONSDATA *consdata, int num)
static SCIP_DECL_CONSINITSOL(consInitsolQuadratic)
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Constraint handler for variable bound constraints .
SCIP_Bool SCIPisRelEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPaddSquareCoefQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
static SCIP_RETCODE propagateBoundsBilinearTerm(SCIP *scip, SCIP_CONS *cons, SCIP_Real intervalinfty, SCIP_VAR *x, SCIP_Real xsqrcoef, SCIP_Real xlincoef, SCIP_VAR *y, SCIP_Real ysqrcoef, SCIP_Real ylincoef, SCIP_Real bilincoef, SCIP_INTERVAL rhs, SCIP_RESULT *result, int *nchgbds)
#define ROWPREP_SCALEDOWN_MINMAXCOEF
SCIP_RETCODE SCIPcatchVarEvent(SCIP *scip, SCIP_VAR *var, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
SCIP_RETCODE SCIPchgRhsQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_Real rhs)
int SCIPexprgraphGetNodeNChildren(SCIP_EXPRGRAPHNODE *node)
#define SCIPallocClearBufferArray(scip, ptr, num)
SCIP_Real SCIPintervalNegateReal(SCIP_Real x)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_RETCODE SCIPincludeQuadconsUpgrade(SCIP *scip, SCIP_DECL_QUADCONSUPGD((*quadconsupgd)), int priority, SCIP_Bool active, const char *conshdlrname)
SCIP_RETCODE SCIPsetConshdlrGetVars(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSGETVARS((*consgetvars)))
static SCIP_DECL_SORTINDCOMP(quadVarTermComp)
static SCIP_RETCODE replaceQuadVarTermPos(SCIP *scip, SCIP_CONS *cons, int pos, SCIP_VAR *var, SCIP_Real coef, SCIP_Real offset)
#define SCIP_DECL_CONSINITPRE(x)
#define CONSHDLR_DELAYPROP
SCIP_Bool SCIPvarIsInitial(SCIP_VAR *var)
void SCIPsortPtrPtrReal(void **ptrarray1, void **ptrarray2, SCIP_Real *realarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
SCIP_RETCODE SCIPaddRowprepTerms(SCIP *scip, SCIP_ROWPREP *rowprep, int nvars, SCIP_VAR **vars, SCIP_Real *coefs)
SCIP_RETCODE SCIPsetConshdlrEnforelax(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSENFORELAX((*consenforelax)))
#define SCIPallocClearBlockMemoryArray(scip, ptr, num)
SCIP_RETCODE SCIPresetConsAge(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE getImpliedBounds(SCIP *scip, SCIP_VAR *x, SCIP_Bool xval, SCIP_VAR *y, SCIP_INTERVAL *resultant)
SCIP_RETCODE SCIPdelCons(SCIP *scip, SCIP_CONS *cons)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
SCIP_VAR ** SCIPvarGetMultaggrVars(SCIP_VAR *var)
int SCIProwGetNNonz(SCIP_ROW *row)
SCIP_RETCODE SCIPcleanupRowprep(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_SOL *sol, SCIP_Real maxcoefrange, SCIP_Real minviol, SCIP_Real *coefrange, SCIP_Real *viol)
static SCIP_RETCODE generateCutNonConvex(SCIP *scip, SCIP_CONS *cons, SCIP_SIDETYPE violside, SCIP_Real *ref, SCIP_ROWPREP *rowprep, SCIP_Bool *success)
#define CONSHDLR_PROPFREQ
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
static SCIP_DECL_CONSSEPALP(consSepalpQuadratic)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
internal methods for NLPI solver interfaces
SCIP_RETCODE SCIPaddRowprepTerm(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_VAR *var, SCIP_Real coef)
static SCIP_RETCODE lockLinearVariable(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
SCIP_Bool SCIPconsIsAdded(SCIP_CONS *cons)
SCIP_RETCODE SCIPnlpiCreateProblem(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM **problem, const char *name)
static SCIP_RETCODE catchVarEvents(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, 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_NLPSOLSTAT SCIPgetNLPSolstat(SCIP *scip)
const char * SCIProwGetName(SCIP_ROW *row)
SCIP_RETCODE SCIPgetTransformedVar(SCIP *scip, SCIP_VAR *var, SCIP_VAR **transvar)
static void consdataUpdateLinearActivityUbChange(SCIP *scip, SCIP_CONSDATA *consdata, SCIP_Real coef, SCIP_Real oldbnd, SCIP_Real newbnd)
static SCIP_RETCODE dropLinearVarEvents(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons, int linvarpos)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
static SCIP_RETCODE addQuadVarTerm(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real lincoef, SCIP_Real sqrcoef)
SCIP_Bool SCIPisFeasNegative(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPvarGetBestBoundLocal(SCIP_VAR *var)
static SCIP_DECL_CONSENABLE(consEnableQuadratic)
static SCIP_RETCODE generateCut(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_Real *ref, SCIP_SOL *sol, SCIP_SIDETYPE violside, SCIP_ROW **row, SCIP_Real *efficacy, SCIP_Bool checkcurvmultivar, SCIP_Real minefficacy)
static void consdataUpdateLinearActivityLbChange(SCIP *scip, SCIP_CONSDATA *consdata, SCIP_Real coef, SCIP_Real oldbnd, SCIP_Real newbnd)
SCIP_Bool SCIPisFeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_DECL_NONLINCONSUPGD(nonlinconsUpgdQuadratic)
SCIP_Real SCIPgetRelaxFeastolFactor(SCIP *scip)
#define CONSHDLR_MAXPREROUNDS
SCIP_RETCODE SCIPchgLinearCoefQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
void SCIPintervalSetRoundingMode(SCIP_ROUNDMODE roundmode)
static SCIP_DECL_CONSEXITPRE(consExitpreQuadratic)
SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr)
SCIP_Real SCIProwGetLhs(SCIP_ROW *row)
SCIP_Real SCIPadjustedVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real ub)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
static SCIP_Real getGradientMaxElement(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol)
static SCIP_RETCODE evaluateGauge(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *refsol, SCIP_Real *gaugeval, SCIP_Bool *success)
static SCIP_RETCODE presolveSolve(SCIP *scip, SCIP_CONS *cons, SCIP_RESULT *result, SCIP_Bool *redundant, int *naggrvars)
SCIP_RETCODE SCIPnlpiAddConstraints(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int nconss, const SCIP_Real *lhss, const SCIP_Real *rhss, const int *nlininds, int *const *lininds, SCIP_Real *const *linvals, const int *nquadelems, SCIP_QUADELEM *const *quadelems, int *const *exprvaridxs, SCIP_EXPRTREE *const *exprtrees, const char **names)
int SCIPgetSubscipDepth(SCIP *scip)
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)
#define CONSHDLR_SEPAPRIORITY
int SCIPsnprintf(char *t, int len, const char *s,...)
SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPunmarkConsPropagate(SCIP *scip, SCIP_CONS *cons)
enum SCIP_Retcode SCIP_RETCODE
SCIP_RETCODE SCIPsolveNLP(SCIP *scip)
static SCIP_RETCODE generateCutConvex(SCIP *scip, SCIP_CONS *cons, SCIP_SIDETYPE violside, SCIP_Real *ref, SCIP_ROWPREP *rowprep, SCIP_Bool *success)
SCIP_RETCODE SCIPaddVarLocks(SCIP *scip, SCIP_VAR *var, int nlocksdown, int nlocksup)
SCIP_Bool SCIPconsIsStickingAtNode(SCIP_CONS *cons)
#define SCIP_PRESOLTIMING_EXHAUSTIVE
static void consdataFindUnlockedLinearVar(SCIP *scip, SCIP_CONSDATA *consdata)
static void checkCurvatureEasy(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *determined, SCIP_Bool checkmultivariate)
void SCIPintervalSetBounds(SCIP_INTERVAL *resultant, SCIP_Real inf, SCIP_Real sup)
SCIP_Real SCIPgetRhsNonlinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPconsIsTransformed(SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateConsBasicQuadratic2(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadvarterms, SCIP_QUADVARTERM *quadvarterms, int nbilinterms, SCIP_BILINTERM *bilinterms, SCIP_Real lhs, SCIP_Real rhs)
static GRAPHNODE ** active
SCIP_RETCODE SCIPtightenVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened)
static SCIP_RETCODE removeBilinearTermsPos(SCIP *scip, SCIP_CONS *cons, int nterms, int *termposs)
#define SCIPfreeBlockMemory(scip, ptr)
void SCIPaddBilinLinearization(SCIP *scip, SCIP_Real bilincoef, SCIP_Real refpointx, SCIP_Real refpointy, SCIP_Real *lincoefx, SCIP_Real *lincoefy, SCIP_Real *linconstant, 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_Real SCIPselectSimpleValue(SCIP_Real lb, SCIP_Real ub, SCIP_Longint maxdnom)
static SCIP_RETCODE presolveTryAddAND(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, int *naddconss)
SCIP_EVENTHDLR * SCIPfindEventhdlr(SCIP *scip, const char *name)
Constraint handler for AND constraints, .
SCIP_RETCODE SCIPnlpiGetSolution(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_Real **primalvalues, SCIP_Real **consdualvalues, SCIP_Real **varlbdualvalues, SCIP_Real **varubdualvalues)
SCIP_RETCODE SCIPwriteVarsPolynomial(SCIP *scip, FILE *file, SCIP_VAR ***monomialvars, SCIP_Real **monomialexps, SCIP_Real *monomialcoefs, int *monomialnvars, int nmonomials, SCIP_Bool type)
static SCIP_RETCODE mergeAndCleanBilinearTerms(SCIP *scip, SCIP_CONS *cons)
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_RETCODE chgLinearCoefPos(SCIP *scip, SCIP_CONS *cons, int pos, SCIP_Real newcoef)
static SCIP_RETCODE propagateBoundsCons(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_RESULT *result, int *nchgbds, SCIP_Bool *redundant)
SCIP_RETCODE SCIPcreateLPSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
static SCIP_DECL_CONSENFOLP(consEnfolpQuadratic)
#define SCIPfreeBufferArray(scip, ptr)
SCIP_Real SCIPadjustedVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real lb)
SCIP_Bool SCIPvarIsRemovable(SCIP_VAR *var)
#define SCIPallocBlockMemory(scip, ptr)
#define SCIPdebugPrintCons(x, y, z)
static SCIP_RETCODE dropQuadVarEvents(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons, int quadvarpos)
SCIP_RETCODE SCIPcreateConsBasicQuadratic(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadterms, SCIP_VAR **quadvars1, SCIP_VAR **quadvars2, SCIP_Real *quadcoefs, SCIP_Real lhs, SCIP_Real rhs)
SCIP_Bool SCIPconsIsRemovable(SCIP_CONS *cons)
#define SCIP_EVENTTYPE_BOUNDCHANGED
SCIP_RETCODE SCIPsetConshdlrInitlp(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINITLP((*consinitlp)))
static SCIP_RETCODE registerBranchingCandidatesViolation(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, int *nnotify)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
#define SCIPdebugMsgPrint
#define ROWPREP_SCALEUP_MAXMAXCOEF
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)
static void consdataUpdateLinearActivity(SCIP *scip, SCIP_CONSDATA *consdata, SCIP_Real intervalinfty)
SCIP_RETCODE SCIPsetConshdlrParse(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPARSE((*consparse)))
SCIP_Real SCIPgetLhsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPconsIsActive(SCIP_CONS *cons)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
int SCIPgetNContVars(SCIP *scip)
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)
SCIP_Real SCIPepsilon(SCIP *scip)
static SCIP_RETCODE lockQuadraticVariable(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
#define SCIP_PRESOLTIMING_FAST
SCIP_Real SCIPgetRowMaxCoef(SCIP *scip, SCIP_ROW *row)
SCIP_RETCODE SCIPaddLinearVarQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
void SCIPintervalSolveUnivariateQuadExpression(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL sqrcoeff, SCIP_INTERVAL lincoeff, SCIP_INTERVAL rhs)
SCIP_RETCODE SCIPcreateConsQuadratic(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadterms, SCIP_VAR **quadvars1, SCIP_VAR **quadvars2, SCIP_Real *quadcoefs, 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)
static SCIP_RETCODE unlockQuadraticVariable(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
int SCIPgetNQuadVarTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPconsIsOriginal(SCIP_CONS *cons)
int SCIPnlrowGetNQuadElems(SCIP_NLROW *nlrow)
SCIP_RETCODE SCIPcreateConsVarbound(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *var, SCIP_VAR *vbdvar, SCIP_Real vbdcoef, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
#define SCIP_EVENTTYPE_LBCHANGED
const char * SCIPgetProbName(SCIP *scip)
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
static SCIP_RETCODE registerBranchingCandidatesGap(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, int *nnotify)
int SCIPgetNBilinTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPnlpiSolve(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem)
SCIP_RETCODE SCIPheurPassSolTrySol(SCIP *scip, SCIP_HEUR *heur, SCIP_SOL *sol)
SCIP_EXPROP SCIPexprgraphGetNodeOperator(SCIP_EXPRGRAPHNODE *node)
static SCIP_RETCODE consdataSortQuadVarTerms(SCIP *scip, SCIP_CONSDATA *consdata)
#define CONSHDLR_EAGERFREQ
SCIP_RETCODE SCIPnlpiAddVars(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int nvars, const SCIP_Real *lbs, const SCIP_Real *ubs, const char **varnames)
SCIP_RETCODE SCIPchgVarType(SCIP *scip, SCIP_VAR *var, SCIP_VARTYPE vartype, SCIP_Bool *infeasible)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
SCIP_RETCODE SCIPsetConshdlrInitsol(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINITSOL((*consinitsol)))
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
SCIP_Bool SCIPisConcaveQuadratic(SCIP *scip, SCIP_CONS *cons)
#define SCIP_EVENTTYPE_SOLFOUND
void SCIPfreeRowprep(SCIP *scip, SCIP_ROWPREP **rowprep)
SCIP_RETCODE SCIPchgLhsQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_Real lhs)
static SCIP_RETCODE checkCurvature(SCIP *scip, SCIP_CONS *cons, SCIP_Bool checkmultivariate)
SCIP_Real SCIPeventGetNewbound(SCIP_EVENT *event)
SCIP_RETCODE SCIPcreateSolCopy(SCIP *scip, SCIP_SOL **sol, SCIP_SOL *sourcesol)
SCIP_Bool SCIPisPresolveFinished(SCIP *scip)
SCIP_Bool SCIPconsIsLocked(SCIP_CONS *cons)
SCIP_VAR ** SCIPnlrowGetQuadVars(SCIP_NLROW *nlrow)
static SCIP_RETCODE presolveTryAddLinearReform(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, int *naddconss)
static SCIP_RETCODE generateCutFactorableDo(SCIP *scip, SCIP_CONS *cons, SCIP_Real *ref, SCIP_Real multleft, SCIP_Real *coefleft, SCIP_Real multright, SCIP_Real *coefright, SCIP_Real rightminactivity, SCIP_Real rightmaxactivity, SCIP_Real rhs, SCIP_ROWPREP *rowprep, SCIP_Bool *success)
void SCIPmarkRowNotRemovableLocal(SCIP *scip, SCIP_ROW *row)
SCIP_RETCODE SCIPsetConshdlrCopy(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), SCIP_DECL_CONSCOPY((*conscopy)))
SCIP_RETCODE SCIPaddLinearConsToNlpHeurSubNlp(SCIP *scip, SCIP_HEUR *heur, SCIP_Bool addcombconss, SCIP_Bool addcontconss)
static SCIP_DECL_CONSEXIT(consExitQuadratic)
const char * SCIPheurGetName(SCIP_HEUR *heur)
struct SCIP_QuadVarEventData SCIP_QUADVAREVENTDATA
SCIP_Bool SCIPintervalIsEntire(SCIP_Real infinity, SCIP_INTERVAL operand)
void SCIPaddBilinMcCormick(SCIP *scip, SCIP_Real bilincoef, SCIP_Real lbx, SCIP_Real ubx, SCIP_Real refpointx, SCIP_Real lby, SCIP_Real uby, SCIP_Real refpointy, SCIP_Bool overestimate, SCIP_Real *lincoefx, SCIP_Real *lincoefy, SCIP_Real *linconstant, SCIP_Bool *success)
SCIP_HEUR * SCIPfindHeur(SCIP *scip, const char *name)
SCIP_RETCODE SCIPfindQuadVarTermQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, int *pos)
SCIP_RETCODE SCIPensureRowprepSize(SCIP *scip, SCIP_ROWPREP *rowprep, int size)
static void propagateBoundsGetQuadActivity(SCIP *scip, SCIP_CONSDATA *consdata, SCIP_Real intervalinfty, SCIP_Real *minquadactivity, SCIP_Real *maxquadactivity, int *minactivityinf, int *maxactivityinf, SCIP_INTERVAL *quadactcontr)
static SCIP_RETCODE addLinearizationCuts(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *ref, SCIP_Bool *separatedlpsol, SCIP_Real minefficacy)
SCIP_RETCODE SCIPcreateConsAnd(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *resvar, int nvars, SCIP_VAR **vars, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
interval arithmetics for provable bounds
static SCIP_RETCODE removeFixedVariables(SCIP *scip, SCIP_CONS *cons)
void SCIPintervalSetEmpty(SCIP_INTERVAL *resultant)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
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_RETCODE SCIPdelConsLocal(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPintervalGetInf(SCIP_INTERVAL interval)
static SCIP_DECL_CONSDELETE(consDeleteQuadratic)
static SCIP_DECL_CONSPARSE(consParseQuadratic)
SCIP_Bool SCIProwIsLocal(SCIP_ROW *row)
SCIP_RETCODE SCIPreleaseNlRow(SCIP *scip, SCIP_NLROW **nlrow)
static SCIP_RETCODE presolveUpgrade(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_Bool *upgraded, int *nupgdconss, int *naddconss, SCIP_PRESOLTIMING presoltiming)
SCIP_RETCODE SCIPgetProbvarSum(SCIP *scip, SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
static SCIP_RETCODE catchQuadVarEvents(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons, int quadvarpos)
SCIP_Real * SCIPgetCoefsLinearVarsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIPInterval sqrt(const SCIPInterval &x)
#define SCIPfreeBufferArrayNull(scip, ptr)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
int SCIPgetLinvarMayDecreaseQuadratic(SCIP *scip, SCIP_CONS *cons)
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_CONSCHECK(consCheckQuadratic)
const char * SCIPconsGetName(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsPropagated(SCIP_CONS *cons)
#define SCIP_EVENTTYPE_IMPLADDED
static SCIP_DECL_CONSPRESOL(consPresolQuadratic)
void SCIPaddRowprepSide(SCIP_ROWPREP *rowprep, SCIP_Real side)
struct SCIP_EventData SCIP_EVENTDATA
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_RETCODE SCIPsetConshdlrFree(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSFREE((*consfree)))
static SCIP_DECL_CONSTRANS(consTransQuadratic)
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
constraint handler for quadratic constraints
SCIP_CONSHDLRDATA * SCIPconshdlrGetData(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPcreateRowprep(SCIP *scip, SCIP_ROWPREP **rowprep, SCIP_SIDETYPE sidetype, SCIP_Bool local)
#define CONSHDLR_CHECKPRIORITY
SCIP_RETCODE SCIPmarkConsPropagate(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE registerBranchingCandidates(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, int *nnotify)
SCIP_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
SCIP_Real SCIPgetSolTransObj(SCIP *scip, SCIP_SOL *sol)
int SCIPgetNNlpis(SCIP *scip)
SCIP_RETCODE SCIPsetNLPInitialGuessSol(SCIP *scip, SCIP_SOL *sol)
SCIP_RETCODE SCIPgetNlRowQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_NLROW **nlrow)
SCIP_RETCODE SCIPcreateChild(SCIP *scip, SCIP_NODE **node, SCIP_Real nodeselprio, SCIP_Real estimate)
SCIP_QUADELEM * SCIPnlrowGetQuadElems(SCIP_NLROW *nlrow)
#define SCIP_EVENTTYPE_LBTIGHTENED
unsigned int SCIP_PRESOLTIMING
static SCIP_RETCODE disaggregate(SCIP *scip, SCIP_CONS *cons, SCIP_CONSDATA *consdata, int *naddconss, int *ndelconss, SCIP_Bool *success)
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define CONSHDLR_ENFOPRIORITY
SCIP_Real SCIPvarGetMultaggrConstant(SCIP_VAR *var)
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)
static void rowprepCleanupScaledown(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_Real *viol, SCIP_Real minviol)
#define SCIPdebugGetSolVal(scip, var, val)
SCIP_RETCODE SCIPaddCut(SCIP *scip, SCIP_SOL *sol, SCIP_ROW *cut, SCIP_Bool forcecut, SCIP_Bool *infeasible)
static SCIP_RETCODE rowprepCleanupSortTerms(SCIP *scip, SCIP_ROWPREP *rowprep)
struct SCIP_ConsData SCIP_CONSDATA
SCIP_BILINTERM * SCIPgetBilinTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
#define SCIP_EVENTTYPE_BOUNDTIGHTENED
SCIP_RETCODE LapackDsyev(SCIP_Bool computeeigenvectors, int N, SCIP_Real *a, SCIP_Real *w)
SCIP_COL ** SCIProwGetCols(SCIP_ROW *row)
SCIP_NLPSOLSTAT SCIPnlpiGetSolstat(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem)
SCIP_RETCODE SCIPnlpiSetObjective(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int nlins, const int *lininds, const SCIP_Real *linvals, int nquadelems, const SCIP_QUADELEM *quadelems, const int *exprvaridxs, const SCIP_EXPRTREE *exprtree, const SCIP_Real constant)
#define SCIP_EVENTTYPE_UBCHANGED
SCIP_Bool SCIPhasPrimalRay(SCIP *scip)
void SCIPaddSquareSecant(SCIP *scip, SCIP_Real sqrcoef, SCIP_Real lb, SCIP_Real ub, SCIP_Real refpoint, SCIP_Real *lincoef, SCIP_Real *linconstant, SCIP_Bool *success)
int SCIPconshdlrGetNConss(SCIP_CONSHDLR *conshdlr)
static SCIP_RETCODE consdataEnsureAdjBilinSize(SCIP *scip, SCIP_QUADVARTERM *quadvarterm, int num)
SCIP_Bool SCIPisHugeValue(SCIP *scip, SCIP_Real val)
static SCIP_RETCODE proposeFeasibleSolution(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, SCIP_Bool *success)
SCIP_Real SCIPgetRhsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPexprgraphGetNodeQuadraticConstant(SCIP_EXPRGRAPHNODE *node)
SCIP_RETCODE SCIPgetViolationQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Real *violation)
SCIP_Bool SCIPvarIsOriginal(SCIP_VAR *var)
SCIP_RETCODE SCIPaddBilinTermQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var1, SCIP_VAR *var2, SCIP_Real coef)
SCIP_RETCODE SCIPnlpiFreeProblem(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM **problem)
static SCIP_RETCODE computeInteriorPoint(SCIP *scip, SCIP_CONS *cons, char method, SCIP_Bool *success)
static SCIP_RETCODE propagateBoundsTightenVarUb(SCIP *scip, SCIP_CONS *cons, SCIP_Real intervalinfty, SCIP_VAR *var, SCIP_Real bnd, SCIP_RESULT *result, int *nchgbds)
#define SCIPallocBufferArray(scip, ptr, num)
SCIP_Real * SCIProwGetVals(SCIP_ROW *row)
SCIP_BOUNDTYPE * SCIPvarGetImplTypes(SCIP_VAR *var, SCIP_Bool varfixing)
#define CONSHDLR_NEEDSCONS
SCIP_VAR * SCIPeventGetVar(SCIP_EVENT *event)
static SCIP_DECL_CONSINITLP(consInitlpQuadratic)
static SCIP_DECL_CONSFREE(consFreeQuadratic)
SCIP_RETCODE SCIPcatchEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
static SCIP_RETCODE presolveDisaggregate(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, int *naddconss)
SCIP_Bool SCIPexprgraphAreAllNodeChildrenVars(SCIP_EXPRGRAPHNODE *node)
static void rowprepCleanupIntegralCoefs(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_Real *viol)
#define CONSHDLR_DELAYSEPA
static SCIP_DECL_CONSHDLRCOPY(conshdlrCopyQuadratic)
static SCIP_RETCODE registerBranchingCandidatesCentrality(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, int *nnotify)
SCIP_EVENTTYPE SCIPeventGetType(SCIP_EVENT *event)
static SCIP_RETCODE computeGauge(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
static SCIP_RETCODE generateCutFactorable(SCIP *scip, SCIP_CONS *cons, SCIP_SIDETYPE violside, SCIP_Real *ref, SCIP_ROWPREP *rowprep, SCIP_Bool *success)
static const char * paramname[]
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)
#define NONLINCONSUPGD_PRIORITY
int SCIPgetDepth(SCIP *scip)
SCIP_RETCODE SCIPnlpiSetIntPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, int ival)
constraint handler for nonlinear constraints
int SCIPvarGetNImpls(SCIP_VAR *var, SCIP_Bool varfixing)
void SCIPintervalSolveBivariateQuadExpressionAllScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_Real ax, SCIP_Real ay, SCIP_Real axy, SCIP_Real bx, SCIP_Real by, SCIP_INTERVAL rhs, SCIP_INTERVAL xbnds, SCIP_INTERVAL ybnds)
SCIP_RETCODE SCIPprintCons(SCIP *scip, SCIP_CONS *cons, FILE *file)
void SCIPmergeRowprepTerms(SCIP *scip, SCIP_ROWPREP *rowprep)
int SCIPvarGetNLocksUp(SCIP_VAR *var)
SCIP_Bool SCIPstrToRealValue(const char *str, SCIP_Real *value, char **endptr)
SCIP_NLPTERMSTAT SCIPnlpiGetTermstat(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem)
static SCIP_DECL_CONSEXITSOL(consExitsolQuadratic)
static SCIP_RETCODE replaceByLinearConstraints(SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_Bool *addedcons, SCIP_Bool *reduceddom, SCIP_Bool *infeasible)
SCIP_RETCODE SCIPaddPoolCut(SCIP *scip, SCIP_ROW *row)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
int SCIPvarCompare(SCIP_VAR *var1, SCIP_VAR *var2)
static SCIP_RETCODE generateCutLTI(SCIP *scip, SCIP_CONS *cons, SCIP_SIDETYPE violside, SCIP_Real *ref, SCIP_SOL *sol, SCIP_ROWPREP *rowprep, SCIP_Bool *success)
SCIP_RETCODE SCIPcreateEmptyRowSepa(SCIP *scip, SCIP_ROW **row, SCIP_SEPA *sepa, const char *name, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool removable)
static void consdataSortLinearVars(SCIP_CONSDATA *consdata)
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 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 SCIPdropVarEvent(SCIP *scip, SCIP_VAR *var, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
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)
SCIP_Real SCIPintervalGetSup(SCIP_INTERVAL interval)
#define BMScopyMemoryArray(ptr, source, num)
#define ROWPREP_SCALEUP_MAXSIDE
SCIP_RETCODE SCIPlockVarCons(SCIP *scip, SCIP_VAR *var, SCIP_CONS *cons, SCIP_Bool lockdown, SCIP_Bool lockup)
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
#define infty2infty(infty1, infty2, val)
SCIP_RETCODE SCIPsetConshdlrPrint(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPRINT((*consprint)))
static SCIP_RETCODE consdataFree(SCIP *scip, SCIP_CONSDATA **consdata)
#define SCIP_EVENTTYPE_UBTIGHTENED
Constraint handler for linear constraints in their most general form, .
static SCIP_RETCODE createNlRow(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE computeViolations(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, SCIP_Bool *solviolbounds, SCIP_CONS **maxviolcon)
SCIP_Bool SCIPisCutApplicable(SCIP *scip, SCIP_ROW *cut)
int SCIPvarGetMultaggrNVars(SCIP_VAR *var)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_Real * SCIPvarGetImplBounds(SCIP_VAR *var, SCIP_Bool varfixing)
#define BMSclearMemory(ptr)
static SCIP_Bool consdataCheckBilinTermsSort(SCIP_CONSDATA *consdata)
SCIP_RETCODE SCIPgetRowprepRowCons(SCIP *scip, SCIP_ROW **row, SCIP_ROWPREP *rowprep, SCIP_CONSHDLR *conshdlr)
char name[SCIP_MAXSTRLEN]
SCIP_RETCODE SCIPsetConshdlrEnable(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSENABLE((*consenable)))
void * SCIPexprgraphGetNodeVar(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node)
int SCIPgetNBinVars(SCIP *scip)
SCIP_Bool SCIPisLinearLocalQuadratic(SCIP *scip, SCIP_CONS *cons)
static void generateCutLTIcomputeCoefs(SCIP *scip, SCIP_Real xl, SCIP_Real xu, SCIP_Real x0, SCIP_Real yl, SCIP_Real yu, SCIP_Real y0_, SCIP_Real wl, SCIP_Real wu, SCIP_Real w0, SCIP_Real *cx, SCIP_Real *cy, SCIP_Real *cw, SCIP_Real *c0, SCIP_Bool *success)
static SCIP_DECL_CONSENFORELAX(consEnforelaxQuadratic)
SCIP_Bool SCIPinProbing(SCIP *scip)
static SCIP_Bool generateCutLTIfindIntersection(SCIP *scip, SCIP_Real x0, SCIP_Real y0_, SCIP_Real x1, SCIP_Real y1_, SCIP_Real wl, SCIP_Real wu, SCIP_Real *xl, SCIP_Real *yl, SCIP_Real *xu, SCIP_Real *yu)
SCIP_Real * SCIPexprgraphGetNodeQuadraticLinearCoefs(SCIP_EXPRGRAPHNODE *node)
#define ROWPREP_SCALEUP_MINVIOLFACTOR
int SCIPgetNVars(SCIP *scip)
SCIP_RETCODE SCIPcheckCurvatureQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPnodeGetEstimate(SCIP_NODE *node)
void SCIPenableNLP(SCIP *scip)
static SCIP_RETCODE registerLargeRelaxValueVariableForBranching(SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, SCIP_VAR **brvar)
SCIP_QUADVAREVENTDATA * eventdata
SCIP_VAR ** SCIPvarGetImplVars(SCIP_VAR *var, SCIP_Bool varfixing)
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
SCIP_RETCODE SCIPreleaseRow(SCIP *scip, SCIP_ROW **row)
int SCIPgetLinvarMayIncreaseQuadratic(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNLinearVarsQuadratic(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE addBilinearTerm(SCIP *scip, SCIP_CONS *cons, int var1pos, int var2pos, SCIP_Real coef)
SCIP_RETCODE SCIPcreateNLPSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
static void consdataMoveQuadVarTerm(SCIP_CONSDATA *consdata, int oldpos, int newpos)
int SCIPvarGetNLocksDown(SCIP_VAR *var)
static SCIP_RETCODE processCut(SCIP *scip, SCIP_ROW **row, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Real efficacy, SCIP_Real actminefficacy, SCIP_Bool inenforcement, SCIP_Real *bestefficacy, SCIP_RESULT *result)
void SCIPsort(int *perm, SCIP_DECL_SORTINDCOMP((*indcomp)), void *dataptr, int len)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPcopyRowprep(SCIP *scip, SCIP_ROWPREP **target, SCIP_ROWPREP *source)
static SCIP_RETCODE consdataCreateEmpty(SCIP *scip, SCIP_CONSDATA **consdata)
static SCIP_DECL_CONSGETNVARS(consGetNVarsQuadratic)
SCIP_Bool SCIPisIntegral(SCIP *scip, SCIP_Real val)
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)
void SCIPfreeParseVarsPolynomialData(SCIP *scip, SCIP_VAR ****monomialvars, SCIP_Real ***monomialexps, SCIP_Real **monomialcoefs, int **monomialnvars, int nmonomials)
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)
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
SCIP_CONSDATA * SCIPconsGetData(SCIP_CONS *cons)
SCIP_RETCODE SCIPsetConshdlrInit(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINIT((*consinit)))
SCIP_Real SCIPintervalQuadUpperBound(SCIP_Real infinity, SCIP_Real a, SCIP_INTERVAL b_, SCIP_INTERVAL x)
SCIP_RETCODE SCIPsetConshdlrExit(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSEXIT((*consexit)))
static SCIP_RETCODE dropVarEvents(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons)
static SCIP_DECL_CONSGETVARS(consGetVarsQuadratic)
#define SCIP_EVENTTYPE_FORMAT
static void rowprepCleanupSide(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_Real *viol)
static SCIP_DECL_CONSCOPY(consCopyQuadratic)
static SCIP_DECL_CONSINIT(consInitQuadratic)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
static SCIP_RETCODE unlockLinearVariable(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
void SCIPintervalSetRoundingModeUpwards(void)
static SCIP_RETCODE computeReferencePointProjection(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *refsol, SCIP_Real *ref)
SCIP_RETCODE SCIPsetConshdlrPresol(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPRESOL((*conspresol)), int maxprerounds, SCIP_PRESOLTIMING presoltiming)
NLP local search primal heuristic using sub-SCIPs.
static SCIP_RETCODE generateCutSol(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_SOL *refsol, SCIP_SIDETYPE violside, SCIP_ROW **row, SCIP_Real *efficacy, SCIP_Bool checkcurvmultivar, SCIP_Real minefficacy, char mode)
SCIP_Real SCIPgetRowLPFeasibility(SCIP *scip, SCIP_ROW *row)
SCIP_RETCODE SCIPgetFeasibilityQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Real *feasibility)
SCIP_RETCODE SCIPsortQuadVarTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPeventGetOldbound(SCIP_EVENT *event)
int SCIPscaleRowprep(SCIP_ROWPREP *rowprep, SCIP_Real factor)
SCIP_Bool SCIPisFeasPositive(SCIP *scip, SCIP_Real val)
void SCIPsortDownRealRealPtr(SCIP_Real *realarray1, SCIP_Real *realarray2, void **ptrarray, int len)
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 SCIPaggregateVars(SCIP *scip, SCIP_VAR *varx, SCIP_VAR *vary, SCIP_Real scalarx, SCIP_Real scalary, SCIP_Real rhs, SCIP_Bool *infeasible, SCIP_Bool *redundant, SCIP_Bool *aggregated)
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)
SCIP_RETCODE SCIPaddToNlpiProblemQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *nlpiprob, SCIP_HASHMAP *scipvar2nlpivar, SCIP_Bool names)
SCIP_VAR ** SCIPgetLinearVarsNonlinear(SCIP *scip, SCIP_CONS *cons)
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_Bool SCIPhaveVarsCommonClique(SCIP *scip, SCIP_VAR *var1, SCIP_Bool value1, SCIP_VAR *var2, SCIP_Bool value2, SCIP_Bool regardimplics)
static SCIP_RETCODE computeReferencePointGauge(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *refsol, SCIP_Real *ref, SCIP_Bool *success)
SCIP_Bool SCIPconsIsEnforced(SCIP_CONS *cons)
static SCIP_RETCODE checkFactorable(SCIP *scip, 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)
void SCIPsortInt(int *intarray, int len)
static SCIP_RETCODE propagateBoundsTightenVarLb(SCIP *scip, SCIP_CONS *cons, SCIP_Real intervalinfty, SCIP_VAR *var, SCIP_Real bnd, SCIP_RESULT *result, int *nchgbds)
SCIP_RETCODE SCIPcreateConsQuadratic2(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadvarterms, SCIP_QUADVARTERM *quadvarterms, int nbilinterms, SCIP_BILINTERM *bilinterms, 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)
static SCIP_RETCODE delLinearCoefPos(SCIP *scip, SCIP_CONS *cons, int pos)
static SCIP_RETCODE consdataEnsureBilinSize(SCIP *scip, SCIP_CONSDATA *consdata, int num)
SCIP_RETCODE SCIPaddQuadVarLinearCoefQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
SCIP_BOUNDTYPE SCIPvarGetBestBoundType(SCIP_VAR *var)
SCIP_RETCODE SCIPunlinkSol(SCIP *scip, SCIP_SOL *sol)
#define SCIPdebugAddSolVal(scip, var, val)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
static SCIP_DECL_CONSLOCK(consLockQuadratic)
SCIP_RETCODE SCIPcreateConsBounddisjunction(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_BOUNDTYPE *boundtypes, SCIP_Real *bounds, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
SCIP_RETCODE SCIPparseVarsPolynomial(SCIP *scip, const char *str, SCIP_VAR ****monomialvars, SCIP_Real ***monomialexps, SCIP_Real **monomialcoefs, int **monomialnvars, int *nmonomials, char **endptr, SCIP_Bool *success)
void SCIPintervalMulInf(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
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
static SCIP_DECL_EVENTEXEC(processVarEvent)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
static SCIP_RETCODE addLinearCoef(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
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)
#define CONSHDLR_PROP_TIMING
#define SCIP_DECL_QUADCONSUPGD(x)
static SCIP_DECL_CONSPROP(consPropQuadratic)
SCIP_NLPI ** SCIPgetNlpis(SCIP *scip)
static SCIP_RETCODE delQuadVarTermPos(SCIP *scip, SCIP_CONS *cons, int pos)
SCIP_Real SCIPgetUpperbound(SCIP *scip)
static SCIP_DECL_CONSPRINT(consPrintQuadratic)
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
#define BMSclearMemoryArray(ptr, num)
SCIP_Bool SCIPisSumLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define ROWPREP_SCALEUP_MAXMINCOEF
static SCIP_RETCODE presolveDisaggregateMarkComponent(SCIP *scip, SCIP_CONSDATA *consdata, int quadvaridx, SCIP_HASHMAP *var2component, int componentnr)
#define CONSHDLR_SEPAFREQ
static SCIP_RETCODE computeED(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
SCIP_QUADVARTERM * SCIPgetQuadVarTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateNlRow(SCIP *scip, SCIP_NLROW **nlrow, const char *name, SCIP_Real constant, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadvars, SCIP_VAR **quadvars, int nquadelems, SCIP_QUADELEM *quadelems, SCIP_EXPRTREE *expression, SCIP_Real lhs, SCIP_Real rhs, SCIP_EXPRCURV curvature)
static SCIP_RETCODE propagateBounds(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_RESULT *result, int *nchgbds)
int SCIPexprgraphGetNodeQuadraticNQuadElements(SCIP_EXPRGRAPHNODE *node)
SCIP_EXPRGRAPHNODE * SCIPgetExprgraphNodeNonlinear(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE computeViolation(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool *solviolbounds)
SCIP_Real SCIPceil(SCIP *scip, SCIP_Real val)
void SCIPprintRowprep(SCIP *scip, SCIP_ROWPREP *rowprep, FILE *file)
constraint handler for bound disjunction constraints
void SCIPintervalAddScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
SCIP_RETCODE SCIPsetConshdlrExitsol(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSEXITSOL((*consexitsol)))
SCIP_Longint SCIPgetNLPs(SCIP *scip)
SCIP_Real SCIPround(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPvarIsIntegral(SCIP_VAR *var)
static SCIP_RETCODE consdataFindQuadVarTerm(SCIP *scip, SCIP_CONSDATA *consdata, SCIP_VAR *var, int *pos)
SCIP_ROUNDMODE SCIPintervalGetRoundingMode(void)
SCIP_Longint SCIPcalcGreComDiv(SCIP_Longint val1, SCIP_Longint val2)
SCIP_RETCODE SCIPgetRowprepRowSepa(SCIP *scip, SCIP_ROW **row, SCIP_ROWPREP *rowprep, SCIP_SEPA *sepa)
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
static SCIP_RETCODE mergeAndCleanQuadVarTerms(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPisInRestart(SCIP *scip)
SCIP_SOL * SCIPeventGetSol(SCIP_EVENT *event)
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)
#define SCIPduplicateBlockMemory(scip, ptr, source)
static SCIP_RETCODE consdataEnsureLinearVarsSize(SCIP *scip, SCIP_CONSDATA *consdata, int num)
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 SCIPintervalSetRoundingModeDownwards(void)
SCIP_Real SCIPfloor(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisConvexQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetPrimalRayVal(SCIP *scip, SCIP_VAR *var)
static SCIP_DECL_CONSDISABLE(consDisableQuadratic)
SCIP_RETCODE SCIPgetActivityQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Real *activity)
static SCIP_Bool hasQuadvarHpProperty(SCIP *scip, SCIP_CONSDATA *consdata, int idx)
SCIP_Bool SCIPintervalIsSubsetEQ(SCIP_Real infinity, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
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)
void SCIPintervalSolveUnivariateQuadExpressionPositive(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL sqrcoeff, SCIP_INTERVAL lincoeff, SCIP_INTERVAL rhs)
static SCIP_RETCODE catchLinearVarEvents(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons, int linvarpos)
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)
void SCIPaddSquareLinearization(SCIP *scip, SCIP_Real sqrcoef, SCIP_Real refpoint, SCIP_Bool isint, SCIP_Real *lincoef, SCIP_Real *linconstant, SCIP_Bool *success)
#define SCIPreallocBufferArray(scip, ptr, num)
void SCIPaddRowprepConstant(SCIP_ROWPREP *rowprep, SCIP_Real constant)
SCIP_RETCODE SCIPsetConshdlrProp(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPROP((*consprop)), int propfreq, SCIP_Bool delayprop, SCIP_PROPTIMING proptiming)
static SCIP_RETCODE generateCutUnboundedLP(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SIDETYPE violside, SCIP_ROW **row, SCIP_Real *rowrayprod, SCIP_Bool checkcurvmultivar)
void SCIPintervalQuad(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_Real sqrcoeff, SCIP_INTERVAL lincoeff, SCIP_INTERVAL xrng)
enum SCIP_SideType SCIP_SIDETYPE
SCIP_QUADELEM * SCIPexprgraphGetNodeQuadraticQuadElements(SCIP_EXPRGRAPHNODE *node)