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
135 unsigned int linvarssorted:1;
136 unsigned int linvarsmerged:1;
137 unsigned int quadvarssorted:1;
138 unsigned int quadvarsmerged:1;
139 unsigned int bilinsorted:1;
140 unsigned int bilinmerged:1;
142 unsigned int isconvex:1;
143 unsigned int isconcave:1;
144 unsigned int iscurvchecked:1;
145 unsigned int isremovedfixings:1;
146 unsigned int ispropagated:1;
147 unsigned int ispresolved:1;
148 unsigned int initialmerge:1;
149 #ifdef CHECKIMPLINBILINEAR 150 unsigned int isimpladded:1;
152 unsigned int isgaugeavailable:1;
153 unsigned int isedavailable:1;
157 int minlinactivityinf;
158 int maxlinactivityinf;
164 int linvar_maydecrease;
165 int linvar_mayincrease;
168 int* sepabilinvar2pos;
216 struct SCIP_ConshdlrData
218 int replacebinaryprodlength;
227 char checkquadvarlocks;
230 char disaggrmergemethod;
232 int maxproproundspresolve;
237 char interiorcomputation;
247 int newsoleventfilterpos;
252 int quadconsupgradessize;
253 int nquadconsupgrades;
263 int bilinineqmaxseparounds;
278 const char* conshdlrname
283 assert(scip != NULL);
284 assert(conshdlrdata != NULL);
285 assert(quadconsupgd != NULL);
286 assert(conshdlrname != NULL);
288 for( i = conshdlrdata->nquadconsupgrades - 1; i >= 0; --i )
290 if( conshdlrdata->quadconsupgrades[i]->quadconsupgd == quadconsupgd )
292 SCIPwarningMessage(scip,
"Try to add already known upgrade message for constraint handler <%s>.\n", conshdlrname);
308 #define infty2infty(infty1, infty2, val) ((val) >= (infty1) ? (infty2) : (val)) 323 assert(scip != NULL);
324 assert(eventhdlr != NULL);
325 assert(cons != NULL);
328 assert(consdata != NULL);
330 assert(linvarpos >= 0);
331 assert(linvarpos < consdata->nlinvars);
332 assert(consdata->lineventdata != NULL);
336 eventdata->cons = cons;
337 eventdata->varidx = linvarpos;
344 if( consdata->lincoefs[linvarpos] > 0.0 )
353 if( consdata->lincoefs[linvarpos] > 0.0 )
361 consdata->lineventdata[linvarpos] = eventdata;
369 consdata->minlinactivityinf = -1;
370 consdata->maxlinactivityinf = -1;
387 assert(scip != NULL);
388 assert(eventhdlr != NULL);
389 assert(cons != NULL);
392 assert(consdata != NULL);
394 assert(linvarpos >= 0);
395 assert(linvarpos < consdata->nlinvars);
396 assert(consdata->lineventdata != NULL);
397 assert(consdata->lineventdata[linvarpos] != NULL);
398 assert(consdata->lineventdata[linvarpos]->cons == cons);
399 assert(consdata->lineventdata[linvarpos]->varidx == linvarpos);
400 assert(consdata->lineventdata[linvarpos]->filterpos >= 0);
407 if( consdata->lincoefs[linvarpos] > 0.0 )
416 if( consdata->lincoefs[linvarpos] > 0.0 )
442 assert(scip != NULL);
443 assert(eventhdlr != NULL);
444 assert(cons != NULL);
447 assert(consdata != NULL);
449 assert(quadvarpos >= 0);
450 assert(quadvarpos < consdata->nquadvars);
451 assert(consdata->quadvarterms[quadvarpos].eventdata == NULL);
456 #ifdef CHECKIMPLINBILINEAR 459 eventdata->cons = cons;
460 eventdata->varidx = -quadvarpos-1;
463 consdata->quadvarterms[quadvarpos].eventdata = eventdata;
486 assert(scip != NULL);
487 assert(eventhdlr != NULL);
488 assert(cons != NULL);
491 assert(consdata != NULL);
493 assert(quadvarpos >= 0);
494 assert(quadvarpos < consdata->nquadvars);
495 assert(consdata->quadvarterms[quadvarpos].eventdata != NULL);
496 assert(consdata->quadvarterms[quadvarpos].eventdata->cons == cons);
497 assert(consdata->quadvarterms[quadvarpos].eventdata->varidx == -quadvarpos-1);
498 assert(consdata->quadvarterms[quadvarpos].eventdata->filterpos >= 0);
501 #ifdef CHECKIMPLINBILINEAR 505 SCIP_CALL(
SCIPdropVarEvent(scip, consdata->quadvarterms[quadvarpos].var, eventtype, eventhdlr, (
SCIP_EVENTDATA*)consdata->quadvarterms[quadvarpos].eventdata, consdata->quadvarterms[quadvarpos].eventdata->filterpos) );
524 assert(scip != NULL);
525 assert(cons != NULL);
526 assert(eventhdlr != NULL);
529 assert(consdata != NULL);
530 assert(consdata->lineventdata == NULL);
533 consdata->isremovedfixings =
TRUE;
536 for( i = 0; i < consdata->nlinvars; ++i )
540 var = consdata->linvars[i];
541 consdata->isremovedfixings = consdata->isremovedfixings &&
SCIPvarIsActive(var)
545 for( i = 0; i < consdata->nquadvars; ++i )
547 assert(consdata->quadvarterms[i].eventdata == NULL);
551 var = consdata->quadvarterms[i].var;
552 consdata->isremovedfixings = consdata->isremovedfixings &&
SCIPvarIsActive(var)
556 consdata->ispropagated =
FALSE;
572 assert(scip != NULL);
573 assert(eventhdlr != NULL);
574 assert(cons != NULL);
577 assert(consdata != NULL);
579 if( consdata->lineventdata != NULL )
581 for( i = 0; i < consdata->nlinvars; ++i )
583 if( consdata->lineventdata[i] != NULL )
591 for( i = 0; i < consdata->nquadvars; ++i )
593 if( consdata->quadvarterms[i].eventdata != NULL )
613 assert(scip != NULL);
614 assert(cons != NULL);
619 assert(consdata != NULL);
644 assert(scip != NULL);
645 assert(cons != NULL);
650 assert(consdata != NULL);
707 assert(scip != NULL);
708 assert(consdata != NULL);
714 (consdata->minlinactivityinf > 0 || consdata->maxlinactivityinf > 0 || consdata->minlinactivity <= consdata->maxlinactivity) )
717 assert(consdata->minlinactivityinf >= 0);
718 assert(consdata->maxlinactivityinf >= 0);
722 consdata->minlinactivityinf = 0;
723 consdata->maxlinactivityinf = 0;
728 consdata->minlinactivity =
SCIPisInfinity(scip, consdata->rhs) ? -intervalinfty : 0.0;
729 consdata->maxlinactivity =
SCIPisInfinity(scip, -consdata->lhs) ? intervalinfty : 0.0;
731 if( consdata->nlinvars == 0 )
736 assert(consdata->lineventdata != NULL);
745 for( i = 0; i < consdata->nlinvars; ++i )
747 assert(consdata->lineventdata[i] != NULL);
748 if( consdata->lincoefs[i] >= 0.0 )
753 ++consdata->minlinactivityinf;
763 ++consdata->minlinactivityinf;
768 consdata->minlinactivity += consdata->lincoefs[i] * bnd;
777 for( i = 0; i < consdata->nlinvars; ++i )
779 assert(consdata->lineventdata[i] != NULL);
780 if( consdata->lincoefs[i] >= 0.0 )
785 ++consdata->maxlinactivityinf;
795 ++consdata->maxlinactivityinf;
800 consdata->maxlinactivity += consdata->lincoefs[i] * bnd;
806 assert(consdata->minlinactivityinf > 0 || consdata->maxlinactivityinf > 0 || consdata->minlinactivity <= consdata->maxlinactivity);
821 assert(scip != NULL);
822 assert(consdata != NULL);
849 --consdata->minlinactivityinf;
850 assert(consdata->minlinactivityinf >= 0);
856 consdata->minlinactivity += minuscoef * oldbnd;
861 ++consdata->minlinactivityinf;
865 consdata->minlinactivity += coef * newbnd;
885 --consdata->maxlinactivityinf;
886 assert(consdata->maxlinactivityinf >= 0);
892 consdata->maxlinactivity += minuscoef * oldbnd;
897 ++consdata->maxlinactivityinf;
901 consdata->maxlinactivity += coef * newbnd;
920 assert(scip != NULL);
921 assert(consdata != NULL);
948 --consdata->maxlinactivityinf;
949 assert(consdata->maxlinactivityinf >= 0);
955 consdata->maxlinactivity += minuscoef * oldbnd;
960 ++consdata->maxlinactivityinf;
964 consdata->maxlinactivity += coef * newbnd;
984 --consdata->minlinactivityinf;
985 assert(consdata->minlinactivityinf >= 0);
991 consdata->minlinactivity += minuscoef * oldbnd;
996 ++consdata->minlinactivityinf;
1000 consdata->minlinactivity += coef * newbnd;
1023 assert(scip != NULL);
1024 assert(consdata != NULL);
1025 assert(idx >= 0 && idx < consdata->nquadvars);
1027 var = consdata->quadvarterms[idx].var;
1028 assert(var != NULL);
1030 quadcoef = consdata->quadvarterms[idx].sqrcoef;
1047 assert(scip != NULL);
1048 assert(event != NULL);
1049 assert(eventdata != NULL);
1050 assert(eventhdlr != NULL);
1053 assert(cons != NULL);
1055 assert(consdata != NULL);
1058 assert(varidx < 0 || varidx < consdata->nlinvars);
1059 assert(varidx >= 0 || -varidx-1 < consdata->nquadvars);
1083 consdata->ispropagated =
FALSE;
1092 var = varidx < 0 ? consdata->quadvarterms[-varidx-1].var : consdata->linvars[varidx];
1093 assert(var != NULL);
1099 quadvarterm = &consdata->quadvarterms[-varidx-1];
1107 consdata->quadvarsmerged =
FALSE;
1108 consdata->initialmerge =
FALSE;
1113 consdata->isremovedfixings =
FALSE;
1119 consdata->isremovedfixings =
FALSE;
1122 #ifdef CHECKIMPLINBILINEAR 1128 consdata->isimpladded =
TRUE;
1143 assert(scip != NULL);
1144 assert(consdata != NULL);
1145 assert(consdata->nlinvars <= consdata->linvarssize);
1147 if( num > consdata->linvarssize )
1154 if( consdata->lineventdata != NULL )
1158 consdata->linvarssize = newsize;
1160 assert(num <= consdata->linvarssize);
1173 assert(scip != NULL);
1174 assert(consdata != NULL);
1175 assert(consdata->nquadvars <= consdata->quadvarssize);
1177 if( num > consdata->quadvarssize )
1183 consdata->quadvarssize = newsize;
1185 assert(num <= consdata->quadvarssize);
1198 assert(scip != NULL);
1199 assert(quadvarterm != NULL);
1210 assert(num <= quadvarterm->adjbilinsize);
1223 assert(scip != NULL);
1224 assert(consdata != NULL);
1225 assert(consdata->nbilinterms <= consdata->bilintermssize);
1227 if( num > consdata->bilintermssize )
1233 consdata->bilintermssize = newsize;
1235 assert(num <= consdata->bilintermssize);
1247 assert(scip != NULL);
1248 assert(consdata != NULL);
1256 (*consdata)->linvarssorted =
TRUE;
1257 (*consdata)->linvarsmerged =
TRUE;
1258 (*consdata)->quadvarssorted =
TRUE;
1259 (*consdata)->quadvarsmerged =
TRUE;
1260 (*consdata)->bilinsorted =
TRUE;
1261 (*consdata)->bilinmerged =
TRUE;
1263 (*consdata)->isremovedfixings =
TRUE;
1264 (*consdata)->ispropagated =
TRUE;
1265 (*consdata)->initialmerge =
FALSE;
1267 (*consdata)->linvar_maydecrease = -1;
1268 (*consdata)->linvar_mayincrease = -1;
1272 (*consdata)->minlinactivityinf = -1;
1273 (*consdata)->maxlinactivityinf = -1;
1275 (*consdata)->isgaugeavailable =
FALSE;
1276 (*consdata)->isedavailable =
FALSE;
1300 assert(scip != NULL);
1301 assert(consdata != NULL);
1303 assert(nlinvars == 0 || linvars != NULL);
1304 assert(nlinvars == 0 || lincoefs != NULL);
1305 assert(nquadvars == 0 || quadvarterms != NULL);
1306 assert(nbilinterms == 0 || bilinterms != NULL);
1313 (*consdata)->minlinactivityinf = -1;
1314 (*consdata)->maxlinactivityinf = -1;
1316 (*consdata)->lhs = lhs;
1317 (*consdata)->rhs = rhs;
1323 (*consdata)->nlinvars = nlinvars;
1324 (*consdata)->linvarssize = nlinvars;
1327 for( i = 0; i < nlinvars; ++i )
1334 (*consdata)->linvarssorted =
TRUE;
1335 (*consdata)->linvarsmerged =
TRUE;
1336 (*consdata)->minlinactivity = 0.0;
1337 (*consdata)->maxlinactivity = 0.0;
1338 (*consdata)->minlinactivityinf = 0;
1339 (*consdata)->maxlinactivityinf = 0;
1346 for( i = 0; i < nquadvars; ++i )
1348 (*consdata)->quadvarterms[i].eventdata = NULL;
1349 if( quadvarterms[i].nadjbilin )
1352 (*consdata)->quadvarterms[i].adjbilinsize = quadvarterms[i].
nadjbilin;
1356 assert((*consdata)->quadvarterms[i].nadjbilin == 0);
1357 (*consdata)->quadvarterms[i].adjbilin = NULL;
1358 (*consdata)->quadvarterms[i].adjbilinsize = 0;
1366 (*consdata)->nquadvars = nquadvars;
1367 (*consdata)->quadvarssize = nquadvars;
1372 (*consdata)->quadvarssorted =
TRUE;
1373 (*consdata)->quadvarsmerged =
TRUE;
1377 if( nbilinterms > 0 )
1380 (*consdata)->nbilinterms = nbilinterms;
1381 (*consdata)->bilintermssize = nbilinterms;
1385 (*consdata)->bilinsorted =
TRUE;
1386 (*consdata)->bilinmerged =
TRUE;
1389 (*consdata)->linvar_maydecrease = -1;
1390 (*consdata)->linvar_mayincrease = -1;
1396 (*consdata)->isgaugeavailable =
FALSE;
1410 assert(scip != NULL);
1411 assert(consdata != NULL);
1412 assert(*consdata != NULL);
1419 if( (*consdata)->linvarssize > 0 )
1421 for( i = 0; i < (*consdata)->nlinvars; ++i )
1423 assert((*consdata)->lineventdata == NULL || (*consdata)->lineventdata[i] == NULL);
1430 assert((*consdata)->linvars == NULL);
1431 assert((*consdata)->lincoefs == NULL);
1432 assert((*consdata)->lineventdata == NULL);
1435 for( i = 0; i < (*consdata)->nquadvars; ++i )
1437 assert((*consdata)->quadvarterms[i].eventdata == NULL);
1447 if( (*consdata)->nlrow != NULL )
1476 assert(consdata != NULL);
1478 if( consdata->linvarssorted )
1481 if( consdata->nlinvars <= 1 )
1483 consdata->linvarssorted =
TRUE;
1487 if( consdata->lineventdata == NULL )
1489 SCIPsortPtrReal((
void**)consdata->linvars, consdata->lincoefs, SCIPvarComp, consdata->nlinvars);
1495 SCIPsortPtrPtrReal((
void**)consdata->linvars, (
void**)consdata->lineventdata, consdata->lincoefs, SCIPvarComp, consdata->nlinvars);
1498 for( i = 0; i < consdata->nlinvars; ++i )
1499 if( consdata->lineventdata[i] != NULL )
1500 consdata->lineventdata[i]->varidx = i;
1503 consdata->linvarssorted =
TRUE;
1506 #ifdef SCIP_DISABLED_CODE 1509 int consdataFindLinearVar(
1516 assert(consdata != NULL);
1517 assert(var != NULL);
1519 if( consdata->nlinvars == 0 )
1524 if( !
SCIPsortedvecFindPtr((
void**)consdata->linvars, SCIPvarComp, (
void*)var, consdata->nlinvars, &pos) )
1537 assert(consdata != NULL);
1538 assert(0 <= ind1 && ind1 < consdata->nquadvars);
1539 assert(0 <= ind2 && ind2 < consdata->nquadvars);
1541 return SCIPvarCompare(consdata->quadvarterms[ind1].var, consdata->quadvarterms[ind2].var);
1557 assert(scip != NULL);
1558 assert(consdata != NULL);
1560 if( consdata->quadvarssorted )
1563 if( consdata->nquadvars == 0 )
1565 consdata->quadvarssorted =
TRUE;
1573 SCIPsort(perm, quadVarTermComp, (
void*)consdata, consdata->nquadvars);
1576 for( v = 0; v < consdata->nquadvars; ++v )
1580 quadterm = consdata->quadvarterms[v];
1585 assert(0 <= perm[i] && perm[i] < consdata->nquadvars);
1586 assert(perm[i] != i);
1587 consdata->quadvarterms[i] = consdata->quadvarterms[perm[i]];
1588 if( consdata->quadvarterms[i].eventdata != NULL )
1590 consdata->quadvarterms[i].eventdata->varidx = -i-1;
1596 while( perm[i] != v );
1597 consdata->quadvarterms[i] = quadterm;
1598 if( consdata->quadvarterms[i].eventdata != NULL )
1600 consdata->quadvarterms[i].
eventdata->varidx = -i-1;
1605 consdata->quadvarssorted =
TRUE;
1626 assert(consdata != NULL);
1627 assert(var != NULL);
1628 assert(pos != NULL);
1630 if( consdata->nquadvars == 0 )
1639 right = consdata->nquadvars - 1;
1640 while( left <= right )
1644 middle = (left+right)/2;
1645 assert(0 <= middle && middle < consdata->nquadvars);
1647 cmpres =
SCIPvarCompare(var, consdata->quadvarterms[middle].var);
1651 else if( cmpres > 0 )
1659 assert(left == right+1);
1673 assert(consdata != NULL);
1674 assert(0 <= ind1 && ind1 < consdata->nbilinterms);
1675 assert(0 <= ind2 && ind2 < consdata->nbilinterms);
1677 var1cmp =
SCIPvarCompare(consdata->bilinterms[ind1].var1, consdata->bilinterms[ind2].var1);
1681 return SCIPvarCompare(consdata->bilinterms[ind1].var2, consdata->bilinterms[ind2].var2);
1693 assert(consdata != NULL);
1696 if( !consdata->bilinsorted )
1699 for( i = 0; i < consdata->nbilinterms - 1; ++i )
1701 if( bilinTermComp(consdata, i, i+1) > 0 )
1722 assert(scip != NULL);
1723 assert(consdata != NULL);
1725 if( consdata->bilinsorted )
1728 if( consdata->nbilinterms == 0 )
1730 consdata->bilinsorted =
TRUE;
1739 SCIPsort(perm, bilinTermComp, (
void*)consdata, consdata->nbilinterms);
1742 for( v = 0; v < consdata->nbilinterms; ++v )
1744 assert(0 <= perm[v] && perm[v] < consdata->nbilinterms);
1745 invperm[perm[v]] = v;
1749 for( v = 0; v < consdata->nbilinterms; ++v )
1753 bilinterm = consdata->bilinterms[v];
1758 assert(0 <= perm[i] && perm[i] < consdata->nbilinterms);
1759 assert(perm[i] != i);
1760 consdata->bilinterms[i] = consdata->bilinterms[perm[i]];
1765 while( perm[i] != v );
1766 consdata->bilinterms[i] = bilinterm;
1772 for( v = 0; v < consdata->nquadvars; ++v )
1773 for( i = 0; i < consdata->quadvarterms[v].nadjbilin; ++i )
1774 consdata->quadvarterms[v].adjbilin[i] = invperm[consdata->quadvarterms[v].adjbilin[i]];
1776 consdata->bilinsorted =
TRUE;
1794 assert(consdata != NULL);
1795 assert(oldpos >= 0);
1796 assert(oldpos < consdata->nlinvars);
1797 assert(newpos >= 0);
1798 assert(newpos < consdata->linvarssize);
1800 if( newpos == oldpos )
1803 consdata->linvars [newpos] = consdata->linvars [oldpos];
1804 consdata->lincoefs[newpos] = consdata->lincoefs[oldpos];
1806 if( consdata->lineventdata != NULL )
1808 assert(newpos >= consdata->nlinvars || consdata->lineventdata[newpos] == NULL);
1810 consdata->lineventdata[newpos] = consdata->lineventdata[oldpos];
1811 consdata->lineventdata[newpos]->varidx = newpos;
1813 consdata->lineventdata[oldpos] = NULL;
1816 consdata->linvarssorted =
FALSE;
1827 assert(consdata != NULL);
1828 assert(oldpos >= 0);
1829 assert(oldpos < consdata->nquadvars);
1830 assert(newpos >= 0);
1831 assert(newpos < consdata->quadvarssize);
1833 if( newpos == oldpos )
1836 assert(newpos >= consdata->nquadvars || consdata->quadvarterms[newpos].eventdata == NULL);
1838 consdata->quadvarterms[newpos] = consdata->quadvarterms[oldpos];
1840 if( consdata->quadvarterms[newpos].eventdata != NULL )
1842 consdata->quadvarterms[newpos].eventdata->varidx = -newpos-1;
1843 consdata->quadvarterms[oldpos].eventdata = NULL;
1846 consdata->quadvarssorted =
FALSE;
1861 assert(scip != NULL);
1862 assert(cons != NULL);
1863 assert(var != NULL);
1870 assert(consdata != NULL);
1880 assert(var != NULL);
1884 consdata->linvars [consdata->nlinvars] = var;
1885 consdata->lincoefs[consdata->nlinvars] = coef;
1887 ++consdata->nlinvars;
1898 assert(conshdlrdata != NULL);
1899 assert(conshdlrdata->eventhdlr != NULL);
1901 assert(consdata->lineventdata != NULL);
1902 consdata->lineventdata[consdata->nlinvars-1] = NULL;
1912 consdata->minlinactivityinf = -1;
1913 consdata->maxlinactivityinf = -1;
1916 if( consdata->nlrow != NULL )
1927 consdata->ispropagated =
FALSE;
1928 consdata->ispresolved =
FALSE;
1929 consdata->isremovedfixings = consdata->isremovedfixings &&
SCIPvarIsActive(var)
1931 if( consdata->nlinvars == 1 )
1932 consdata->linvarssorted =
TRUE;
1934 consdata->linvarssorted = consdata->linvarssorted && (
SCIPvarCompare(consdata->linvars[consdata->nlinvars-2], consdata->linvars[consdata->nlinvars-1]) == -1);
1936 consdata->linvarsmerged =
FALSE;
1953 assert(scip != NULL);
1954 assert(cons != NULL);
1957 assert(consdata != NULL);
1958 assert(0 <= pos && pos < consdata->nlinvars);
1960 var = consdata->linvars[pos];
1961 coef = consdata->lincoefs[pos];
1962 assert(var != NULL);
1968 if( consdata->lineventdata != NULL )
1976 assert(conshdlrdata != NULL);
1977 assert(conshdlrdata->eventhdlr != NULL);
1989 --consdata->nlinvars;
1995 consdata->minlinactivityinf = -1;
1996 consdata->maxlinactivityinf = -1;
1999 if( consdata->nlrow != NULL )
2004 consdata->ispropagated =
FALSE;
2005 consdata->ispresolved =
FALSE;
2025 assert(scip != NULL);
2026 assert(cons != NULL);
2029 conshdlrdata = NULL;
2032 assert(consdata != NULL);
2034 assert(pos < consdata->nlinvars);
2037 var = consdata->linvars[pos];
2038 coef = consdata->lincoefs[pos];
2039 assert(var != NULL);
2046 consdata->minlinactivityinf = -1;
2047 consdata->maxlinactivityinf = -1;
2050 if( consdata->nlrow != NULL )
2056 if( newcoef * coef < 0.0 )
2066 if( consdata->lineventdata[pos] != NULL )
2071 assert(conshdlrdata != NULL);
2072 assert(conshdlrdata->eventhdlr != NULL);
2080 consdata->lincoefs[pos] = newcoef;
2083 if( newcoef * coef < 0.0 )
2091 if( conshdlrdata != NULL )
2100 consdata->ispropagated =
FALSE;
2101 consdata->ispresolved =
FALSE;
2120 assert(scip != NULL);
2121 assert(cons != NULL);
2122 assert(var != NULL);
2125 assert(consdata != NULL);
2135 assert(var != NULL);
2140 quadvarterm = &consdata->quadvarterms[consdata->nquadvars];
2141 quadvarterm->
var = var;
2142 quadvarterm->
lincoef = lincoef;
2143 quadvarterm->
sqrcoef = sqrcoef;
2149 ++consdata->nquadvars;
2163 assert(conshdlrdata != NULL);
2164 assert(conshdlrdata->eventhdlr != NULL);
2175 if( consdata->nlrow != NULL )
2183 consdata->ispropagated =
FALSE;
2184 consdata->ispresolved =
FALSE;
2185 consdata->isremovedfixings = consdata->isremovedfixings &&
SCIPvarIsActive(var)
2187 if( consdata->nquadvars == 1 )
2188 consdata->quadvarssorted =
TRUE;
2190 consdata->quadvarssorted = consdata->quadvarssorted &&
2191 (
SCIPvarCompare(consdata->quadvarterms[consdata->nquadvars-2].var, consdata->quadvarterms[consdata->nquadvars-1].var) == -1);
2193 consdata->quadvarsmerged =
FALSE;
2195 consdata->iscurvchecked =
FALSE;
2211 assert(scip != NULL);
2212 assert(cons != NULL);
2215 assert(consdata != NULL);
2216 assert(0 <= pos && pos < consdata->nquadvars);
2218 var = consdata->quadvarterms[pos].var;
2219 assert(var != NULL);
2220 assert(consdata->quadvarterms[pos].nadjbilin == 0);
2226 if( consdata->quadvarterms[pos].eventdata != NULL )
2234 assert(conshdlrdata != NULL);
2235 assert(conshdlrdata->eventhdlr != NULL);
2250 --consdata->nquadvars;
2257 if( consdata->nlrow != NULL )
2262 consdata->ispropagated =
FALSE;
2263 consdata->ispresolved =
FALSE;
2264 consdata->iscurvchecked =
FALSE;
2293 assert(consdata != NULL);
2295 assert(pos < consdata->nquadvars);
2297 quadvarterm = &consdata->quadvarterms[pos];
2311 assert(conshdlrdata != NULL);
2312 assert(conshdlrdata->eventhdlr != NULL);
2314 eventhdlr = conshdlrdata->eventhdlr;
2325 constant = quadvarterm->
lincoef * offset + quadvarterm->
sqrcoef * offset * offset;
2326 if( constant != 0.0 )
2330 consdata->lhs -= constant;
2332 consdata->rhs -= constant;
2337 quadvarterm->
lincoef += 2.0 * quadvarterm->
sqrcoef * coef * offset;
2338 quadvarterm->
sqrcoef *= coef * coef;
2341 for( i = 0; i < quadvarterm->
nadjbilin; ++i )
2343 bilinterm = &consdata->bilinterms[quadvarterm->
adjbilin[i]];
2345 if( bilinterm->
var1 == quadvarterm->
var )
2347 bilinterm->
var1 = var;
2348 var2 = bilinterm->
var2;
2352 assert(bilinterm->
var2 == quadvarterm->
var);
2353 bilinterm->
var2 = var;
2354 var2 = bilinterm->
var1;
2364 bilinterm->
coef = 0.0;
2372 tmp = bilinterm->
var1;
2374 bilinterm->
var2 = tmp;
2384 while( consdata->quadvarterms[var2pos].var != var2 )
2387 assert(var2pos < consdata->nquadvars);
2390 consdata->quadvarterms[var2pos].lincoef += bilinterm->
coef * offset;
2393 bilinterm->
coef *= coef;
2400 quadvarterm->
var = var;
2406 if( eventhdlr != NULL )
2419 if( consdata->nlrow != NULL )
2427 consdata->isremovedfixings = consdata->isremovedfixings &&
SCIPvarIsActive(var)
2429 consdata->quadvarssorted = (consdata->nquadvars == 1);
2430 consdata->quadvarsmerged =
FALSE;
2431 consdata->bilinsorted &= (quadvarterm->
nadjbilin == 0);
2432 consdata->bilinmerged &= (quadvarterm->
nadjbilin == 0);
2434 consdata->ispropagated =
FALSE;
2435 consdata->ispresolved =
FALSE;
2436 consdata->iscurvchecked =
FALSE;
2454 assert(scip != NULL);
2455 assert(cons != NULL);
2457 if( var1pos == var2pos )
2459 SCIPerrorMessage(
"tried to add bilinear term where both variables are the same\n");
2464 assert(consdata != NULL);
2469 assert(var1pos >= 0);
2470 assert(var1pos < consdata->nquadvars);
2471 assert(var2pos >= 0);
2472 assert(var2pos < consdata->nquadvars);
2476 bilinterm = &consdata->bilinterms[consdata->nbilinterms];
2477 if(
SCIPvarCompare(consdata->quadvarterms[var1pos].var, consdata->quadvarterms[var2pos].var) < 0 )
2479 bilinterm->
var1 = consdata->quadvarterms[var1pos].var;
2480 bilinterm->
var2 = consdata->quadvarterms[var2pos].var;
2484 bilinterm->
var1 = consdata->quadvarterms[var2pos].var;
2485 bilinterm->
var2 = consdata->quadvarterms[var1pos].var;
2487 bilinterm->
coef = coef;
2489 if( bilinterm->
var1 == bilinterm->
var2 )
2491 SCIPerrorMessage(
"tried to add bilinear term where both variables are the same, but appear at different positions in quadvarterms array\n");
2499 consdata->quadvarterms[var1pos].adjbilin[consdata->quadvarterms[var1pos].nadjbilin] = consdata->nbilinterms;
2500 consdata->quadvarterms[var2pos].adjbilin[consdata->quadvarterms[var2pos].nadjbilin] = consdata->nbilinterms;
2501 ++consdata->quadvarterms[var1pos].nadjbilin;
2502 ++consdata->quadvarterms[var2pos].nadjbilin;
2504 ++consdata->nbilinterms;
2511 if( consdata->nlrow != NULL )
2516 consdata->ispropagated =
FALSE;
2517 consdata->ispresolved =
FALSE;
2518 if( consdata->nbilinterms == 1 )
2520 consdata->bilinsorted =
TRUE;
2523 consdata->bilinmerged = !
SCIPisZero(scip, consdata->bilinterms[0].coef);
2527 consdata->bilinsorted = consdata->bilinsorted
2528 && (bilinTermComp(consdata, consdata->nbilinterms-2, consdata->nbilinterms-1) <= 0);
2529 consdata->bilinmerged =
FALSE;
2532 consdata->iscurvchecked =
FALSE;
2558 assert(scip != NULL);
2559 assert(cons != NULL);
2560 assert(nterms == 0 || termposs != NULL);
2566 assert(consdata != NULL);
2574 for( j = 0; j < consdata->nbilinterms; ++j )
2577 if( i < nterms && j == termposs[i] )
2587 consdata->bilinterms[j-offset] = consdata->bilinterms[j];
2588 newpos[j] = j - offset;
2590 assert(offset == nterms);
2593 for( i = 0; i < consdata->nquadvars; ++i )
2596 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
2598 assert(consdata->quadvarterms[i].adjbilin[j] < consdata->nbilinterms);
2599 if( newpos[consdata->quadvarterms[i].adjbilin[j]] == -1 )
2607 consdata->quadvarterms[i].adjbilin[j-offset] = newpos[consdata->quadvarterms[i].adjbilin[j]];
2610 consdata->quadvarterms[i].nadjbilin -= offset;
2614 consdata->nbilinterms -= nterms;
2619 consdata->quadvarsmerged =
FALSE;
2621 consdata->ispropagated =
FALSE;
2622 consdata->ispresolved =
FALSE;
2623 consdata->iscurvchecked =
FALSE;
2630 if( consdata->nlrow != NULL )
2654 assert(scip != NULL);
2655 assert(cons != NULL);
2659 if( consdata->quadvarsmerged )
2662 if( consdata->nquadvars == 0 )
2664 consdata->quadvarsmerged =
TRUE;
2669 while( i < consdata->nquadvars )
2674 quadvarterm = &consdata->quadvarterms[i];
2676 for( j = i+1; j < consdata->nquadvars && consdata->quadvarterms[j].var == quadvarterm->
var; ++j )
2679 quadvarterm->
lincoef += consdata->quadvarterms[j].lincoef;
2680 quadvarterm->
sqrcoef += consdata->quadvarterms[j].sqrcoef;
2681 if( consdata->quadvarterms[j].nadjbilin > 0 )
2686 quadvarterm->
nadjbilin += consdata->quadvarterms[j].nadjbilin;
2687 consdata->quadvarterms[j].nadjbilin = 0;
2689 consdata->quadvarterms[j].lincoef = 0.0;
2690 consdata->quadvarterms[j].sqrcoef = 0.0;
2695 for( j = j-1; j > i; --j )
2710 if( consdata->nlrow != NULL )
2733 consdata->quadvarsmerged =
TRUE;
2752 assert(scip != NULL);
2753 assert(cons != NULL);
2757 if( consdata->linvarsmerged )
2760 if( consdata->nlinvars == 0 )
2762 consdata->linvarsmerged =
TRUE;
2767 while( i < consdata->nlinvars )
2773 newcoef = consdata->lincoefs[i];
2774 for( j = i+1; j < consdata->nlinvars && consdata->linvars[i] == consdata->linvars[j]; ++j )
2775 newcoef += consdata->lincoefs[j];
2777 for( j = j-1; j > i; --j )
2787 assert(qvarpos < consdata->nquadvars);
2788 assert(consdata->quadvarterms[qvarpos].var == consdata->linvars[i]);
2789 consdata->quadvarterms[qvarpos].lincoef += newcoef;
2806 consdata->linvarsmerged =
TRUE;
2825 assert(scip != NULL);
2826 assert(cons != NULL);
2833 if( consdata->bilinmerged )
2836 if( consdata->nbilinterms == 0 )
2838 consdata->bilinmerged =
TRUE;
2850 while( i < consdata->nbilinterms )
2852 bilinterm = &consdata->bilinterms[i];
2855 for( j = i+1; j < consdata->nbilinterms && bilinterm->
var1 == consdata->bilinterms[j].var1 && bilinterm->
var2 == consdata->bilinterms[j].var2; ++j )
2857 bilinterm->
coef += consdata->bilinterms[j].coef;
2858 todelete[ntodelete++] = j;
2864 todelete[ntodelete++] = i;
2876 consdata->bilinmerged =
TRUE;
2905 assert(scip != NULL);
2906 assert(cons != NULL);
2910 have_change =
FALSE;
2912 while( i < consdata->nlinvars )
2914 var = consdata->linvars[i];
2924 coef = consdata->lincoefs[i];
2937 SCIPdebugMsg(scip,
" linear term %g*<%s> is replaced by %g * <%s> + %g\n", consdata->lincoefs[i],
SCIPvarGetName(consdata->linvars[i]),
2947 consdata->lhs -= offset;
2949 consdata->rhs -= offset;
2978 for( j = 0; j < naggrs; ++j )
2983 if( aggrconstant != 0.0 )
2986 consdata->lhs -= coef * aggrconstant;
2988 consdata->rhs -= coef * aggrconstant;
2994 while( i < consdata->nquadvars )
2996 var = consdata->quadvarterms[i].var;
3019 SCIPdebugMsg(scip,
" quadratic variable <%s> with status %d is replaced by %g * <%s> + %g\n",
SCIPvarGetName(consdata->quadvarterms[i].var),
3028 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
3030 bilinterm = &consdata->bilinterms[consdata->quadvarterms[i].adjbilin[j]];
3032 var2 = bilinterm->
var1 == consdata->quadvarterms[i].var ? bilinterm->
var2 : bilinterm->
var1;
3033 assert(var2 != consdata->quadvarterms[i].var);
3036 while( consdata->quadvarterms[var2pos].var != var2 )
3039 assert(var2pos < consdata->nquadvars);
3041 consdata->quadvarterms[var2pos].lincoef += bilinterm->
coef * offset;
3044 offset = consdata->quadvarterms[i].lincoef * offset + consdata->quadvarterms[i].sqrcoef * offset * offset;
3046 consdata->lhs -= offset;
3048 consdata->rhs -= offset;
3060 assert(var != NULL);
3097 lcoef = consdata->quadvarterms[i].lincoef;
3098 scoef = consdata->quadvarterms[i].sqrcoef;
3100 nquadtermsold = consdata->nquadvars;
3105 if( aggrconstant != 0.0 || offset != 0.0 )
3108 constant = (aggrconstant * coef + offset) * (lcoef + (aggrconstant * coef + offset) * scoef);
3110 consdata->lhs -= constant;
3112 consdata->rhs -= constant;
3116 for( j = 0; j < naggrs; ++j )
3119 coef * aggrscalars[j] * (lcoef + 2.0 * scoef * (coef * aggrconstant + offset)),
3120 coef * coef * aggrscalars[j] * aggrscalars[j] * scoef) );
3124 SCIP_CALL(
consdataEnsureBilinSize(scip, consdata, consdata->nquadvars + (scoef != 0.0 ? (naggrs * (naggrs-1))/2 : 0) + consdata->quadvarterms[j].nadjbilin * naggrs) );
3129 for( j = 0; j < naggrs; ++j )
3130 for( k = 0; k < j; ++k )
3132 assert(aggrvars[j] != aggrvars[k]);
3134 2.0 * aggrscalars[j] * aggrscalars[k] * coef * coef * scoef) );
3139 for( k = 0; k < consdata->quadvarterms[i].nadjbilin; ++k )
3141 bilinterm = &consdata->bilinterms[consdata->quadvarterms[i].adjbilin[k]];
3142 bilincoef = bilinterm->
coef;
3143 var2 = (bilinterm->
var1 == consdata->quadvarterms[i].var) ? bilinterm->
var2 : bilinterm->
var1;
3144 assert(var2 != consdata->quadvarterms[i].var);
3148 while( consdata->quadvarterms[var2pos].var != var2 )
3151 assert(var2pos < consdata->nquadvars);
3154 for( j = 0; j < naggrs; ++j )
3156 if( aggrvars[j] == var2 )
3158 consdata->quadvarterms[var2pos].sqrcoef += bilincoef * coef * aggrscalars[j];
3166 consdata->quadvarterms[var2pos].lincoef += bilincoef * (aggrconstant * coef + offset);
3177 consdata->isremovedfixings =
TRUE;
3183 for( i = 0; i < consdata->nlinvars; ++i )
3186 for( i = 0; i < consdata->nquadvars; ++i )
3196 consdata->linvarsmerged =
FALSE;
3203 for( i = 0; i < consdata->nbilinterms; ++i )
3205 assert(consdata->bilinterms[i].var1 != consdata->bilinterms[i].var2);
3206 assert(consdata->bilinterms[i].coef != 0.0);
3207 assert(
SCIPvarCompare(consdata->bilinterms[i].var1, consdata->bilinterms[i].var2) < 0);
3238 assert(scip != NULL);
3239 assert(cons != NULL);
3242 assert(consdata != NULL);
3244 if( consdata->nlrow != NULL )
3249 nquadvars = consdata->nquadvars;
3250 nquadelems = consdata->nbilinterms;
3252 for( i = 0; i < nquadvars; ++i )
3254 if( consdata->quadvarterms[i].sqrcoef != 0.0 )
3256 if( !
SCIPisZero(scip, consdata->quadvarterms[i].lincoef) )
3267 for( i = 0; i < nquadvars; ++i )
3269 quadvars[i] = consdata->quadvarterms[i].var;
3271 if( consdata->quadvarterms[i].sqrcoef != 0.0 )
3273 assert(elcnt < nquadelems);
3274 quadelems[elcnt].
idx1 = i;
3275 quadelems[elcnt].
idx2 = i;
3276 quadelems[elcnt].
coef = consdata->quadvarterms[i].sqrcoef;
3280 if( !
SCIPisZero(scip, consdata->quadvarterms[i].lincoef) )
3282 assert(lincnt < nquadlinterms);
3283 quadlinvars [lincnt] = consdata->quadvarterms[i].var;
3284 quadlincoefs[lincnt] = consdata->quadvarterms[i].lincoef;
3288 assert(lincnt == nquadlinterms);
3294 for( i = 0; i < consdata->nbilinterms; ++i )
3296 if( lastvar == consdata->bilinterms[i].var1 )
3298 assert(lastvaridx >= 0);
3299 assert(consdata->quadvarterms[lastvaridx].var == consdata->bilinterms[i].var1);
3303 lastvar = consdata->bilinterms[i].var1;
3310 assert(elcnt < nquadelems);
3311 quadelems[elcnt].
idx1 = MIN(idx1, idx2);
3312 quadelems[elcnt].
idx2 =
MAX(idx1, idx2);
3313 quadelems[elcnt].
coef = consdata->bilinterms[i].coef;
3316 assert(elcnt == nquadelems);
3319 if( consdata->isconcave && consdata->isconvex )
3321 assert(consdata->nbilinterms == 0 && consdata->nquadvars == 0);
3324 else if( consdata->isconcave )
3326 else if( consdata->isconvex )
3332 consdata->nlinvars, consdata->linvars, consdata->lincoefs,
3333 nquadvars, quadvars, nquadelems, quadelems,
3334 NULL, consdata->lhs, consdata->rhs,
3359 assert(scip != NULL);
3360 assert(cons != NULL);
3361 assert(result != NULL);
3362 assert(redundant != NULL);
3368 assert(consdata != NULL);
3372 if(
SCIPisEQ(scip, consdata->lhs, consdata->rhs) && consdata->nlinvars == 0 && consdata->nquadvars == 2 &&
3373 ((
SCIPvarIsBinary(consdata->quadvarterms[0].var) && consdata->quadvarterms[1].sqrcoef == 0.0) ||
3374 (
SCIPvarIsBinary(consdata->quadvarterms[1].var) && consdata->quadvarterms[0].sqrcoef == 0.0)) )
3392 binvaridx = (
SCIPvarIsBinary(consdata->quadvarterms[0].var) && consdata->quadvarterms[1].sqrcoef == 0.0) ? 0 : 1;
3394 x = consdata->quadvarterms[binvaridx].var;
3395 a = consdata->quadvarterms[binvaridx].sqrcoef + consdata->quadvarterms[binvaridx].lincoef;
3397 y = consdata->quadvarterms[1-binvaridx].var;
3398 b = consdata->quadvarterms[1-binvaridx].lincoef;
3400 assert(consdata->nbilinterms <= 1);
3401 c = (consdata->nbilinterms == 1) ? consdata->bilinterms[0].coef : 0.0;
3407 SCIPdebugMsg(scip,
"=> attempt aggregation <%s> = %g*<%s> + %g\n",
SCIPvarGetName(y), (consdata->rhs-a)/(b+c) - consdata->rhs/b,
3410 SCIP_CALL(
SCIPaggregateVars(scip, x, y, (consdata->rhs-a)/(b+c) - consdata->rhs/b, -1.0, -consdata->rhs/b, &infeasible, redundant, &aggregated) );
3413 else if( *redundant || aggregated )
3453 assert(scip != NULL);
3454 assert(conshdlr != NULL);
3455 assert(cons != NULL);
3456 assert(naddconss != NULL);
3459 assert(conshdlrdata != NULL);
3468 if( conshdlrdata->empathy4and < 2 )
3472 assert(consdata != NULL);
3474 if( consdata->nbilinterms == 0 )
3481 for( i = 0; i < consdata->nbilinterms; ++i )
3483 vars[0] = consdata->bilinterms[i].var1;
3487 vars[1] = consdata->bilinterms[i].var2;
3496 #ifdef WITH_DEBUG_SOLUTION 3497 if( SCIPdebugIsMainscip(scip) )
3525 assert(ntodelete < consdata->nbilinterms);
3526 todelete[ntodelete++] = i;
3552 assert(scip != NULL);
3555 assert(resultant != NULL);
3565 resultant->
inf =
MAX(resultant->
inf, MIN(resultant->
sup, 0.0));
3566 resultant->
sup = MIN(resultant->
sup,
MAX(resultant->
inf, 1.0));
3570 resultant->
sup = MIN(resultant->
sup,
MAX(resultant->
inf, 0.0));
3574 resultant->
inf =
MAX(resultant->
inf, MIN(resultant->
sup, 1.0));
3589 assert(implvars != NULL);
3590 assert(impltypes != NULL);
3591 assert(implbounds != NULL);
3598 while( pos > 0 && implvars[pos-1] == y )
3604 while( pos < nimpls && implvars[pos] == y )
3607 resultant->
inf =
MAX(resultant->
inf, MIN(resultant->
sup, implbounds[pos]));
3609 resultant->
sup = MIN(resultant->
sup,
MAX(resultant->
inf, implbounds[pos]));
3613 assert(resultant->
sup >= resultant->
inf);
3666 assert(scip != NULL);
3667 assert(conshdlr != NULL);
3668 assert(cons != NULL);
3669 assert(naddconss != NULL);
3678 assert(conshdlrdata != NULL);
3680 maxnrvar = conshdlrdata->replacebinaryprodlength;
3685 assert(consdata != NULL);
3692 for( i = 0; i < consdata->nquadvars; ++i )
3694 y = consdata->quadvarterms[i].var;
3698 nbilinterms = consdata->quadvarterms[i].nadjbilin;
3699 if( nbilinterms == 0 )
3728 for( ; j < nbilinterms && nxvars < maxnrvar; ++j )
3730 bilinidx = consdata->quadvarterms[i].adjbilin[j];
3731 assert(bilinidx >= 0);
3732 assert(bilinidx < consdata->nbilinterms);
3734 bvar = consdata->bilinterms[bilinidx].var1;
3736 bvar = consdata->bilinterms[bilinidx].var2;
3742 SCIPdebugMsg(scip,
"skip reform of <%s><%s> due to unbounded second variable [%g,%g]\n",
3750 SCIPdebugMsg(scip,
"skip reform of <%s><%s> because second variable is not binary\n",
3755 bilincoef = consdata->bilinterms[bilinidx].coef;
3756 assert(bilincoef != 0.0);
3769 SCIPdebugMsg(scip,
"skip reform of %g<%s><%s> due to huge activity [%g,%g] for <%s> = 0.0\n",
3775 SCIPdebugMsg(scip,
"skip reform of %g<%s><%s> due to huge activity [%g,%g] for <%s> = 1.0\n",
3795 xvars[nxvars] = bvar;
3796 xcoef[nxvars] = bilincoef;
3803 if(
REALABS(bilincoef) < mincoef )
3804 mincoef = ABS(bilincoef);
3805 if(
REALABS(bilincoef) > maxcoef )
3806 maxcoef = ABS(bilincoef);
3825 assert(ntodelete < nbilinterms);
3826 todelete[ntodelete++] = bilinidx;
3841 SCIPdebugMsg(scip,
"got different bounds for y = 0: [%g, %g] and y = 1: [%g, %g]\n", xbndszero.
inf, xbndszero.
sup, xbndsone.
inf, xbndsone.
sup);
3845 if( nxvars == 1 && conshdlrdata->empathy4and >= 1 &&
SCIPvarIsBinary(xvars[0]) )
3851 auxvarinitial, auxvarremovable, NULL, NULL, NULL, NULL, NULL) );
3854 #ifdef WITH_DEBUG_SOLUTION 3855 if( SCIPdebugIsMainscip(scip) )
3897 assert(scale >= 1.0);
3899 else if( nxvars == 1 )
3902 assert(mincoef == maxcoef);
3916 assert(scale > 0.0);
3923 SCIPdebugMsg(scip,
"binary reformulation using scale %g, nxvars = %d, integral = %u\n", scale, nxvars, integral);
3928 for( k = 0; k < nxvars; ++k )
3939 auxvarinitial, auxvarremovable, NULL, NULL, NULL, NULL, NULL) );
3943 #ifdef WITH_DEBUG_SOLUTION 3944 if( SCIPdebugIsMainscip(scip) )
3956 assert(
SCIPisEQ(scip, varval, 1.0));
3959 for( k = 0; k < nxvars; ++k )
3962 debugval += xcoef[k] * varval;
4014 xvars[nxvars+1] = auxvar;
4016 xcoef[nxvars+1] = -1;
4058 while( j < nbilinterms );
4063 SCIPdebugMsg(scip,
"resulting quadratic constraint: ");
4107 assert(scip != NULL);
4108 assert(conshdlr != NULL);
4109 assert(cons != NULL);
4111 assert(upgraded != NULL);
4112 assert(nupgdconss != NULL);
4113 assert(naddconss != NULL);
4120 assert(conshdlrdata != NULL);
4123 if( conshdlrdata->nquadconsupgrades == 0 )
4130 assert(consdata != NULL);
4142 for( i = 0; i < consdata->nlinvars; ++i )
4144 var = consdata->linvars[i];
4145 lincoef = consdata->lincoefs[i];
4177 for( i = 0; i < consdata->nquadvars; ++i )
4179 var = consdata->quadvarterms[i].var;
4180 lincoef = consdata->quadvarterms[i].lincoef;
4181 quadcoef = consdata->quadvarterms[i].sqrcoef;
4214 for( i = 0; i < consdata->nbilinterms && integral; ++i )
4217 integral = integral &&
SCIPisIntegral(scip, consdata->bilinterms[i].coef);
4225 SCIPdebugMsg(scip,
"upgrading quadratic constraint <%s> (%d upgrade methods):\n",
4227 SCIPdebugMsg(scip,
" binlin=%d binquad=%d intlin=%d intquad=%d impllin=%d implquad=%d contlin=%d contquad=%d integral=%u\n",
4228 nbinlin, nbinquad, nintlin, nintquad, nimpllin, nimplquad, ncontlin, ncontquad, integral);
4232 for( i = 0; i < conshdlrdata->nquadconsupgrades; ++i )
4234 if( !conshdlrdata->quadconsupgrades[i]->active )
4237 SCIP_CALL( conshdlrdata->quadconsupgrades[i]->quadconsupgd(scip, cons,
4238 nbinlin, nbinquad, nintlin, nintquad, nimpllin, nimplquad, ncontlin, ncontquad, integral,
4239 &nupgdconss_, upgdconss, upgdconsssize, presoltiming) );
4241 while( nupgdconss_ < 0 )
4244 assert(-nupgdconss_ > upgdconsssize);
4245 upgdconsssize = -nupgdconss_;
4248 SCIP_CALL( conshdlrdata->quadconsupgrades[i]->quadconsupgd(scip, cons,
4249 nbinlin, nbinquad, nintlin, nintquad, nimpllin, nimplquad, ncontlin, ncontquad, integral,
4250 &nupgdconss_, upgdconss, upgdconsssize, presoltiming) );
4252 assert(nupgdconss_ != 0);
4255 if( nupgdconss_ > 0 )
4259 SCIPdebugMsg(scip,
" -> upgraded to %d constraints:\n", nupgdconss_);
4262 for( j = 0; j < nupgdconss_; ++j )
4273 *naddconss += nupgdconss_ - 1;
4305 assert(consdata != NULL);
4306 assert(quadvaridx >= 0);
4307 assert(quadvaridx < consdata->nquadvars);
4308 assert(var2component != NULL);
4309 assert(componentnr >= 0);
4311 quadvarterm = &consdata->quadvarterms[quadvaridx];
4325 for( i = 0; i < quadvarterm->
nadjbilin; ++i )
4327 othervar = consdata->bilinterms[quadvarterm->
adjbilin[i]].var1 == quadvarterm->
var ?
4328 consdata->bilinterms[quadvarterm->
adjbilin[i]].var2 : consdata->bilinterms[quadvarterm->
adjbilin[i]].var1;
4330 assert(othervaridx >= 0);
4357 assert(scip != NULL);
4358 assert(conshdlr != NULL);
4359 assert(var2component != NULL);
4360 assert(ncomponents != NULL);
4361 assert(componentssize != NULL);
4364 assert(conshdlrdata != NULL);
4366 maxncomponents = conshdlrdata->maxdisaggrsize;
4367 assert(maxncomponents > 0);
4370 if( *ncomponents <= maxncomponents )
4383 for( i = 0; i < *ncomponents; ++i )
4386 switch( conshdlrdata->disaggrmergemethod )
4398 SCIPerrorMessage(
"invalid value for constraints/quadratic/disaggrmergemethod parameter");
4402 SCIPdebugMsg(scip,
"%-30s: % 4d components of size % 4d to % 4d, median: % 4d\n",
SCIPgetProbName(scip), *ncomponents, componentssize[0], componentssize[*ncomponents-1], componentssize[*ncomponents/2]);
4404 if( conshdlrdata->disaggrmergemethod ==
'm' )
4410 targetsize = nvars / maxncomponents;
4411 for( i = 0; i < *ncomponents; ++i )
4413 newcompidx[oldcompidx[i]] = i;
4414 count += componentssize[i];
4423 while( i < *ncomponents-1 && (componentssize[i] + componentssize[*ncomponents-1] <= targetsize ||
4424 nvars - count > targetsize * (maxncomponents - i)) )
4427 newcompidx[oldcompidx[*ncomponents-1]] = i;
4430 componentssize[i] += componentssize[*ncomponents-1];
4431 count += componentssize[*ncomponents-1];
4437 assert(count == nvars);
4442 for( i = 0; i < *ncomponents; ++i )
4443 newcompidx[oldcompidx[i]] = i;
4455 newcomponent = newcompidx[oldcomponent];
4456 if( newcomponent >= maxncomponents )
4458 newcomponent = maxncomponents-1;
4459 ++componentssize[maxncomponents-1];
4464 if( *ncomponents > maxncomponents )
4465 *ncomponents = maxncomponents;
4534 int* componentssize;
4541 #ifdef WITH_DEBUG_SOLUTION 4547 assert(scip != NULL);
4548 assert(conshdlr != NULL);
4549 assert(cons != NULL);
4550 assert(naddconss != NULL);
4553 assert(consdata != NULL);
4556 if( consdata->isdisaggregated )
4559 consdata->isdisaggregated =
TRUE;
4565 if( consdata->nquadvars <= 1 )
4577 for( i = 0; i < consdata->nquadvars; ++i )
4584 componentssize[ncomponents] = 0;
4589 assert(ncomponents >= 1);
4594 if( ncomponents == 1 )
4612 #ifdef WITH_DEBUG_SOLUTION 4617 for( comp = 0; comp < ncomponents; ++comp )
4624 SCIP_CALL(
SCIPcreateConsQuadratic2(scip, &auxconss[comp], name, 0, NULL, NULL, 0, NULL, 0, NULL,
4636 for( i = 0; i < consdata->nquadvars; ++i )
4642 assert(comp < ncomponents);
4645 SCIP_CALL(
SCIPaddQuadVarQuadratic(scip, auxconss[comp], consdata->quadvarterms[i].var, scale * consdata->quadvarterms[i].lincoef, scale * consdata->quadvarterms[i].sqrcoef) );
4648 if( !
SCIPisZero(scip, consdata->quadvarterms[i].lincoef) && ABS(consdata->quadvarterms[i].lincoef) < auxcoefs[comp] )
4649 auxcoefs[comp] =
REALABS(consdata->quadvarterms[i].lincoef);
4650 if( !
SCIPisZero(scip, consdata->quadvarterms[i].sqrcoef) && ABS(consdata->quadvarterms[i].sqrcoef) < auxcoefs[comp] )
4651 auxcoefs[comp] =
REALABS(consdata->quadvarterms[i].sqrcoef);
4654 consdata->quadvarterms[i].nadjbilin = 0;
4655 consdata->quadvarterms[i].adjbilinsize = 0;
4657 #ifdef WITH_DEBUG_SOLUTION 4658 if( SCIPdebugIsMainscip(scip) )
4663 auxsolvals[comp] += consdata->quadvarterms[i].lincoef * debugvarval + consdata->quadvarterms[i].sqrcoef * debugvarval * debugvarval;
4669 for( i = 0; i < consdata->nbilinterms; ++i )
4675 assert(comp == (
int)(
size_t)
SCIPhashmapGetImage(var2component, consdata->bilinterms[i].var2));
4676 assert(!
SCIPisZero(scip, consdata->bilinterms[i].coef));
4679 consdata->bilinterms[i].var1, consdata->bilinterms[i].var2, scale * consdata->bilinterms[i].coef) );
4681 if( ABS(consdata->bilinterms[i].coef) < auxcoefs[comp] )
4682 auxcoefs[comp] = ABS(consdata->bilinterms[i].coef);
4684 #ifdef WITH_DEBUG_SOLUTION 4685 if( SCIPdebugIsMainscip(scip) )
4692 auxsolvals[comp] += consdata->bilinterms[i].coef * debugvarval1 * debugvarval2;
4699 consdata->nbilinterms = 0;
4700 consdata->bilintermssize = 0;
4703 for( i = consdata->nquadvars - 1; i >= 0; --i )
4707 assert(consdata->nquadvars == 0);
4710 for( i = 0; i < consdata->nlinvars; ++i )
4716 consdata->lhs *= scale;
4721 consdata->rhs *= scale;
4732 for( comp = 0; comp < ncomponents; ++comp )
4747 assert(auxconsdata != NULL);
4748 auxconsdata->isdisaggregated =
TRUE;
4750 #ifdef WITH_DEBUG_SOLUTION 4751 if( SCIPdebugIsMainscip(scip) )
4761 *naddconss += ncomponents;
4768 #ifdef WITH_DEBUG_SOLUTION 4776 #ifdef CHECKIMPLINBILINEAR 4796 assert(scip != NULL);
4797 assert(cons != NULL);
4798 assert(nbilinremoved != NULL);
4803 assert(consdata != NULL);
4810 for( i = 0; i < consdata->nquadvars; ++i )
4812 x = consdata->quadvarterms[i].var;
4815 if( consdata->quadvarterms[i].nadjbilin == 0 )
4827 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
4829 k = consdata->quadvarterms[i].adjbilin[j];
4831 assert(k < consdata->nbilinterms);
4833 if( consdata->bilinterms[k].coef == 0.0 )
4836 y = consdata->bilinterms[k].var1 == x ? consdata->bilinterms[k].var2 : consdata->bilinterms[k].var1;
4845 consdata->bilinterms[k].coef = 0.0;
4846 consdata->bilinmerged =
FALSE;
4857 assert(consdata->quadvarssorted);
4859 consdata->bilinterms[k].coef = 0.0;
4860 consdata->bilinmerged =
FALSE;
4866 if( *nbilinremoved > 0 )
4871 if( consdata->nlrow != NULL )
4876 consdata->ispropagated =
FALSE;
4877 consdata->ispresolved =
FALSE;
4878 consdata->iscurvchecked =
FALSE;
4881 consdata->isimpladded =
FALSE;
4899 assert(scip != NULL);
4900 assert(cons != NULL);
4901 assert(determined != NULL);
4904 assert(consdata != NULL);
4906 nquadvars = consdata->nquadvars;
4909 if( consdata->iscurvchecked )
4914 consdata->maxnonconvexity = 0.0;
4915 if( nquadvars == 1 )
4917 assert(consdata->nbilinterms == 0);
4918 consdata->isconvex = !
SCIPisNegative(scip, consdata->quadvarterms[0].sqrcoef);
4919 consdata->isconcave = !
SCIPisPositive(scip, consdata->quadvarterms[0].sqrcoef);
4920 consdata->iscurvchecked =
TRUE;
4922 if( !
SCIPisInfinity(scip, -consdata->lhs) && consdata->quadvarterms[0].sqrcoef > 0.0 )
4923 consdata->maxnonconvexity = consdata->quadvarterms[0].sqrcoef;
4924 if( !
SCIPisInfinity(scip, consdata->rhs) && consdata->quadvarterms[0].sqrcoef < 0.0 )
4925 consdata->maxnonconvexity = -consdata->quadvarterms[0].sqrcoef;
4927 else if( nquadvars == 0 )
4929 consdata->isconvex =
TRUE;
4930 consdata->isconcave =
TRUE;
4931 consdata->iscurvchecked =
TRUE;
4933 else if( consdata->nbilinterms == 0 )
4937 consdata->isconvex =
TRUE;
4938 consdata->isconcave =
TRUE;
4940 for( v = nquadvars - 1; v >= 0; --v )
4942 consdata->isconvex = consdata->isconvex && !
SCIPisNegative(scip, consdata->quadvarterms[v].sqrcoef);
4943 consdata->isconcave = consdata->isconcave && !
SCIPisPositive(scip, consdata->quadvarterms[v].sqrcoef);
4945 if( !
SCIPisInfinity(scip, -consdata->lhs) && consdata->quadvarterms[v].sqrcoef > consdata->maxnonconvexity )
4946 consdata->maxnonconvexity = consdata->quadvarterms[0].sqrcoef;
4947 if( !
SCIPisInfinity(scip, consdata->rhs) && -consdata->quadvarterms[v].sqrcoef > consdata->maxnonconvexity )
4948 consdata->maxnonconvexity = -consdata->quadvarterms[0].sqrcoef;
4951 consdata->iscurvchecked =
TRUE;
4953 else if( !checkmultivariate )
4955 consdata->isconvex =
FALSE;
4956 consdata->isconcave =
FALSE;
4957 consdata->iscurvchecked =
TRUE;
4961 *determined =
FALSE;
4983 assert(scip != NULL);
4984 assert(cons != NULL);
4987 assert(consdata != NULL);
4989 n = consdata->nquadvars;
4991 if( consdata->iscurvchecked )
5011 assert(consdata->nbilinterms == 1);
5012 consdata->isconvex =
5013 consdata->quadvarterms[0].sqrcoef >= 0 &&
5014 consdata->quadvarterms[1].sqrcoef >= 0 &&
5015 4 * consdata->quadvarterms[0].sqrcoef * consdata->quadvarterms[1].sqrcoef >= consdata->bilinterms[0].coef * consdata->bilinterms[0].coef;
5016 consdata->isconcave =
5017 consdata->quadvarterms[0].sqrcoef <= 0 &&
5018 consdata->quadvarterms[1].sqrcoef <= 0 &&
5019 4 * consdata->quadvarterms[0].sqrcoef * consdata->quadvarterms[1].sqrcoef >= consdata->bilinterms[0].coef * consdata->bilinterms[0].coef;
5022 tracehalf = (consdata->quadvarterms[0].sqrcoef + consdata->quadvarterms[1].sqrcoef) / 2.0;
5023 discriminantroot = consdata->quadvarterms[0].sqrcoef * consdata->quadvarterms[1].sqrcoef - SQR(consdata->bilinterms[0].coef / 2.0);
5024 discriminantroot = SQR(tracehalf) - discriminantroot;
5026 discriminantroot = SQRT(
MAX(0.0, discriminantroot));
5028 consdata->maxnonconvexity = 0.0;
5030 consdata->maxnonconvexity =
MAX(consdata->maxnonconvexity, tracehalf + discriminantroot);
5032 consdata->maxnonconvexity =
MAX(consdata->maxnonconvexity, discriminantroot - tracehalf);
5034 consdata->iscurvchecked =
TRUE;
5040 if( nn < 0 || (
unsigned) (
int) nn > UINT_MAX /
sizeof(
SCIP_Real) )
5043 consdata->isconvex =
FALSE;
5044 consdata->isconcave =
FALSE;
5045 consdata->iscurvchecked =
TRUE;
5054 consdata->isconvex =
TRUE;
5055 consdata->isconcave =
TRUE;
5056 consdata->maxnonconvexity = 0.0;
5059 for( i = 0; i < n; ++i )
5061 if( consdata->quadvarterms[i].nadjbilin > 0 )
5064 matrix[i*n + i] = consdata->quadvarterms[i].sqrcoef;
5069 if( !
SCIPisInfinity(scip, -consdata->lhs) && consdata->quadvarterms[i].sqrcoef > consdata->maxnonconvexity )
5070 consdata->maxnonconvexity = consdata->quadvarterms[i].sqrcoef;
5071 if( !
SCIPisInfinity(scip, consdata->rhs) && -consdata->quadvarterms[i].sqrcoef > consdata->maxnonconvexity )
5072 consdata->maxnonconvexity = -consdata->quadvarterms[i].sqrcoef;
5076 consdata->isconvex =
FALSE;
5078 consdata->isconcave =
FALSE;
5084 if( !consdata->isconvex && !consdata->isconcave )
5088 consdata->iscurvchecked =
TRUE;
5092 consdata->maxnonconvexity =
MAX(1000.0, consdata->maxnonconvexity);
5098 for( i = 0; i < consdata->nbilinterms; ++i )
5105 matrix[row * n + col] = consdata->bilinterms[i].coef/2;
5107 matrix[col * n + row] = consdata->bilinterms[i].coef/2;
5117 SCIPwarningMessage(scip,
"Failed to compute eigenvalues of quadratic coefficient matrix of constraint %s. Assuming matrix is indefinite.\n",
SCIPconsGetName(cons));
5118 consdata->isconvex =
FALSE;
5119 consdata->isconcave =
FALSE;
5129 printf(
"cons <%s>[%g,%g] spectrum = [%g,%g]\n",
SCIPconsGetName(cons), consdata->lhs, consdata->rhs, alleigval[0], alleigval[n-1]);
5133 consdata->iscurvchecked =
TRUE;
5135 for( i = 0; i < consdata->nquadvars; ++i )
5138 allbinary = i == consdata->nquadvars;
5140 if( !
SCIPisInfinity(scip, consdata->rhs) && alleigval[0] > 0.1 && allbinary )
5142 printf(
"deconvexify cons <%s> by shifting hessian by %g\n",
SCIPconsGetName(cons), alleigval[0]);
5143 for( i = 0; i < consdata->nquadvars; ++i )
5145 consdata->quadvarterms[i].sqrcoef -= alleigval[0];
5146 consdata->quadvarterms[i].lincoef += alleigval[0];
5150 if( !
SCIPisInfinity(scip, consdata->lhs) && alleigval[n-1] < -0.1 && allbinary )
5152 printf(
"deconcavify cons <%s> by shifting hessian by %g\n",
SCIPconsGetName(cons), alleigval[n-1]);
5153 for( i = 0; i < consdata->nquadvars; ++i )
5155 consdata->quadvarterms[i].sqrcoef -= alleigval[n-1];
5156 consdata->quadvarterms[i].lincoef += alleigval[n-1];
5164 consdata->maxnonconvexity =
MAX(consdata->maxnonconvexity, alleigval[n-1]);
5166 consdata->maxnonconvexity =
MAX(consdata->maxnonconvexity, -alleigval[0]);
5172 consdata->isconvex =
FALSE;
5173 consdata->isconcave =
FALSE;
5174 consdata->iscurvchecked =
TRUE;
5205 assert(scip != NULL);
5206 assert(cons != NULL);
5209 assert(consdata != NULL);
5210 assert(consdata->factorleft == NULL);
5211 assert(consdata->factorright == NULL);
5214 if( consdata->nbilinterms == 0 )
5228 if( consdata->iscurvchecked && (consdata->isconvex || consdata->isconcave) )
5231 n = consdata->nquadvars + 1;
5249 for( i = 0; i < consdata->nbilinterms; ++i )
5251 bilinterm = &consdata->bilinterms[i];
5257 assert(idx1 != idx2);
5259 a[MIN(idx1,idx2) * n +
MAX(idx1,idx2)] = bilinterm->
coef / 2.0;
5263 for( i = 0; i < consdata->nquadvars; ++i )
5265 a[i*n + i] = consdata->quadvarterms[i].sqrcoef;
5266 a[i*n + n-1] = consdata->quadvarterms[i].lincoef / 2.0;
5272 SCIPdebugMsg(scip,
"Failed to compute eigenvalues and eigenvectors of augmented quadratic form matrix for constraint <%s>.\n",
SCIPconsGetName(cons));
5279 for( i = 0; i < n; ++i )
5296 if( i < n || posidx == -1 || negidx == -1 )
5311 sigma1 =
sqrt( eigvals[posidx]);
5312 sigma2 =
sqrt(-eigvals[negidx]);
5313 for( i = 0; i < n; ++i )
5315 consdata->factorleft[i] = sigma1 * a[posidx * n + i] - sigma2 * a[negidx * n + i];
5316 consdata->factorright[i] = sigma1 * a[posidx * n + i] + sigma2 * a[negidx * n + i];
5318 if(
SCIPisZero(scip, consdata->factorleft[i]) )
5319 consdata->factorleft[i] = 0.0;
5320 if(
SCIPisZero(scip, consdata->factorright[i]) )
5321 consdata->factorright[i] = 0.0;
5326 for( i = 0; i < consdata->nquadvars; ++i )
5328 if( consdata->factorleft[i] != 0.0 )
5332 for( i = 0; i < consdata->nquadvars; ++i )
5334 if( consdata->factorright[i] != 0.0 )
5346 for( i = 0; i < consdata->nbilinterms; ++i )
5348 bilinterm = &consdata->bilinterms[i];
5353 if( !
SCIPisRelEQ(scip, consdata->factorleft[idx1] * consdata->factorright[idx2] + consdata->factorleft[idx2] * consdata->factorright[idx1], bilinterm->
coef) )
5361 for( i = 0; i < consdata->nquadvars; ++i )
5363 if( !
SCIPisRelEQ(scip, consdata->factorleft[i] * consdata->factorright[i], consdata->quadvarterms[i].sqrcoef) )
5369 if( !
SCIPisRelEQ(scip, consdata->factorleft[n-1] * consdata->factorright[i] + consdata->factorleft[i] * consdata->factorright[n-1], consdata->quadvarterms[i].lincoef) )
5378 SCIPdebugMsg(scip,
"Factorization not accurate enough. Dropping it.\n");
5412 assert(scip != NULL);
5413 assert(cons != NULL);
5414 assert(solviolbounds != NULL);
5417 assert(consdata != NULL);
5419 *solviolbounds =
FALSE;
5420 consdata->activity = 0.0;
5421 consdata->lhsviol = 0.0;
5422 consdata->rhsviol = 0.0;
5424 for( i = 0; i < consdata->nlinvars; ++i )
5428 var = consdata->linvars[i];
5430 activity = consdata->lincoefs[i] * varval;
5452 consdata->activity += activity;
5455 for( j = 0; j < consdata->nquadvars; ++j )
5459 var = consdata->quadvarterms[j].var;
5461 activity = (consdata->quadvarterms[j].lincoef + consdata->quadvarterms[j].sqrcoef * varval) * varval;
5489 *solviolbounds =
TRUE;
5493 activity = (consdata->quadvarterms[j].lincoef + consdata->quadvarterms[j].sqrcoef * varval) * varval;
5497 consdata->activity += activity;
5500 for( j = 0; j < consdata->nbilinterms; ++j )
5504 var = consdata->bilinterms[j].var1;
5505 var2 = consdata->bilinterms[j].var2;
5515 *solviolbounds =
TRUE;
5522 *solviolbounds =
TRUE;
5527 activity = consdata->bilinterms[j].coef * varval * varval2;
5547 consdata->activity += activity;
5553 if( consdata->activity < consdata->lhs && !
SCIPisInfinity(scip, -consdata->lhs) )
5555 consdata->lhsviol = consdata->lhs - consdata->activity;
5556 absviol = consdata->lhsviol;
5557 relviol =
SCIPrelDiff(consdata->lhs, consdata->activity);
5560 consdata->lhsviol = 0.0;
5563 if( consdata->activity > consdata->rhs && !
SCIPisInfinity(scip, consdata->rhs) )
5565 consdata->rhsviol = consdata->activity - consdata->rhs;
5566 absviol = consdata->rhsviol;
5567 relviol =
SCIPrelDiff(consdata->activity, consdata->rhs);
5570 consdata->rhsviol = 0.0;
5596 assert(scip != NULL);
5597 assert(conss != NULL || nconss == 0);
5598 assert(solviolbounds != NULL);
5599 assert(maxviolcon != NULL);
5601 *solviolbounds =
FALSE;
5606 for( c = 0; c < nconss; ++c )
5608 assert(conss != NULL);
5609 assert(conss[c] != NULL);
5612 *solviolbounds |= solviolbounds1;
5615 assert(consdata != NULL);
5617 viol =
MAX(consdata->lhsviol, consdata->rhsviol);
5621 *maxviolcon = conss[c];
5636 assert(bilinterms != NULL);
5638 var1cmp =
SCIPvarCompare(bilinterms[ind1].var1, bilinterms[ind2].var1);
5642 return SCIPvarCompare(bilinterms[ind1].var2, bilinterms[ind2].var2);
5653 assert(bilinterms != NULL);
5662 else if( vol1 < vol2 )
5664 return bilinTermComp2(dataptr, ind1, ind2);
5686 assert(scip != NULL);
5687 assert(bilinterms != NULL);
5688 assert(nbilinterms > 0);
5689 assert(bilinconss != NULL);
5690 assert(bilinposs != NULL);
5696 SCIPsort(perm, bilinTermCompVolume, (
void*)bilinterms, nbilinterms);
5699 for( v = 0; v < nbilinterms; ++v )
5703 bilinterm = bilinterms[v];
5704 bilincons = bilinconss[v];
5705 bilinpos = bilinposs[v];
5710 assert(0 <= perm[i] && perm[i] < nbilinterms);
5711 assert(perm[i] != i);
5713 bilinterms[i] = bilinterms[perm[i]];
5714 bilinconss[i] = bilinconss[perm[i]];
5715 bilinposs[i] = bilinposs[perm[i]];
5721 while( perm[i] != v );
5722 bilinterms[i] = bilinterm;
5723 bilinconss[i] = bilincons;
5724 bilinposs[i] = bilinpos;
5755 assert(scip != NULL);
5756 assert(conshdlrdata != NULL);
5757 assert(conss != NULL);
5764 assert(conshdlrdata->bilinestimators == NULL);
5765 assert(conshdlrdata->nbilinterms == 0);
5767 conshdlrdata->storedbilinearterms =
TRUE;
5771 for( c = 0; c < nconss; ++c )
5774 assert(consdata != NULL);
5775 nbilinterms += consdata->nbilinterms;
5779 if( nbilinterms == 0 )
5789 for( c = 0; c < nconss; ++c )
5796 if( consdata->nbilinterms > 0 )
5801 for( i = 0; i < consdata->nbilinterms; ++i )
5803 assert(consdata->bilinterms != NULL);
5804 assert(consdata->bilinterms[i].var1 != consdata->bilinterms[i].var2);
5807 bilinterms[pos] = consdata->bilinterms[i];
5808 bilincons[pos] = conss[c];
5813 assert(consdata->bilintermsidx != NULL);
5814 consdata->bilintermsidx[i] = -1;
5817 assert(pos == nbilinterms);
5823 conshdlrdata->nbilinterms = nbilinterms;
5824 for( i = 0; i < nbilinterms - 1; ++i )
5826 assert(bilinTermCompVolume((
void*)bilinterms, i, i+1) != 0 || bilinTermComp2((
void*)bilinterms, i, i+1) <= 0);
5828 if( bilinTermComp2((
void*)bilinterms, i, i+1) == 0 )
5829 --(conshdlrdata->nbilinterms);
5831 assert(conshdlrdata->nbilinterms <= nbilinterms && conshdlrdata->nbilinterms > 0);
5838 for( i = 0; i < nbilinterms; ++i )
5845 assert(consdata != NULL);
5846 assert(bilinpos[i] >= 0 && bilinpos[i] < consdata->nbilinterms);
5849 if( i == 0 || bilinTermComp2((
void*)bilinterms, i-1, i) != 0 )
5851 conshdlrdata->bilinestimators[pos].x = bilinterms[i].var1;
5852 conshdlrdata->bilinestimators[pos].y = bilinterms[i].var2;
5853 conshdlrdata->bilinestimators[pos].lastimprfac = 0.0;
5854 conshdlrdata->bilinestimators[pos].maxnonconvexity = 0.0;
5864 conshdlrdata->bilinestimators[pos-1].nunderest += (hasrhs && !consdata->isconvex) ? 1 : 0;
5865 conshdlrdata->bilinestimators[pos-1].noverest += (haslhs && !consdata->isconcave) ? 1 : 0;
5866 conshdlrdata->bilinestimators[pos-1].maxnonconvexity =
MAX(conshdlrdata->bilinestimators[pos-1].maxnonconvexity, consdata->maxnonconvexity);
5871 conshdlrdata->bilinestimators[pos-1].nunderest += (haslhs && !consdata->isconcave) ? 1 : 0;
5872 conshdlrdata->bilinestimators[pos-1].noverest += (hasrhs && !consdata->isconvex) ? 1 : 0;
5873 conshdlrdata->bilinestimators[pos-1].maxnonconvexity =
MAX(conshdlrdata->bilinestimators[pos-1].maxnonconvexity, consdata->maxnonconvexity);
5877 x = consdata->bilinterms[bilinpos[i]].var1;
5880 if( x == conshdlrdata->bilinestimators[pos-1].x )
5882 assert(consdata->bilinterms[bilinpos[i]].var2 == conshdlrdata->bilinestimators[pos-1].y);
5883 consdata->bilintermsidx[bilinpos[i]] = pos-1;
5886 assert(pos == conshdlrdata->nbilinterms);
5893 for( c = 0; c < nconss; ++c )
5896 assert(consdata != NULL);
5898 for( i = 0; i < consdata->nbilinterms; ++i )
5900 SCIP_VAR* x = consdata->bilinterms[i].var1;
5901 SCIP_VAR* y = consdata->bilinterms[i].var2;
5902 int idx = consdata->bilintermsidx[i];
5904 assert(idx >= 0 && idx < conshdlrdata->nbilinterms);
5905 assert(x == conshdlrdata->bilinestimators[idx].x);
5906 assert(y == conshdlrdata->bilinestimators[idx].y);
5909 if( !
SCIPisInfinity(scip, consdata->rhs) && !consdata->isconvex )
5910 assert(conshdlrdata->bilinestimators[idx].nunderest + conshdlrdata->bilinestimators[idx].noverest > 0);
5911 if( !
SCIPisInfinity(scip, -consdata->lhs) && !consdata->isconcave )
5912 assert(conshdlrdata->bilinestimators[idx].nunderest + conshdlrdata->bilinestimators[idx].noverest > 0);
5937 assert(conshdlrdata != NULL);
5939 for( c = 0; c < nconss; ++c )
5942 assert(consdata != NULL);
5949 conshdlrdata->nbilinterms = 0;
5950 conshdlrdata->storedbilinearterms =
FALSE;
5977 assert(rowprep != NULL);
5978 assert(rightminactivity * multright > 0.0);
5979 assert(rightmaxactivity * multright > 0.0);
5980 assert(multright == 1.0 || multright == -1.0);
5983 assert(consdata != NULL);
6007 assert(
SCIPisFeasLE(scip, rightminactivity, rightmaxactivity));
6009 constant = multleft * multright * coefleft[consdata->nquadvars];
6010 constant -= rhs * multright * (1.0 / rightminactivity + 1.0 / rightmaxactivity);
6011 constant += rhs * multright * coefright[consdata->nquadvars] / (rightminactivity * rightmaxactivity);
6015 for( i = 0; i < consdata->nquadvars; ++i )
6017 coef = multleft * multright * coefleft[i];
6018 coef += rhs * multright / (rightminactivity * rightmaxactivity) * coefright[i];
6037 refvalue = coefright[consdata->nquadvars];
6038 for( i = 0; i < consdata->nquadvars; ++i )
6039 refvalue += coefright[i] * ref[i];
6044 constant = multleft * multright * coefleft[consdata->nquadvars];
6045 constant -= 2.0 * rhs / (multright * refvalue);
6046 constant += rhs / (refvalue * refvalue) * multright * coefright[consdata->nquadvars];
6050 for( i = 0; i < consdata->nquadvars; ++i )
6052 coef = multleft * multright * coefleft[i];
6053 coef += rhs / (refvalue * refvalue) * multright * coefright[i];
6090 assert(scip != NULL);
6091 assert(cons != NULL);
6092 assert(ref != NULL);
6093 assert(rowprep != NULL);
6094 assert(success != NULL);
6097 assert(consdata != NULL);
6098 assert(consdata->nlinvars == 0);
6099 assert(consdata->factorleft != NULL);
6100 assert(consdata->factorright != NULL);
6104 leftminactivity = consdata->factorleft[consdata->nquadvars];
6105 leftmaxactivity = consdata->factorleft[consdata->nquadvars];
6106 rightminactivity = consdata->factorright[consdata->nquadvars];
6107 rightmaxactivity = consdata->factorright[consdata->nquadvars];
6108 for( i = 0; i < consdata->nquadvars; ++i )
6112 if( consdata->factorleft[i] > 0.0 )
6117 leftminactivity += consdata->factorleft[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
6119 else if( consdata->factorleft[i] < 0.0 )
6124 leftminactivity += consdata->factorleft[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
6129 if( consdata->factorleft[i] > 0.0 )
6134 leftmaxactivity += consdata->factorleft[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
6136 else if( consdata->factorleft[i] < 0.0 )
6141 leftmaxactivity += consdata->factorleft[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
6147 if( consdata->factorright[i] > 0.0 )
6152 rightminactivity += consdata->factorright[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
6154 else if( consdata->factorright[i] < 0.0 )
6159 rightminactivity += consdata->factorright[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
6164 if( consdata->factorright[i] > 0.0 )
6169 rightmaxactivity += consdata->factorright[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
6171 else if( consdata->factorright[i] < 0.0 )
6176 rightmaxactivity += consdata->factorright[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
6184 rhs = consdata->rhs;
6189 rhs = -consdata->lhs;
6213 if( rightminactivity < 0.0 )
6219 SCIP_CALL(
generateCutFactorableDo(scip, cons, ref, multleft, consdata->factorleft, multright, consdata->factorright, rightminactivity, rightmaxactivity, rhs, rowprep, success) );
6231 if( leftminactivity < 0.0 )
6237 SCIP_CALL(
generateCutFactorableDo(scip, cons, ref, multleft, consdata->factorright, multright, consdata->factorleft, leftminactivity, leftmaxactivity, rhs, rowprep, success) );
6240 (!
SCIPisInfinity(scip, -rightminactivity) && !
SCIPisInfinity(scip, rightmaxactivity) && rightmaxactivity - rightminactivity < leftmaxactivity - leftminactivity) )
6247 if( rightminactivity < 0.0 )
6253 SCIP_CALL(
generateCutFactorableDo(scip, cons, ref, multleft, consdata->factorleft, multright, consdata->factorright, rightminactivity, rightmaxactivity, rhs, rowprep, success) );
6262 if( leftminactivity < 0.0 )
6268 SCIP_CALL(
generateCutFactorableDo(scip, cons, ref, multleft, consdata->factorright, multright, consdata->factorleft, leftminactivity, leftmaxactivity, rhs, rowprep, success) );
6298 assert(wl ==
SCIP_INVALID || (xl != NULL && yl != NULL));
6299 assert(wu ==
SCIP_INVALID || (xu != NULL && yu != NULL));
6318 a = (x1 - x0) * (y1_ - y0_);
6320 b = x0 * y1_ + y0_ * x1 - 2.0 * c;
6334 if( b * b - 4.0 * a * (c - wl) < 0.0 )
6336 SCIPdebugMsg(scip,
"probable numerical difficulties, give up\n");
6340 denom =
sqrt(b * b - 4.0 * a * (c - wl));
6341 q = -0.5 * (b + COPYSIGN(denom, b));
6346 tl = (tl1 >= 0.0 && (tl2 < 0.0 || tl1 < tl2)) ? tl1 : tl2;
6356 if( b * b - 4.0 * a * (c - wu) < 0.0 )
6358 SCIPdebugMsg(scip,
"probable numerical difficulties, give up\n");
6362 denom =
sqrt(b * b - 4.0 * a * (c - wu));
6363 q = -0.5 * (b + COPYSIGN(denom, b));
6368 tu = (tu1 >= 0.0 && (tu2 < 0.0 || tu1 < tu2)) ? tu1 : tu2;
6386 *xl = (
SCIP_Real)(x0 + tl * (x1 - x0 ));
6387 *yl = (
SCIP_Real)(y0_ + tl * (y1_ - y0_));
6391 SCIPdebugMsg(scip,
"probable numerical difficulties, give up\n");
6399 *yu = (
SCIP_Real)(y0_ + tu * (y1_ - y0_));
6403 SCIPdebugMsg(scip,
"probable numerical difficulties, give up\n");
6412 SCIPdebugMsg(scip,
"probable numerical difficulties, give up\n");
6473 *cw = (2.0 * xd * yd - (*cx * xo + *cy * yo)) / (xo * yo - xd * yd);
6514 assert(scip != NULL);
6519 assert(success != NULL);
6528 SCIPdebugMsg(scip,
"x: %9g\t[%9g\t%9g]\n", x0, xl, xu);
6529 SCIPdebugMsg(scip,
"y: %9g\t[%9g\t%9g]\n", y0_, yl, yu);
6530 SCIPdebugMsg(scip,
"w: %9g\t[%9g\t%9g]\n", w0, wl, wu);
6533 assert(wl >= 0.0 || wu <= 0.0);
6545 if( xl >= 0.0 || yl >= 0.0 ||
SCIPisLT(scip, xl * yl, wl) )
6550 else if( xu <= 0.0 || yu <= 0.0 ||
SCIPisLT(scip, xu * yu, wl) )
6565 if( xl >= 0.0 || yu <= 0.0 ||
SCIPisGT(scip, xl * yu, wu) )
6570 else if( xu <= 0.0 || yl >= 0.0 ||
SCIPisGT(scip, xu * yl, wu))
6623 x0 = MIN(xu,
MAX(x0, xl));
6624 y0_ = MIN(yu,
MAX(y0_, yl));
6625 w0 = MIN(wu,
MAX(w0, wl));
6628 SCIPdebugMsg(scip,
"x: %9g\t[%9g\t%9g]\n", x0, xl, xu);
6629 SCIPdebugMsg(scip,
"y: %9g\t[%9g\t%9g]\n", y0_, yl, yu);
6630 SCIPdebugMsg(scip,
"w: %9g\t[%9g\t%9g]\n", w0, wl, wu);
6634 SCIPdebugMsg(scip,
"box for x and y inside feasible region -> nothing to separate\n");
6639 SCIPdebugMsg(scip,
"point to separate not below curve -> cannot separate\n");
6646 if(
generateCutLTIfindIntersection(scip, 0.0, 0.0, x0, y0_, wl, wu, &xlow, &ylow, &xupp, &yupp) )
6650 SCIPdebugMsg(scip,
"lower: %9g\t%9g\tprod %9g\n", xlow, ylow, xlow*ylow);
6651 SCIPdebugMsg(scip,
"upper: %9g\t%9g\tprod %9g\n", xupp, yupp, xupp*yupp);
6654 if( (xlow <= xl && yupp >= yu) || (ylow <= yl && xupp >= xu) )
6658 if( xlow >= xl && xupp <= xu && ylow >= yl && yupp <= yu )
6668 else if( xlow >= xl && ylow >= yl && (xupp > xu || yupp > yu) )
6687 if(
generateCutLTIfindIntersection(scip, xupp, yupp, x0, y0_, wl,
SCIP_INVALID, &xlow, &ylow, NULL, NULL) )
6691 if( xlow < xl || ylow < yl )
6702 else if( xupp <= xu && yupp <= yu && (xlow < xl || ylow < yl) )
6721 if(
generateCutLTIfindIntersection(scip, xlow, ylow, x0, y0_,
SCIP_INVALID, wu, NULL, NULL, &xupp, &yupp) )
6725 if( xupp > xu || yupp > yu )
6736 else if( (xlow < xl && xupp > xu) || (ylow < yl && yupp > yu) )
6768 SCIPdebugMsg(scip,
"lower: %9g\t%9g\tprod %9g\n", xlow, ylow, xlow*ylow);
6769 SCIPdebugMsg(scip,
"upper: %9g\t%9g\tprod %9g\n", xupp, yupp, xupp*yupp);
6793 if(
generateCutLTIfindIntersection(scip, xlow, ylow, x0, y0_,
SCIP_INVALID, wu, NULL, NULL, &xupp2, &yupp2) ||
6796 if(
generateCutLTIfindIntersection(scip, xupp, yupp, x0, y0_, wl,
SCIP_INVALID, &xlow2, &ylow2, NULL, NULL) ||
6814 SCIPdebugMsg(scip,
"points are in a weird position:\n");
6815 SCIPdebugMsg(scip,
"lower: %9g\t%9g\tprod %9g\n", xlow, ylow, xlow*ylow);
6816 SCIPdebugMsg(scip,
"upper: %9g\t%9g\tprod %9g\n", xupp, yupp, xupp*yupp);
6821 SCIPdebugMsg(scip,
"cut w.r.t. reduced points: %gx-%g %+gy-%g %+gw-%g >= 0\n",
6822 *cx, c0x, *cy, c0y, *cw, c0w);
6832 *c0 = c0x + c0y + c0w;
6869 assert(scip != NULL);
6870 assert(cons != NULL);
6871 assert(ref != NULL);
6872 assert(rowprep != NULL);
6873 assert(success != NULL);
6878 assert(consdata != NULL);
6879 assert(consdata->nlinvars > 0);
6880 assert(consdata->factorleft != NULL);
6881 assert(consdata->factorright != NULL);
6889 rhsminactivity = consdata->lhs;
6890 rhsmaxactivity = consdata->rhs;
6893 for( i = 0; i < consdata->nlinvars; ++i )
6897 if( consdata->lincoefs[i] < 0.0 )
6902 rhsminactivity -= consdata->lincoefs[i] *
SCIPvarGetLbLocal(consdata->linvars[i]);
6906 assert(consdata->lincoefs[i] > 0.0);
6910 rhsminactivity -= consdata->lincoefs[i] *
SCIPvarGetUbLocal(consdata->linvars[i]);
6915 if( consdata->lincoefs[i] < 0.0 )
6920 rhsmaxactivity -= consdata->lincoefs[i] *
SCIPvarGetUbLocal(consdata->linvars[i]);
6924 assert(consdata->lincoefs[i] > 0.0);
6928 rhsmaxactivity -= consdata->lincoefs[i] *
SCIPvarGetLbLocal(consdata->linvars[i]);
6931 rhsrefactivity -= consdata->lincoefs[i] *
SCIPgetSolVal(scip, sol, consdata->linvars[i]);
6948 leftminactivity = consdata->factorleft[consdata->nquadvars];
6949 leftmaxactivity = consdata->factorleft[consdata->nquadvars];
6950 leftrefactivity = consdata->factorleft[consdata->nquadvars];
6951 rightminactivity = consdata->factorright[consdata->nquadvars];
6952 rightmaxactivity = consdata->factorright[consdata->nquadvars];
6953 rightrefactivity = consdata->factorright[consdata->nquadvars];
6954 for( i = 0; i < consdata->nquadvars; ++i )
6958 if( consdata->factorleft[i] > 0.0 )
6963 leftminactivity += consdata->factorleft[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
6965 else if( consdata->factorleft[i] < 0.0 )
6970 leftminactivity += consdata->factorleft[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
6975 if( consdata->factorleft[i] > 0.0 )
6980 leftmaxactivity += consdata->factorleft[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
6982 else if( consdata->factorleft[i] < 0.0 )
6987 leftmaxactivity += consdata->factorleft[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
6990 leftrefactivity += consdata->factorleft[i] * ref[i];
6994 if( consdata->factorright[i] > 0.0 )
6999 rightminactivity += consdata->factorright[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
7001 else if( consdata->factorright[i] < 0.0 )
7006 rightminactivity += consdata->factorright[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
7011 if( consdata->factorright[i] > 0.0 )
7016 rightmaxactivity += consdata->factorright[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
7018 else if( consdata->factorright[i] < 0.0 )
7023 rightmaxactivity += consdata->factorright[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
7026 rightrefactivity += consdata->factorright[i] * ref[i];
7035 if(
SCIPisRelEQ(scip, leftminactivity, leftmaxactivity) ||
SCIPisRelEQ(scip, rightminactivity, rightmaxactivity) )
7043 leftminactivity, leftmaxactivity, leftrefactivity,
7044 rightminactivity, rightmaxactivity, rightrefactivity,
7045 rhsminactivity, rhsmaxactivity, rhsrefactivity,
7046 &coefleft, &coefright, &coefrhs, &cutlhs,
7052 SCIPdebugMsg(scip,
"LTI for x[%g,%g] * y[%g,%g] = w[%g,%g]: %gx %+gy %+gw >= %g; feas: %g\n",
7053 leftminactivity, leftmaxactivity, rightminactivity, rightmaxactivity, rhsminactivity, rhsmaxactivity,
7054 coefleft, coefright, coefrhs, cutlhs,
7055 coefleft * leftrefactivity + coefright * rightrefactivity + coefrhs * rhsrefactivity - cutlhs
7058 if( coefleft * leftrefactivity + coefright * rightrefactivity + coefrhs * rhsrefactivity >= cutlhs )
7068 for( i = 0; i < consdata->nquadvars; ++i )
7070 SCIP_CALL(
SCIPaddRowprepTerm(scip, rowprep, consdata->quadvarterms[i].var, coefleft * consdata->factorleft[i] + coefright * consdata->factorright[i]) );
7072 SCIPaddRowprepConstant(rowprep, coefleft * consdata->factorleft[i] + coefright * consdata->factorright[i]);
7074 for( i = 0; i < consdata->nlinvars; ++i )
7122 assert(scip != NULL);
7123 assert(cons != NULL);
7124 assert(ref != NULL);
7125 assert(success != NULL);
7128 assert(consdata != NULL);
7133 for( j = 0; j < consdata->nquadvars && *success; ++j )
7135 var = consdata->quadvarterms[j].var;
7149 for( k = 0; k < consdata->quadvarterms[j].nadjbilin && *success; ++k )
7151 bilinterm = &consdata->bilinterms[consdata->quadvarterms[j].adjbilin[k]];
7152 if( bilinterm->
var1 != var )
7154 assert(bilinterm->
var2 != var);
7155 assert(consdata->sepabilinvar2pos != NULL);
7157 var2pos = consdata->sepabilinvar2pos[consdata->quadvarterms[j].adjbilin[k]];
7158 assert(var2pos >= 0);
7159 assert(var2pos < consdata->nquadvars);
7160 assert(consdata->quadvarterms[var2pos].var == bilinterm->
var2);
7220 assert(nineqs >= 0 && nineqs <= 2);
7221 assert(bestcoefx != NULL);
7222 assert(bestcoefy != NULL);
7223 assert(bestconst != NULL);
7224 assert(bestval != NULL);
7229 assert(ineqs != NULL);
7246 for( i = 0; i < nineqs; ++i )
7248 constshift[i] =
MAX(0.0, ineqs[3*i] * refx - ineqs[3*i+1] * refy - ineqs[3*i+2]);
7249 SCIPdebugMsg(scip,
"constant shift of inequality %d = %.16f\n", constshift[i]);
7255 SCIPcomputeBilinEnvelope2(scip, bilincoef, lbx, ubx, refx, lby, uby, refy, overestimate, ineqs[0], ineqs[1],
7256 ineqs[2] + constshift[0], ineqs[3], ineqs[4], ineqs[5] + constshift[1], &xcoef, &ycoef, &constant, &update);
7260 SCIP_Real val = xcoef * refx + ycoef * refy + constant;
7261 SCIP_Real relimpr = 1.0 - (
REALABS(val - bilincoef * refx * refy) + 1e-4) / (
REALABS(*bestval - bilincoef * refx * refy) + 1e-4);
7265 if( relimpr > 0.05 && absimpr > 1e-3 && ((overestimate &&
SCIPisRelLT(scip, val, *bestval)) || (!overestimate &&
SCIPisRelGT(scip, val, *bestval))) )
7269 *bestconst = constant;
7277 for( i = 0; i < nineqs; ++i )
7279 SCIPcomputeBilinEnvelope1(scip, bilincoef, lbx, ubx, refx, lby, uby, refy, overestimate, ineqs[3*i], ineqs[3*i+1],
7280 ineqs[3*i+2] + constshift[i], &xcoef, &ycoef, &constant, &update);
7284 SCIP_Real val = xcoef * refx + ycoef * refy + constant;
7285 SCIP_Real relimpr = 1.0 - (
REALABS(val - bilincoef * refx * refy) + 1e-4) / (
REALABS(mccormickval - bilincoef * refx * refy) + 1e-4);
7289 if( relimpr > 0.05 && absimpr > 1e-3 && ((overestimate &&
SCIPisRelLT(scip, val, *bestval)) || (!overestimate &&
SCIPisRelGT(scip, val, *bestval))) )
7293 *bestconst = constant;
7316 interiorityx = MIN(refx-lbx, ubx-refx) /
MAX(ubx-lbx,
SCIPepsilon(scip));
7317 interiorityy = MIN(refy-lby, uby-refy) /
MAX(uby-lby,
SCIPepsilon(scip));
7319 return 2.0*MIN(interiorityx, interiorityy);
7345 assert(scip != NULL);
7346 assert(conshdlrdata != NULL);
7347 assert(cons != NULL);
7348 assert(ref != NULL);
7349 assert(success != NULL);
7352 assert(consdata != NULL);
7358 for( j = 0; j < consdata->nquadvars && *success; ++j )
7360 var = consdata->quadvarterms[j].var;
7365 sqrcoef = consdata->quadvarterms[j].sqrcoef;
7366 if( sqrcoef != 0.0 )
7374 &constant, success);
7380 &constant, success);
7387 for( k = 0; k < consdata->quadvarterms[j].nadjbilin && (*success); ++k )
7399 idx = consdata->quadvarterms[j].adjbilin[k];
7400 bilinterm = &consdata->bilinterms[idx];
7401 if( bilinterm->
var1 != var )
7403 assert(bilinterm->
var2 != var);
7404 assert(consdata->sepabilinvar2pos != NULL);
7406 var2pos = consdata->sepabilinvar2pos[consdata->quadvarterms[j].adjbilin[k]];
7407 assert(var2pos >= 0);
7408 assert(var2pos < consdata->nquadvars);
7409 assert(consdata->quadvarterms[var2pos].var == bilinterm->
var2);
7413 y = bilinterm->
var2;
7415 refy = ref[var2pos];
7420 SCIPdebugMsg(scip,
"bilinear term %g %s %s with (%g,%g) in [%g,%g]x[%g,%g] overestimate=%u\n", bilinterm->
coef,
7429 SCIPdebugMsg(scip,
"McCormick = %g (%u)\n", refx * coef + refy * coef2 + constant, *success);
7432 if( conshdlrdata->bilinestimators != NULL && ubx - lbx >= 0.1 && uby - lby >= 0.1
7440 mccormick = refx * coef + refy * coef2 + constant;
7444 bilintermidx = consdata->bilintermsidx[idx];
7445 assert(conshdlrdata->bilinestimators != NULL);
7446 bilinestimator = &(conshdlrdata->bilinestimators[bilintermidx]);
7447 assert(bilinestimator->
x == x);
7448 assert(bilinestimator->
y == y);
7454 if(
SCIPisGE(scip, score, conshdlrdata->minscorebilinterms)
7467 bilinestimator->
nineqoverest, mccormick, &coef, &coef2, &constant, &bestval, &updaterelax);
7471 bilinestimator->
ninequnderest, mccormick, &coef, &coef2, &constant, &bestval, &updaterelax);
7473 SCIPdebugMsg(scip,
"found better relaxation value: %u (%g)\n", updaterelax, bestval);
7482 assert(
SCIPisEQ(scip, bestval, coef * refx + coef2 * refy + constant));
7539 assert(scip != NULL);
7540 assert(conshdlr != NULL);
7541 assert(cons != NULL);
7542 assert(ref != NULL);
7543 assert(row != NULL);
7546 assert(conshdlrdata != NULL);
7549 assert(consdata != NULL);
7559 if( consdata->factorleft != NULL )
7561 if( consdata->nlinvars == 0 )
7595 SCIPdebugMsg(scip,
"skip cut for constraint <%s> because efficacy %g too low (< %g)\n",
SCIPconsGetName(cons), viol, minefficacy);
7610 success = coefrange <= conshdlrdata->cutmaxrange;
7620 if( success && !
SCIPisInfinity(scip, -minefficacy) && viol < minefficacy )
7622 SCIPdebugMsg(scip,
"skip cut for constraint <%s> because efficacy %g too low (< %g)\n",
SCIPconsGetName(cons), viol, minefficacy);
7631 SCIPdebugMsg(scip,
"found cut <%s>, lhs=%g, rhs=%g, mincoef=%g, maxcoef=%g, range=%g, nnz=%d, efficacy=%g\n",
7637 if( efficacy != NULL )
7681 assert(scip != NULL);
7682 assert(conshdlr != NULL);
7683 assert(cons != NULL);
7686 assert(consdata != NULL);
7689 assert((consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs)) ||
7695 consdata->isedavailable =
FALSE;
7703 n = consdata->nquadvars;
7707 if( nn < 0 || (
unsigned) (
int) nn > UINT_MAX /
sizeof(
SCIP_Real) )
7709 SCIPdebugMsg(scip,
"n is too large to compute eigendecomposition\n");
7710 consdata->isedavailable =
FALSE;
7716 matrix = consdata->eigenvectors;
7722 for( i = 0; i < n; ++i )
7725 matrix[i*n + i] = consdata->quadvarterms[i].sqrcoef;
7727 printf(
"inserting in position %d, value %g\n", i*n + i, consdata->quadvarterms[i].sqrcoef);
7731 for( i = 0; i < consdata->nbilinterms; ++i )
7739 matrix[row * n + col] = consdata->bilinterms[i].coef/2;
7741 printf(
"inserting in position %d, value %g\n", row*n + col, consdata->bilinterms[i].coef/2);
7746 matrix[col * n + row] = consdata->bilinterms[i].coef/2;
7748 printf(
"inserting in position %d, value %g\n", col*n + row, consdata->bilinterms[i].coef/2);
7754 printf(
"matrix built:\n");
7755 for( i = 0; i < n; i++ )
7757 for( j = 0; j < n; j++ )
7758 printf(
"%g ", matrix[i*n + j]);
7769 consdata->isedavailable =
FALSE;
7773 consdata->isedavailable =
TRUE;
7777 for( i = 0; i < n; i++ )
7778 for( j = 0; j < n; j++ )
7779 consdata->bp[i] += consdata->quadvarterms[j].lincoef * matrix[i*n + j];
7782 printf(
"eigenvalues:\n");
7783 for( j = 0; j < n; j++ )
7784 printf(
"%g ", consdata->eigenvalues[j]);
7786 printf(
"\neigenvectors (P^T):\n");
7787 for( i = 0; i < n; i++ )
7789 for( j = 0; j < n; j++ )
7790 printf(
"%g ", matrix[i*n + j]);
7795 for( j = 0; j < n; j++ )
7796 printf(
"%g ", consdata->bp[j]);
7797 printf(
"svd computed successfully\n");
7833 int nlrownquadelems;
7837 assert(scip != NULL);
7838 assert(cons != NULL);
7840 assert(success != NULL);
7844 assert(consdata != NULL);
7846 assert((consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs)) ||
7860 #ifdef SCIP_DEBUG_INT 7870 if( consdata->isconvex )
7874 for( i = 0; i < consdata->nlinvars; ++i )
7876 if( consdata->lincoefs[i] >= 0.0 )
7893 SCIPdebugMsg(scip,
"maximum activity is infinity: there is no interior point for fun <= rhs - maxlinactivity!\n");
7898 if( consdata->nlinvars == 0 )
7901 nlpiside = consdata->rhs - nlpiside;
7907 for( i = 0; i < consdata->nlinvars; ++i )
7909 if( consdata->lincoefs[i] >= 0.0 )
7926 SCIPdebugMsg(scip,
"minimum activity is -infinity: there is no interior point for fun >= lhs - minlinactivity!\n");
7931 if( consdata->nlinvars == 0 )
7934 nlpiside = consdata->lhs - nlpiside;
7937 nquadvars = consdata->nquadvars;
7940 if( method ==
'a' && ((consdata->isconvex &&
SCIPisGE(scip, nlpiside, 0.0))
7941 || (consdata->isconcave &&
SCIPisLE(scip, nlpiside, 0.0))) )
7950 if( consdata->nlrow == NULL )
7953 assert(consdata->nlrow != NULL);
7957 assert(nlpi != NULL);
7962 assert(prob != NULL);
7964 #ifdef SCIP_DEBUG_INT 7976 for( i = 0; i < nquadvars; i++ )
7981 lincoefs[i] = consdata->quadvarterms[i].lincoef;
7997 for( i = 0; i < nlrownquadelems; i++ )
7999 assert(nlrowquadvars[nlrowquadelems[i].idx1] == consdata->quadvarterms[nlrowquadelems[i].
idx1].var);
8000 assert(nlrowquadvars[nlrowquadelems[i].idx2] == consdata->quadvarterms[nlrowquadelems[i].
idx2].var);
8011 if( consdata->isconvex )
8014 &nlrownquadelems, &nlrowquadelems, NULL, NULL, NULL) );
8019 &nlrownquadelems, &nlrowquadelems, NULL, NULL, NULL) );
8025 if( consdata->isconvex )
8028 nlrownquadelems, nlrowquadelems, NULL, NULL, 0.0) );
8033 for( i = 0; i < nquadvars; i++ )
8037 for( i = 0; i < nlrownquadelems; i++ )
8038 nlrowquadelems->
coef *= -1;
8041 nlrownquadelems, nlrowquadelems, NULL, NULL, 0.0) );
8044 for( i = 0; i < nlrownquadelems; i++ )
8045 nlrowquadelems->
coef *= -1;
8050 SCIPerrorMessage(
"undefined method for computing interior point: %c\n", method);
8064 SCIPdebugMsg(scip,
"cons <%s>: NLP Solver termination status not okay: %d\n",
8077 SCIPdebugMsg(scip,
"cons <%s>: found an interior point. solution status: %d, termination status: %d\n",
8086 SCIPdebugMsg(scip,
"cons <%s>: failed to find an interior point. solution status: %d, termination status: %d\n",
8093 SCIPerrorMessage(
"cons <%s>: undefined behaviour of NLP Solver. solution status: %d, termination status: %d\n",
8107 for( i = 0; i < nquadvars; i++ )
8110 consdata->interiorpoint[i] = 0.0;
8112 consdata->interiorpoint[i] = interiorpoint[i];
8119 #ifdef SCIP_DEBUG_INT 8120 printf(
"Computation of interior point for cons <%s>:\n",
SCIPconsGetName(cons));
8121 printf(
" - has %d linear variables\n", consdata->nlinvars);
8122 if( consdata->isconvex )
8124 printf(
" - is convex. rhs: %g maximum activity of linear variables: %g\n", consdata->rhs, consdata->rhs - nlpiside);
8125 printf(
" - searched for point whose quadratic part is <= %g\n", nlpiside);
8129 printf(
" - is concave. lhs: %g minimum activity of linear variables: %g\n", consdata->lhs, consdata->lhs - nlpiside);
8130 printf(
" - searched for point whose quadratic part is >= %g\n", nlpiside);
8137 printf(
"Computation successful, 0 is interior point.\n");
8138 for( i = 0; i < nquadvars; i++ )
8140 assert(consdata->interiorpoint[i] == 0.0);
8145 printf(
"Computation successful, NLP soltat: %d, termstat: %d\nPoint found:\n",
8147 for( i = 0; i < nquadvars; i++ )
8149 printf(
"%s = %g\n",
SCIPvarGetName(consdata->quadvarterms[i].var), consdata->interiorpoint[i]);
8155 printf(
"Computation failed. NLP soltat: %d, termstat: %d\n",
8157 printf(
"run with SCIP_DEBUG for more info\n");
8209 assert(scip != NULL);
8210 assert(conshdlr != NULL);
8211 assert(cons != NULL);
8214 assert(consdata != NULL);
8217 assert(conshdlrdata != NULL);
8218 assert(conshdlrdata->gaugecuts);
8221 convex = consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs);
8222 assert(convex || (consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs)));
8232 SCIPdebugMsg(scip,
"failed to compute gauge function\n");
8233 consdata->isgaugeavailable =
FALSE;
8246 consdata->interiorpointval = 0;
8247 consdata->gaugeconst = 0;
8248 for( i = 0; i < consdata->nquadvars; i++ )
8253 val = consdata->interiorpoint[i];
8254 quadvarterm = &consdata->quadvarterms[i];
8256 consdata->interiorpointval += (quadvarterm->
lincoef + quadvarterm->
sqrcoef * val) * val;
8257 consdata->gaugeconst += quadvarterm->
sqrcoef * val * val;
8259 for( j = 0; j < quadvarterm->
nadjbilin; ++j )
8263 bilintermidx = quadvarterm->
adjbilin[j];
8264 bilinterm = &consdata->bilinterms[bilintermidx];
8266 if( bilinterm->
var1 != quadvarterm->
var )
8270 assert(consdata->sepabilinvar2pos != NULL);
8271 assert(consdata->quadvarterms[consdata->sepabilinvar2pos[bilintermidx]].var == bilinterm->
var2);
8273 val2 = consdata->interiorpoint[consdata->sepabilinvar2pos[bilintermidx]];
8275 consdata->interiorpointval += bilinterm->
coef * val * val2;
8276 consdata->gaugeconst += bilinterm->
coef * val * val2;
8281 for( i = 0; i < consdata->nquadvars; i++ )
8283 quadvarterm = &consdata->quadvarterms[i];
8284 consdata->gaugecoefs[i] += quadvarterm->
lincoef + 2.0 * quadvarterm->
sqrcoef * consdata->interiorpoint[i];
8286 for( j = 0; j < quadvarterm->
nadjbilin; j++ )
8291 bilintermidx = quadvarterm->
adjbilin[j];
8292 bilinterm = &consdata->bilinterms[bilintermidx];
8294 if( bilinterm->
var1 == quadvarterm->
var )
8296 varpos = consdata->sepabilinvar2pos[bilintermidx];
8299 assert(consdata->quadvarterms[varpos].var == bilinterm->
var2);
8301 consdata->gaugecoefs[i] += bilinterm->
coef * consdata->interiorpoint[varpos];
8302 consdata->gaugecoefs[varpos] += bilinterm->
coef * consdata->interiorpoint[i];
8307 #ifdef SCIP_DEBUG_INT 8308 printf(
"quadratic part at interior point: %g\n", consdata->interiorpointval);
8310 for( j = 0; j < consdata->nquadvars; j++ )
8312 printf(
"b_gauge[%s] = %g\n",
SCIPvarGetName(consdata->quadvarterms[j].var), consdata->gaugecoefs[j]);
8314 printf(
"c_gauge = %g\n", consdata->gaugeconst);
8317 SCIPdebugMsg(scip,
"gauge function computed successfully\n");
8318 consdata->isgaugeavailable =
TRUE;
8348 assert(scip != NULL);
8349 assert(conshdlr != NULL);
8350 assert(cons != NULL);
8353 assert(consdata != NULL);
8354 assert(consdata->isgaugeavailable);
8358 convex = consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs);
8368 side = consdata->rhs;
8369 for( i = 0; i < consdata->nlinvars; i++ )
8370 side -=
SCIPgetSolVal(scip, refsol, consdata->linvars[i]) * consdata->lincoefs[i];
8372 aterm = side - consdata->interiorpointval;
8382 #ifdef SCIP_DEBUG_GAUGE 8385 printf(
"For current level, there is no interior point. ");
8386 printf(
"rhs: %g level: %15.20g interiorpointval: %15.20g\n", consdata->rhs, side, consdata->interiorpointval);
8387 if( consdata->nlinvars == 1 )
8391 var = consdata->linvars[0];
8392 printf(
"var <%s> = %g in [%15.20g, %15.20g] is linpart\n",
SCIPvarGetName(var),
8398 printf(
"For current level, there is interior point. ");
8399 printf(
"rhs: %g level: %15.20g interiorpointval: %15.20g\n", consdata->rhs, side, consdata->interiorpointval);
8410 side = consdata->lhs;
8411 for( i = 0; i < consdata->nlinvars; i++ )
8412 side -=
SCIPgetSolVal(scip, refsol, consdata->linvars[i]) * consdata->lincoefs[i];
8414 aterm = side - consdata->interiorpointval;
8416 #ifdef SCIP_DEBUG_GAUGE 8419 printf(
"For current level, there is no interior point. ");
8420 printf(
"lhs: %g level: %15.20g interiorpointval: %15.20g\n", consdata->lhs, side, consdata->interiorpointval);
8421 if( consdata->nlinvars == 1 )
8425 var = consdata->linvars[0];
8426 printf(
"var <%s> = %g in [%15.20g, %15.20g] is linpart\n",
SCIPvarGetName(var),
8432 printf(
"For current level, there is interior point. ");
8433 printf(
"lhs: %g level: %15.20g interiorpointval: %15.20g\n", consdata->lhs, side, consdata->interiorpointval);
8445 bterm = -consdata->interiorpointval - consdata->gaugeconst;
8446 cterm = consdata->gaugeconst;
8447 for( i = 0; i < consdata->nquadvars; i++ )
8451 val =
SCIPgetSolVal(scip, refsol, consdata->quadvarterms[i].var);
8452 bterm += consdata->gaugecoefs[i] * val;
8453 cterm -= consdata->gaugecoefs[i] * val;
8454 cterm += (consdata->quadvarterms[i].lincoef + consdata->quadvarterms[i].sqrcoef * val) * val;
8457 for( i = 0; i < consdata->nbilinterms; i++ )
8462 var1 = consdata->bilinterms[i].var1;
8463 var2 = consdata->bilinterms[i].var2;
8468 if( convex && cterm < 0.0 )
8473 else if( !convex && cterm > 0.0 )
8478 assert(bterm*bterm + 4*aterm*cterm >= 0);
8482 *gaugeval = bterm +
sqrt(bterm*bterm + 4 * aterm * cterm);
8483 *gaugeval = *gaugeval / (2 * aterm);
8487 *gaugeval = bterm -
sqrt(bterm*bterm + 4 * aterm * cterm);
8488 *gaugeval = *gaugeval / (2 * aterm);
8493 #ifdef SCIP_DEBUG_GAUGE 8494 printf(
"Gauge's aterm = %g, bterm = %g, cterm = %g\n", aterm, bterm, cterm);
8550 assert(scip != NULL);
8551 assert(conshdlr != NULL);
8552 assert(cons != NULL);
8555 assert(consdata != NULL);
8556 assert(consdata->isedavailable);
8561 pt = consdata->eigenvectors;
8562 D = consdata->eigenvalues;
8563 n = consdata->nquadvars;
8568 for( i = 0; i < consdata->nlinvars; i++ )
8570 c1 += consdata->lincoefs[i] *
SCIPgetSolVal(scip, refsol, consdata->linvars[i]);
8571 c2 -= consdata->lincoefs[i] * consdata->lincoefs[i];
8576 isconcave = consdata->isconcave;
8588 for( i = 0; i < n; i++ )
8596 for( i = 0; i < n; i++ )
8597 for( j = 0; j < n; j++ )
8598 y0_[i] +=
SCIPgetSolVal(scip, refsol, consdata->quadvarterms[j].var) * pt[i*n + j];
8603 for( i = 0; i < n; i++ )
8605 for( j = 0; j < n; j++ )
8606 printf(
"%g ", pt[i*n + j]);
8610 for( i = 0; i < n; i++ )
8611 printf(
"%g ",
SCIPgetSolVal(scip, refsol, consdata->quadvarterms[i].var));
8613 printf(
"P^T x_0: ");
8614 for( i = 0; i < n; i++ )
8615 printf(
"%g ", y0_[i]);
8618 for( i = 0; i < n; i++ )
8619 printf(
"%g ", bp[i]);
8621 printf(
"<d,linvars> = %g\n", c1);
8622 printf(
"-norm(d)^2/2 = %g\n", c2);
8629 for( iter = 0; iter < 9; iter++ )
8631 assert(phirhoprime != 0.0);
8632 rho = rho - (phirho - c)/ phirhoprime;
8645 for( i = 0; i < n; i++ )
8647 assert(1.0 + rho * D[i] != 0.0);
8648 yrho[i] = (y0_[i] - rho * bp[i]/2.0) / (1.0 + rho * D[i]);
8649 yrhoprime[i] = -(D[i] * y0_[i] + bp[i]/2.0) / ( (1.0 + rho * D[i])*(1.0 + rho * D[i]) );
8650 phirho += yrho[i] * (yrho[i] * D[i] + bp[i]);
8651 phirhoprime += yrhoprime[i] * (2 * D[i] * yrho[i] + bp[i]);
8653 phirho += c2 * rho + c1;
8656 printf(
"iteration %d: rho = %g, phirho = %g, phirho' = %g\n", iter, rho, phirho, phirhoprime);
8661 for( i = 0; i < n; i++ )
8665 for( j = 0; j < n; j++ )
8666 ref[i] += pt[j*n + i] * yrho[j];
8672 for( i = 0; i < n; i++ )
8679 #ifdef SCIP_DISABLED_CODE 8681 for( j = 0; j < consdata->nquadvars; ++j )
8687 var = consdata->quadvarterms[j].var;
8694 ref[j] = MIN(ub,
MAX(lb, ref[j]));
8699 printf(
"modified reference point by a projection:\n");
8700 for( j = 0; j < consdata->nquadvars; ++j )
8702 printf(
"%s = %g\n",
SCIPvarGetName(consdata->quadvarterms[j].var), ref[j]);
8732 assert(scip != NULL);
8733 assert(conshdlr != NULL);
8734 assert(cons != NULL);
8737 assert(consdata != NULL);
8738 assert(consdata->isgaugeavailable);
8745 #ifdef SCIP_DEBUG_GAUGE 8746 printf(
"Couldn't evaluate gauge!\n");
8751 #ifdef SCIP_DEBUG_GAUGE 8755 level = consdata->rhs;
8756 for( j = 0; j < consdata->nlinvars; j++ )
8757 level -=
SCIPgetSolVal(scip, refsol, consdata->linvars[j]) * consdata->lincoefs[j];
8759 printf(
"Summary:\n");
8760 printf(
"For cons <%s>: gauge at level %g evaluated at (refsol - intpoint) is %.10f\n",
8762 printf(
"refsol - intpoint:\n");
8764 for( j = 0; j < consdata->nquadvars; ++j )
8767 vvar = consdata->quadvarterms[j].var;
8769 consdata->interiorpoint[j],
SCIPgetSolVal(scip, refsol, vvar) - consdata->interiorpoint[j]);
8772 printf(
"refsol is in the closure of the region (gaugeval <= 1), don't modify reference point\n");
8790 for( j = 0; j < consdata->nquadvars; ++j )
8792 var = consdata->quadvarterms[j].var;
8799 intpoint = consdata->interiorpoint[j];
8800 ref[j] = (
SCIPgetSolVal(scip, refsol, var) - intpoint) / gaugeval + intpoint;
8801 ref[j] = MIN(ub,
MAX(lb, ref[j]));
8804 #ifdef SCIP_DEBUG_GAUGE 8805 printf(
"successful application of guage: %g\n", gaugeval);
8806 printf(
"modified reference point:\n");
8807 for( j = 0; j < consdata->nquadvars; ++j )
8809 printf(
"%s = % 20.15g\n",
SCIPvarGetName(consdata->quadvarterms[j].var), ref[j]);
8844 assert(scip != NULL);
8845 assert(conshdlr != NULL);
8846 assert(cons != NULL);
8849 assert(consdata != NULL);
8852 assert(conshdlrdata != NULL);
8854 if( refsol == NULL )
8866 if( conshdlrdata->gaugecuts && consdata->isgaugeavailable )
8870 else if( conshdlrdata->projectedcuts && consdata->isedavailable )
8872 SCIPdebugMessage(
"use the projection of refsol onto the region defined by the constraint as reference point\n");
8880 SCIP_CALL(
generateCut(scip, conshdlr, cons, ref, sol, violside, row, efficacy, checkcurvmultivar, minefficacy) );
8885 SCIPdebugMsg(scip,
"%s cut fail, try without modifying\n", conshdlrdata->gaugecuts ?
"gauge" :
"projected");
8893 for( j = 0; j < consdata->nquadvars; ++j )
8895 var = consdata->quadvarterms[j].var;
8903 ref[j] = MIN(ub,
MAX(lb, ref[j]));
8906 SCIP_CALL(
generateCut(scip, conshdlr, cons, ref, sol, violside, row, efficacy, checkcurvmultivar, minefficacy) );
8913 if( conshdlrdata->gaugecuts && consdata->isgaugeavailable )
8919 SCIP_CALL(
generateCut(scip, conshdlr, cons, ref, sol, violside, row, efficacy, checkcurvmultivar, minefficacy) );
8926 if( conshdlrdata->projectedcuts && consdata->isedavailable )
8929 SCIP_CALL(
generateCut(scip, conshdlr, cons, ref, sol, violside, row, efficacy, checkcurvmultivar, minefficacy) );
8936 for( j = 0; j < consdata->nquadvars; ++j )
8938 var = consdata->quadvarterms[j].var;
8946 ref[j] = MIN(ub,
MAX(lb, ref[j]));
8948 SCIP_CALL(
generateCut(scip, conshdlr, cons, ref, sol, violside, row, efficacy, checkcurvmultivar, minefficacy) );
8983 assert(scip != NULL);
8984 assert(conshdlr != NULL);
8985 assert(cons != NULL);
8986 assert(row != NULL);
8990 assert(consdata != NULL);
8996 SCIPdebugMsg(scip,
"do not have primal ray, thus cannot resolve unboundedness\n");
9005 SCIP_CALL(
generateCutSol(scip, conshdlr, cons, NULL, NULL, violside, row, NULL,
FALSE, -
SCIPinfinity(scip),
'd') );
9008 if( *row != NULL && rowrayprod != NULL )
9015 assert(var != NULL);
9035 for( i = 0; i < consdata->nquadvars; ++i )
9037 var = consdata->quadvarterms[i].var;
9041 matrixrayprod = 2.0 * consdata->quadvarterms[i].sqrcoef * rayval;
9042 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
9044 bilinterm = &consdata->bilinterms[consdata->quadvarterms[i].adjbilin[j]];
9055 quadrayprod += matrixrayprod * ref[i];
9056 linrayprod += consdata->quadvarterms[i].lincoef * rayval;
9068 for( i = 0; i < consdata->nlinvars; ++i )
9071 SCIPdebugMsg(scip,
"initially have <b,ray> = %g and <ref, 2*A*ref> = %g\n", linrayprod, quadrayprod);
9083 scale = 2*
REALABS(linrayprod/quadrayprod);
9085 scale = 1.0/
REALABS(quadrayprod);
9088 for( i = 0; i < consdata->nquadvars; ++i )
9090 quadrayprod *= scale;
9093 if( rowrayprod != NULL )
9094 *rowrayprod = quadrayprod + linrayprod;
9096 SCIPdebugMsg(scip,
"calling generateCut, expecting ray product %g\n", quadrayprod + linrayprod);
9121 assert(scip != NULL);
9122 assert(row != NULL);
9123 assert(conshdlr != NULL);
9124 assert(result != NULL);
9125 assert(cons != NULL);
9132 assert(conshdlrdata != NULL);
9135 assert(consdata != NULL);
9150 SCIPdebugMessage(
"add cut with efficacy %g for constraint <%s> violated by %g\n", efficacy,
9157 if( inenforcement && !conshdlrdata->enfocutsremovable )
9160 if( bestefficacy != NULL && efficacy > *bestefficacy )
9161 *bestefficacy = efficacy;
9192 assert(scip != NULL);
9193 assert(conshdlr != NULL);
9194 assert(conss != NULL || nconss == 0);
9195 assert(nusefulconss <= nconss);
9196 assert(result != NULL);
9201 assert(conshdlrdata != NULL);
9203 if( bestefficacy != NULL )
9204 *bestefficacy = 0.0;
9210 assert(conss != NULL);
9212 assert(consdata != NULL);
9241 efficacy = -rayprod;
9245 SCIP_CALL(
processCut(scip, &row, conshdlr, conss[c], efficacy, minefficacy, inenforcement, bestefficacy, result) );
9252 conshdlrdata->checkcurvature, minefficacy,
'd') );
9254 SCIP_CALL(
processCut(scip, &row, conshdlr, conss[c], efficacy, minefficacy, inenforcement, bestefficacy, result) );
9294 assert(scip != NULL);
9295 assert(conshdlr != NULL);
9296 assert(conss != NULL || nconss == 0);
9299 assert(conshdlrdata != NULL);
9301 if( separatedlpsol != NULL )
9302 *separatedlpsol =
FALSE;
9304 for( c = 0; c < nconss; ++c )
9306 assert(conss[c] != NULL);
9314 assert(consdata != NULL);
9319 conshdlrdata->checkcurvature, -
SCIPinfinity(scip),
'l') );
9321 else if( consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs) )
9324 conshdlrdata->checkcurvature, -
SCIPinfinity(scip),
'l') );
9335 if( separatedlpsol != NULL )
9340 if( efficacy >= minefficacy )
9344 *separatedlpsol =
TRUE;
9347 assert( ! infeasible );
9374 assert(scip != NULL);
9375 assert(event != NULL);
9376 assert(eventdata != NULL);
9377 assert(eventhdlr != NULL);
9389 assert(sol != NULL);
9392 assert(conshdlrdata != NULL);
9402 assert(conss != NULL);
9446 assert(scip != NULL);
9447 assert(conshdlr != NULL);
9448 assert(conss != NULL || nconss == 0);
9455 assert(conshdlr != NULL);
9457 for( c = 0; c < nconss; ++c )
9459 assert(conss != NULL);
9461 assert(consdata != NULL);
9463 if( !consdata->nquadvars )
9469 SCIPdebugMsg(scip,
"cons <%s> violation: %g %g convex: %u %u\n",
SCIPconsGetName(conss[c]), consdata->lhsviol, consdata->rhsviol, consdata->isconvex, consdata->isconcave);
9472 for( j = 0; j < consdata->nquadvars; ++j )
9474 x = consdata->quadvarterms[j].var;
9475 if( (
SCIPisGT(scip, consdata->rhsviol,
SCIPfeastol(scip)) && consdata->quadvarterms[j].sqrcoef < 0) ||
9476 (
SCIPisGT(scip, consdata->lhsviol,
SCIPfeastol(scip)) && consdata->quadvarterms[j].sqrcoef > 0) )
9495 gap = (xval-xlb)*(xub-xval)/(1+2*ABS(xval));
9503 for( j = 0; j < consdata->nbilinterms; ++j )
9506 x = consdata->bilinterms[j].var1;
9512 y = consdata->bilinterms[j].var2;
9523 if( !xunbounded && !yunbounded )
9533 xval =
MAX(xlb, MIN(xval, xub));
9534 yval =
MAX(ylb, MIN(yval, yub));
9536 coef_ =
SCIPisGT(scip, consdata->lhsviol,
SCIPfeastol(scip)) ? -consdata->bilinterms[j].coef : consdata->bilinterms[j].coef;
9539 if( (xub-xlb)*yval + (yub-ylb)*xval <= xub*yub - xlb*ylb )
9540 gap = (xval*yval - xlb*yval - ylb*xval + xlb*ylb) / (1+
sqrt(xval*xval + yval*yval));
9542 gap = (xval*yval - xval*yub - yval*xub + xub*yub) / (1+
sqrt(xval*xval + yval*yval));
9546 if( (xub-xlb)*yval - (yub-ylb)*xval <= xub*ylb - xlb*yub )
9547 gap = -(xval*yval - xval*ylb - yval*xub + xub*ylb) / (1+
sqrt(xval*xval + yval*yval));
9549 gap = -(xval*yval - xval*yub - yval*xlb + xlb*yub) / (1+
sqrt(xval*xval + yval*yval));
9557 if( consdata->bilintermsidx != NULL && conshdlrdata->usebilinineqbranch )
9562 assert(conshdlrdata->bilinestimators != NULL);
9564 bilinidx = consdata->bilintermsidx[j];
9565 assert(bilinidx >= 0 && bilinidx < conshdlrdata->nbilinterms);
9567 bilinestimator = &conshdlrdata->bilinestimators[bilinidx];
9568 assert(bilinestimator != NULL);
9569 assert(bilinestimator->
x == x);
9570 assert(bilinestimator->
y == y);
9590 if( xbinary || ybinary )
9604 if( xunbounded || yunbounded )
9610 #ifdef BRANCHTOLINEARITY 9613 if(
SCIPisLT(scip, xub-xlb, yub-ylb) )
9619 if(
SCIPisGT(scip, xub-xlb, yub-ylb) )
9643 SCIPdebugMsg(scip,
"registered %d branching candidates\n", *nnotify);
9675 assert(scip != NULL);
9676 assert(conshdlr != NULL);
9677 assert(conss != NULL || nconss == 0);
9681 for( c = 0; c < nconss; ++c )
9683 assert(conss != NULL);
9685 assert(consdata != NULL);
9687 if( !consdata->nquadvars )
9693 SCIPdebugMsg(scip,
"cons %s violation: %g %g convex: %u %u\n",
SCIPconsGetName(conss[c]), consdata->lhsviol, consdata->rhsviol, consdata->isconvex, consdata->isconcave);
9695 for( j = 0; j < consdata->nquadvars; ++j )
9697 quadvarterm = &consdata->quadvarterms[j];
9702 x = quadvarterm->
var;
9727 SCIPdebugMsg(scip,
"registered %d branching candidates\n", *nnotify);
9761 assert(scip != NULL);
9762 assert(conshdlr != NULL);
9763 assert(conss != NULL || nconss == 0);
9767 for( c = 0; c < nconss; ++c )
9769 assert(conss != NULL);
9771 assert(consdata != NULL);
9773 if( !consdata->nquadvars )
9779 SCIPdebugMsg(scip,
"cons %s violation: %g %g convex: %u %u\n",
SCIPconsGetName(conss[c]), consdata->lhsviol, consdata->rhsviol, consdata->isconvex, consdata->isconcave);
9781 for( j = 0; j < consdata->nquadvars; ++j )
9783 quadvarterm = &consdata->quadvarterms[j];
9788 x = quadvarterm->
var;
9799 xval =
MAX(xlb, MIN(xub, xval));
9814 score = 4.0 * (xval - xlb) * (xub - xval) / ((xub - xlb) * (xub - xlb));
9823 SCIPdebugMsg(scip,
"registered %d branching candidates\n", *nnotify);
9842 assert(conshdlrdata != NULL);
9844 switch( conshdlrdata->branchscoring )
9884 assert(scip != NULL);
9885 assert(conss != NULL || nconss == 0);
9890 for( c = 0; c < nconss; ++c )
9892 assert(conss != NULL);
9894 assert(consdata != NULL);
9899 for( i = 0; i < consdata->nquadvars; ++i )
9904 val =
SCIPgetSolVal(scip, sol, consdata->quadvarterms[i].var);
9905 if( ABS(val) > brvarval )
9907 brvarval = ABS(val);
9908 *brvar = consdata->quadvarterms[i].var;
9913 if( *brvar != NULL )
9943 assert(scip != NULL);
9944 assert(conss != NULL || nconss == 0);
9945 assert(addedcons != NULL);
9946 assert(reduceddom != NULL);
9947 assert(infeasible != NULL);
9950 *reduceddom =
FALSE;
9951 *infeasible =
FALSE;
9953 for( c = 0; c < nconss; ++c )
9955 assert(conss != NULL);
9957 assert(consdata != NULL);
9964 for( i = 0; i < consdata->nquadvars; ++i )
9966 var = consdata->quadvarterms[i].var;
9972 constant += (consdata->quadvarterms[i].lincoef + consdata->quadvarterms[i].sqrcoef * val1) * val1;
10002 *reduceddom =
TRUE;
10011 for( i = 0; i < consdata->nbilinterms; ++i )
10015 constant += consdata->bilinterms[i].coef * val1 * val2;
10019 if ( consdata->nlinvars == 1 )
10025 coef = *consdata->lincoefs;
10026 var = *consdata->linvars;
10034 lhs = (consdata->lhs - constant) /
REALABS(coef);
10039 rhs = (consdata->rhs - constant) /
REALABS(coef);
10041 SCIPdebugMsg(scip,
"Linear constraint with one variable: %.20g <= %g <%s> <= %.20g\n", lhs, coef > 0.0 ? 1.0 : -1.0,
SCIPvarGetName(var), rhs);
10057 SCIPdebugMsg(scip,
"node will marked as infeasible since lb/ub of %s is +/-infinity\n",
10060 *infeasible =
TRUE;
10069 SCIPdebugMsg(scip,
"Lower bound leads to infeasibility.\n");
10075 *reduceddom =
TRUE;
10085 SCIPdebugMsg(scip,
"Upper bound leads to infeasibility.\n");
10091 *reduceddom =
TRUE;
10099 consdata->nlinvars, consdata->linvars, consdata->lincoefs,
10107 SCIPdebugMsg(scip,
"replace quadratic constraint <%s> by linear constraint after all quadratic vars have been fixed\n",
SCIPconsGetName(conss[c]) );
10114 SCIPdebugMsg(scip,
"linear constraint is feasible and LP optimal, thus do not add\n");
10144 assert(scip != NULL);
10145 assert(cons != NULL);
10146 assert(intervalinfty > 0.0);
10147 assert(bnd > -intervalinfty);
10148 assert(var != NULL);
10149 assert(result != NULL);
10151 assert(nchgbds != NULL);
10172 SCIPdebugMsg(scip,
"%s found constraint <%s> infeasible due to tightened lower bound %g for variable <%s>\n",
10180 SCIPdebugMsg(scip,
"%s tightened lower bound of variable <%s> in constraint <%s> to %g\n",
10205 assert(scip != NULL);
10206 assert(cons != NULL);
10207 assert(intervalinfty > 0.0);
10208 assert(bnd < intervalinfty);
10209 assert(var != NULL);
10210 assert(result != NULL);
10212 assert(nchgbds != NULL);
10233 SCIPdebugMsg(scip,
"%s found constraint <%s> infeasible due to tightened upper bound %g for variable <%s>\n",
10241 SCIPdebugMsg(scip,
"%s tightened upper bound of variable <%s> in constraint <%s> to %g\n",
10267 assert(scip != NULL);
10268 assert(cons != NULL);
10269 assert(var != NULL);
10270 assert(result != NULL);
10271 assert(nchgbds != NULL);
10323 SCIPdebugMsg(scip,
"found <%s> infeasible because propagated domain of quadratic variable <%s> is outside of (-infty, +infty)\n",
10358 #ifndef PROPBILINNEW 10384 assert(scip != NULL);
10385 assert(cons != NULL);
10389 assert(result != NULL);
10391 assert(nchgbds != NULL);
10392 assert(bilincoef != 0.0);
10471 assert(scip != NULL);
10472 assert(cons != NULL);
10476 assert(result != NULL);
10478 assert(nchgbds != NULL);
10479 assert(bilincoef != 0.0);
10532 int* minactivityinf,
10533 int* maxactivityinf,
10546 assert(scip != NULL);
10547 assert(consdata != NULL);
10548 assert(minquadactivity != NULL);
10549 assert(maxquadactivity != NULL);
10550 assert(minactivityinf != NULL);
10551 assert(maxactivityinf != NULL);
10552 assert(quadactcontr != NULL);
10557 *minquadactivity =
SCIPisInfinity(scip, consdata->rhs) ? -intervalinfty : 0.0;
10558 *maxquadactivity =
SCIPisInfinity(scip, -consdata->lhs) ? intervalinfty : 0.0;
10560 *minactivityinf = 0;
10561 *maxactivityinf = 0;
10563 if( consdata->nquadvars == 0 )
10569 for( i = 0; i < consdata->nquadvars; ++i )
10582 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
10584 k = consdata->quadvarterms[i].adjbilin[j];
10585 if( consdata->bilinterms[k].var1 != consdata->quadvarterms[i].var )
10599 if( bnd >= intervalinfty )
10609 *maxquadactivity += bnd;
10610 quadactcontr[i].
sup = bnd;
10616 *maxquadactivity += bnd;
10618 quadactcontr[i].
sup = bnd;
10628 if( bnd <= -intervalinfty )
10638 *minquadactivity += bnd;
10639 quadactcontr[i].
inf = bnd;
10645 *minquadactivity += bnd;
10647 quadactcontr[i].
inf = bnd;
10654 (*minactivityinf > 0 ? -intervalinfty : *minquadactivity),
10655 (*maxactivityinf > 0 ? intervalinfty : *maxquadactivity));
10687 assert(scip != NULL);
10688 assert(conshdlr != NULL);
10689 assert(cons != NULL);
10690 assert(result != NULL);
10691 assert(nchgbds != NULL);
10692 assert(redundant != NULL);
10695 assert(consdata != NULL);
10698 *redundant =
FALSE;
10704 quadactcontr = NULL;
10705 quadminactinf = -1;
10706 quadmaxactinf = -1;
10714 assert(consdata->minlinactivityinf >= 0);
10715 assert(consdata->maxlinactivityinf >= 0);
10720 if( consdata->nbilinterms > 0 )
10730 propagateBoundsGetQuadActivity(scip, consdata, intervalinfty, &minquadactivity, &maxquadactivity, &quadminactinf, &quadmaxactinf, quadactcontr);
10734 SCIPdebugMsg(scip,
"linear activity: [%g, %g] quadratic activity: [%g, %g]\n",
10735 (consdata->minlinactivityinf > 0 ? -intervalinfty : consdata->minlinactivity),
10736 (consdata->maxlinactivityinf > 0 ? intervalinfty : consdata->maxlinactivity),
10737 consdata->quadactivitybounds.inf, consdata->quadactivitybounds.sup);
10745 SCIPintervalSetBounds(&consactivity, consdata->minlinactivityinf > 0 ? -intervalinfty : consdata->minlinactivity,
10746 consdata->maxlinactivityinf > 0 ? intervalinfty : consdata->maxlinactivity);
10747 SCIPintervalAdd(intervalinfty, &consactivity, consactivity, consdata->quadactivitybounds);
10750 SCIPdebugMsg(scip,
"found constraint <%s> to be redundant: sides: [%g, %g], activity: [%g, %g]\n",
10762 SCIPdebugMsg(scip,
"found constraint <%s> to be infeasible; sides: [%g, %g], activity: [%g, %g], infeas: %g\n",
10770 SCIPintervalSub(intervalinfty, &rhs, consbounds, consdata->quadactivitybounds);
10775 for( i = 0; i < consdata->nlinvars; ++i )
10777 coef = consdata->lincoefs[i];
10778 var = consdata->linvars[i];
10798 if( consdata->minlinactivityinf == 0 && !
SCIPisInfinity(scip, -consdata->minlinactivity) )
10805 bnd -= consdata->minlinactivity;
10820 bnd -= consdata->minlinactivity;
10834 if( consdata->maxlinactivityinf == 0 && !
SCIPisInfinity(scip, consdata->maxlinactivity) )
10841 bnd -= consdata->maxlinactivity;
10856 bnd -= consdata->maxlinactivity;
10868 assert(coef < 0.0 );
10873 if( consdata->maxlinactivityinf == 0 && !
SCIPisInfinity(scip, consdata->maxlinactivity) )
10879 bnd = consdata->maxlinactivity;
10894 bnd = consdata->maxlinactivity;
10909 if( consdata->minlinactivityinf == 0 && !
SCIPisInfinity(scip, -consdata->minlinactivity) )
10915 bnd = consdata->minlinactivity;
10930 bnd = consdata->minlinactivity;
10950 assert(consdata->minlinactivityinf > 0 || consdata->maxlinactivityinf > 0 || consdata->minlinactivity <= consdata->maxlinactivity);
10952 (consdata->minlinactivityinf > 0 ? -intervalinfty : consdata->minlinactivity),
10953 (consdata->maxlinactivityinf > 0 ? intervalinfty : consdata->maxlinactivity));
10957 if( consdata->nquadvars == 1 )
10962 assert(consdata->nbilinterms == 0);
10964 var = consdata->quadvarterms[0].var;
10970 else if( consdata->nbilinterms == 1 && consdata->nquadvars == 2 )
10973 assert(consdata->bilinterms[0].var1 == consdata->quadvarterms[0].var || consdata->bilinterms[0].var1 == consdata->quadvarterms[1].var);
10974 assert(consdata->bilinterms[0].var2 == consdata->quadvarterms[0].var || consdata->bilinterms[0].var2 == consdata->quadvarterms[1].var);
10978 consdata->quadvarterms[0].var, consdata->quadvarterms[0].sqrcoef, consdata->quadvarterms[0].lincoef,
10979 consdata->quadvarterms[1].var, consdata->quadvarterms[1].sqrcoef, consdata->quadvarterms[1].lincoef,
10980 consdata->bilinterms[0].coef,
10981 rhs, result, nchgbds) );
10986 consdata->quadvarterms[1].var, consdata->quadvarterms[1].sqrcoef, consdata->quadvarterms[1].lincoef,
10987 consdata->quadvarterms[0].var, consdata->quadvarterms[0].sqrcoef, consdata->quadvarterms[0].lincoef,
10988 consdata->bilinterms[0].coef,
10989 rhs, result, nchgbds) );
10997 if( quadminactinf == -1 )
10999 assert(quadactcontr == NULL);
11001 propagateBoundsGetQuadActivity(scip, consdata, intervalinfty, &minquadactivity, &maxquadactivity, &quadminactinf, &quadmaxactinf, quadactcontr);
11003 assert(quadactcontr != NULL);
11004 assert(quadminactinf >= 0);
11005 assert(quadmaxactinf >= 0);
11016 for( i = 0; i < consdata->nquadvars; ++i )
11018 var = consdata->quadvarterms[i].var;
11034 if( quadminactinf == 0 || (quadminactinf == 1 &&
SCIPintervalGetInf(quadactcontr[i]) <= -intervalinfty) )
11038 rhs2.
sup = rhs.
sup - minquadactivity;
11047 rhs2.
sup = intervalinfty;
11052 rhs2.
sup = intervalinfty;
11058 if( quadmaxactinf == 0 || (quadmaxactinf == 1 &&
SCIPintervalGetSup(quadactcontr[i]) >= intervalinfty) )
11062 rhs2.
inf = rhs.
inf - maxquadactivity;
11071 rhs2.
inf = -intervalinfty;
11076 rhs2.
inf = -intervalinfty;
11086 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
11088 k = consdata->quadvarterms[i].adjbilin[j];
11090 if( consdata->bilinterms[k].var1 == var )
11116 assert(consdata->bilinterms[k].var2 == var);
11118 assert(consdata->quadvarssorted);
11120 assert(otherpos >= 0);
11121 assert(consdata->quadvarterms[otherpos].var == consdata->bilinterms[k].var1);
11123 if( (consdata->quadvarterms[otherpos].sqrcoef != 0.0) || consdata->quadvarterms[otherpos].lincoef != 0.0 ||
11124 consdata->quadvarterms[otherpos].nadjbilin > 1 )
11142 if( rhs2.
inf > -intervalinfty )
11148 if( bilinbounds.
sup < intervalinfty )
11152 if( rhs2.
sup < intervalinfty )
11158 if( bilinbounds.
inf > -intervalinfty )
11168 if( consdata->bilinterms[k].var1 != var )
11213 assert(scip != NULL);
11214 assert(conshdlr != NULL);
11215 assert(conss != NULL || nconss == 0);
11216 assert(result != NULL);
11217 assert(nchgbds != NULL);
11222 assert(conshdlrdata != NULL);
11227 maxproprounds = conshdlrdata->maxproproundspresolve;
11229 maxproprounds = conshdlrdata->maxproprounds;
11236 SCIPdebugMsg(scip,
"starting domain propagation round %d of %d for %d constraints\n", roundnr, maxproprounds, nconss);
11238 for( c = 0; c < nconss && *result !=
SCIP_CUTOFF; ++c )
11240 assert(conss != NULL);
11252 *result = propresult;
11264 while( success && *result !=
SCIP_CUTOFF && roundnr < maxproprounds );
11280 consdata->linvar_maydecrease = -1;
11281 consdata->linvar_mayincrease = -1;
11284 for( i = 0; i < consdata->nlinvars; ++i )
11287 assert(consdata->lincoefs[i] != 0.0);
11288 if( consdata->lincoefs[i] > 0.0 )
11303 if( (consdata->linvar_maydecrease < 0) ||
11304 (
SCIPvarGetObj(consdata->linvars[consdata->linvar_maydecrease]) / consdata->lincoefs[consdata->linvar_maydecrease] >
SCIPvarGetObj(consdata->linvars[i]) / consdata->lincoefs[i]) )
11305 consdata->linvar_maydecrease = i;
11312 if( (consdata->linvar_mayincrease < 0) ||
11313 (
SCIPvarGetObj(consdata->linvars[consdata->linvar_mayincrease]) / consdata->lincoefs[consdata->linvar_mayincrease] >
SCIPvarGetObj(consdata->linvars[i]) / consdata->lincoefs[i]) )
11314 consdata->linvar_mayincrease = i;
11319 if( consdata->linvar_mayincrease >= 0 )
11321 SCIPdebugMsg(scip,
"may increase <%s> to become feasible\n",
SCIPvarGetName(consdata->linvars[consdata->linvar_mayincrease]));
11323 if( consdata->linvar_maydecrease >= 0 )
11325 SCIPdebugMsg(scip,
"may decrease <%s> to become feasible\n",
SCIPvarGetName(consdata->linvars[consdata->linvar_maydecrease]));
11355 assert(scip != NULL);
11356 assert(conshdlr != NULL);
11357 assert(conss != NULL || nconss == 0);
11358 assert(success != NULL);
11367 assert(conshdlrdata != NULL);
11378 SCIPdebugMsg(scip,
"attempt to make solution from <%s> feasible by shifting linear variable\n",
11381 for( c = 0; c < nconss; ++c )
11384 assert(consdata != NULL);
11393 assert(!solviolbounds);
11394 viol = consdata->lhs - consdata->activity;
11399 assert(!solviolbounds);
11400 viol = consdata->rhs - consdata->activity;
11405 assert(viol != 0.0);
11406 if( consdata->linvar_mayincrease >= 0 &&
11407 ((viol > 0.0 && consdata->lincoefs[consdata->linvar_mayincrease] > 0.0) || (viol < 0.0 && consdata->lincoefs[consdata->linvar_mayincrease] < 0.0)) )
11410 var = consdata->linvars[consdata->linvar_mayincrease];
11412 delta = viol / consdata->lincoefs[consdata->linvar_mayincrease];
11413 assert(delta > 0.0);
11418 delta = MIN(
MAX(0.0, gap), delta);
11431 viol -= consdata->lincoefs[consdata->linvar_mayincrease] * delta;
11437 assert(viol != 0.0);
11438 if( consdata->linvar_maydecrease >= 0 &&
11439 ((viol > 0.0 && consdata->lincoefs[consdata->linvar_maydecrease] < 0.0) || (viol < 0.0 && consdata->lincoefs[consdata->linvar_maydecrease] > 0.0)) )
11442 var = consdata->linvars[consdata->linvar_maydecrease];
11444 delta = viol / consdata->lincoefs[consdata->linvar_maydecrease];
11445 assert(delta < 0.0);
11450 delta =
MAX(MIN(0.0, gap), delta);
11462 viol -= consdata->lincoefs[consdata->linvar_maydecrease] * delta;
11479 assert(conshdlrdata->trysolheur != NULL);
11514 assert(scip != NULL);
11515 assert(conshdlr != NULL);
11516 assert(conss != NULL || nconss == 0);
11517 assert(nconss >= 0);
11518 assert(nusefulconss >= 0);
11519 assert(result != NULL);
11522 assert(conshdlrdata != NULL);
11526 if( maxviolcon == NULL )
11534 if( solviolbounds )
11541 assert(solinfeasible);
11545 if( !solinfeasible )
11551 assert(consdata != NULL);
11552 maxviol = consdata->lhsviol + consdata->rhsviol;
11556 sol == NULL ?
"LP" :
"relaxation");
11567 if( conshdlrdata->nenforounds > 100 )
11580 ++conshdlrdata->nenforounds;
11586 if( conshdlrdata->enfolplimit != -1 && conshdlrdata->nenforounds > conshdlrdata->enfolplimit )
11589 "cut off subtree because enforcement limit was reached; this might lead to incorrect results\n");
11597 conshdlrdata->nenforounds = 0;
11606 *result = propresult;
11622 SCIPdebugMsg(scip,
"separation succeeded (bestefficacy = %g, minefficacy = %g)\n", sepaefficacy,
SCIPfeastol(scip));
11631 SCIPdebugMsg(scip,
"separation failed (bestefficacy = %g < %g = minefficacy ); max viol: %g\n", sepaefficacy,
SCIPfeastol(scip), maxviol);
11648 SCIPdebugMsg(scip,
"separation fallback succeeded, efficacy = %g\n", sepaefficacy);
11654 if( nnotify == 0 && !solinfeasible )
11661 if( brvar == NULL )
11675 else if ( addedcons )
11677 else if ( reduceddom )
11682 SCIPwarningMessage(scip,
"could not enforce feasibility by separating or branching; declaring solution with viol %g as feasible\n", maxviol);
11689 SCIPdebugMsg(scip,
"Could not find any usual branching variable candidate. Proposed variable <%s> with LP value %g for branching.\n",
11695 assert(*result ==
SCIP_INFEASIBLE && (solinfeasible || nnotify > 0));
11707 assert(nupgdconss != NULL);
11708 assert(upgdconss != NULL);
11770 if( upgdconsssize < 1 )
11832 if( lincoefs != NULL )
11834 if( lincoefs[i] != 0.0 )
11842 for( i = 0; i < nquadelems; ++i )
11847 if( quadelems[i].idx1 == quadelems[i].idx2 )
11852 quadelems[i].coef) );
11860 quadelems[i].coef) );
11883 assert(scip != NULL);
11884 assert(conshdlr != NULL);
11902 assert(scip != NULL);
11903 assert(conshdlr != NULL);
11906 assert(conshdlrdata != NULL);
11908 for( i = 0; i < conshdlrdata->nquadconsupgrades; ++i )
11910 assert(conshdlrdata->quadconsupgrades[i] != NULL);
11925 assert(scip != NULL);
11926 assert(conshdlr != NULL);
11929 assert(conshdlrdata != NULL);
11931 conshdlrdata->subnlpheur =
SCIPfindHeur(scip,
"subnlp");
11932 conshdlrdata->trysolheur =
SCIPfindHeur(scip,
"trysol");
11944 assert(scip != NULL);
11945 assert(conshdlr != NULL);
11948 assert(conshdlrdata != NULL);
11950 conshdlrdata->subnlpheur = NULL;
11951 conshdlrdata->trysolheur = NULL;
11965 assert(scip != NULL);
11966 assert(conshdlr != NULL);
11967 assert(conss != NULL || nconss == 0);
11970 assert(conshdlrdata != NULL);
11986 assert(scip != NULL);
11987 assert(conshdlr != NULL);
11988 assert(conss != NULL || nconss == 0);
11990 for( c = 0; c < nconss; ++c )
11992 assert(conss != NULL);
11994 assert(consdata != NULL);
11996 if( !consdata->isremovedfixings )
12006 assert(consdata->isremovedfixings);
12007 assert(consdata->linvarsmerged);
12008 assert(consdata->quadvarsmerged);
12009 assert(consdata->bilinmerged);
12012 for( i = 0; i < consdata->nlinvars; ++i )
12015 for( i = 0; i < consdata->nquadvars; ++i )
12039 assert(scip != NULL);
12040 assert(conshdlr != NULL);
12041 assert(conss != NULL || nconss == 0);
12044 assert(conshdlrdata != NULL);
12046 for( c = 0; c < nconss; ++c )
12048 assert(conss != NULL);
12050 assert(consdata != NULL);
12057 consdata->lincoefsmax = 0.0;
12058 for( i = 0; i < consdata->nlinvars; ++i )
12060 consdata->lincoefsmin = MIN(consdata->lincoefsmin,
REALABS(consdata->lincoefs[i]));
12061 consdata->lincoefsmax =
MAX(consdata->lincoefsmax,
REALABS(consdata->lincoefs[i]));
12067 if( consdata->nlrow == NULL )
12073 assert(consdata->nlrow != NULL);
12079 assert(consdata->sepaquadvars == NULL);
12080 assert(consdata->sepabilinvar2pos == NULL);
12081 if( consdata->nquadvars > 0 )
12089 for( i = 0; i < consdata->nquadvars; ++i )
12090 consdata->sepaquadvars[i] = consdata->quadvarterms[i].var;
12092 for( i = 0; i < consdata->nbilinterms; ++i )
12098 if( conshdlrdata->checkfactorable )
12105 if( conshdlrdata->gaugecuts &&
SCIPgetSubscipDepth(scip) == 0 && consdata->nquadvars > 0 )
12108 if( (consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs)) ||
12109 (consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs)) )
12116 if( conshdlrdata->projectedcuts &&
SCIPgetSubscipDepth(scip) == 0 && consdata->nquadvars > 0 )
12119 if( (consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs)) ||
12120 (consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs)) )
12128 consdata->ispropagated =
FALSE;
12137 conshdlrdata->newsoleventfilterpos = -1;
12138 if( nconss != 0 && conshdlrdata->linearizeheursol )
12143 assert(eventhdlr != NULL);
12151 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");
12155 conshdlrdata->sepanlp =
FALSE;
12156 conshdlrdata->lastenfonode = NULL;
12157 conshdlrdata->nenforounds = 0;
12173 assert(scip != NULL);
12174 assert(conshdlr != NULL);
12175 assert(conss != NULL || nconss == 0);
12178 assert(conshdlrdata != NULL);
12180 for( c = 0; c < nconss; ++c )
12183 assert(consdata != NULL);
12186 if( consdata->nlrow != NULL )
12191 assert(!
SCIPconsIsEnabled(conss[c]) || consdata->sepaquadvars != NULL || consdata->nquadvars == 0);
12192 assert(!
SCIPconsIsEnabled(conss[c]) || consdata->sepabilinvar2pos != NULL || consdata->nquadvars == 0);
12212 if( conshdlrdata->newsoleventfilterpos >= 0 )
12217 assert(eventhdlr != NULL);
12220 conshdlrdata->newsoleventfilterpos = -1;
12235 assert(scip != NULL);
12236 assert(conshdlr != NULL);
12237 assert(cons != NULL);
12238 assert(consdata != NULL);
12243 assert(*consdata == NULL);
12257 assert(sourcedata != NULL);
12260 sourcedata->lhs, sourcedata->rhs,
12261 sourcedata->nlinvars, sourcedata->linvars, sourcedata->lincoefs,
12262 sourcedata->nquadvars, sourcedata->quadvarterms,
12263 sourcedata->nbilinterms, sourcedata->bilinterms,
12266 for( i = 0; i < targetdata->nlinvars; ++i )
12272 for( i = 0; i < targetdata->nquadvars; ++i )
12278 for( i = 0; i < targetdata->nbilinterms; ++i )
12283 if(
SCIPvarCompare(targetdata->bilinterms[i].var1, targetdata->bilinterms[i].var2) > 0 )
12286 tmp = targetdata->bilinterms[i].var2;
12287 targetdata->bilinterms[i].var2 = targetdata->bilinterms[i].var1;
12288 targetdata->bilinterms[i].var1 = tmp;
12299 SCIPdebugMsg(scip,
"created transformed quadratic constraint ");
12317 assert(scip != NULL);
12318 assert(conshdlr != NULL);
12319 assert(conss != NULL || nconss == 0);
12322 assert(conshdlrdata != NULL);
12324 *infeasible =
FALSE;
12326 for( c = 0; c < nconss && !(*infeasible); ++c )
12328 assert(conss[c] != NULL);
12333 assert(consdata != NULL);
12337 if( consdata->nquadvars == 0 )
12352 if( (consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs)) ||
12353 (consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs)) )
12360 for( k = 0; k < 5; ++k )
12362 lambda = 0.1 * (k+1);
12363 for( i = 0; i < consdata->nquadvars; ++i )
12365 var = consdata->quadvarterms[i].var;
12376 lb = MIN(-10.0, ub - 0.1*
REALABS(ub));
12381 x[i] = lambda * ub + (1.0 - lambda) * lb;
12383 x[i] = lambda * lb + (1.0 - lambda) * ub;
12400 if( !(*infeasible) && ((! consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs))
12401 || (! consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs))) )
12414 for( k = 0; k < 2; ++k )
12424 for( i = 0; i < consdata->nquadvars; ++i )
12426 var = consdata->quadvarterms[i].var;
12435 x[i] = MIN(0.0, ub);
12442 x[i] =
MAX(0.0, lb);
12447 lambda = 0.4 + 0.2 * ((i+k)%2) + 0.01 * i / (double)consdata->nquadvars;
12452 possquare |= consdata->quadvarterms[i].sqrcoef > 0.0;
12453 negsquare |= consdata->quadvarterms[i].sqrcoef < 0.0;
12456 if( !consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs) )
12469 if( !(*infeasible) && !consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs) )
12486 (consdata->nbilinterms == 0 && (!possquare ||
SCIPisInfinity(scip, consdata->rhs))) ||
12487 (consdata->nbilinterms == 0 && (!negsquare ||
SCIPisInfinity(scip, -consdata->lhs))) )
12511 assert(scip != NULL);
12512 assert(conshdlr != NULL);
12513 assert(conss != NULL || nconss == 0);
12514 assert(result != NULL);
12519 assert(conshdlrdata != NULL);
12524 if( solviolbounds )
12528 if( maxviolcon == NULL )
12534 if(
SCIPgetDepth(scip) == 0 && !conshdlrdata->sepanlp &&
12551 for( c = 0; c < nconss; ++c )
12553 assert(conss[c] != NULL);
12556 assert(consdata != NULL);
12575 if( conshdlrdata->subnlpheur != NULL )
12590 SCIPdebugMsg(scip,
"solved NLP relax, solution status: %d\n", solstat);
12596 conshdlrdata->sepanlp =
TRUE;
12600 SCIPdebugMsg(scip,
"NLP relaxation is globally infeasible, thus can cutoff node\n");
12612 assert(nlpsol != NULL);
12615 if( solvednlp && conshdlrdata->trysolheur != NULL )
12625 if( nfracvars == 0 )
12637 if( lpsolseparated )
12639 SCIPdebugMsg(scip,
"linearization cuts separate LP solution\n");
12662 assert(scip != NULL);
12663 assert(conshdlr != NULL);
12664 assert(conss != NULL || nconss == 0);
12665 assert(sol != NULL);
12666 assert(result != NULL);
12673 if( solviolbounds )
12677 if( maxviolcon == NULL )
12717 assert(scip != NULL);
12718 assert(conss != NULL || nconss == 0);
12723 assert(!solviolbounds);
12725 if( maxviolcon == NULL )
12740 *result = propresult;
12748 for( c = 0; c < nconss; ++c )
12750 assert(conss != NULL);
12752 assert(consdata != NULL);
12757 for( i = 0; i < consdata->nlinvars; ++i )
12759 var = consdata->linvars[i];
12767 for( i = 0; i < consdata->nquadvars; ++i )
12769 var = consdata->quadvarterms[i].var;
12804 SCIPdebugMsg(scip,
"All variables in violated constraints fixed (up to epsilon). Cannot find branching candidate. Forcing solution of LP.\n");
12818 assert(scip != NULL);
12819 assert(conshdlr != NULL);
12820 assert(conss != NULL || nconss == 0);
12821 assert(result != NULL);
12842 assert(scip != NULL);
12843 assert(conshdlr != NULL);
12844 assert(conss != NULL || nconss == 0);
12845 assert(result != NULL);
12854 SCIPdebugMsg(scip,
"presolving will %swait with reformulation\n", doreformulations ?
"not " :
"");
12857 assert(conshdlrdata != NULL);
12859 for( c = 0; c < nconss; ++c )
12861 assert(conss != NULL);
12863 assert(consdata != NULL);
12868 if( !consdata->initialmerge )
12873 consdata->initialmerge =
TRUE;
12876 havechange =
FALSE;
12877 #ifdef CHECKIMPLINBILINEAR 12881 SCIP_CALL( presolveApplyImplications(scip, conss[c], &nbilinremoved) );
12882 if( nbilinremoved > 0 )
12884 *nchgcoefs += nbilinremoved;
12888 assert(!consdata->isimpladded);
12894 if( !consdata->ispresolved || !consdata->ispropagated || nnewchgvartypes > 0 )
12906 if( !consdata->isremovedfixings )
12909 assert(consdata->isremovedfixings);
12936 if( doreformulations )
12940 naddconss_old = *naddconss;
12943 assert(*naddconss >= naddconss_old);
12945 if( *naddconss == naddconss_old )
12949 assert(*naddconss >= naddconss_old);
12952 if( conshdlrdata->maxdisaggrsize > 1 )
12958 if( *naddconss > naddconss_old )
12969 if( consdata->nlinvars == 0 && consdata->nquadvars == 0 )
12990 if( (presoltiming & SCIP_PRESOLTIMING_FAST) != 0 && !consdata->ispropagated )
13001 SCIPdebugMsg(scip,
"starting domain propagation round %d of %d\n", roundnr, conshdlrdata->maxproproundspresolve);
13003 if( !consdata->ispropagated )
13005 consdata->ispropagated =
TRUE;
13011 SCIPdebugMsg(scip,
"propagation on constraint <%s> says problem is infeasible in presolve\n",
13033 while( !consdata->ispropagated && roundnr < conshdlrdata->maxproproundspresolve );
13040 if( (nnewchgvartypes != 0 || havechange || !consdata->ispresolved)
13051 for( i = 0; !fail && i < consdata->nlinvars; ++i )
13061 else if(
SCIPisEQ(scip, ABS(consdata->lincoefs[i]), 1.0) )
13062 candidate = consdata->linvars[i];
13066 for( i = 0; !fail && i < consdata->nquadvars; ++i )
13070 for( i = 0; !fail && i < consdata->nbilinterms; ++i )
13073 if( !fail && candidate != NULL )
13120 if( !consdata->initialmerge )
13125 consdata->initialmerge =
TRUE;
13128 for( i = 0; i < consdata->nquadvars; ++i )
13134 var = consdata->quadvarterms[i].var;
13135 assert(var != NULL);
13177 consdata->ispresolved =
TRUE;
13192 assert(scip != NULL);
13193 assert(cons != NULL);
13196 assert(consdata != NULL);
13201 for( i = 0; i < consdata->nlinvars; ++i )
13203 if( consdata->lincoefs[i] > 0 )
13227 for( i = 0; i < consdata->nquadvars; ++i )
13242 assert(scip != NULL);
13243 assert(conshdlr != NULL);
13244 assert(cons != NULL);
13249 assert(conshdlrdata != NULL);
13267 SCIP_CALL( consInitsolQuadratic(scip, conshdlr, &cons, 1) );
13279 assert(scip != NULL);
13280 assert(conshdlr != NULL);
13281 assert(cons != NULL);
13285 assert(conshdlrdata != NULL);
13292 SCIP_CALL( consExitsolQuadratic(scip, conshdlr, &cons, 1,
FALSE) );
13307 assert(scip != NULL);
13308 assert(cons != NULL);
13311 assert(consdata != NULL);
13316 && !
SCIPisEQ(scip, consdata->lhs, consdata->rhs) )
13320 if( consdata->nlinvars == 0 && consdata->nquadvars == 0 )
13329 int* monomialnvars;
13334 monomialssize = consdata->nlinvars + 2 * consdata->nquadvars + consdata->nbilinterms;
13341 for( j = 0; j < consdata->nlinvars; ++j )
13343 assert(nmonomials < monomialssize);
13347 monomialvars[nmonomials][0] = consdata->linvars[j];
13348 monomialexps[nmonomials] = NULL;
13349 monomialcoefs[nmonomials] = consdata->lincoefs[j];
13350 monomialnvars[nmonomials] = 1;
13354 for( j = 0; j < consdata->nquadvars; ++j )
13356 if( consdata->quadvarterms[j].lincoef != 0.0 )
13358 assert(nmonomials < monomialssize);
13362 monomialvars[nmonomials][0] = consdata->quadvarterms[j].var;
13363 monomialexps[nmonomials] = NULL;
13364 monomialcoefs[nmonomials] = consdata->quadvarterms[j].lincoef;
13365 monomialnvars[nmonomials] = 1;
13369 if( consdata->quadvarterms[j].sqrcoef != 0.0 )
13371 assert(nmonomials < monomialssize);
13376 monomialvars[nmonomials][0] = consdata->quadvarterms[j].var;
13377 monomialexps[nmonomials][0] = 2.0;
13378 monomialcoefs[nmonomials] = consdata->quadvarterms[j].sqrcoef;
13379 monomialnvars[nmonomials] = 1;
13384 for( j = 0; j < consdata->nbilinterms; ++j )
13386 assert(nmonomials < monomialssize);
13390 monomialvars[nmonomials][0] = consdata->bilinterms[j].var1;
13391 monomialvars[nmonomials][1] = consdata->bilinterms[j].var2;
13392 monomialexps[nmonomials] = NULL;
13393 monomialcoefs[nmonomials] = consdata->bilinterms[j].coef;
13394 monomialnvars[nmonomials] = 2;
13400 for( j = 0; j < nmonomials; ++j )
13413 if(
SCIPisEQ(scip, consdata->lhs, consdata->rhs) )
13445 assert(scip != NULL);
13446 assert(conss != NULL || nconss == 0);
13447 assert(result != NULL);
13450 assert(conshdlrdata != NULL);
13455 maypropfeasible = conshdlrdata->linfeasshift && (conshdlrdata->trysolheur != NULL) &&
13457 for( c = 0; c < nconss; ++c )
13459 assert(conss != NULL);
13461 assert(!solviolbounds);
13464 assert(consdata != NULL);
13475 SCIPinfoMessage(scip, NULL,
"violation: left hand side is violated by %.15g (scaled: %.15g)\n", consdata->lhs - consdata->activity, consdata->lhsviol);
13479 SCIPinfoMessage(scip, NULL,
"violation: right hand side is violated by %.15g (scaled: %.15g)\n", consdata->activity - consdata->rhs, consdata->rhsviol);
13482 if( (conshdlrdata->subnlpheur == NULL || sol == NULL) && !maypropfeasible && !completely )
13484 if( consdata->lhsviol > maxviol || consdata->rhsviol > maxviol )
13485 maxviol = consdata->lhsviol + consdata->rhsviol;
13489 maypropfeasible =
FALSE;
13491 if( maypropfeasible )
13501 if( !(consdata->linvar_mayincrease >= 0 && consdata->lincoefs[consdata->linvar_mayincrease] > 0.0) &&
13502 ! (consdata->linvar_maydecrease >= 0 && consdata->lincoefs[consdata->linvar_maydecrease] < 0.0) )
13503 maypropfeasible =
FALSE;
13510 if( !(consdata->linvar_mayincrease >= 0 && consdata->lincoefs[consdata->linvar_mayincrease] < 0.0) &&
13511 ! (consdata->linvar_maydecrease >= 0 && consdata->lincoefs[consdata->linvar_maydecrease] > 0.0) )
13512 maypropfeasible =
FALSE;
13550 assert(scip != NULL);
13551 assert(cons != NULL);
13552 assert(sourcescip != NULL);
13553 assert(sourceconshdlr != NULL);
13554 assert(sourcecons != NULL);
13555 assert(varmap != NULL);
13556 assert(valid != NULL);
13559 assert(consdata != NULL);
13562 quadvarterms = NULL;
13567 if( consdata->nlinvars != 0 )
13570 for( i = 0; i < consdata->nlinvars; ++i )
13572 SCIP_CALL(
SCIPgetVarCopy(sourcescip, scip, consdata->linvars[i], &linvars[i], varmap, consmap, global, valid) );
13573 assert(!(*valid) || linvars[i] != NULL);
13581 if( consdata->nbilinterms != 0 )
13586 if( consdata->nquadvars != 0 )
13589 for( i = 0; i < consdata->nquadvars; ++i )
13591 SCIP_CALL(
SCIPgetVarCopy(sourcescip, scip, consdata->quadvarterms[i].var, &quadvarterms[i].
var, varmap, consmap, global, valid) );
13592 assert(!(*valid) || quadvarterms[i].var != NULL);
13598 quadvarterms[i].
lincoef = consdata->quadvarterms[i].lincoef;
13599 quadvarterms[i].
sqrcoef = consdata->quadvarterms[i].sqrcoef;
13601 quadvarterms[i].
nadjbilin = consdata->quadvarterms[i].nadjbilin;
13602 quadvarterms[i].
adjbilin = consdata->quadvarterms[i].adjbilin;
13604 assert(consdata->nbilinterms != 0 || consdata->quadvarterms[i].nadjbilin == 0);
13606 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
13608 assert(bilinterms != NULL);
13610 k = consdata->quadvarterms[i].adjbilin[j];
13611 assert(consdata->bilinterms[k].var1 != NULL);
13612 assert(consdata->bilinterms[k].var2 != NULL);
13613 if( consdata->bilinterms[k].var1 == consdata->quadvarterms[i].var )
13615 assert(consdata->bilinterms[k].var2 != consdata->quadvarterms[i].var);
13616 bilinterms[k].
var1 = quadvarterms[i].
var;
13620 assert(consdata->bilinterms[k].var2 == consdata->quadvarterms[i].var);
13621 bilinterms[k].
var2 = quadvarterms[i].
var;
13623 bilinterms[k].
coef = consdata->bilinterms[k].coef;
13628 assert(stickingatnode ==
FALSE);
13630 consdata->nlinvars, linvars, consdata->lincoefs,
13631 consdata->nquadvars, quadvarterms,
13632 consdata->nbilinterms, bilinterms,
13633 consdata->lhs, consdata->rhs,
13634 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable) );
13638 targetconsdata->isconvex = consdata->isconvex;
13639 targetconsdata->isconcave = consdata->isconcave;
13640 targetconsdata->iscurvchecked = consdata->iscurvchecked;
13658 int* monomialnvars;
13664 assert(scip != NULL);
13665 assert(success != NULL);
13666 assert(str != NULL);
13667 assert(name != NULL);
13668 assert(cons != NULL);
13674 (*success) =
FALSE;
13681 while( isspace((
unsigned char)*str) )
13685 if( isdigit((
unsigned char)str[0]) || ((str[0] ==
'-' || str[0] ==
'+') && isdigit((
unsigned char)str[1])) )
13695 while( isspace((
unsigned char)*endptr) )
13698 if( endptr[0] !=
'<' || endptr[1] !=
'=' )
13709 while( isspace((
unsigned char)*str) )
13722 while( isspace((
unsigned char)*str) )
13725 if( *str && str[0] ==
'<' && str[1] ==
'=' )
13736 else if( *str && str[0] ==
'>' && str[1] ==
'=' )
13750 else if( *str && str[0] ==
'=' && str[1] ==
'=' )
13775 assert(stickingatnode ==
FALSE);
13777 0, NULL, NULL, NULL, lhs, rhs,
13778 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable) );
13780 for( i = 0; i < nmonomials; ++i )
13782 if( monomialnvars[i] == 0 )
13787 else if( monomialnvars[i] == 1 && monomialexps[i][0] == 1.0 )
13792 else if( monomialnvars[i] == 1 && monomialexps[i][0] == 2.0 )
13797 else if( monomialnvars[i] == 2 && monomialexps[i][0] == 1.0 && monomialexps[i][1] == 1.0 )
13804 var1 = monomialvars[i][0];
13805 var2 = monomialvars[i][1];
13830 SCIPerrorMessage(
"polynomial in quadratic constraint does not have degree at most 2\n");
13849 assert(cons != NULL);
13850 assert(success != NULL);
13853 assert(consdata != NULL);
13855 if( varssize < consdata->nlinvars + consdata->nquadvars )
13856 (*success) =
FALSE;
13861 assert(vars != NULL);
13865 for( i = 0; i < consdata->nquadvars; ++i )
13866 vars[consdata->nlinvars+i] = consdata->quadvarterms[i].var;
13880 assert(cons != NULL);
13881 assert(success != NULL);
13884 assert(consdata != NULL);
13886 (*nvars) = consdata->nlinvars + consdata->nquadvars;
13912 consEnfolpQuadratic, consEnfopsQuadratic, consCheckQuadratic, consLockQuadratic,
13914 assert(conshdlr != NULL);
13943 "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)",
13944 &conshdlrdata->replacebinaryprodlength,
FALSE, INT_MAX, 0, INT_MAX, NULL, NULL) );
13947 "empathy level for using the AND constraint handler: 0 always avoid using AND; 1 use AND sometimes; 2 use AND as often as possible",
13948 &conshdlrdata->empathy4and,
FALSE, 0, 0, 2, NULL, NULL) );
13951 "whether to make non-varbound linear constraints added due to replacing products with binary variables initial",
13952 &conshdlrdata->binreforminitial,
TRUE,
FALSE, NULL, NULL) );
13955 "whether to consider only binary variables when replacing products with binary variables",
13956 &conshdlrdata->binreformbinaryonly,
FALSE,
TRUE, NULL, NULL) );
13959 "limit (as factor on 1/feastol) on coefficients and coef. range in linear constraints created when replacing products with binary variables",
13960 &conshdlrdata->binreformmaxcoef,
TRUE, 1e-4, 0.0,
SCIPinfinity(scip), NULL, NULL) );
13963 "maximal coef range of a cut (maximal coefficient divided by minimal coefficient) in order to be added to LP relaxation",
13964 &conshdlrdata->cutmaxrange,
TRUE, 1e+7, 0.0,
SCIPinfinity(scip), NULL, NULL) );
13967 "minimal curvature of constraints to be considered when returning bilinear terms to other plugins",
13971 "whether linearizations of convex quadratic constraints should be added to cutpool in a solution found by some heuristic",
13972 &conshdlrdata->linearizeheursol,
TRUE,
TRUE, NULL, NULL) );
13975 "whether multivariate quadratic functions should be checked for convexity/concavity",
13976 &conshdlrdata->checkcurvature,
FALSE,
TRUE, NULL, NULL) );
13979 "whether constraint functions should be checked to be factorable",
13980 &conshdlrdata->checkfactorable,
TRUE,
TRUE, NULL, NULL) );
13983 "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)",
13984 &conshdlrdata->checkquadvarlocks,
TRUE,
't',
"bdt", NULL, NULL) );
13987 "whether to try to make solutions in check function feasible by shifting a linear variable (esp. useful if constraint was actually objective function)",
13988 &conshdlrdata->linfeasshift,
TRUE,
TRUE, NULL, NULL) );
13991 "maximum number of created constraints when disaggregating a quadratic constraint (<= 1: off)",
13992 &conshdlrdata->maxdisaggrsize,
FALSE, 127, 1, INT_MAX, NULL, NULL) );
13995 "strategy how to merge independent blocks to reach maxdisaggrsize limit (keep 'b'iggest blocks and merge others; keep 's'mallest blocks and merge other; merge small blocks into bigger blocks to reach 'm'ean sizes)",
13996 &conshdlrdata->disaggrmergemethod,
TRUE,
'm',
"bms", NULL, NULL) );
13999 "limit on number of propagation rounds for a single constraint within one round of SCIP propagation during solve",
14000 &conshdlrdata->maxproprounds,
TRUE, 1, 0, INT_MAX, NULL, NULL) );
14003 "limit on number of propagation rounds for a single constraint within one round of SCIP presolve",
14004 &conshdlrdata->maxproproundspresolve,
TRUE, 10, 0, INT_MAX, NULL, NULL) );
14007 "maximum number of enforcement rounds before declaring the LP relaxation infeasible (-1: no limit); WARNING: changing this parameter might lead to incorrect results!",
14008 &conshdlrdata->enfolplimit,
TRUE, -1, -1, INT_MAX, NULL, NULL) );
14011 "minimal required fraction of continuous variables in problem to use solution of NLP relaxation in root for separation",
14012 &conshdlrdata->sepanlpmincont,
FALSE, 1.0, 0.0, 2.0, NULL, NULL) );
14015 "are cuts added during enforcement removable from the LP in the same node?",
14016 &conshdlrdata->enfocutsremovable,
TRUE,
FALSE, NULL, NULL) );
14019 "should convex quadratics generated strong cuts via gauge function?",
14020 &conshdlrdata->gaugecuts,
FALSE,
TRUE, NULL, NULL) );
14023 "how the interior point for gauge cuts should be computed: 'a'ny point per constraint, 'm'ost interior per constraint",
14024 &conshdlrdata->interiorcomputation,
TRUE,
'a',
"am", NULL, NULL) );
14027 "should convex quadratics generated strong cuts via projections?",
14028 &conshdlrdata->projectedcuts,
FALSE,
FALSE, NULL, NULL) );
14031 "which score to give branching candidates: convexification 'g'ap, constraint 'v'iolation, 'c'entrality of variable value in domain",
14032 &conshdlrdata->branchscoring,
TRUE,
'g',
"cgv", NULL, NULL) );
14035 "should linear inequalities be consindered when computing the branching scores for bilinear terms?",
14036 &conshdlrdata->usebilinineqbranch,
FALSE,
FALSE, NULL, NULL) );
14039 "minimal required score in order to use linear inequalities for tighter bilinear relaxations",
14040 &conshdlrdata->minscorebilinterms,
FALSE, 0.01, 0.0, 1.0, NULL, NULL) );
14043 "maximum number of separation rounds to use linear inequalities for the bilinear term relaxation in a local node",
14044 &conshdlrdata->bilinineqmaxseparounds,
TRUE, 3, 0, INT_MAX, NULL, NULL) );
14046 conshdlrdata->eventhdlr = NULL;
14048 processVarEvent, NULL) );
14049 assert(conshdlrdata->eventhdlr != NULL);
14052 processNewSolutionEvent, NULL) );
14066 const char* conshdlrname
14076 assert(quadconsupgd != NULL);
14077 assert(conshdlrname != NULL );
14081 if( conshdlr == NULL )
14088 assert(conshdlrdata != NULL);
14094 quadconsupgrade->quadconsupgd = quadconsupgd;
14095 quadconsupgrade->
priority = priority;
14099 assert(conshdlrdata->nquadconsupgrades <= conshdlrdata->quadconsupgradessize);
14100 if( conshdlrdata->nquadconsupgrades+1 > conshdlrdata->quadconsupgradessize )
14106 conshdlrdata->quadconsupgradessize = newsize;
14108 assert(conshdlrdata->nquadconsupgrades+1 <= conshdlrdata->quadconsupgradessize);
14110 for( i = conshdlrdata->nquadconsupgrades; i > 0 && conshdlrdata->quadconsupgrades[i-1]->priority < quadconsupgrade->
priority; --i )
14111 conshdlrdata->quadconsupgrades[i] = conshdlrdata->quadconsupgrades[i-1];
14112 assert(0 <= i && i <= conshdlrdata->nquadconsupgrades);
14113 conshdlrdata->quadconsupgrades[i] = quadconsupgrade;
14114 conshdlrdata->nquadconsupgrades++;
14120 paramname, paramdesc,
14121 &quadconsupgrade->
active,
FALSE, active, NULL, NULL) );
14182 assert(linvars != NULL || nlinvars == 0);
14183 assert(lincoefs != NULL || nlinvars == 0);
14184 assert(quadvars1 != NULL || nquadterms == 0);
14185 assert(quadvars2 != NULL || nquadterms == 0);
14186 assert(quadcoefs != NULL || nquadterms == 0);
14188 assert(modifiable ==
FALSE);
14192 if( conshdlr == NULL )
14201 consdata->lhs = lhs;
14202 consdata->rhs = rhs;
14204 SCIP_CALL(
SCIPcreateCons(scip, cons, name, conshdlr, consdata, initial, separate, enforce, check, propagate,
14205 local, modifiable, dynamic, removable,
FALSE) );
14210 for( i = 0; i < nquadterms; ++i )
14217 if( quadvars1[i] == quadvars2[i] )
14218 sqrcoef = quadcoefs[i];
14226 assert(consdata->nquadvars >= 0);
14227 assert(consdata->quadvarterms[consdata->nquadvars-1].var == quadvars1[i]);
14235 assert(consdata->quadvarterms[var1pos].var == quadvars1[i]);
14236 consdata->quadvarterms[var1pos].sqrcoef += sqrcoef;
14240 if( quadvars1[i] == quadvars2[i] )
14246 assert(sqrcoef == 0.0);
14248 assert(consdata->nquadvars >= 0);
14249 assert(consdata->quadvarterms[consdata->nquadvars-1].var == quadvars2[i]);
14258 if( nbilinterms > 0 )
14261 for( i = 0; i < nquadterms; ++i )
14267 if( quadvars1[i] == quadvars2[i] )
14282 for( i = 0; i < nlinvars; ++i )
14291 assert(consdata->quadvarterms[var1pos].var == linvars[i]);
14292 consdata->quadvarterms[var1pos].lincoef += lincoefs[i];
14335 nquadterms, quadvars1, quadvars2, quadcoefs, lhs, rhs,
14377 assert(modifiable ==
FALSE);
14378 assert(nlinvars == 0 || (linvars != NULL && lincoefs != NULL));
14379 assert(nquadvarterms == 0 || quadvarterms != NULL);
14380 assert(nbilinterms == 0 || bilinterms != NULL);
14384 if( conshdlr == NULL )
14392 nlinvars, linvars, lincoefs, nquadvarterms, quadvarterms, nbilinterms, bilinterms,
14396 SCIP_CALL(
SCIPcreateCons(scip, cons, name, conshdlr, consdata, initial, separate, enforce, check, propagate,
14397 local, modifiable, dynamic, removable,
FALSE) );
14428 nquadvarterms, quadvarterms, nbilinterms, bilinterms, lhs, rhs,
14444 assert(scip != NULL);
14445 assert(cons != NULL);
14456 assert(consdata != NULL);
14457 assert(consdata->lhs <= consdata->rhs);
14460 consdata->lhs -= constant;
14462 consdata->rhs -= constant;
14464 if( consdata->lhs > consdata->rhs )
14466 assert(
SCIPisEQ(scip, consdata->lhs, consdata->rhs));
14467 consdata->lhs = consdata->rhs;
14479 assert(scip != NULL);
14480 assert(cons != NULL);
14481 assert(var != NULL);
14505 assert(scip != NULL);
14506 assert(cons != NULL);
14507 assert(var != NULL);
14537 assert(scip != NULL);
14538 assert(cons != NULL);
14539 assert(var != NULL);
14553 assert(consdata != NULL);
14561 assert(pos < consdata->nquadvars);
14562 assert(consdata->quadvarterms[pos].var == var);
14564 consdata->quadvarterms[pos].lincoef += coef;
14567 consdata->ispropagated =
FALSE;
14568 consdata->ispresolved = consdata->ispresolved && !
SCIPisZero(scip, consdata->quadvarterms[pos].lincoef);
14590 assert(scip != NULL);
14591 assert(cons != NULL);
14592 assert(var != NULL);
14606 assert(consdata != NULL);
14614 assert(pos < consdata->nquadvars);
14615 assert(consdata->quadvarterms[pos].var == var);
14617 consdata->quadvarterms[pos].sqrcoef += coef;
14620 consdata->isconvex =
FALSE;
14621 consdata->isconcave =
FALSE;
14622 consdata->iscurvchecked =
FALSE;
14623 consdata->ispropagated =
FALSE;
14624 consdata->ispresolved = consdata->ispresolved && !
SCIPisZero(scip, consdata->quadvarterms[pos].sqrcoef);
14649 assert(scip != NULL);
14650 assert(cons != NULL);
14651 assert(var1 != NULL);
14652 assert(var2 != NULL);
14669 assert(consdata != NULL);
14675 var1pos = consdata->nquadvars-1;
14678 if( !consdata->quadvarssorted )
14683 assert(var1pos >= 0);
14686 assert(consdata->quadvarssorted);
14691 var2pos = consdata->nquadvars-1;
14694 assert(consdata->quadvarterms[var1pos].var == var1);
14695 assert(consdata->quadvarterms[var2pos].var == var2);
14711 assert(cons != NULL);
14712 assert(nlrow != NULL);
14715 assert(consdata != NULL);
14717 if( consdata->nlrow == NULL )
14721 assert(consdata->nlrow != NULL);
14722 *nlrow = consdata->nlrow;
14733 assert(cons != NULL);
14747 assert(cons != NULL);
14761 assert(cons != NULL);
14774 assert(cons != NULL);
14788 assert(cons != NULL);
14800 assert(cons != NULL);
14819 assert(cons != NULL);
14821 assert(var != NULL);
14822 assert(pos != NULL);
14835 assert(cons != NULL);
14849 assert(cons != NULL);
14861 assert(cons != NULL);
14873 assert(cons != NULL);
14887 assert(cons != NULL);
14890 assert(consdata != NULL);
14895 return consdata->linvar_maydecrease;
14906 assert(cons != NULL);
14909 assert(consdata != NULL);
14914 return consdata->linvar_mayincrease;
14923 assert(cons != NULL);
14938 assert(cons != NULL);
14942 assert(determined);
14955 assert(cons != NULL);
14959 assert(determined);
14975 assert(scip != NULL);
14976 assert(cons != NULL);
14977 assert(violation != NULL);
14983 assert(consdata != NULL);
14985 *violation =
MAX(consdata->lhsviol, consdata->rhsviol);
15004 assert(scip != NULL);
15005 assert(cons != NULL);
15008 assert(consdata != NULL);
15011 for( i = 0; i < consdata->nquadvars; ++i )
15013 if( consdata->quadvarterms[i].sqrcoef == 0.0 )
15016 var1 = consdata->quadvarterms[i].var;
15017 assert(var1 != NULL);
15023 for( i = 0; i < consdata->nbilinterms; ++i )
15025 var1 = consdata->bilinterms[i].var1;
15026 var2 = consdata->bilinterms[i].var2;
15028 assert(var1 != NULL);
15029 assert(var2 != NULL);
15064 assert(scip != NULL);
15065 assert(cons != NULL);
15066 assert(nlpi != NULL);
15067 assert(nlpiprob != NULL);
15068 assert(scipvar2nlpivar != NULL);
15071 assert(consdata != NULL);
15074 nlininds = consdata->nlinvars;
15075 nquadelems = consdata->nbilinterms;
15076 for( j = 0; j < consdata->nquadvars; ++j )
15078 if( consdata->quadvarterms[j].sqrcoef != 0.0 )
15080 if( consdata->quadvarterms[j].lincoef != 0.0 )
15093 for( j = 0; j < consdata->nlinvars; ++j )
15095 linvals[j] = consdata->lincoefs[j];
15100 lincnt = consdata->nlinvars;
15105 if( nquadelems > 0 )
15111 for( j = 0; j < consdata->nquadvars; ++j )
15115 if( consdata->quadvarterms[j].lincoef != 0.0 )
15117 assert(lininds != NULL);
15118 assert(linvals != NULL);
15119 lininds[lincnt] = idx1;
15120 linvals[lincnt] = consdata->quadvarterms[j].lincoef;
15124 if( consdata->quadvarterms[j].sqrcoef != 0.0 )
15126 assert(quadcnt < nquadelems);
15127 assert(quadelems != NULL);
15128 quadelems[quadcnt].
idx1 = idx1;
15129 quadelems[quadcnt].
idx2 = idx1;
15130 quadelems[quadcnt].
coef = consdata->quadvarterms[j].sqrcoef;
15134 for( l = 0; l < consdata->quadvarterms[j].nadjbilin; ++l )
15136 othervar = consdata->bilinterms[consdata->quadvarterms[j].adjbilin[l]].var2;
15138 if( othervar == consdata->quadvarterms[j].var )
15141 assert(quadcnt < nquadelems);
15142 assert(quadelems != NULL);
15145 quadelems[quadcnt].
idx1 = MIN(idx1, idx2);
15146 quadelems[quadcnt].
idx2 =
MAX(idx1, idx2);
15147 quadelems[quadcnt].
coef = consdata->bilinterms[consdata->quadvarterms[j].adjbilin[l]].coef;
15152 assert(quadcnt == nquadelems);
15153 assert(lincnt == nlininds);
15158 &consdata->lhs, &consdata->rhs,
15159 &nlininds, &lininds, &linvals ,
15160 &nquadelems, &quadelems,
15161 NULL, NULL, &name) );
15183 assert(scip != NULL);
15184 assert(cons != NULL);
15195 SCIPerrorMessage(
"method may only be called during problem creation stage for original constraints\n");
15200 assert(consdata != NULL);
15208 if( !
SCIPisLE(scip, lhs, consdata->rhs) )
15211 consdata->lhs = lhs;
15228 assert(scip != NULL);
15229 assert(cons != NULL);
15240 SCIPerrorMessage(
"method may only be called during problem creation stage for original constraints\n");
15245 assert(consdata != NULL);
15253 if( !
SCIPisLE(scip, consdata->lhs, rhs) )
15256 consdata->rhs = rhs;
15272 assert(scip != NULL);
15273 assert(cons != NULL);
15274 assert(feasibility != NULL);
15285 assert(consdata != NULL);
15290 *feasibility = (consdata->rhs - consdata->activity);
15292 *feasibility = (consdata->activity - consdata->lhs);
15297 *feasibility = MIN( consdata->rhs - consdata->activity, consdata->activity - consdata->lhs );
15314 assert(scip != NULL);
15315 assert(cons != NULL);
15316 assert(activity != NULL);
15327 assert(consdata != NULL);
15329 *activity = consdata->activity;
15350 assert(scip != NULL);
15351 assert(cons != NULL);
15352 assert(var != NULL);
15362 SCIPerrorMessage(
"method may only be called during problem creation stage for original constraints and variables\n");
15367 assert(consdata != NULL);
15371 for( i = 0; i < consdata->nquadvars; ++i )
15373 if( var == consdata->quadvarterms[i].var )
15377 consdata->quadvarterms[i].lincoef = 0.0;
15380 consdata->quadvarsmerged =
FALSE;
15383 consdata->quadvarterms[i].lincoef = coef;
15391 while( i < consdata->nlinvars )
15393 if( var == consdata->linvars[i] )
15418 consdata->ispropagated =
FALSE;
15419 consdata->ispresolved =
FALSE;
15443 assert(scip != NULL);
15444 assert(cons != NULL);
15445 assert(var != NULL);
15456 SCIPerrorMessage(
"method may only be called during problem creation stage for original constraints and variables\n");
15461 assert(consdata != NULL);
15465 for( i = 0; i < consdata->nquadvars; ++i )
15467 if( var == consdata->quadvarterms[i].var )
15469 consdata->quadvarterms[i].sqrcoef = (found ||
SCIPisZero(scip, coef)) ? 0.0 : coef;
15481 consdata->isconvex =
FALSE;
15482 consdata->isconcave =
FALSE;
15483 consdata->iscurvchecked =
FALSE;
15484 consdata->ispropagated =
FALSE;
15485 consdata->ispresolved =
FALSE;
15491 consdata->quadvarsmerged =
FALSE;
15513 assert(scip != NULL);
15514 assert(cons != NULL);
15515 assert(var1 != NULL);
15516 assert(var2 != NULL);
15527 SCIPerrorMessage(
"method may only be called during problem creation stage for original constraints and variables\n");
15538 assert(consdata != NULL);
15542 for( i = 0; i < consdata->nbilinterms; ++i )
15544 if( (consdata->bilinterms[i].var1 == var1 && consdata->bilinterms[i].var2 == var2) ||
15545 (consdata->bilinterms[i].var1 == var2 && consdata->bilinterms[i].var2 == var1) )
15549 consdata->bilinterms[i].coef = 0.0;
15552 consdata->bilinmerged =
FALSE;
15555 consdata->bilinterms[i].coef = coef;
15567 consdata->isconvex =
FALSE;
15568 consdata->isconcave =
FALSE;
15569 consdata->iscurvchecked =
FALSE;
15570 consdata->ispropagated =
FALSE;
15571 consdata->ispresolved =
FALSE;
15587 assert(scip != NULL);
15591 if( conshdlr == NULL )
15595 assert(conshdlrdata != NULL);
15597 return conshdlrdata->nbilinterms;
15605 int* RESTRICT nbilinterms,
15606 int* RESTRICT nunderests,
15607 int* RESTRICT noverests,
15615 assert(scip != NULL);
15618 assert(nbilinterms != NULL);
15619 assert(nunderests != NULL);
15620 assert(noverests!= NULL);
15621 assert(maxnonconvexity != NULL);
15625 if( conshdlr == NULL )
15632 assert(conshdlrdata != NULL);
15634 for( i = 0; i < conshdlrdata->nbilinterms; ++i )
15636 x[i] = conshdlrdata->bilinestimators[i].x;
15637 y[i] = conshdlrdata->bilinestimators[i].y;
15638 nunderests[i] = conshdlrdata->bilinestimators[i].nunderest;
15639 noverests[i] = conshdlrdata->bilinestimators[i].noverest;
15640 maxnonconvexity[i] = conshdlrdata->bilinestimators[i].maxnonconvexity;
15643 *nbilinterms = conshdlrdata->nbilinterms;
15664 assert(viol1 != NULL);
15665 assert(viol2 != NULL);
15667 norm = SQRT(SQR(xcoef) + SQR(ycoef));
15670 if( xcoef * ycoef >= 0 )
15710 assert(scip != NULL);
15717 assert(success != NULL);
15727 if( conshdlr == NULL )
15731 assert(conshdlrdata != NULL);
15732 assert(idx < conshdlrdata->nbilinterms);
15734 bilinest = &conshdlrdata->bilinestimators[idx];
15735 assert(bilinest != NULL);
15736 assert(bilinest->
x == x);
15737 assert(bilinest->
y == y);
15742 if( xcoef * ycoef > 0.0 )
15754 getIneqViol(x, y, xcoef, ycoef, constant, &viol1, &viol2);
15755 SCIPdebugMsg(scip,
"violations of inequality = (%g,%g)\n", viol1, viol2);
15762 for( i = 0; i < *nineqs; ++i )
15767 SCIPdebugMsg(scip,
"inequality already found -> skip\n");
15777 ineqs[3*(*nineqs)] = xcoef;
15778 ineqs[3*(*nineqs) + 1] = ycoef;
15779 ineqs[3*(*nineqs) + 2] = constant;
15790 assert(*nineqs == 2);
15798 getIneqViol(x, y, ineqs[0], ineqs[1], ineqs[2], &viols1[0], &viols2[0]);
15799 getIneqViol(x, y, ineqs[3], ineqs[4], ineqs[5], &viols1[1], &viols2[1]);
15800 bestviol =
MAX(viols1[0], viols1[1]) +
MAX(viols2[0], viols2[1]);
15802 for( i = 0; i < 2; ++i )
15805 if(
SCIPisGT(scip, viol, bestviol) )
15816 assert(pos >= 0 && pos < 2);
15817 ineqs[3*pos] = xcoef;
15818 ineqs[3*pos+1] = ycoef;
15819 ineqs[3*pos+2] = constant;
15823 SCIPdebugMsg(scip,
"accepted inequality? %u\n", *success);
15840 assert(scip != NULL);
15841 assert(rowprep != NULL);
15846 (*rowprep)->sidetype = sidetype;
15847 (*rowprep)->local = local;
15858 assert(scip != NULL);
15859 assert(rowprep != NULL);
15860 assert(*rowprep != NULL);
15874 assert(scip != NULL);
15875 assert(target != NULL);
15876 assert(source != NULL);
15879 if( source->
coefs != NULL )
15883 if( source->
vars != NULL )
15903 assert(scip != NULL);
15904 assert(rowprep != NULL);
15929 assert(scip != NULL);
15930 assert(rowprep != NULL);
15932 if( *rowprep->
name !=
'\0' )
15937 for( i = 0; i < rowprep->
nvars; ++i )
15953 assert(scip != NULL);
15954 assert(rowprep != NULL);
15955 assert(var != NULL);
15979 assert(scip != NULL);
15980 assert(rowprep != NULL);
15981 assert(vars != NULL || nvars == 0);
15982 assert(coefs != NULL || nvars == 0);
15993 rowprep->
nvars += nvars;
15999 #undef SCIPaddRowprepSide 16000 #undef SCIPaddRowprepConstant 16009 assert(rowprep != NULL);
16011 rowprep->
side += side;
16023 assert(rowprep != NULL);
16038 activity = -rowprep->
side;
16039 for( i = 0; i < rowprep->
nvars; ++i )
16052 return MAX(activity, 0.0);
16055 return MAX(-activity, 0.0);
16070 assert(scip != NULL);
16071 assert(rowprep != NULL);
16073 if( rowprep->
nvars <= 1 )
16082 while( j < rowprep->nvars )
16084 if( rowprep->
vars[i] == rowprep->
vars[j] )
16092 if( rowprep->
coefs[i] == 0.0 )
16096 rowprep->
vars[i] = rowprep->
vars[j];
16104 rowprep->
vars[i+1] = rowprep->
vars[j];
16112 if( rowprep->
coefs[i] == 0.0 )
16116 rowprep->
nvars = i+1;
16128 assert(scip != NULL);
16129 assert(rowprep != NULL);
16132 switch( rowprep->
nvars )
16145 tmp1 = rowprep->
coefs[0];
16147 rowprep->
coefs[1] = tmp1;
16149 tmp2 = rowprep->
vars[0];
16150 rowprep->
vars[0] = rowprep->
vars[1];
16151 rowprep->
vars[1] = tmp2;
16161 for( i = 0; i < rowprep->
nvars; ++i )
16169 while( rowprep->
nvars > 0 && rowprep->
coefs[rowprep->
nvars-1] == 0.0 )
16199 if( rowprep->
nvars > 0 )
16205 mincoef = maxcoef = 1.0;
16211 while( maxcoef / mincoef > maxcoefrange )
16213 SCIPdebugMsg(scip,
"cut coefficients have very large range: mincoef = %g maxcoef = %g\n", mincoef, maxcoef);
16218 assert(rowprep->
nvars > 1);
16234 for( pos = 0; pos < 2; ++pos )
16236 var = rowprep->
vars[pos ? rowprep->
nvars-1 : maxcoefidx];
16237 coef = rowprep->
coefs[pos ? rowprep->
nvars-1 : maxcoefidx];
16241 assert(coef != 0.0);
16246 ref =
MAX(lb, MIN(ub, ref));
16255 loss[pos] =
REALABS(coef) * (ref - lb);
16264 loss[pos] =
REALABS(coef) * (ub - ref);
16266 assert(loss[pos] >= 0.0);
16268 SCIPdebugMsg(scip,
"aggregating %g*<%s> %c= ... with <%s>[%g] %c= %g looses %g\n",
16280 pos = (loss[1] ==
SCIP_INVALID || loss[1] > loss[0]) ? 0 : 1;
16283 var = rowprep->
vars[pos ? rowprep->
nvars-1 : maxcoefidx];
16284 coef = rowprep->
coefs[pos ? rowprep->
nvars-1 : maxcoefidx];
16307 rowprep->
coefs[maxcoefidx] = 0.0;
16328 if( maxcoefidx > 0 )
16331 for( i = maxcoefidx; i < rowprep->
nvars; ++i )
16333 rowprep->
vars[i-maxcoefidx] = rowprep->
vars[i];
16334 rowprep->
coefs[i-maxcoefidx] = rowprep->
coefs[i];
16336 rowprep->
nvars -= maxcoefidx;
16354 assert(scip != NULL);
16355 assert(rowprep != NULL);
16356 assert(viol != NULL);
16363 if( *viol >= minviol )
16383 *viol = ldexp(*viol, scaleexp);
16409 if( *viol > minviol && scalefactor * *viol < minviol )
16411 assert(minviol > 0.0);
16412 assert(*viol > 0.0);
16427 *viol = ldexp(*viol, scaleexp);
16446 assert(scip != NULL);
16447 assert(rowprep != NULL);
16448 assert(viol != NULL);
16461 for( i = 0; i < rowprep->
nvars; ++i )
16463 coef = rowprep->
coefs[i];
16465 if( coef != roundcoef &&
SCIPisEQ(scip, coef, roundcoef) )
16470 var = rowprep->
vars[i];
16472 if( rowprep->
local )
16477 if( rowprep->
local )
16485 SCIPdebugMsg(scip,
"var <%s> [%g,%g] has almost integral coef %.20g, round coefficient to %g and add constant %g\n",
16495 SCIPdebugMsg(scip,
"var <%s> [%g,%g] has almost integral coef %.20g, round coefficient to %g without relaxing side (!)\n",
16498 rowprep->
coefs[i] = roundcoef;
16504 while( rowprep->
nvars > 0 && rowprep->
coefs[rowprep->
nvars-1] == 0.0 )
16527 rowprep->
side = 0.0;
16560 assert(maxcoefrange > 1.0);
16566 if( rowprep->
nvars > 0 )
16572 SCIPinfoMessage(scip, NULL,
"starting cleanup, coefrange %g: ", maxcoef/mincoef);
16581 assert(myviol >= 0.0);
16584 if( rowprep->
nvars > 0 )
16590 SCIPinfoMessage(scip, NULL,
"improved coefrange to %g, viol %g: ", maxcoef / mincoef, myviol);
16595 if( minviol > 0.0 )
16619 SCIPinfoMessage(scip, NULL,
"adjusted almost-integral coefs and sides, viol %g: ", myviol);
16624 if( coefrange != NULL )
16626 if( rowprep->
nvars > 0 )
16657 assert(rowprep != NULL);
16658 assert(factor > 0.0);
16661 v = frexp(factor, &expon);
16667 for( i = 0; i < rowprep->
nvars; ++i )
16668 rowprep->
coefs[i] = ldexp(rowprep->
coefs[i], expon);
16671 rowprep->
side = ldexp(rowprep->
side, expon);
16684 assert(scip != NULL);
16685 assert(row != NULL);
16686 assert(rowprep != NULL);
16706 assert(scip != NULL);
16707 assert(row != NULL);
16708 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)))
void * SCIPhashmapEntryGetImage(SCIP_HASHMAPENTRY *entry)
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)
static SCIP_RETCODE freeAllBilinearTerms(SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata, SCIP_CONS **conss, int nconss)
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_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_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
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)
Constraint handler for variable bound constraints .
SCIP_Bool SCIPisRelEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
int SCIPgetNAllBilinearTermsQuadratic(SCIP *scip)
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)
#define CONSHDLR_PROPFREQ
SCIP_Real inequnderest[6]
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_RETCODE SCIPnlpiGetSolution(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_Real **primalvalues, SCIP_Real **consdualvalues, SCIP_Real **varlbdualvalues, SCIP_Real **varubdualvalues, SCIP_Real *objval)
SCIP_Real SCIPvarGetBestBoundLocal(SCIP_VAR *var)
SCIP_Real SCIPdualfeastol(SCIP *scip)
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)
#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_RETCODE evaluateGauge(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *refsol, SCIP_Real *gaugeval, SCIP_Bool *success)
static SCIP_RETCODE storeAllBilinearTerms(SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata, SCIP_CONS **conss, int nconss)
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)
SCIP_Real SCIPrelDiff(SCIP_Real val1, SCIP_Real val2)
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)
void SCIPsortDownIntInt(int *intarray1, int *intarray2, int len)
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 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
void SCIPcomputeBilinEnvelope2(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 xcoef1, SCIP_Real ycoef1, SCIP_Real constant1, SCIP_Real xcoef2, SCIP_Real ycoef2, SCIP_Real constant2, SCIP_Real *RESTRICT lincoefx, SCIP_Real *RESTRICT lincoefy, SCIP_Real *RESTRICT linconstant, SCIP_Bool *RESTRICT success)
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_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)
SCIP_Bool SCIPisRelGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
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
SCIP_Bool SCIPisRelLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_RETCODE generateCutNonConvex(SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata, SCIP_CONS *cons, SCIP_SIDETYPE violside, SCIP_Real *ref, SCIP_ROWPREP *rowprep, SCIP_Bool *success)
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)
SCIP_RETCODE SCIPaddBilinearIneqQuadratic(SCIP *scip, SCIP_VAR *x, SCIP_VAR *y, int idx, SCIP_Real xcoef, SCIP_Real ycoef, SCIP_Real constant, SCIP_Bool *success)
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)
void SCIPcomputeBilinEnvelope1(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 xcoef, SCIP_Real ycoef, SCIP_Real constant, SCIP_Real *RESTRICT lincoefx, SCIP_Real *RESTRICT lincoefy, SCIP_Real *RESTRICT linconstant, SCIP_Bool *RESTRICT success)
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)
SCIP_Bool SCIPisRelGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static void getIneqViol(SCIP_VAR *x, SCIP_VAR *y, SCIP_Real xcoef, SCIP_Real ycoef, SCIP_Real constant, SCIP_Real *viol1, SCIP_Real *viol2)
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)
int SCIPhashmapGetNEntries(SCIP_HASHMAP *hashmap)
void SCIPintervalSetEmpty(SCIP_INTERVAL *resultant)
SCIP_RETCODE SCIPgetAllBilinearTermsQuadratic(SCIP *scip, SCIP_VAR **RESTRICT x, SCIP_VAR **RESTRICT y, int *RESTRICT nbilinterms, int *RESTRICT nunderests, int *RESTRICT noverests, SCIP_Real *maxnonconvexity)
SCIP_Real SCIPgetRowprepViolation(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_SOL *sol)
SCIP_HASHMAPENTRY * SCIPhashmapGetEntry(SCIP_HASHMAP *hashmap, int entryidx)
void SCIPsortIntInt(int *intarray1, int *intarray2, int len)
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_RETCODE computeViolation(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool *solviolbounds)
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)
static SCIP_RETCODE presolveDisaggregateMarkComponent(SCIP *scip, SCIP_CONSDATA *consdata, int quadvaridx, SCIP_HASHMAP *var2component, int componentnr, int *componentsize)
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)
void SCIPhashmapEntrySetImage(SCIP_HASHMAPENTRY *entry, void *image)
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)
SCIP_Real SCIPgetSepaMinEfficacy(SCIP *scip)
unsigned int SCIP_PRESOLTIMING
#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)
SCIP_RETCODE SCIPaddRow(SCIP *scip, SCIP_ROW *row, SCIP_Bool forcecut, SCIP_Bool *infeasible)
static void rowprepCleanupScaledown(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_Real *viol, SCIP_Real minviol)
#define SCIPdebugGetSolVal(scip, var, val)
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
static unsigned int nextPowerOf2(unsigned int v)
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)
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)
SCIP_Real SCIPlpfeastol(SCIP *scip)
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_RETCODE sortAllBilinTerms(SCIP *scip, SCIP_BILINTERM *bilinterms, int nbilinterms, SCIP_CONS **bilinconss, int *bilinposs)
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)
static SCIP_Real getInteriority(SCIP *scip, SCIP_Real lbx, SCIP_Real ubx, SCIP_Real refx, SCIP_Real lby, SCIP_Real uby, SCIP_Real refy)
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)
Constraint handler for linear constraints in their most general form, .
static SCIP_RETCODE createNlRow(SCIP *scip, SCIP_CONS *cons)
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)
#define SCIP_EVENTTYPE_GBDCHANGED
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)
SCIP_Bool SCIPinDive(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)
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)
void SCIPupdateSolConsViolation(SCIP *scip, SCIP_SOL *sol, SCIP_Real absviol, SCIP_Real relviol)
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)
static SCIP_RETCODE presolveDisaggregateMergeComponents(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_HASHMAP *var2component, int nvars, int *ncomponents, int *componentssize)
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
#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)
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)
static void updateBilinearRelaxation(SCIP *scip, SCIP_VAR *RESTRICT x, SCIP_VAR *RESTRICT y, SCIP_Real bilincoef, SCIP_SIDETYPE violside, SCIP_Real refx, SCIP_Real refy, SCIP_Real *RESTRICT ineqs, int nineqs, SCIP_Real mccormickval, SCIP_Real *RESTRICT bestcoefx, SCIP_Real *RESTRICT bestcoefy, SCIP_Real *RESTRICT bestconst, SCIP_Real *RESTRICT bestval, SCIP_Bool *success)
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)
SCIP_Bool SCIPisRelLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
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)
static SCIP_RETCODE computeViolations(SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, SCIP_Bool *solviolbounds, SCIP_CONS **maxviolcon)
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)
static SCIP_RETCODE processCut(SCIP *scip, SCIP_ROW **row, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_Real efficacy, SCIP_Real minefficacy, SCIP_Bool inenforcement, SCIP_Real *bestefficacy, SCIP_RESULT *result)
void SCIPintervalSolveUnivariateQuadExpressionPositive(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL sqrcoeff, SCIP_INTERVAL lincoeff, SCIP_INTERVAL rhs)
int SCIPgetNSepaRounds(SCIP *scip)
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)
SCIP_RETCODE SCIPnlpiSetRealPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, SCIP_Real dval)
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)