53 #define CONSHDLR_NAME "quadratic" 54 #define CONSHDLR_DESC "quadratic constraints of the form lhs <= b' x + x' A x <= rhs" 55 #define CONSHDLR_SEPAPRIORITY 10 56 #define CONSHDLR_ENFOPRIORITY -50 57 #define CONSHDLR_CHECKPRIORITY -4000000 58 #define CONSHDLR_SEPAFREQ 1 59 #define CONSHDLR_PROPFREQ 1 60 #define CONSHDLR_EAGERFREQ 100 62 #define CONSHDLR_MAXPREROUNDS -1 63 #define CONSHDLR_DELAYSEPA FALSE 64 #define CONSHDLR_DELAYPROP FALSE 65 #define CONSHDLR_NEEDSCONS TRUE 67 #define CONSHDLR_PROP_TIMING SCIP_PROPTIMING_BEFORELP 68 #define CONSHDLR_PRESOLTIMING SCIP_PRESOLTIMING_ALWAYS 70 #define MAXDNOM 10000LL 71 #define NONLINCONSUPGD_PRIORITY 40000 72 #define INITLPMAXVARVAL 1000.0 85 #define INTERIOR_EPS 1e-1 88 #define GAUGESCALE 0.99999 95 struct SCIP_QuadVarEventData
124 unsigned int linvarssorted:1;
125 unsigned int linvarsmerged:1;
126 unsigned int quadvarssorted:1;
127 unsigned int quadvarsmerged:1;
128 unsigned int bilinsorted:1;
129 unsigned int bilinmerged:1;
131 unsigned int isconvex:1;
132 unsigned int isconcave:1;
133 unsigned int iscurvchecked:1;
134 unsigned int isremovedfixings:1;
135 unsigned int ispropagated:1;
136 unsigned int ispresolved:1;
137 unsigned int initialmerge:1;
138 #ifdef CHECKIMPLINBILINEAR 139 unsigned int isimpladded:1;
141 unsigned int isgaugeavailable:1;
142 unsigned int isedavailable:1;
146 int minlinactivityinf;
147 int maxlinactivityinf;
153 int linvar_maydecrease;
154 int linvar_mayincrease;
157 int* sepabilinvar2pos;
184 struct SCIP_ConshdlrData
186 int replacebinaryprodlength;
197 char checkquadvarlocks;
201 int maxproproundspresolve;
206 char interiorcomputation;
218 int newsoleventfilterpos;
223 int quadconsupgradessize;
224 int nquadconsupgrades;
239 const char* conshdlrname
244 assert(scip !=
NULL);
245 assert(conshdlrdata !=
NULL);
246 assert(quadconsupgd !=
NULL);
247 assert(conshdlrname !=
NULL);
249 for( i = conshdlrdata->nquadconsupgrades - 1; i >= 0; --i )
251 if( conshdlrdata->quadconsupgrades[i]->quadconsupgd == quadconsupgd )
253 SCIPwarningMessage(scip,
"Try to add already known upgrade message for constraint handler <%s>.\n", conshdlrname);
269 #define infty2infty(infty1, infty2, val) ((val) >= (infty1) ? (infty2) : (val)) 284 assert(scip !=
NULL);
285 assert(eventhdlr !=
NULL);
286 assert(cons !=
NULL);
289 assert(consdata !=
NULL);
291 assert(linvarpos >= 0);
292 assert(linvarpos < consdata->nlinvars);
293 assert(consdata->lineventdata !=
NULL);
297 eventdata->cons = cons;
298 eventdata->varidx = linvarpos;
305 if( consdata->lincoefs[linvarpos] > 0.0 )
314 if( consdata->lincoefs[linvarpos] > 0.0 )
322 consdata->lineventdata[linvarpos] = eventdata;
330 consdata->minlinactivityinf = -1;
331 consdata->maxlinactivityinf = -1;
348 assert(scip !=
NULL);
349 assert(eventhdlr !=
NULL);
350 assert(cons !=
NULL);
353 assert(consdata !=
NULL);
355 assert(linvarpos >= 0);
356 assert(linvarpos < consdata->nlinvars);
357 assert(consdata->lineventdata !=
NULL);
358 assert(consdata->lineventdata[linvarpos] !=
NULL);
359 assert(consdata->lineventdata[linvarpos]->cons == cons);
360 assert(consdata->lineventdata[linvarpos]->varidx == linvarpos);
361 assert(consdata->lineventdata[linvarpos]->filterpos >= 0);
368 if( consdata->lincoefs[linvarpos] > 0.0 )
377 if( consdata->lincoefs[linvarpos] > 0.0 )
403 assert(scip !=
NULL);
404 assert(eventhdlr !=
NULL);
405 assert(cons !=
NULL);
408 assert(consdata !=
NULL);
410 assert(quadvarpos >= 0);
411 assert(quadvarpos < consdata->nquadvars);
412 assert(consdata->quadvarterms[quadvarpos].eventdata ==
NULL);
417 #ifdef CHECKIMPLINBILINEAR 420 eventdata->cons = cons;
421 eventdata->varidx = -quadvarpos-1;
424 consdata->quadvarterms[quadvarpos].eventdata = eventdata;
447 assert(scip !=
NULL);
448 assert(eventhdlr !=
NULL);
449 assert(cons !=
NULL);
452 assert(consdata !=
NULL);
454 assert(quadvarpos >= 0);
455 assert(quadvarpos < consdata->nquadvars);
456 assert(consdata->quadvarterms[quadvarpos].eventdata !=
NULL);
457 assert(consdata->quadvarterms[quadvarpos].eventdata->cons == cons);
458 assert(consdata->quadvarterms[quadvarpos].eventdata->varidx == -quadvarpos-1);
459 assert(consdata->quadvarterms[quadvarpos].eventdata->filterpos >= 0);
462 #ifdef CHECKIMPLINBILINEAR 466 SCIP_CALL(
SCIPdropVarEvent(scip, consdata->quadvarterms[quadvarpos].var, eventtype, eventhdlr, (
SCIP_EVENTDATA*)consdata->quadvarterms[quadvarpos].eventdata, consdata->quadvarterms[quadvarpos].eventdata->filterpos) );
485 assert(scip !=
NULL);
486 assert(cons !=
NULL);
487 assert(eventhdlr !=
NULL);
490 assert(consdata !=
NULL);
491 assert(consdata->lineventdata ==
NULL);
494 consdata->isremovedfixings =
TRUE;
497 for( i = 0; i < consdata->nlinvars; ++i )
501 var = consdata->linvars[i];
502 consdata->isremovedfixings = consdata->isremovedfixings &&
SCIPvarIsActive(var)
506 for( i = 0; i < consdata->nquadvars; ++i )
508 assert(consdata->quadvarterms[i].eventdata ==
NULL);
512 var = consdata->quadvarterms[i].var;
513 consdata->isremovedfixings = consdata->isremovedfixings &&
SCIPvarIsActive(var)
517 consdata->ispropagated =
FALSE;
533 assert(scip !=
NULL);
534 assert(eventhdlr !=
NULL);
535 assert(cons !=
NULL);
538 assert(consdata !=
NULL);
540 if( consdata->lineventdata !=
NULL )
542 for( i = 0; i < consdata->nlinvars; ++i )
544 if( consdata->lineventdata[i] !=
NULL )
552 for( i = 0; i < consdata->nquadvars; ++i )
554 if( consdata->quadvarterms[i].eventdata !=
NULL )
574 assert(scip !=
NULL);
575 assert(cons !=
NULL);
580 assert(consdata !=
NULL);
605 assert(scip !=
NULL);
606 assert(cons !=
NULL);
611 assert(consdata !=
NULL);
668 assert(scip !=
NULL);
669 assert(consdata !=
NULL);
675 (consdata->minlinactivityinf > 0 || consdata->maxlinactivityinf > 0 || consdata->minlinactivity <= consdata->maxlinactivity) )
678 assert(consdata->minlinactivityinf >= 0);
679 assert(consdata->maxlinactivityinf >= 0);
683 consdata->minlinactivityinf = 0;
684 consdata->maxlinactivityinf = 0;
689 consdata->minlinactivity =
SCIPisInfinity(scip, consdata->rhs) ? -intervalinfty : 0.0;
690 consdata->maxlinactivity =
SCIPisInfinity(scip, -consdata->lhs) ? intervalinfty : 0.0;
692 if( consdata->nlinvars == 0 )
697 assert(consdata->lineventdata !=
NULL);
706 for( i = 0; i < consdata->nlinvars; ++i )
708 assert(consdata->lineventdata[i] !=
NULL);
709 if( consdata->lincoefs[i] >= 0.0 )
714 ++consdata->minlinactivityinf;
724 ++consdata->minlinactivityinf;
729 consdata->minlinactivity += consdata->lincoefs[i] * bnd;
738 for( i = 0; i < consdata->nlinvars; ++i )
740 assert(consdata->lineventdata[i] !=
NULL);
741 if( consdata->lincoefs[i] >= 0.0 )
746 ++consdata->maxlinactivityinf;
756 ++consdata->maxlinactivityinf;
761 consdata->maxlinactivity += consdata->lincoefs[i] * bnd;
767 assert(consdata->minlinactivityinf > 0 || consdata->maxlinactivityinf > 0 || consdata->minlinactivity <= consdata->maxlinactivity);
782 assert(scip !=
NULL);
783 assert(consdata !=
NULL);
810 --consdata->minlinactivityinf;
811 assert(consdata->minlinactivityinf >= 0);
817 consdata->minlinactivity += minuscoef * oldbnd;
822 ++consdata->minlinactivityinf;
826 consdata->minlinactivity += coef * newbnd;
846 --consdata->maxlinactivityinf;
847 assert(consdata->maxlinactivityinf >= 0);
853 consdata->maxlinactivity += minuscoef * oldbnd;
858 ++consdata->maxlinactivityinf;
862 consdata->maxlinactivity += coef * newbnd;
881 assert(scip !=
NULL);
882 assert(consdata !=
NULL);
909 --consdata->maxlinactivityinf;
910 assert(consdata->maxlinactivityinf >= 0);
916 consdata->maxlinactivity += minuscoef * oldbnd;
921 ++consdata->maxlinactivityinf;
925 consdata->maxlinactivity += coef * newbnd;
945 --consdata->minlinactivityinf;
946 assert(consdata->minlinactivityinf >= 0);
952 consdata->minlinactivity += minuscoef * oldbnd;
957 ++consdata->minlinactivityinf;
961 consdata->minlinactivity += coef * newbnd;
984 assert(scip !=
NULL);
985 assert(consdata !=
NULL);
986 assert(idx >= 0 && idx < consdata->nquadvars);
988 var = consdata->quadvarterms[idx].var;
991 quadcoef = consdata->quadvarterms[idx].sqrcoef;
1008 assert(scip !=
NULL);
1009 assert(event !=
NULL);
1010 assert(eventdata !=
NULL);
1011 assert(eventhdlr !=
NULL);
1014 assert(cons !=
NULL);
1016 assert(consdata !=
NULL);
1019 assert(varidx < 0 || varidx < consdata->nlinvars);
1020 assert(varidx >= 0 || -varidx-1 < consdata->nquadvars);
1031 quadvarterm = &consdata->quadvarterms[-varidx-1];
1032 var = quadvarterm->
var;
1043 consdata->quadvarsmerged =
FALSE;
1044 consdata->initialmerge =
FALSE;
1064 consdata->ispropagated =
FALSE;
1066 var = varidx < 0 ? consdata->quadvarterms[-varidx-1].var : consdata->linvars[varidx];
1067 assert(var !=
NULL);
1070 consdata->isremovedfixings =
FALSE;
1076 consdata->isremovedfixings =
FALSE;
1079 #ifdef CHECKIMPLINBILINEAR 1085 consdata->isimpladded =
TRUE;
1100 assert(scip !=
NULL);
1101 assert(consdata !=
NULL);
1102 assert(consdata->nlinvars <= consdata->linvarssize);
1104 if( num > consdata->linvarssize )
1111 if( consdata->lineventdata !=
NULL )
1115 consdata->linvarssize = newsize;
1117 assert(num <= consdata->linvarssize);
1130 assert(scip !=
NULL);
1131 assert(consdata !=
NULL);
1132 assert(consdata->nquadvars <= consdata->quadvarssize);
1134 if( num > consdata->quadvarssize )
1140 consdata->quadvarssize = newsize;
1142 assert(num <= consdata->quadvarssize);
1155 assert(scip !=
NULL);
1156 assert(quadvarterm !=
NULL);
1167 assert(num <= quadvarterm->adjbilinsize);
1180 assert(scip !=
NULL);
1181 assert(consdata !=
NULL);
1182 assert(consdata->nbilinterms <= consdata->bilintermssize);
1184 if( num > consdata->bilintermssize )
1190 consdata->bilintermssize = newsize;
1192 assert(num <= consdata->bilintermssize);
1204 assert(scip !=
NULL);
1205 assert(consdata !=
NULL);
1213 (*consdata)->linvarssorted =
TRUE;
1214 (*consdata)->linvarsmerged =
TRUE;
1215 (*consdata)->quadvarssorted =
TRUE;
1216 (*consdata)->quadvarsmerged =
TRUE;
1217 (*consdata)->bilinsorted =
TRUE;
1218 (*consdata)->bilinmerged =
TRUE;
1220 (*consdata)->isremovedfixings =
TRUE;
1221 (*consdata)->ispropagated =
TRUE;
1222 (*consdata)->initialmerge =
FALSE;
1224 (*consdata)->linvar_maydecrease = -1;
1225 (*consdata)->linvar_mayincrease = -1;
1229 (*consdata)->minlinactivityinf = -1;
1230 (*consdata)->maxlinactivityinf = -1;
1232 (*consdata)->isgaugeavailable =
FALSE;
1233 (*consdata)->isedavailable =
FALSE;
1257 assert(scip !=
NULL);
1258 assert(consdata !=
NULL);
1260 assert(nlinvars == 0 || linvars !=
NULL);
1261 assert(nlinvars == 0 || lincoefs !=
NULL);
1262 assert(nquadvars == 0 || quadvarterms !=
NULL);
1263 assert(nbilinterms == 0 || bilinterms !=
NULL);
1270 (*consdata)->minlinactivityinf = -1;
1271 (*consdata)->maxlinactivityinf = -1;
1273 (*consdata)->lhs = lhs;
1274 (*consdata)->rhs = rhs;
1280 (*consdata)->nlinvars = nlinvars;
1281 (*consdata)->linvarssize = nlinvars;
1284 for( i = 0; i < nlinvars; ++i )
1291 (*consdata)->linvarssorted =
TRUE;
1292 (*consdata)->linvarsmerged =
TRUE;
1293 (*consdata)->minlinactivity = 0.0;
1294 (*consdata)->maxlinactivity = 0.0;
1295 (*consdata)->minlinactivityinf = 0;
1296 (*consdata)->maxlinactivityinf = 0;
1303 for( i = 0; i < nquadvars; ++i )
1305 (*consdata)->quadvarterms[i].eventdata =
NULL;
1306 if( quadvarterms[i].nadjbilin )
1309 (*consdata)->quadvarterms[i].adjbilinsize = quadvarterms[i].
nadjbilin;
1313 assert((*consdata)->quadvarterms[i].nadjbilin == 0);
1314 (*consdata)->quadvarterms[i].adjbilin =
NULL;
1315 (*consdata)->quadvarterms[i].adjbilinsize = 0;
1323 (*consdata)->nquadvars = nquadvars;
1324 (*consdata)->quadvarssize = nquadvars;
1329 (*consdata)->quadvarssorted =
TRUE;
1330 (*consdata)->quadvarsmerged =
TRUE;
1334 if( nbilinterms > 0 )
1337 (*consdata)->nbilinterms = nbilinterms;
1338 (*consdata)->bilintermssize = nbilinterms;
1342 (*consdata)->bilinsorted =
TRUE;
1343 (*consdata)->bilinmerged =
TRUE;
1346 (*consdata)->linvar_maydecrease = -1;
1347 (*consdata)->linvar_mayincrease = -1;
1353 (*consdata)->isgaugeavailable =
FALSE;
1367 assert(scip !=
NULL);
1368 assert(consdata !=
NULL);
1369 assert(*consdata !=
NULL);
1376 if( (*consdata)->linvarssize > 0 )
1378 for( i = 0; i < (*consdata)->nlinvars; ++i )
1380 assert((*consdata)->lineventdata ==
NULL || (*consdata)->lineventdata[i] ==
NULL);
1387 assert((*consdata)->linvars ==
NULL);
1388 assert((*consdata)->lincoefs ==
NULL);
1389 assert((*consdata)->lineventdata ==
NULL);
1392 for( i = 0; i < (*consdata)->nquadvars; ++i )
1394 assert((*consdata)->quadvarterms[i].eventdata ==
NULL);
1404 if( (*consdata)->nlrow !=
NULL )
1430 assert(consdata !=
NULL);
1432 if( consdata->linvarssorted )
1435 if( consdata->nlinvars <= 1 )
1437 consdata->linvarssorted =
TRUE;
1441 if( consdata->lineventdata ==
NULL )
1443 SCIPsortPtrReal((
void**)consdata->linvars, consdata->lincoefs, SCIPvarComp, consdata->nlinvars);
1449 SCIPsortPtrPtrReal((
void**)consdata->linvars, (
void**)consdata->lineventdata, consdata->lincoefs, SCIPvarComp, consdata->nlinvars);
1452 for( i = 0; i < consdata->nlinvars; ++i )
1453 if( consdata->lineventdata[i] !=
NULL )
1454 consdata->lineventdata[i]->varidx = i;
1457 consdata->linvarssorted =
TRUE;
1460 #ifdef SCIP_DISABLED_CODE 1463 int consdataFindLinearVar(
1470 assert(consdata !=
NULL);
1471 assert(var !=
NULL);
1473 if( consdata->nlinvars == 0 )
1478 if( !
SCIPsortedvecFindPtr((
void**)consdata->linvars, SCIPvarComp, (
void*)var, consdata->nlinvars, &pos) )
1491 assert(consdata !=
NULL);
1492 assert(0 <= ind1 && ind1 < consdata->nquadvars);
1493 assert(0 <= ind2 && ind2 < consdata->nquadvars);
1495 return SCIPvarCompare(consdata->quadvarterms[ind1].var, consdata->quadvarterms[ind2].var);
1511 assert(scip !=
NULL);
1512 assert(consdata !=
NULL);
1514 if( consdata->quadvarssorted )
1517 if( consdata->nquadvars == 0 )
1519 consdata->quadvarssorted =
TRUE;
1527 SCIPsort(perm, quadVarTermComp, (
void*)consdata, consdata->nquadvars);
1530 for( v = 0; v < consdata->nquadvars; ++v )
1534 quadterm = consdata->quadvarterms[v];
1539 assert(0 <= perm[i] && perm[i] < consdata->nquadvars);
1540 assert(perm[i] != i);
1541 consdata->quadvarterms[i] = consdata->quadvarterms[perm[i]];
1542 if( consdata->quadvarterms[i].eventdata !=
NULL )
1544 consdata->quadvarterms[i].eventdata->varidx = -i-1;
1550 while( perm[i] != v );
1551 consdata->quadvarterms[i] = quadterm;
1552 if( consdata->quadvarterms[i].eventdata !=
NULL )
1554 consdata->quadvarterms[i].
eventdata->varidx = -i-1;
1559 consdata->quadvarssorted =
TRUE;
1580 assert(consdata !=
NULL);
1581 assert(var !=
NULL);
1582 assert(pos !=
NULL);
1584 if( consdata->nquadvars == 0 )
1593 right = consdata->nquadvars - 1;
1594 while( left <= right )
1598 middle = (left+right)/2;
1599 assert(0 <= middle && middle < consdata->nquadvars);
1601 cmpres =
SCIPvarCompare(var, consdata->quadvarterms[middle].var);
1605 else if( cmpres > 0 )
1613 assert(left == right+1);
1627 assert(consdata !=
NULL);
1628 assert(0 <= ind1 && ind1 < consdata->nbilinterms);
1629 assert(0 <= ind2 && ind2 < consdata->nbilinterms);
1631 var1cmp =
SCIPvarCompare(consdata->bilinterms[ind1].var1, consdata->bilinterms[ind2].var1);
1635 return SCIPvarCompare(consdata->bilinterms[ind1].var2, consdata->bilinterms[ind2].var2);
1647 assert(consdata !=
NULL);
1650 if( !consdata->bilinsorted )
1653 for( i = 0; i < consdata->nbilinterms - 1; ++i )
1655 if( bilinTermComp(consdata, i, i+1) > 0 )
1676 assert(scip !=
NULL);
1677 assert(consdata !=
NULL);
1679 if( consdata->bilinsorted )
1682 if( consdata->nbilinterms == 0 )
1684 consdata->bilinsorted =
TRUE;
1693 SCIPsort(perm, bilinTermComp, (
void*)consdata, consdata->nbilinterms);
1696 for( v = 0; v < consdata->nbilinterms; ++v )
1698 assert(0 <= perm[v] && perm[v] < consdata->nbilinterms);
1699 invperm[perm[v]] = v;
1703 for( v = 0; v < consdata->nbilinterms; ++v )
1707 bilinterm = consdata->bilinterms[v];
1712 assert(0 <= perm[i] && perm[i] < consdata->nbilinterms);
1713 assert(perm[i] != i);
1714 consdata->bilinterms[i] = consdata->bilinterms[perm[i]];
1719 while( perm[i] != v );
1720 consdata->bilinterms[i] = bilinterm;
1726 for( v = 0; v < consdata->nquadvars; ++v )
1727 for( i = 0; i < consdata->quadvarterms[v].nadjbilin; ++i )
1728 consdata->quadvarterms[v].adjbilin[i] = invperm[consdata->quadvarterms[v].adjbilin[i]];
1730 consdata->bilinsorted =
TRUE;
1748 assert(consdata !=
NULL);
1749 assert(oldpos >= 0);
1750 assert(oldpos < consdata->nlinvars);
1751 assert(newpos >= 0);
1752 assert(newpos < consdata->linvarssize);
1754 if( newpos == oldpos )
1757 consdata->linvars [newpos] = consdata->linvars [oldpos];
1758 consdata->lincoefs[newpos] = consdata->lincoefs[oldpos];
1760 if( consdata->lineventdata !=
NULL )
1762 assert(newpos >= consdata->nlinvars || consdata->lineventdata[newpos] ==
NULL);
1764 consdata->lineventdata[newpos] = consdata->lineventdata[oldpos];
1765 consdata->lineventdata[newpos]->varidx = newpos;
1767 consdata->lineventdata[oldpos] =
NULL;
1770 consdata->linvarssorted =
FALSE;
1781 assert(consdata !=
NULL);
1782 assert(oldpos >= 0);
1783 assert(oldpos < consdata->nquadvars);
1784 assert(newpos >= 0);
1785 assert(newpos < consdata->quadvarssize);
1787 if( newpos == oldpos )
1790 assert(newpos >= consdata->nquadvars || consdata->quadvarterms[newpos].eventdata ==
NULL);
1792 consdata->quadvarterms[newpos] = consdata->quadvarterms[oldpos];
1794 if( consdata->quadvarterms[newpos].eventdata !=
NULL )
1796 consdata->quadvarterms[newpos].eventdata->varidx = -newpos-1;
1797 consdata->quadvarterms[oldpos].eventdata =
NULL;
1800 consdata->quadvarssorted =
FALSE;
1815 assert(scip !=
NULL);
1816 assert(cons !=
NULL);
1817 assert(var !=
NULL);
1824 assert(consdata !=
NULL);
1834 assert(var !=
NULL);
1838 consdata->linvars [consdata->nlinvars] = var;
1839 consdata->lincoefs[consdata->nlinvars] = coef;
1841 ++consdata->nlinvars;
1852 assert(conshdlrdata !=
NULL);
1853 assert(conshdlrdata->eventhdlr !=
NULL);
1855 assert(consdata->lineventdata !=
NULL);
1856 consdata->lineventdata[consdata->nlinvars-1] =
NULL;
1866 consdata->minlinactivityinf = -1;
1867 consdata->maxlinactivityinf = -1;
1870 if( consdata->nlrow !=
NULL )
1881 consdata->ispropagated =
FALSE;
1882 consdata->ispresolved =
FALSE;
1883 consdata->isremovedfixings = consdata->isremovedfixings &&
SCIPvarIsActive(var)
1885 if( consdata->nlinvars == 1 )
1886 consdata->linvarssorted =
TRUE;
1888 consdata->linvarssorted = consdata->linvarssorted && (
SCIPvarCompare(consdata->linvars[consdata->nlinvars-2], consdata->linvars[consdata->nlinvars-1]) == -1);
1890 consdata->linvarsmerged =
FALSE;
1907 assert(scip !=
NULL);
1908 assert(cons !=
NULL);
1911 assert(consdata !=
NULL);
1912 assert(0 <= pos && pos < consdata->nlinvars);
1914 var = consdata->linvars[pos];
1915 coef = consdata->lincoefs[pos];
1916 assert(var !=
NULL);
1922 if( consdata->lineventdata !=
NULL )
1930 assert(conshdlrdata !=
NULL);
1931 assert(conshdlrdata->eventhdlr !=
NULL);
1943 --consdata->nlinvars;
1949 consdata->minlinactivityinf = -1;
1950 consdata->maxlinactivityinf = -1;
1953 if( consdata->nlrow !=
NULL )
1958 consdata->ispropagated =
FALSE;
1959 consdata->ispresolved =
FALSE;
1979 assert(scip !=
NULL);
1980 assert(cons !=
NULL);
1983 conshdlrdata =
NULL;
1986 assert(consdata !=
NULL);
1988 assert(pos < consdata->nlinvars);
1991 var = consdata->linvars[pos];
1992 coef = consdata->lincoefs[pos];
1993 assert(var !=
NULL);
2000 consdata->minlinactivityinf = -1;
2001 consdata->maxlinactivityinf = -1;
2004 if( consdata->nlrow !=
NULL )
2010 if( newcoef * coef < 0.0 )
2020 if( consdata->lineventdata[pos] !=
NULL )
2025 assert(conshdlrdata !=
NULL);
2026 assert(conshdlrdata->eventhdlr !=
NULL);
2034 consdata->lincoefs[pos] = newcoef;
2037 if( newcoef * coef < 0.0 )
2045 if( conshdlrdata !=
NULL )
2054 consdata->ispropagated =
FALSE;
2055 consdata->ispresolved =
FALSE;
2074 assert(scip !=
NULL);
2075 assert(cons !=
NULL);
2076 assert(var !=
NULL);
2079 assert(consdata !=
NULL);
2089 assert(var !=
NULL);
2094 quadvarterm = &consdata->quadvarterms[consdata->nquadvars];
2095 quadvarterm->
var = var;
2096 quadvarterm->
lincoef = lincoef;
2097 quadvarterm->
sqrcoef = sqrcoef;
2103 ++consdata->nquadvars;
2117 assert(conshdlrdata !=
NULL);
2118 assert(conshdlrdata->eventhdlr !=
NULL);
2129 if( consdata->nlrow !=
NULL )
2137 consdata->ispropagated =
FALSE;
2138 consdata->ispresolved =
FALSE;
2139 consdata->isremovedfixings = consdata->isremovedfixings &&
SCIPvarIsActive(var)
2141 if( consdata->nquadvars == 1 )
2142 consdata->quadvarssorted =
TRUE;
2144 consdata->quadvarssorted = consdata->quadvarssorted &&
2145 (
SCIPvarCompare(consdata->quadvarterms[consdata->nquadvars-2].var, consdata->quadvarterms[consdata->nquadvars-1].var) == -1);
2147 consdata->quadvarsmerged =
FALSE;
2149 consdata->iscurvchecked =
FALSE;
2165 assert(scip !=
NULL);
2166 assert(cons !=
NULL);
2169 assert(consdata !=
NULL);
2170 assert(0 <= pos && pos < consdata->nquadvars);
2172 var = consdata->quadvarterms[pos].var;
2173 assert(var !=
NULL);
2174 assert(consdata->quadvarterms[pos].nadjbilin == 0);
2180 if( consdata->quadvarterms[pos].eventdata !=
NULL )
2188 assert(conshdlrdata !=
NULL);
2189 assert(conshdlrdata->eventhdlr !=
NULL);
2204 --consdata->nquadvars;
2211 if( consdata->nlrow !=
NULL )
2216 consdata->ispropagated =
FALSE;
2217 consdata->ispresolved =
FALSE;
2218 consdata->iscurvchecked =
FALSE;
2247 assert(consdata !=
NULL);
2249 assert(pos < consdata->nquadvars);
2251 quadvarterm = &consdata->quadvarterms[pos];
2265 assert(conshdlrdata !=
NULL);
2266 assert(conshdlrdata->eventhdlr !=
NULL);
2268 eventhdlr = conshdlrdata->eventhdlr;
2279 constant = quadvarterm->
lincoef * offset + quadvarterm->
sqrcoef * offset * offset;
2280 if( constant != 0.0 )
2284 consdata->lhs -= constant;
2286 consdata->rhs -= constant;
2291 quadvarterm->
lincoef += 2.0 * quadvarterm->
sqrcoef * coef * offset;
2292 quadvarterm->
sqrcoef *= coef * coef;
2295 for( i = 0; i < quadvarterm->
nadjbilin; ++i )
2297 bilinterm = &consdata->bilinterms[quadvarterm->
adjbilin[i]];
2299 if( bilinterm->
var1 == quadvarterm->
var )
2301 bilinterm->
var1 = var;
2302 var2 = bilinterm->
var2;
2306 assert(bilinterm->
var2 == quadvarterm->
var);
2307 bilinterm->
var2 = var;
2308 var2 = bilinterm->
var1;
2318 bilinterm->
coef = 0.0;
2326 tmp = bilinterm->
var1;
2328 bilinterm->
var2 = tmp;
2338 while( consdata->quadvarterms[var2pos].var != var2 )
2341 assert(var2pos < consdata->nquadvars);
2344 consdata->quadvarterms[var2pos].lincoef += bilinterm->
coef * offset;
2347 bilinterm->
coef *= coef;
2354 quadvarterm->
var = var;
2360 if( eventhdlr !=
NULL )
2373 if( consdata->nlrow !=
NULL )
2381 consdata->isremovedfixings = consdata->isremovedfixings &&
SCIPvarIsActive(var)
2383 consdata->quadvarssorted = (consdata->nquadvars == 1);
2384 consdata->quadvarsmerged =
FALSE;
2385 consdata->bilinsorted &= (quadvarterm->
nadjbilin == 0);
2386 consdata->bilinmerged &= (quadvarterm->
nadjbilin == 0);
2388 consdata->ispropagated =
FALSE;
2389 consdata->ispresolved =
FALSE;
2390 consdata->iscurvchecked =
FALSE;
2408 assert(scip !=
NULL);
2409 assert(cons !=
NULL);
2411 if( var1pos == var2pos )
2413 SCIPerrorMessage(
"tried to add bilinear term where both variables are the same\n");
2418 assert(consdata !=
NULL);
2423 assert(var1pos >= 0);
2424 assert(var1pos < consdata->nquadvars);
2425 assert(var2pos >= 0);
2426 assert(var2pos < consdata->nquadvars);
2430 bilinterm = &consdata->bilinterms[consdata->nbilinterms];
2431 if(
SCIPvarCompare(consdata->quadvarterms[var1pos].var, consdata->quadvarterms[var2pos].var) < 0 )
2433 bilinterm->
var1 = consdata->quadvarterms[var1pos].var;
2434 bilinterm->
var2 = consdata->quadvarterms[var2pos].var;
2438 bilinterm->
var1 = consdata->quadvarterms[var2pos].var;
2439 bilinterm->
var2 = consdata->quadvarterms[var1pos].var;
2441 bilinterm->
coef = coef;
2443 if( bilinterm->
var1 == bilinterm->
var2 )
2445 SCIPerrorMessage(
"tried to add bilinear term where both variables are the same, but appear at different positions in quadvarterms array\n");
2453 consdata->quadvarterms[var1pos].adjbilin[consdata->quadvarterms[var1pos].nadjbilin] = consdata->nbilinterms;
2454 consdata->quadvarterms[var2pos].adjbilin[consdata->quadvarterms[var2pos].nadjbilin] = consdata->nbilinterms;
2455 ++consdata->quadvarterms[var1pos].nadjbilin;
2456 ++consdata->quadvarterms[var2pos].nadjbilin;
2458 ++consdata->nbilinterms;
2465 if( consdata->nlrow !=
NULL )
2470 consdata->ispropagated =
FALSE;
2471 consdata->ispresolved =
FALSE;
2472 if( consdata->nbilinterms == 1 )
2474 consdata->bilinsorted =
TRUE;
2477 consdata->bilinmerged = !
SCIPisZero(scip, consdata->bilinterms[0].coef);
2481 consdata->bilinsorted = consdata->bilinsorted
2482 && (bilinTermComp(consdata, consdata->nbilinterms-2, consdata->nbilinterms-1) <= 0);
2483 consdata->bilinmerged =
FALSE;
2486 consdata->iscurvchecked =
FALSE;
2512 assert(scip !=
NULL);
2513 assert(cons !=
NULL);
2514 assert(nterms == 0 || termposs !=
NULL);
2520 assert(consdata !=
NULL);
2528 for( j = 0; j < consdata->nbilinterms; ++j )
2531 if( i < nterms && j == termposs[i] )
2541 consdata->bilinterms[j-offset] = consdata->bilinterms[j];
2542 newpos[j] = j - offset;
2544 assert(offset == nterms);
2547 for( i = 0; i < consdata->nquadvars; ++i )
2550 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
2552 assert(consdata->quadvarterms[i].adjbilin[j] < consdata->nbilinterms);
2553 if( newpos[consdata->quadvarterms[i].adjbilin[j]] == -1 )
2561 consdata->quadvarterms[i].adjbilin[j-offset] = newpos[consdata->quadvarterms[i].adjbilin[j]];
2564 consdata->quadvarterms[i].nadjbilin -= offset;
2568 consdata->nbilinterms -= nterms;
2573 consdata->quadvarsmerged =
FALSE;
2575 consdata->ispropagated =
FALSE;
2576 consdata->ispresolved =
FALSE;
2577 consdata->iscurvchecked =
FALSE;
2584 if( consdata->nlrow !=
NULL )
2608 assert(scip !=
NULL);
2609 assert(cons !=
NULL);
2613 if( consdata->quadvarsmerged )
2616 if( consdata->nquadvars == 0 )
2618 consdata->quadvarsmerged =
TRUE;
2623 while( i < consdata->nquadvars )
2628 quadvarterm = &consdata->quadvarterms[i];
2630 for( j = i+1; j < consdata->nquadvars && consdata->quadvarterms[j].var == quadvarterm->
var; ++j )
2633 quadvarterm->
lincoef += consdata->quadvarterms[j].lincoef;
2634 quadvarterm->
sqrcoef += consdata->quadvarterms[j].sqrcoef;
2635 if( consdata->quadvarterms[j].nadjbilin > 0 )
2640 quadvarterm->
nadjbilin += consdata->quadvarterms[j].nadjbilin;
2641 consdata->quadvarterms[j].nadjbilin = 0;
2643 consdata->quadvarterms[j].lincoef = 0.0;
2644 consdata->quadvarterms[j].sqrcoef = 0.0;
2649 for( j = j-1; j > i; --j )
2664 if( consdata->nlrow !=
NULL )
2687 consdata->quadvarsmerged =
TRUE;
2706 assert(scip !=
NULL);
2707 assert(cons !=
NULL);
2711 if( consdata->linvarsmerged )
2714 if( consdata->nlinvars == 0 )
2716 consdata->linvarsmerged =
TRUE;
2721 while( i < consdata->nlinvars )
2727 newcoef = consdata->lincoefs[i];
2728 for( j = i+1; j < consdata->nlinvars && consdata->linvars[i] == consdata->linvars[j]; ++j )
2729 newcoef += consdata->lincoefs[j];
2731 for( j = j-1; j > i; --j )
2741 assert(qvarpos < consdata->nquadvars);
2742 assert(consdata->quadvarterms[qvarpos].var == consdata->linvars[i]);
2743 consdata->quadvarterms[qvarpos].lincoef += newcoef;
2760 consdata->linvarsmerged =
TRUE;
2779 assert(scip !=
NULL);
2780 assert(cons !=
NULL);
2787 if( consdata->bilinmerged )
2790 if( consdata->nbilinterms == 0 )
2792 consdata->bilinmerged =
TRUE;
2804 while( i < consdata->nbilinterms )
2806 bilinterm = &consdata->bilinterms[i];
2809 for( j = i+1; j < consdata->nbilinterms && bilinterm->
var1 == consdata->bilinterms[j].var1 && bilinterm->
var2 == consdata->bilinterms[j].var2; ++j )
2811 bilinterm->
coef += consdata->bilinterms[j].coef;
2812 todelete[ntodelete++] = j;
2818 todelete[ntodelete++] = i;
2830 consdata->bilinmerged =
TRUE;
2858 assert(scip !=
NULL);
2859 assert(cons !=
NULL);
2863 have_change =
FALSE;
2865 while( i < consdata->nlinvars )
2867 var = consdata->linvars[i];
2877 coef = consdata->lincoefs[i];
2890 SCIPdebugMsg(scip,
" linear term %g*<%s> is replaced by %g * <%s> + %g\n", consdata->lincoefs[i],
SCIPvarGetName(consdata->linvars[i]),
2900 consdata->lhs -= offset;
2902 consdata->rhs -= offset;
2931 for( j = 0; j < naggrs; ++j )
2936 if( aggrconstant != 0.0 )
2939 consdata->lhs -= coef * aggrconstant;
2941 consdata->rhs -= coef * aggrconstant;
2947 while( i < consdata->nquadvars )
2949 var = consdata->quadvarterms[i].var;
2972 SCIPdebugMsg(scip,
" quadratic variable <%s> with status %d is replaced by %g * <%s> + %g\n",
SCIPvarGetName(consdata->quadvarterms[i].var),
2981 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
2983 bilinterm = &consdata->bilinterms[consdata->quadvarterms[i].adjbilin[j]];
2985 var2 = bilinterm->
var1 == consdata->quadvarterms[i].var ? bilinterm->
var2 : bilinterm->
var1;
2986 assert(var2 != consdata->quadvarterms[i].var);
2989 while( consdata->quadvarterms[var2pos].var != var2 )
2992 assert(var2pos < consdata->nquadvars);
2994 consdata->quadvarterms[var2pos].lincoef += bilinterm->
coef * offset;
2997 offset = consdata->quadvarterms[i].lincoef * offset + consdata->quadvarterms[i].sqrcoef * offset * offset;
2999 consdata->lhs -= offset;
3001 consdata->rhs -= offset;
3013 assert(var !=
NULL);
3050 lcoef = consdata->quadvarterms[i].lincoef;
3051 scoef = consdata->quadvarterms[i].sqrcoef;
3053 nquadtermsold = consdata->nquadvars;
3058 if( aggrconstant != 0.0 || offset != 0.0 )
3061 constant = (aggrconstant * coef + offset) * (lcoef + (aggrconstant * coef + offset) * scoef);
3063 consdata->lhs -= constant;
3065 consdata->rhs -= constant;
3069 for( j = 0; j < naggrs; ++j )
3072 coef * aggrscalars[j] * (lcoef + 2.0 * scoef * (coef * aggrconstant + offset)),
3073 coef * coef * aggrscalars[j] * aggrscalars[j] * scoef) );
3077 SCIP_CALL(
consdataEnsureBilinSize(scip, consdata, consdata->nquadvars + (scoef != 0.0 ? (naggrs * (naggrs-1))/2 : 0) + consdata->quadvarterms[j].nadjbilin * naggrs) );
3082 for( j = 0; j < naggrs; ++j )
3083 for( k = 0; k < j; ++k )
3085 assert(aggrvars[j] != aggrvars[k]);
3087 2.0 * aggrscalars[j] * aggrscalars[k] * coef * coef * scoef) );
3092 for( k = 0; k < consdata->quadvarterms[i].nadjbilin; ++k )
3094 bilinterm = &consdata->bilinterms[consdata->quadvarterms[i].adjbilin[k]];
3095 var2 = (bilinterm->
var1 == consdata->quadvarterms[i].var) ? bilinterm->
var2 : bilinterm->
var1;
3096 assert(var2 != consdata->quadvarterms[i].var);
3100 while( consdata->quadvarterms[var2pos].var != var2 )
3103 assert(var2pos < consdata->nquadvars);
3106 for( j = 0; j < naggrs; ++j )
3108 if( aggrvars[j] == var2 )
3110 consdata->quadvarterms[var2pos].sqrcoef += bilinterm->
coef * coef * aggrscalars[j];
3118 consdata->quadvarterms[var2pos].lincoef += bilinterm->
coef * (aggrconstant * coef + offset);
3129 consdata->isremovedfixings =
TRUE;
3135 for( i = 0; i < consdata->nlinvars; ++i )
3138 for( i = 0; i < consdata->nquadvars; ++i )
3148 consdata->linvarsmerged =
FALSE;
3155 for( i = 0; i < consdata->nbilinterms; ++i )
3157 assert(consdata->bilinterms[i].var1 != consdata->bilinterms[i].var2);
3158 assert(consdata->bilinterms[i].coef != 0.0);
3159 assert(
SCIPvarCompare(consdata->bilinterms[i].var1, consdata->bilinterms[i].var2) < 0);
3190 assert(scip !=
NULL);
3191 assert(cons !=
NULL);
3194 assert(consdata !=
NULL);
3196 if( consdata->nlrow !=
NULL )
3201 nquadvars = consdata->nquadvars;
3202 nquadelems = consdata->nbilinterms;
3204 for( i = 0; i < nquadvars; ++i )
3206 if( consdata->quadvarterms[i].sqrcoef != 0.0 )
3208 if( !
SCIPisZero(scip, consdata->quadvarterms[i].lincoef) )
3219 for( i = 0; i < nquadvars; ++i )
3221 quadvars[i] = consdata->quadvarterms[i].var;
3223 if( consdata->quadvarterms[i].sqrcoef != 0.0 )
3225 assert(elcnt < nquadelems);
3226 quadelems[elcnt].
idx1 = i;
3227 quadelems[elcnt].
idx2 = i;
3228 quadelems[elcnt].
coef = consdata->quadvarterms[i].sqrcoef;
3232 if( !
SCIPisZero(scip, consdata->quadvarterms[i].lincoef) )
3234 assert(lincnt < nquadlinterms);
3235 quadlinvars [lincnt] = consdata->quadvarterms[i].var;
3236 quadlincoefs[lincnt] = consdata->quadvarterms[i].lincoef;
3240 assert(lincnt == nquadlinterms);
3246 for( i = 0; i < consdata->nbilinterms; ++i )
3248 if( lastvar == consdata->bilinterms[i].var1 )
3250 assert(lastvaridx >= 0);
3251 assert(consdata->quadvarterms[lastvaridx].var == consdata->bilinterms[i].var1);
3255 lastvar = consdata->bilinterms[i].var1;
3262 assert(elcnt < nquadelems);
3263 quadelems[elcnt].
idx1 =
MIN(idx1, idx2);
3264 quadelems[elcnt].
idx2 =
MAX(idx1, idx2);
3265 quadelems[elcnt].
coef = consdata->bilinterms[i].coef;
3268 assert(elcnt == nquadelems);
3271 if( consdata->isconcave && consdata->isconvex )
3273 assert(consdata->nbilinterms == 0 && consdata->nquadvars == 0);
3276 else if( consdata->isconcave )
3278 else if( consdata->isconvex )
3284 consdata->nlinvars, consdata->linvars, consdata->lincoefs,
3285 nquadvars, quadvars, nquadelems, quadelems,
3286 NULL, consdata->lhs, consdata->rhs,
3311 assert(scip !=
NULL);
3312 assert(cons !=
NULL);
3313 assert(result !=
NULL);
3314 assert(redundant !=
NULL);
3320 assert(consdata !=
NULL);
3324 if(
SCIPisEQ(scip, consdata->lhs, consdata->rhs) && consdata->nlinvars == 0 && consdata->nquadvars == 2 &&
3325 ((
SCIPvarIsBinary(consdata->quadvarterms[0].var) && consdata->quadvarterms[1].sqrcoef == 0.0) ||
3326 (
SCIPvarIsBinary(consdata->quadvarterms[1].var) && consdata->quadvarterms[0].sqrcoef == 0.0)) )
3344 binvaridx = (
SCIPvarIsBinary(consdata->quadvarterms[0].var) && consdata->quadvarterms[1].sqrcoef == 0.0) ? 0 : 1;
3346 x = consdata->quadvarterms[binvaridx].var;
3347 a = consdata->quadvarterms[binvaridx].sqrcoef + consdata->quadvarterms[binvaridx].lincoef;
3349 y = consdata->quadvarterms[1-binvaridx].var;
3350 b = consdata->quadvarterms[1-binvaridx].lincoef;
3352 assert(consdata->nbilinterms <= 1);
3353 c = (consdata->nbilinterms == 1) ? consdata->bilinterms[0].coef : 0.0;
3359 SCIPdebugMsg(scip,
"=> attempt aggregation <%s> = %g*<%s> + %g\n",
SCIPvarGetName(y), (consdata->rhs-a)/(b+c) - consdata->rhs/b,
3362 SCIP_CALL(
SCIPaggregateVars(scip, x, y, (consdata->rhs-a)/(b+c) - consdata->rhs/b, -1.0, -consdata->rhs/b, &infeasible, redundant, &aggregated) );
3365 else if( *redundant || aggregated )
3405 assert(scip !=
NULL);
3406 assert(conshdlr !=
NULL);
3407 assert(cons !=
NULL);
3408 assert(naddconss !=
NULL);
3411 assert(conshdlrdata !=
NULL);
3414 if( conshdlrdata->empathy4and < 2 )
3418 assert(consdata !=
NULL);
3420 if( consdata->nbilinterms == 0 )
3427 for( i = 0; i < consdata->nbilinterms; ++i )
3429 vars[0] = consdata->bilinterms[i].var1;
3433 vars[1] = consdata->bilinterms[i].var2;
3442 #ifdef SCIP_DEBUG_SOLUTION 3443 if( SCIPdebugIsMainscip(scip) )
3471 assert(ntodelete < consdata->nbilinterms);
3472 todelete[ntodelete++] = i;
3498 assert(scip !=
NULL);
3501 assert(resultant !=
NULL);
3535 assert(implvars !=
NULL);
3536 assert(impltypes !=
NULL);
3537 assert(implbounds !=
NULL);
3544 while( pos > 0 && implvars[pos-1] == y )
3550 while( pos < nimpls && implvars[pos] == y )
3553 resultant->
inf =
MAX(resultant->
inf,
MIN(resultant->
sup, implbounds[pos]));
3555 resultant->
sup =
MIN(resultant->
sup,
MAX(resultant->
inf, implbounds[pos]));
3559 assert(resultant->
sup >= resultant->
inf);
3612 assert(scip !=
NULL);
3613 assert(conshdlr !=
NULL);
3614 assert(cons !=
NULL);
3615 assert(naddconss !=
NULL);
3618 assert(conshdlrdata !=
NULL);
3620 maxnrvar = conshdlrdata->replacebinaryprodlength;
3625 assert(consdata !=
NULL);
3632 for( i = 0; i < consdata->nquadvars; ++i )
3634 y = consdata->quadvarterms[i].var;
3638 nbilinterms = consdata->quadvarterms[i].nadjbilin;
3639 if( nbilinterms == 0 )
3668 for( ; j < nbilinterms && nxvars < maxnrvar; ++j )
3670 bilinidx = consdata->quadvarterms[i].adjbilin[j];
3671 assert(bilinidx >= 0);
3672 assert(bilinidx < consdata->nbilinterms);
3674 bvar = consdata->bilinterms[bilinidx].var1;
3676 bvar = consdata->bilinterms[bilinidx].var2;
3682 SCIPdebugMsg(scip,
"skip reform of <%s><%s> due to unbounded second variable [%g,%g]\n",
3687 bilincoef = consdata->bilinterms[bilinidx].coef;
3688 assert(bilincoef != 0.0);
3701 SCIPdebugMsg(scip,
"skip reform of %g<%s><%s> due to huge activity [%g,%g] for <%s> = 0.0\n",
3707 SCIPdebugMsg(scip,
"skip reform of %g<%s><%s> due to huge activity [%g,%g] for <%s> = 1.0\n",
3727 xvars[nxvars] = bvar;
3728 xcoef[nxvars] = bilincoef;
3735 if(
REALABS(bilincoef) < mincoef )
3736 mincoef = ABS(bilincoef);
3737 if(
REALABS(bilincoef) > maxcoef )
3738 maxcoef = ABS(bilincoef);
3757 assert(ntodelete < nbilinterms);
3758 todelete[ntodelete++] = bilinidx;
3773 SCIPdebugMsg(scip,
"got different bounds for y = 0: [%g, %g] and y = 1: [%g, %g]\n", xbndszero.
inf, xbndszero.
sup, xbndsone.
inf, xbndsone.
sup);
3777 if( nxvars == 1 && conshdlrdata->empathy4and >= 1 &&
SCIPvarIsBinary(xvars[0]) )
3786 #ifdef SCIP_DEBUG_SOLUTION 3787 if( SCIPdebugIsMainscip(scip) )
3829 assert(scale >= 1.0);
3831 else if( nxvars == 1 )
3834 assert(mincoef == maxcoef);
3848 assert(scale > 0.0);
3855 SCIPdebugMsg(scip,
"binary reformulation using scale %g, nxvars = %d, integral = %u\n", scale, nxvars, integral);
3860 for( k = 0; k < nxvars; ++k )
3875 #ifdef SCIP_DEBUG_SOLUTION 3876 if( SCIPdebugIsMainscip(scip) )
3888 assert(
SCIPisEQ(scip, varval, 1.0));
3891 for( k = 0; k < nxvars; ++k )
3894 debugval += xcoef[k] * varval;
3946 xvars[nxvars+1] = auxvar;
3948 xcoef[nxvars+1] = -1;
3990 while( j < nbilinterms );
3995 SCIPdebugMsg(scip,
"resulting quadratic constraint: ");
4039 assert(scip !=
NULL);
4040 assert(conshdlr !=
NULL);
4041 assert(cons !=
NULL);
4043 assert(upgraded !=
NULL);
4044 assert(nupgdconss !=
NULL);
4045 assert(naddconss !=
NULL);
4052 assert(conshdlrdata !=
NULL);
4055 if( conshdlrdata->nquadconsupgrades == 0 )
4062 assert(consdata !=
NULL);
4074 for( i = 0; i < consdata->nlinvars; ++i )
4076 var = consdata->linvars[i];
4077 lincoef = consdata->lincoefs[i];
4109 for( i = 0; i < consdata->nquadvars; ++i )
4111 var = consdata->quadvarterms[i].var;
4112 lincoef = consdata->quadvarterms[i].lincoef;
4113 quadcoef = consdata->quadvarterms[i].sqrcoef;
4146 for( i = 0; i < consdata->nbilinterms && integral; ++i )
4149 integral = integral &&
SCIPisIntegral(scip, consdata->bilinterms[i].coef);
4157 SCIPdebugMsg(scip,
"upgrading quadratic constraint <%s> (%d upgrade methods):\n",
4159 SCIPdebugMsg(scip,
" binlin=%d binquad=%d intlin=%d intquad=%d impllin=%d implquad=%d contlin=%d contquad=%d integral=%u\n",
4160 nbinlin, nbinquad, nintlin, nintquad, nimpllin, nimplquad, ncontlin, ncontquad, integral);
4164 for( i = 0; i < conshdlrdata->nquadconsupgrades; ++i )
4166 if( !conshdlrdata->quadconsupgrades[i]->active )
4169 SCIP_CALL( conshdlrdata->quadconsupgrades[i]->quadconsupgd(scip, cons,
4170 nbinlin, nbinquad, nintlin, nintquad, nimpllin, nimplquad, ncontlin, ncontquad, integral,
4171 &nupgdconss_, upgdconss, upgdconsssize, presoltiming) );
4173 while( nupgdconss_ < 0 )
4176 assert(-nupgdconss_ > upgdconsssize);
4177 upgdconsssize = -nupgdconss_;
4180 SCIP_CALL( conshdlrdata->quadconsupgrades[i]->quadconsupgd(scip, cons,
4181 nbinlin, nbinquad, nintlin, nintquad, nimpllin, nimplquad, ncontlin, ncontquad, integral,
4182 &nupgdconss_, upgdconss, upgdconsssize, presoltiming) );
4184 assert(nupgdconss_ != 0);
4187 if( nupgdconss_ > 0 )
4191 SCIPdebugMsg(scip,
" -> upgraded to %d constraints:\n", nupgdconss_);
4194 for( j = 0; j < nupgdconss_; ++j )
4205 *naddconss += nupgdconss_ - 1;
4236 assert(consdata !=
NULL);
4237 assert(quadvaridx >= 0);
4238 assert(quadvaridx < consdata->nquadvars);
4239 assert(var2component !=
NULL);
4240 assert(componentnr >= 0);
4242 quadvarterm = &consdata->quadvarterms[quadvaridx];
4255 for( i = 0; i < quadvarterm->
nadjbilin; ++i )
4257 othervar = consdata->bilinterms[quadvarterm->
adjbilin[i]].var1 == quadvarterm->
var ?
4258 consdata->bilinterms[quadvarterm->
adjbilin[i]].var2 : consdata->bilinterms[quadvarterm->
adjbilin[i]].var1;
4260 assert(othervaridx >= 0);
4286 assert(scip !=
NULL);
4287 assert(conshdlr !=
NULL);
4288 assert(cons !=
NULL);
4289 assert(naddconss !=
NULL);
4292 assert(consdata !=
NULL);
4298 if( consdata->nquadvars <= 1 )
4308 for( i = 0; i < consdata->nquadvars; ++i )
4317 assert(ncomponents >= 1);
4322 if( ncomponents == 1 )
4333 for( comp = 0; comp < ncomponents; ++comp )
4340 SCIP_CALL(
SCIPcreateConsQuadratic2(scip, &auxconss[comp], name, 0,
NULL,
NULL, 0,
NULL, 0,
NULL,
4352 for( i = 0; i < consdata->nquadvars; ++i )
4356 assert(comp < ncomponents);
4359 SCIP_CALL(
SCIPaddQuadVarQuadratic(scip, auxconss[comp], consdata->quadvarterms[i].var, consdata->quadvarterms[i].lincoef, consdata->quadvarterms[i].sqrcoef) );
4362 if( !
SCIPisZero(scip, consdata->quadvarterms[i].lincoef) && ABS(consdata->quadvarterms[i].lincoef) < auxcoefs[comp] )
4363 auxcoefs[comp] =
REALABS(consdata->quadvarterms[i].lincoef);
4364 if( !
SCIPisZero(scip, consdata->quadvarterms[i].sqrcoef) && ABS(consdata->quadvarterms[i].sqrcoef) < auxcoefs[comp] )
4365 auxcoefs[comp] =
REALABS(consdata->quadvarterms[i].sqrcoef);
4368 consdata->quadvarterms[i].nadjbilin = 0;
4369 consdata->quadvarterms[i].adjbilinsize = 0;
4373 for( i = 0; i < consdata->nbilinterms; ++i )
4376 assert(comp == (
int)(
size_t)
SCIPhashmapGetImage(var2component, consdata->bilinterms[i].var2));
4377 assert(!
SCIPisZero(scip, consdata->bilinterms[i].coef));
4380 consdata->bilinterms[i].var1, consdata->bilinterms[i].var2, consdata->bilinterms[i].coef) );
4382 if( ABS(consdata->bilinterms[i].coef) < auxcoefs[comp] )
4383 auxcoefs[comp] = ABS(consdata->bilinterms[i].coef);
4388 consdata->nbilinterms = 0;
4389 consdata->bilintermssize = 0;
4392 for( i = consdata->nquadvars - 1; i >= 0; --i )
4396 assert(consdata->nquadvars == 0);
4405 for( comp = 0; comp < ncomponents; ++comp )
4419 *naddconss += ncomponents;
4431 #ifdef CHECKIMPLINBILINEAR 4451 assert(scip !=
NULL);
4452 assert(cons !=
NULL);
4453 assert(nbilinremoved !=
NULL);
4458 assert(consdata !=
NULL);
4465 for( i = 0; i < consdata->nquadvars; ++i )
4467 x = consdata->quadvarterms[i].var;
4470 if( consdata->quadvarterms[i].nadjbilin == 0 )
4482 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
4484 k = consdata->quadvarterms[i].adjbilin[j];
4486 assert(k < consdata->nbilinterms);
4488 if( consdata->bilinterms[k].coef == 0.0 )
4491 y = consdata->bilinterms[k].var1 == x ? consdata->bilinterms[k].var2 : consdata->bilinterms[k].var1;
4500 consdata->bilinterms[k].coef = 0.0;
4501 consdata->bilinmerged =
FALSE;
4512 assert(consdata->quadvarssorted);
4514 consdata->bilinterms[k].coef = 0.0;
4515 consdata->bilinmerged =
FALSE;
4521 if( *nbilinremoved > 0 )
4526 if( consdata->nlrow !=
NULL )
4531 consdata->ispropagated =
FALSE;
4532 consdata->ispresolved =
FALSE;
4533 consdata->iscurvchecked =
FALSE;
4536 consdata->isimpladded =
FALSE;
4554 assert(scip !=
NULL);
4555 assert(cons !=
NULL);
4556 assert(determined !=
NULL);
4559 assert(consdata !=
NULL);
4561 nquadvars = consdata->nquadvars;
4564 if( consdata->iscurvchecked )
4569 if( nquadvars == 1 )
4571 assert(consdata->nbilinterms == 0);
4572 consdata->isconvex = !
SCIPisNegative(scip, consdata->quadvarterms[0].sqrcoef);
4573 consdata->isconcave = !
SCIPisPositive(scip, consdata->quadvarterms[0].sqrcoef);
4574 consdata->iscurvchecked =
TRUE;
4576 else if( nquadvars == 0 )
4578 consdata->isconvex =
TRUE;
4579 consdata->isconcave =
TRUE;
4580 consdata->iscurvchecked =
TRUE;
4582 else if( consdata->nbilinterms == 0 )
4586 consdata->isconvex =
TRUE;
4587 consdata->isconcave =
TRUE;
4589 for( v = nquadvars - 1; v >= 0; --v )
4591 consdata->isconvex = consdata->isconvex && !
SCIPisNegative(scip, consdata->quadvarterms[v].sqrcoef);
4592 consdata->isconcave = consdata->isconcave && !
SCIPisPositive(scip, consdata->quadvarterms[v].sqrcoef);
4595 consdata->iscurvchecked =
TRUE;
4597 else if( !checkmultivariate )
4599 consdata->isconvex =
FALSE;
4600 consdata->isconcave =
FALSE;
4601 consdata->iscurvchecked =
TRUE;
4604 *determined =
FALSE;
4626 assert(scip !=
NULL);
4627 assert(cons !=
NULL);
4630 assert(consdata !=
NULL);
4632 n = consdata->nquadvars;
4634 if( consdata->iscurvchecked )
4651 assert(consdata->nbilinterms == 1);
4652 consdata->isconvex =
4653 consdata->quadvarterms[0].sqrcoef >= 0 &&
4654 consdata->quadvarterms[1].sqrcoef >= 0 &&
4655 4 * consdata->quadvarterms[0].sqrcoef * consdata->quadvarterms[1].sqrcoef >= consdata->bilinterms[0].coef * consdata->bilinterms[0].coef;
4656 consdata->isconcave =
4657 consdata->quadvarterms[0].sqrcoef <= 0 &&
4658 consdata->quadvarterms[1].sqrcoef <= 0 &&
4659 4 * consdata->quadvarterms[0].sqrcoef * consdata->quadvarterms[1].sqrcoef >= consdata->bilinterms[0].coef * consdata->bilinterms[0].coef;
4661 consdata->iscurvchecked =
TRUE;
4667 if( nn < 0 || (
unsigned) (
int) nn > UINT_MAX /
sizeof(
SCIP_Real) )
4670 consdata->isconvex =
FALSE;
4671 consdata->isconcave =
FALSE;
4672 consdata->iscurvchecked =
TRUE;
4680 consdata->isconvex =
TRUE;
4681 consdata->isconcave =
TRUE;
4684 for( i = 0; i < n; ++i )
4686 if( consdata->quadvarterms[i].nadjbilin > 0 )
4689 matrix[i*n + i] = consdata->quadvarterms[i].sqrcoef;
4693 consdata->isconvex =
FALSE;
4695 consdata->isconcave =
FALSE;
4698 if( !consdata->isconvex && !consdata->isconcave )
4702 consdata->iscurvchecked =
TRUE;
4708 for( i = 0; i < consdata->nbilinterms; ++i )
4715 matrix[row * n + col] = consdata->bilinterms[i].coef/2;
4717 matrix[col * n + row] = consdata->bilinterms[i].coef/2;
4727 SCIPwarningMessage(scip,
"Failed to compute eigenvalues of quadratic coefficient matrix of constraint %s. Assuming matrix is indefinite.\n",
SCIPconsGetName(cons));
4728 consdata->isconvex =
FALSE;
4729 consdata->isconcave =
FALSE;
4739 printf(
"cons <%s>[%g,%g] spectrum = [%g,%g]\n",
SCIPconsGetName(cons), consdata->lhs, consdata->rhs, alleigval[0], alleigval[n-1]);
4743 consdata->iscurvchecked =
TRUE;
4745 for( i = 0; i < consdata->nquadvars; ++i )
4748 allbinary = i == consdata->nquadvars;
4750 if( !
SCIPisInfinity(scip, consdata->rhs) && alleigval[0] > 0.1 && allbinary )
4752 printf(
"deconvexify cons <%s> by shifting hessian by %g\n",
SCIPconsGetName(cons), alleigval[0]);
4753 for( i = 0; i < consdata->nquadvars; ++i )
4755 consdata->quadvarterms[i].sqrcoef -= alleigval[0];
4756 consdata->quadvarterms[i].lincoef += alleigval[0];
4760 if( !
SCIPisInfinity(scip, consdata->lhs) && alleigval[n-1] < -0.1 && allbinary )
4762 printf(
"deconcavify cons <%s> by shifting hessian by %g\n",
SCIPconsGetName(cons), alleigval[n-1]);
4763 for( i = 0; i < consdata->nquadvars; ++i )
4765 consdata->quadvarterms[i].sqrcoef -= alleigval[n-1];
4766 consdata->quadvarterms[i].lincoef += alleigval[n-1];
4776 consdata->isconvex =
FALSE;
4777 consdata->isconcave =
FALSE;
4778 consdata->iscurvchecked =
TRUE;
4808 assert(scip !=
NULL);
4809 assert(cons !=
NULL);
4812 assert(consdata !=
NULL);
4813 assert(consdata->factorleft ==
NULL);
4814 assert(consdata->factorright ==
NULL);
4817 if( consdata->nbilinterms == 0 )
4831 if( consdata->iscurvchecked && (consdata->isconvex || consdata->isconcave) )
4834 n = consdata->nquadvars + 1;
4852 for( i = 0; i < consdata->nbilinterms; ++i )
4854 bilinterm = &consdata->bilinterms[i];
4860 assert(idx1 != idx2);
4862 a[
MIN(idx1,idx2) * n +
MAX(idx1,idx2)] = bilinterm->
coef / 2.0;
4866 for( i = 0; i < consdata->nquadvars; ++i )
4868 a[i*n + i] = consdata->quadvarterms[i].sqrcoef;
4869 a[i*n + n-1] = consdata->quadvarterms[i].lincoef / 2.0;
4875 SCIPdebugMsg(scip,
"Failed to compute eigenvalues and eigenvectors of augmented quadratic form matrix for constraint <%s>.\n",
SCIPconsGetName(cons));
4882 for( i = 0; i < n; ++i )
4899 if( i < n || posidx == -1 || negidx == -1 )
4914 sigma1 =
sqrt( eigvals[posidx]);
4915 sigma2 =
sqrt(-eigvals[negidx]);
4916 for( i = 0; i < n; ++i )
4918 consdata->factorleft[i] = sigma1 * a[posidx * n + i] - sigma2 * a[negidx * n + i];
4919 consdata->factorright[i] = sigma1 * a[posidx * n + i] + sigma2 * a[negidx * n + i];
4921 if(
SCIPisZero(scip, consdata->factorleft[i]) )
4922 consdata->factorleft[i] = 0.0;
4923 if(
SCIPisZero(scip, consdata->factorright[i]) )
4924 consdata->factorright[i] = 0.0;
4929 for( i = 0; i < consdata->nquadvars; ++i )
4931 if( consdata->factorleft[i] != 0.0 )
4935 for( i = 0; i < consdata->nquadvars; ++i )
4937 if( consdata->factorright[i] != 0.0 )
4949 for( i = 0; i < consdata->nbilinterms; ++i )
4951 bilinterm = &consdata->bilinterms[i];
4956 if( !
SCIPisRelEQ(scip, consdata->factorleft[idx1] * consdata->factorright[idx2] + consdata->factorleft[idx2] * consdata->factorright[idx1], bilinterm->
coef) )
4964 for( i = 0; i < consdata->nquadvars; ++i )
4966 if( !
SCIPisRelEQ(scip, consdata->factorleft[i] * consdata->factorright[i], consdata->quadvarterms[i].sqrcoef) )
4972 if( !
SCIPisRelEQ(scip, consdata->factorleft[n-1] * consdata->factorright[i] + consdata->factorleft[i] * consdata->factorright[n-1], consdata->quadvarterms[i].lincoef) )
4981 SCIPdebugMsg(scip,
"Factorization not accurate enough. Dropping it.\n");
5007 assert(scip !=
NULL);
5008 assert(cons !=
NULL);
5011 assert(consdata !=
NULL);
5016 for( i = 0; i < consdata->nlinvars; ++i )
5017 if(
REALABS(consdata->lincoefs[i]) > maxelem )
5018 maxelem =
REALABS(consdata->lincoefs[i]);
5021 maxelem = consdata->lincoefsmax;
5023 for( i = 0; i < consdata->nquadvars; ++i )
5025 var = consdata->quadvarterms[i].var;
5028 g = consdata->quadvarterms[i].lincoef;
5029 g += 2.0 * consdata->quadvarterms[i].sqrcoef *
SCIPgetSolVal(scip, sol, var);
5030 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
5032 k = consdata->quadvarterms[i].adjbilin[j];
5033 if( consdata->bilinterms[k].var1 == var )
5034 g += consdata->bilinterms[k].coef *
SCIPgetSolVal(scip, sol, consdata->bilinterms[k].var2);
5036 g += consdata->bilinterms[k].coef *
SCIPgetSolVal(scip, sol, consdata->bilinterms[k].var1);
5067 assert(scip !=
NULL);
5068 assert(cons !=
NULL);
5069 assert(solviolbounds !=
NULL);
5072 assert(conshdlrdata !=
NULL);
5075 assert(consdata !=
NULL);
5077 *solviolbounds =
FALSE;
5078 consdata->activity = 0.0;
5081 for( i = 0; i < consdata->nlinvars; ++i )
5083 var = consdata->linvars[i];
5096 consdata->activity += consdata->lincoefs[i] * varval;
5099 for( j = 0; j < consdata->nquadvars; ++j )
5101 var = consdata->quadvarterms[j].var;
5118 *solviolbounds =
TRUE;
5123 consdata->activity += (consdata->quadvarterms[j].lincoef + consdata->quadvarterms[j].sqrcoef * varval) * varval;
5126 for( j = 0; j < consdata->nbilinterms; ++j )
5128 var = consdata->bilinterms[j].var1;
5129 var2 = consdata->bilinterms[j].var2;
5138 *solviolbounds =
TRUE;
5144 *solviolbounds =
TRUE;
5149 consdata->activity += consdata->bilinterms[j].coef * varval * varval2;
5153 if( consdata->activity < consdata->lhs && !
SCIPisInfinity(scip, -consdata->lhs) )
5154 consdata->lhsviol = consdata->lhs - consdata->activity;
5156 consdata->lhsviol = 0.0;
5159 if( consdata->activity > consdata->rhs && !
SCIPisInfinity(scip, consdata->rhs) )
5160 consdata->rhsviol = consdata->activity - consdata->rhs;
5162 consdata->rhsviol = 0.0;
5164 switch( conshdlrdata->scaling )
5172 if( consdata->lhsviol > 0.0 || consdata->rhsviol > 0.0 )
5178 consdata->lhsviol /= norm;
5179 consdata->rhsviol /= norm;
5186 if( consdata->lhsviol > 0.0 )
5187 consdata->lhsviol /=
MAX(1.0,
REALABS(consdata->lhs));
5189 if( consdata->rhsviol > 0.0 )
5190 consdata->rhsviol /=
MAX(1.0,
REALABS(consdata->rhs));
5221 assert(scip !=
NULL);
5222 assert(conss !=
NULL || nconss == 0);
5223 assert(solviolbounds !=
NULL);
5224 assert(maxviolcon !=
NULL);
5226 *solviolbounds =
FALSE;
5231 for( c = 0; c < nconss; ++c )
5233 assert(conss !=
NULL);
5234 assert(conss[c] !=
NULL);
5237 *solviolbounds |= solviolbounds1;
5240 assert(consdata !=
NULL);
5242 viol =
MAX(consdata->lhsviol, consdata->rhsviol);
5246 *maxviolcon = conss[c];
5277 assert(cutcoef !=
NULL);
5278 assert(rightminactivity * multright > 0.0);
5279 assert(rightmaxactivity * multright > 0.0);
5280 assert(multright == 1.0 || multright == -1.0);
5283 assert(consdata !=
NULL);
5305 assert(
SCIPisFeasLE(scip, rightminactivity, rightmaxactivity));
5307 constant = multleft * multright * coefleft[consdata->nquadvars];
5308 constant -= rhs * multright * (1.0 / rightminactivity + 1.0 / rightmaxactivity);
5309 constant += rhs * multright * coefright[consdata->nquadvars] / (rightminactivity * rightmaxactivity);
5311 for( i = 0; i < consdata->nquadvars; ++i )
5313 cutcoef[i] = multleft * multright * coefleft[i];
5314 cutcoef[i] += rhs * multright / (rightminactivity * rightmaxactivity) * coefright[i];
5332 refvalue = coefright[consdata->nquadvars];
5333 for( i = 0; i < consdata->nquadvars; ++i )
5334 refvalue += coefright[i] * ref[i];
5339 constant = multleft * multright * coefleft[consdata->nquadvars];
5340 constant -= 2.0 * rhs / (multright * refvalue);
5341 constant += rhs / (refvalue * refvalue) * multright * coefright[consdata->nquadvars];
5343 for( i = 0; i < consdata->nquadvars; ++i )
5345 cutcoef[i] = multleft * multright * coefleft[i];
5346 cutcoef[i] += rhs / (refvalue * refvalue) * multright * coefright[i];
5352 *cutrhs = -constant;
5386 assert(scip !=
NULL);
5387 assert(cons !=
NULL);
5388 assert(ref !=
NULL);
5389 assert(cutcoef !=
NULL);
5390 assert(cutlhs !=
NULL);
5391 assert(cutrhs !=
NULL);
5392 assert(islocal !=
NULL);
5393 assert(success !=
NULL);
5394 assert(name !=
NULL);
5397 assert(consdata !=
NULL);
5398 assert(consdata->nlinvars == 0);
5399 assert(consdata->factorleft !=
NULL);
5400 assert(consdata->factorright !=
NULL);
5405 leftminactivity = consdata->factorleft[consdata->nquadvars];
5406 leftmaxactivity = consdata->factorleft[consdata->nquadvars];
5407 rightminactivity = consdata->factorright[consdata->nquadvars];
5408 rightmaxactivity = consdata->factorright[consdata->nquadvars];
5409 for( i = 0; i < consdata->nquadvars; ++i )
5413 if( consdata->factorleft[i] > 0.0 )
5418 leftminactivity += consdata->factorleft[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
5420 else if( consdata->factorleft[i] < 0.0 )
5425 leftminactivity += consdata->factorleft[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
5430 if( consdata->factorleft[i] > 0.0 )
5435 leftmaxactivity += consdata->factorleft[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
5437 else if( consdata->factorleft[i] < 0.0 )
5442 leftmaxactivity += consdata->factorleft[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
5448 if( consdata->factorright[i] > 0.0 )
5453 rightminactivity += consdata->factorright[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
5455 else if( consdata->factorright[i] < 0.0 )
5460 rightminactivity += consdata->factorright[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
5465 if( consdata->factorright[i] > 0.0 )
5470 rightmaxactivity += consdata->factorright[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
5472 else if( consdata->factorright[i] < 0.0 )
5477 rightmaxactivity += consdata->factorright[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
5485 rhs = consdata->rhs;
5490 rhs = -consdata->lhs;
5514 if( rightminactivity < 0.0 )
5520 generateCutFactorableDo(scip, cons, ref, multleft, consdata->factorleft, multright, consdata->factorright, rightminactivity, rightmaxactivity, rhs, cutcoef, cutrhs, islocal, success, name);
5532 if( leftminactivity < 0.0 )
5538 generateCutFactorableDo(scip, cons, ref, multleft, consdata->factorright, multright, consdata->factorleft, leftminactivity, leftmaxactivity, rhs, cutcoef, cutrhs, islocal, success, name);
5541 (!
SCIPisInfinity(scip, -rightminactivity) && !
SCIPisInfinity(scip, rightmaxactivity) && rightmaxactivity - rightminactivity < leftmaxactivity - leftminactivity) )
5548 if( rightminactivity < 0.0 )
5554 generateCutFactorableDo(scip, cons, ref, multleft, consdata->factorleft, multright, consdata->factorright, rightminactivity, rightmaxactivity, rhs, cutcoef, cutrhs, islocal, success, name);
5563 if( leftminactivity < 0.0 )
5569 generateCutFactorableDo(scip, cons, ref, multleft, consdata->factorright, multright, consdata->factorleft, leftminactivity, leftmaxactivity, rhs, cutcoef, cutrhs, islocal, success, name);
5619 a = (x1 - x0) * (y1_ - y0_);
5621 b = x0 * y1_ + y0_ * x1 - 2.0 * c;
5635 if( b * b - 4.0 * a * (c - wl) < 0.0 )
5637 SCIPdebugMsg(scip,
"probable numerical difficulties, give up\n");
5641 denom =
sqrt(b * b - 4.0 * a * (c - wl));
5642 q = -0.5 * (b + COPYSIGN(denom, b));
5647 tl = (tl1 >= 0.0 && (tl2 < 0.0 || tl1 < tl2)) ? tl1 : tl2;
5657 if( b * b - 4.0 * a * (c - wu) < 0.0 )
5659 SCIPdebugMsg(scip,
"probable numerical difficulties, give up\n");
5663 denom =
sqrt(b * b - 4.0 * a * (c - wu));
5664 q = -0.5 * (b + COPYSIGN(denom, b));
5669 tu = (tu1 >= 0.0 && (tu2 < 0.0 || tu1 < tu2)) ? tu1 : tu2;
5687 *xl = (
SCIP_Real)(x0 + tl * (x1 - x0 ));
5688 *yl = (
SCIP_Real)(y0_ + tl * (y1_ - y0_));
5692 SCIPdebugMsg(scip,
"probable numerical difficulties, give up\n");
5700 *yu = (
SCIP_Real)(y0_ + tu * (y1_ - y0_));
5704 SCIPdebugMsg(scip,
"probable numerical difficulties, give up\n");
5713 SCIPdebugMsg(scip,
"probable numerical difficulties, give up\n");
5774 *cw = (2.0 * xd * yd - (*cx * xo + *cy * yo)) / (xo * yo - xd * yd);
5815 assert(scip !=
NULL);
5820 assert(success !=
NULL);
5829 SCIPdebugMsg(scip,
"x: %9g\t[%9g\t%9g]\n", x0, xl, xu);
5830 SCIPdebugMsg(scip,
"y: %9g\t[%9g\t%9g]\n", y0_, yl, yu);
5831 SCIPdebugMsg(scip,
"w: %9g\t[%9g\t%9g]\n", w0, wl, wu);
5834 assert(wl >= 0.0 || wu <= 0.0);
5846 if( xl >= 0.0 || yl >= 0.0 ||
SCIPisLT(scip, xl * yl, wl) )
5851 else if( xu <= 0.0 || yu <= 0.0 ||
SCIPisLT(scip, xu * yu, wl) )
5866 if( xl >= 0.0 || yu <= 0.0 ||
SCIPisGT(scip, xl * yu, wu) )
5871 else if( xu <= 0.0 || yl >= 0.0 ||
SCIPisGT(scip, xu * yl, wu))
5924 x0 =
MIN(xu,
MAX(x0, xl));
5925 y0_ =
MIN(yu,
MAX(y0_, yl));
5926 w0 =
MIN(wu,
MAX(w0, wl));
5929 SCIPdebugMsg(scip,
"x: %9g\t[%9g\t%9g]\n", x0, xl, xu);
5930 SCIPdebugMsg(scip,
"y: %9g\t[%9g\t%9g]\n", y0_, yl, yu);
5931 SCIPdebugMsg(scip,
"w: %9g\t[%9g\t%9g]\n", w0, wl, wu);
5935 SCIPdebugMsg(scip,
"box for x and y inside feasible region -> nothing to separate\n");
5940 SCIPdebugMsg(scip,
"point to separate not below curve -> cannot separate\n");
5947 if(
generateCutLTIfindIntersection(scip, 0.0, 0.0, x0, y0_, wl, wu, &xlow, &ylow, &xupp, &yupp) )
5951 SCIPdebugMsg(scip,
"lower: %9g\t%9g\tprod %9g\n", xlow, ylow, xlow*ylow);
5952 SCIPdebugMsg(scip,
"upper: %9g\t%9g\tprod %9g\n", xupp, yupp, xupp*yupp);
5955 if( (xlow <= xl && yupp >= yu) || (ylow <= yl && xupp >= xu) )
5959 if( xlow >= xl && xupp <= xu && ylow >= yl && yupp <= yu )
5969 else if( xlow >= xl && ylow >= yl && (xupp > xu || yupp > yu) )
5988 if(
generateCutLTIfindIntersection(scip, xupp, yupp, x0, y0_, wl,
SCIP_INVALID, &xlow, &ylow,
NULL,
NULL) )
5992 if( xlow < xl || ylow < yl )
6003 else if( xupp <= xu && yupp <= yu && (xlow < xl || ylow < yl) )
6022 if(
generateCutLTIfindIntersection(scip, xlow, ylow, x0, y0_,
SCIP_INVALID, wu,
NULL,
NULL, &xupp, &yupp) )
6026 if( xupp > xu || yupp > yu )
6037 else if( (xlow < xl && xupp > xu) || (ylow < yl && yupp > yu) )
6069 SCIPdebugMsg(scip,
"lower: %9g\t%9g\tprod %9g\n", xlow, ylow, xlow*ylow);
6070 SCIPdebugMsg(scip,
"upper: %9g\t%9g\tprod %9g\n", xupp, yupp, xupp*yupp);
6094 if(
generateCutLTIfindIntersection(scip, xlow, ylow, x0, y0_,
SCIP_INVALID, wu,
NULL,
NULL, &xupp2, &yupp2) ||
6097 if(
generateCutLTIfindIntersection(scip, xupp, yupp, x0, y0_, wl,
SCIP_INVALID, &xlow2, &ylow2,
NULL,
NULL) ||
6115 SCIPdebugMsg(scip,
"points are in a weird position:\n");
6116 SCIPdebugMsg(scip,
"lower: %9g\t%9g\tprod %9g\n", xlow, ylow, xlow*ylow);
6117 SCIPdebugMsg(scip,
"upper: %9g\t%9g\tprod %9g\n", xupp, yupp, xupp*yupp);
6122 SCIPdebugMsg(scip,
"cut w.r.t. reduced points: %gx-%g %+gy-%g %+gw-%g >= 0\n",
6123 *cx, c0x, *cy, c0y, *cw, c0w);
6133 *c0 = c0x + c0y + c0w;
6174 assert(scip !=
NULL);
6175 assert(cons !=
NULL);
6176 assert(ref !=
NULL);
6177 assert(cutcoeflin !=
NULL);
6178 assert(cutcoefquad !=
NULL);
6179 assert(cutlhs !=
NULL);
6180 assert(cutrhs !=
NULL);
6181 assert(islocal !=
NULL);
6182 assert(success !=
NULL);
6183 assert(name !=
NULL);
6188 assert(consdata !=
NULL);
6189 assert(consdata->nlinvars > 0);
6190 assert(consdata->factorleft !=
NULL);
6191 assert(consdata->factorright !=
NULL);
6199 rhsminactivity = consdata->lhs;
6200 rhsmaxactivity = consdata->rhs;
6203 for( i = 0; i < consdata->nlinvars; ++i )
6207 if( consdata->lincoefs[i] < 0.0 )
6212 rhsminactivity -= consdata->lincoefs[i] *
SCIPvarGetLbLocal(consdata->linvars[i]);
6216 assert(consdata->lincoefs[i] > 0.0);
6220 rhsminactivity -= consdata->lincoefs[i] *
SCIPvarGetUbLocal(consdata->linvars[i]);
6225 if( consdata->lincoefs[i] < 0.0 )
6230 rhsmaxactivity -= consdata->lincoefs[i] *
SCIPvarGetUbLocal(consdata->linvars[i]);
6234 assert(consdata->lincoefs[i] > 0.0);
6238 rhsmaxactivity -= consdata->lincoefs[i] *
SCIPvarGetLbLocal(consdata->linvars[i]);
6241 rhsrefactivity -= consdata->lincoefs[i] *
SCIPgetSolVal(scip, sol, consdata->linvars[i]);
6258 leftminactivity = consdata->factorleft[consdata->nquadvars];
6259 leftmaxactivity = consdata->factorleft[consdata->nquadvars];
6260 leftrefactivity = consdata->factorleft[consdata->nquadvars];
6261 rightminactivity = consdata->factorright[consdata->nquadvars];
6262 rightmaxactivity = consdata->factorright[consdata->nquadvars];
6263 rightrefactivity = consdata->factorright[consdata->nquadvars];
6264 for( i = 0; i < consdata->nquadvars; ++i )
6268 if( consdata->factorleft[i] > 0.0 )
6273 leftminactivity += consdata->factorleft[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
6275 else if( consdata->factorleft[i] < 0.0 )
6280 leftminactivity += consdata->factorleft[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
6285 if( consdata->factorleft[i] > 0.0 )
6290 leftmaxactivity += consdata->factorleft[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
6292 else if( consdata->factorleft[i] < 0.0 )
6297 leftmaxactivity += consdata->factorleft[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
6300 leftrefactivity += consdata->factorleft[i] * ref[i];
6304 if( consdata->factorright[i] > 0.0 )
6309 rightminactivity += consdata->factorright[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
6311 else if( consdata->factorright[i] < 0.0 )
6316 rightminactivity += consdata->factorright[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
6321 if( consdata->factorright[i] > 0.0 )
6326 rightmaxactivity += consdata->factorright[i] *
SCIPvarGetUbLocal(consdata->quadvarterms[i].var);
6328 else if( consdata->factorright[i] < 0.0 )
6333 rightmaxactivity += consdata->factorright[i] *
SCIPvarGetLbLocal(consdata->quadvarterms[i].var);
6336 rightrefactivity += consdata->factorright[i] * ref[i];
6345 if(
SCIPisRelEQ(scip, leftminactivity, leftmaxactivity) ||
SCIPisRelEQ(scip, rightminactivity, rightmaxactivity) )
6353 leftminactivity, leftmaxactivity, leftrefactivity,
6354 rightminactivity, rightmaxactivity, rightrefactivity,
6355 rhsminactivity, rhsmaxactivity, rhsrefactivity,
6356 &coefleft, &coefright, &coefrhs, cutlhs,
6362 SCIPdebugMsg(scip,
"LTI for x[%g,%g] * y[%g,%g] = w[%g,%g]: %gx %+gy %+gw >= %g; feas: %g\n",
6363 leftminactivity, leftmaxactivity, rightminactivity, rightmaxactivity, rhsminactivity, rhsmaxactivity,
6364 coefleft, coefright, coefrhs, *cutlhs,
6365 coefleft * leftrefactivity + coefright * rightrefactivity + coefrhs * rhsrefactivity - *cutlhs
6368 if( coefleft * leftrefactivity + coefright * rightrefactivity + coefrhs * rhsrefactivity >= *cutlhs )
6378 for( i = 0; i < consdata->nquadvars; ++i )
6379 cutcoefquad[i] = coefleft * consdata->factorleft[i] + coefright * consdata->factorright[i];
6380 assert(i == consdata->nquadvars);
6381 *cutlhs -= coefleft * consdata->factorleft[i] + coefright * consdata->factorright[i];
6384 for( i = 0; i < consdata->nlinvars; ++i )
6385 (*cutcoeflin)[i] = -coefrhs * consdata->lincoefs[i];
6390 *cutlhs -= coefrhs * consdata->rhs;
6396 *cutlhs -= coefrhs * consdata->lhs;
6432 assert(scip !=
NULL);
6433 assert(cons !=
NULL);
6434 assert(ref !=
NULL);
6435 assert(coef !=
NULL);
6436 assert(lhs !=
NULL);
6437 assert(rhs !=
NULL);
6438 assert(islocal !=
NULL);
6439 assert(success !=
NULL);
6442 assert(consdata !=
NULL);
6449 for( j = 0; j < consdata->nquadvars && *success; ++j )
6452 coef[j] += consdata->quadvarterms[j].lincoef;
6455 var = consdata->quadvarterms[j].var;
6460 for( k = 0; k < consdata->quadvarterms[j].nadjbilin && *success; ++k )
6462 bilinterm = &consdata->bilinterms[consdata->quadvarterms[j].adjbilin[k]];
6463 if( bilinterm->
var1 != var )
6465 assert(bilinterm->
var2 != var);
6466 assert(consdata->sepabilinvar2pos !=
NULL);
6468 var2pos = consdata->sepabilinvar2pos[consdata->quadvarterms[j].adjbilin[k]];
6469 assert(var2pos >= 0);
6470 assert(var2pos < consdata->nquadvars);
6471 assert(consdata->quadvarterms[var2pos].var == bilinterm->
var2);
6485 *lhs = consdata->lhs - constant;
6491 *rhs = consdata->rhs - constant;
6523 assert(scip !=
NULL);
6524 assert(cons !=
NULL);
6525 assert(ref !=
NULL);
6526 assert(coef !=
NULL);
6527 assert(lhs !=
NULL);
6528 assert(rhs !=
NULL);
6529 assert(islocal !=
NULL);
6530 assert(success !=
NULL);
6533 assert(consdata !=
NULL);
6541 for( j = 0; j < consdata->nquadvars && *success; ++j )
6544 coef[j] += consdata->quadvarterms[j].lincoef;
6546 var = consdata->quadvarterms[j].var;
6548 sqrcoef = consdata->quadvarterms[j].sqrcoef;
6549 if( sqrcoef != 0.0 )
6555 &constant, success);
6561 &constant, success);
6565 for( k = 0; k < consdata->quadvarterms[j].nadjbilin && *success; ++k )
6567 bilinterm = &consdata->bilinterms[consdata->quadvarterms[j].adjbilin[k]];
6568 if( bilinterm->
var1 != var )
6570 assert(bilinterm->
var2 != var);
6571 assert(consdata->sepabilinvar2pos !=
NULL);
6573 var2pos = consdata->sepabilinvar2pos[consdata->quadvarterms[j].adjbilin[k]];
6574 assert(var2pos >= 0);
6575 assert(var2pos < consdata->nquadvars);
6576 assert(consdata->quadvarterms[var2pos].var == bilinterm->
var2);
6593 *lhs = consdata->lhs - constant;
6599 *rhs = consdata->rhs - constant;
6640 assert(scip !=
NULL);
6641 assert(conshdlr !=
NULL);
6642 assert(cons !=
NULL);
6643 assert(ref !=
NULL);
6644 assert(row !=
NULL);
6647 assert(conshdlrdata !=
NULL);
6650 assert(consdata !=
NULL);
6656 lincoefs = consdata->lincoefs;
6657 lincoefsmax = consdata->lincoefsmax;
6658 lincoefsmin = consdata->lincoefsmin;
6667 if( consdata->factorleft !=
NULL )
6669 if( consdata->nlinvars == 0 )
6678 SCIP_CALL(
generateCutLTI(scip, cons, violside, ref, sol, &lincoefs, coef, &lhs, &rhs, &islocal, &success, cutname) );
6681 for( i = 0; i < consdata->nlinvars; ++i )
6683 if(
REALABS(lincoefs[i]) > lincoefsmax )
6684 lincoefsmax =
REALABS(lincoefs[i]);
6685 if(
REALABS(lincoefs[i]) < lincoefsmin )
6686 lincoefsmin =
REALABS(lincoefs[i]);
6727 refactivitylinpart = 0.0;
6728 #if !defined(SCIP_DEBUG) 6731 for( j = 0; j < consdata->nlinvars; ++j )
6745 refactivity = refactivitylinpart;
6747 mincoef = lincoefsmin;
6748 maxcoef = lincoefsmax;
6750 for( j = 0; j < consdata->nquadvars; ++j )
6760 if(
SCIPisEQ(scip, coef[j], roundcoef) && coef[j] != roundcoef )
6764 var = consdata->quadvarterms[j].var;
6778 SCIPdebugMsg(scip,
"var <%s> [%g,%g] has almost integral coef %.20g, round coefficient to %g and add constant %g\n",
6780 constant += (coef[j]-roundcoef) * xbnd;
6781 coef[j] = roundcoef;
6785 if( coef[j] == 0.0 )
6790 refactivity += coef[j] *
SCIPgetSolVal(scip, sol, consdata->quadvarterms[j].var);
6793 if( abscoef < mincoef )
6798 if( abscoef > maxcoef )
6802 if( maxcoef < mincoef )
6807 assert(maxcoef == 0.0);
6812 SCIPdebugMsg(scip,
"skip cut for constraint <%s> since all coefficients are zero and it's always satisfied\n",
SCIPconsGetName(cons));
6823 if( maxcoef / mincoef > conshdlrdata->cutmaxrange )
6825 SCIPdebugMsg(scip,
"cut coefficients for constraint <%s> have very large range: mincoef = %g maxcoef = %g\n",
SCIPconsGetName(cons), mincoef, maxcoef);
6826 if( mincoefidx >= 0 )
6828 var = consdata->quadvarterms[mincoefidx].var;
6837 coef[mincoefidx] = 0.0;
6846 coef[mincoefidx] = 0.0;
6862 viol = lhs - refactivity;
6867 viol = refactivity - rhs;
6873 SCIPdebugMsg(scip,
"skip cut for constraint <%s> because both sides are not finite: lhs = %g, rhs = %g\n",
SCIPconsGetName(cons), lhs, rhs);
6881 switch( conshdlrdata->scaling )
6890 rowefficacy /=
MAX(1.0, maxcoef);
6898 rowefficacy /=
MAX(1.0, abslhs);
6903 rowefficacy /=
MAX(1.0, absrhs);
6916 if( success && !
SCIPisInfinity(scip, -minefficacy) && rowefficacy < minefficacy )
6918 SCIPdebugMsg(scip,
"skip cut for constraint <%s> because efficacy %g too low (< %g)\n",
SCIPconsGetName(cons), rowefficacy, minefficacy);
6931 assert(consdata->sepaquadvars !=
NULL || consdata->nquadvars == 0);
6934 SCIPdebugMsg(scip,
"found cut <%s>, lhs=%g, rhs=%g, mincoef=%g, maxcoef=%g, range=%g, nnz=%d, violation=%g, efficacy=%g\n",
6936 mincoef, maxcoef, maxcoef/mincoef,
6939 if( efficacy !=
NULL )
6941 *efficacy = rowefficacy;
6961 if( lincoefs != consdata->lincoefs )
7004 assert(scip !=
NULL);
7005 assert(conshdlr !=
NULL);
7006 assert(cons !=
NULL);
7009 assert(consdata !=
NULL);
7012 assert((consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs)) ||
7018 consdata->isedavailable =
FALSE;
7026 n = consdata->nquadvars;
7030 if( nn < 0 || (
unsigned) (
int) nn > UINT_MAX /
sizeof(
SCIP_Real) )
7032 SCIPdebugMsg(scip,
"n is too large to compute eigendecomposition\n");
7033 consdata->isedavailable =
FALSE;
7039 matrix = consdata->eigenvectors;
7045 for( i = 0; i < n; ++i )
7048 matrix[i*n + i] = consdata->quadvarterms[i].sqrcoef;
7050 printf(
"inserting in position %d, value %g\n", i*n + i, consdata->quadvarterms[i].sqrcoef);
7054 for( i = 0; i < consdata->nbilinterms; ++i )
7062 matrix[row * n + col] = consdata->bilinterms[i].coef/2;
7064 printf(
"inserting in position %d, value %g\n", row*n + col, consdata->bilinterms[i].coef/2);
7069 matrix[col * n + row] = consdata->bilinterms[i].coef/2;
7071 printf(
"inserting in position %d, value %g\n", col*n + row, consdata->bilinterms[i].coef/2);
7077 printf(
"matrix built:\n");
7078 for( i = 0; i < n; i++ )
7080 for( j = 0; j < n; j++ )
7081 printf(
"%g ", matrix[i*n + j]);
7092 consdata->isedavailable =
FALSE;
7096 consdata->isedavailable =
TRUE;
7100 for( i = 0; i < n; i++ )
7101 for( j = 0; j < n; j++ )
7102 consdata->bp[i] += consdata->quadvarterms[j].lincoef * matrix[i*n + j];
7105 printf(
"eigenvalues:\n");
7106 for( j = 0; j < n; j++ )
7107 printf(
"%g ", consdata->eigenvalues[j]);
7109 printf(
"\neigenvectors (P^T):\n");
7110 for( i = 0; i < n; i++ )
7112 for( j = 0; j < n; j++ )
7113 printf(
"%g ", matrix[i*n + j]);
7118 for( j = 0; j < n; j++ )
7119 printf(
"%g ", consdata->bp[j]);
7120 printf(
"svd computed successfully\n");
7157 int nlrownquadelems;
7161 assert(scip !=
NULL);
7162 assert(cons !=
NULL);
7164 assert(success !=
NULL);
7168 assert(consdata !=
NULL);
7170 assert((consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs)) ||
7184 #ifdef SCIP_DEBUG_INT 7194 if( consdata->isconvex )
7198 for( i = 0; i < consdata->nlinvars; ++i )
7200 if( consdata->lincoefs[i] >= 0.0 )
7217 SCIPdebugMsg(scip,
"maximum activity is infinity: there is no interior point for fun <= rhs - maxlinactivity!\n");
7222 if( consdata->nlinvars == 0 )
7225 nlpiside = consdata->rhs - nlpiside;
7231 for( i = 0; i < consdata->nlinvars; ++i )
7233 if( consdata->lincoefs[i] >= 0.0 )
7250 SCIPdebugMsg(scip,
"minimum activity is -infinity: there is no interior point for fun >= lhs - minlinactivity!\n");
7255 if( consdata->nlinvars == 0 )
7258 nlpiside = consdata->lhs - nlpiside;
7261 nquadvars = consdata->nquadvars;
7264 if( method ==
'a' && ((consdata->isconvex &&
SCIPisGE(scip, nlpiside, 0.0))
7265 || (consdata->isconcave &&
SCIPisLE(scip, nlpiside, 0.0))) )
7274 if( consdata->nlrow ==
NULL )
7277 assert(consdata->nlrow !=
NULL);
7281 assert(nlpi !=
NULL);
7286 assert(prob !=
NULL);
7288 #ifdef SCIP_DEBUG_INT 7300 for( i = 0; i < nquadvars; i++ )
7305 lincoefs[i] = consdata->quadvarterms[i].lincoef;
7321 for( i = 0; i < nlrownquadelems; i++ )
7323 assert(nlrowquadvars[nlrowquadelems[i].idx1] == consdata->quadvarterms[nlrowquadelems[i].
idx1].var);
7324 assert(nlrowquadvars[nlrowquadelems[i].idx2] == consdata->quadvarterms[nlrowquadelems[i].
idx2].var);
7335 if( consdata->isconvex )
7338 &nlrownquadelems, &nlrowquadelems,
NULL,
NULL,
NULL) );
7343 &nlrownquadelems, &nlrowquadelems,
NULL,
NULL,
NULL) );
7349 if( consdata->isconvex )
7352 nlrownquadelems, nlrowquadelems,
NULL,
NULL, 0.0) );
7357 for( i = 0; i < nquadvars; i++ )
7361 for( i = 0; i < nlrownquadelems; i++ )
7362 nlrowquadelems->
coef *= -1;
7365 nlrownquadelems, nlrowquadelems,
NULL,
NULL, 0.0) );
7368 for( i = 0; i < nlrownquadelems; i++ )
7369 nlrowquadelems->
coef *= -1;
7374 SCIPerrorMessage(
"undefined method for computing interior point: %c\n", method);
7384 SCIPdebugMsg(scip,
"cons <%s>: NLP Solver termination status not okay: %d\n",
7397 SCIPdebugMsg(scip,
"cons <%s>: found an interior point. solution status: %d, termination status: %d\n",
7405 SCIPdebugMsg(scip,
"cons <%s>: failed to find an interior point. solution status: %d, termination status: %d\n",
7413 SCIPerrorMessage(
"cons <%s>: undefined behaviour of NLP Solver. solution status: %d, termination status: %d\n",
7427 for( i = 0; i < nquadvars; i++ )
7430 consdata->interiorpoint[i] = 0.0;
7432 consdata->interiorpoint[i] = interiorpoint[i];
7439 #ifdef SCIP_DEBUG_INT 7440 printf(
"Computation of interior point for cons <%s>:\n",
SCIPconsGetName(cons));
7441 printf(
" - has %d linear variables\n", consdata->nlinvars);
7442 if( consdata->isconvex )
7444 printf(
" - is convex. rhs: %g maximum activity of linear variables: %g\n", consdata->rhs, consdata->rhs - nlpiside);
7445 printf(
" - searched for point whose quadratic part is <= %g\n", nlpiside);
7449 printf(
" - is concave. lhs: %g minimum activity of linear variables: %g\n", consdata->lhs, consdata->lhs - nlpiside);
7450 printf(
" - searched for point whose quadratic part is >= %g\n", nlpiside);
7457 printf(
"Computation successful, 0 is interior point.\n");
7458 for( i = 0; i < nquadvars; i++ )
7460 assert(consdata->interiorpoint[i] == 0.0);
7465 printf(
"Computation successful, NLP soltat: %d, termstat: %d\nPoint found:\n",
7467 for( i = 0; i < nquadvars; i++ )
7469 printf(
"%s = %g\n",
SCIPvarGetName(consdata->quadvarterms[i].var), consdata->interiorpoint[i]);
7475 printf(
"Computation failed. NLP soltat: %d, termstat: %d\n",
7477 printf(
"run with SCIP_DEBUG for more info\n");
7529 assert(scip !=
NULL);
7530 assert(conshdlr !=
NULL);
7531 assert(cons !=
NULL);
7534 assert(consdata !=
NULL);
7537 assert(conshdlrdata !=
NULL);
7538 assert(conshdlrdata->gaugecuts);
7541 convex = consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs);
7542 assert(convex || (consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs)));
7552 SCIPdebugMsg(scip,
"failed to compute gauge function\n");
7553 consdata->isgaugeavailable =
FALSE;
7566 consdata->interiorpointval = 0;
7567 consdata->gaugeconst = 0;
7568 for( i = 0; i < consdata->nquadvars; i++ )
7573 val = consdata->interiorpoint[i];
7574 quadvarterm = &consdata->quadvarterms[i];
7576 consdata->interiorpointval += (quadvarterm->
lincoef + quadvarterm->
sqrcoef * val) * val;
7577 consdata->gaugeconst += quadvarterm->
sqrcoef * val * val;
7579 for( j = 0; j < quadvarterm->
nadjbilin; ++j )
7583 bilintermidx = quadvarterm->
adjbilin[j];
7584 bilinterm = &consdata->bilinterms[bilintermidx];
7586 if( bilinterm->
var1 != quadvarterm->
var )
7590 assert(consdata->sepabilinvar2pos !=
NULL);
7591 assert(consdata->quadvarterms[consdata->sepabilinvar2pos[bilintermidx]].var == bilinterm->
var2);
7593 val2 = consdata->interiorpoint[consdata->sepabilinvar2pos[bilintermidx]];
7595 consdata->interiorpointval += bilinterm->
coef * val * val2;
7596 consdata->gaugeconst += bilinterm->
coef * val * val2;
7601 for( i = 0; i < consdata->nquadvars; i++ )
7603 quadvarterm = &consdata->quadvarterms[i];
7604 consdata->gaugecoefs[i] += quadvarterm->
lincoef + 2.0 * quadvarterm->
sqrcoef * consdata->interiorpoint[i];
7606 for( j = 0; j < quadvarterm->
nadjbilin; j++ )
7611 bilintermidx = quadvarterm->
adjbilin[j];
7612 bilinterm = &consdata->bilinterms[bilintermidx];
7614 if( bilinterm->
var1 == quadvarterm->
var )
7616 varpos = consdata->sepabilinvar2pos[bilintermidx];
7619 assert(consdata->quadvarterms[varpos].var == bilinterm->
var2);
7621 consdata->gaugecoefs[i] += bilinterm->
coef * consdata->interiorpoint[varpos];
7622 consdata->gaugecoefs[varpos] += bilinterm->
coef * consdata->interiorpoint[i];
7627 #ifdef SCIP_DEBUG_INT 7628 printf(
"quadratic part at interior point: %g\n", consdata->interiorpointval);
7630 for( j = 0; j < consdata->nquadvars; j++ )
7632 printf(
"b_gauge[%s] = %g\n",
SCIPvarGetName(consdata->quadvarterms[j].var), consdata->gaugecoefs[j]);
7634 printf(
"c_gauge = %g\n", consdata->gaugeconst);
7637 SCIPdebugMsg(scip,
"gauge function computed successfully\n");
7638 consdata->isgaugeavailable =
TRUE;
7668 assert(scip !=
NULL);
7669 assert(conshdlr !=
NULL);
7670 assert(cons !=
NULL);
7673 assert(consdata !=
NULL);
7674 assert(consdata->isgaugeavailable);
7678 convex = consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs);
7688 side = consdata->rhs;
7689 for( i = 0; i < consdata->nlinvars; i++ )
7690 side -=
SCIPgetSolVal(scip, refsol, consdata->linvars[i]) * consdata->lincoefs[i];
7692 aterm = side - consdata->interiorpointval;
7702 #ifdef SCIP_DEBUG_GAUGE 7705 printf(
"For current level, there is no interior point. ");
7706 printf(
"rhs: %g level: %15.20g interiorpointval: %15.20g\n", consdata->rhs, side, consdata->interiorpointval);
7707 if( consdata->nlinvars == 1 )
7711 var = consdata->linvars[0];
7712 printf(
"var <%s> = %g in [%15.20g, %15.20g] is linpart\n",
SCIPvarGetName(var),
7718 printf(
"For current level, there is interior point. ");
7719 printf(
"rhs: %g level: %15.20g interiorpointval: %15.20g\n", consdata->rhs, side, consdata->interiorpointval);
7730 side = consdata->lhs;
7731 for( i = 0; i < consdata->nlinvars; i++ )
7732 side -=
SCIPgetSolVal(scip, refsol, consdata->linvars[i]) * consdata->lincoefs[i];
7734 aterm = side - consdata->interiorpointval;
7736 #ifdef SCIP_DEBUG_GAUGE 7739 printf(
"For current level, there is no interior point. ");
7740 printf(
"lhs: %g level: %15.20g interiorpointval: %15.20g\n", consdata->lhs, side, consdata->interiorpointval);
7741 if( consdata->nlinvars == 1 )
7745 var = consdata->linvars[0];
7746 printf(
"var <%s> = %g in [%15.20g, %15.20g] is linpart\n",
SCIPvarGetName(var),
7752 printf(
"For current level, there is interior point. ");
7753 printf(
"lhs: %g level: %15.20g interiorpointval: %15.20g\n", consdata->lhs, side, consdata->interiorpointval);
7765 bterm = -consdata->interiorpointval - consdata->gaugeconst;
7766 cterm = consdata->gaugeconst;
7767 for( i = 0; i < consdata->nquadvars; i++ )
7771 val =
SCIPgetSolVal(scip, refsol, consdata->quadvarterms[i].var);
7772 bterm += consdata->gaugecoefs[i] * val;
7773 cterm -= consdata->gaugecoefs[i] * val;
7774 cterm += (consdata->quadvarterms[i].lincoef + consdata->quadvarterms[i].sqrcoef * val) * val;
7777 for( i = 0; i < consdata->nbilinterms; i++ )
7782 var1 = consdata->bilinterms[i].var1;
7783 var2 = consdata->bilinterms[i].var2;
7788 if( convex && cterm < 0.0 )
7793 else if( !convex && cterm > 0.0 )
7798 assert(bterm*bterm + 4*aterm*cterm >= 0);
7802 *gaugeval = bterm +
sqrt(bterm*bterm + 4 * aterm * cterm);
7803 *gaugeval = *gaugeval / (2 * aterm);
7807 *gaugeval = bterm -
sqrt(bterm*bterm + 4 * aterm * cterm);
7808 *gaugeval = *gaugeval / (2 * aterm);
7813 #ifdef SCIP_DEBUG_GAUGE 7814 printf(
"Gauge's aterm = %g, bterm = %g, cterm = %g\n", aterm, bterm, cterm);
7870 assert(scip !=
NULL);
7871 assert(conshdlr !=
NULL);
7872 assert(cons !=
NULL);
7875 assert(consdata !=
NULL);
7876 assert(consdata->isedavailable);
7881 pt = consdata->eigenvectors;
7882 D = consdata->eigenvalues;
7883 n = consdata->nquadvars;
7888 for( i = 0; i < consdata->nlinvars; i++ )
7890 c1 += consdata->lincoefs[i] *
SCIPgetSolVal(scip, refsol, consdata->linvars[i]);
7891 c2 -= consdata->lincoefs[i] * consdata->lincoefs[i];
7896 isconcave = consdata->isconcave;
7908 for( i = 0; i < n; i++ )
7916 for( i = 0; i < n; i++ )
7917 for( j = 0; j < n; j++ )
7918 y0_[i] +=
SCIPgetSolVal(scip, refsol, consdata->quadvarterms[j].var) * pt[i*n + j];
7923 for( i = 0; i < n; i++ )
7925 for( j = 0; j < n; j++ )
7926 printf(
"%g ", pt[i*n + j]);
7930 for( i = 0; i < n; i++ )
7931 printf(
"%g ",
SCIPgetSolVal(scip, refsol, consdata->quadvarterms[i].var));
7933 printf(
"P^T x_0: ");
7934 for( i = 0; i < n; i++ )
7935 printf(
"%g ", y0_[i]);
7938 for( i = 0; i < n; i++ )
7939 printf(
"%g ", bp[i]);
7941 printf(
"<d,linvars> = %g\n", c1);
7942 printf(
"-norm(d)^2/2 = %g\n", c2);
7949 for( iter = 0; iter < 9; iter++ )
7951 assert(phirhoprime != 0.0);
7952 rho = rho - (phirho - c)/ phirhoprime;
7965 for( i = 0; i < n; i++ )
7967 assert(1.0 + rho * D[i] != 0.0);
7968 yrho[i] = (y0_[i] - rho * bp[i]/2.0) / (1.0 + rho * D[i]);
7969 yrhoprime[i] = -(D[i] * y0_[i] + bp[i]/2.0) / ( (1.0 + rho * D[i])*(1.0 + rho * D[i]) );
7970 phirho += yrho[i] * (yrho[i] * D[i] + bp[i]);
7971 phirhoprime += yrhoprime[i] * (2 * D[i] * yrho[i] + bp[i]);
7973 phirho += c2 * rho + c1;
7976 printf(
"iteration %d: rho = %g, phirho = %g, phirho' = %g\n", iter, rho, phirho, phirhoprime);
7981 for( i = 0; i < n; i++ )
7985 for( j = 0; j < n; j++ )
7986 ref[i] += pt[j*n + i] * yrho[j];
7992 for( i = 0; i < n; i++ )
7999 #ifdef SCIP_DISABLED_CODE 8001 for( j = 0; j < consdata->nquadvars; ++j )
8007 var = consdata->quadvarterms[j].var;
8014 ref[j] =
MIN(ub,
MAX(lb, ref[j]));
8019 printf(
"modified reference point by a projection:\n");
8020 for( j = 0; j < consdata->nquadvars; ++j )
8022 printf(
"%s = %g\n",
SCIPvarGetName(consdata->quadvarterms[j].var), ref[j]);
8052 assert(scip !=
NULL);
8053 assert(conshdlr !=
NULL);
8054 assert(cons !=
NULL);
8057 assert(consdata !=
NULL);
8058 assert(consdata->isgaugeavailable);
8065 #ifdef SCIP_DEBUG_GAUGE 8066 printf(
"Couldn't evaluate gauge!\n");
8071 #ifdef SCIP_DEBUG_GAUGE 8075 level = consdata->rhs;
8076 for( j = 0; j < consdata->nlinvars; j++ )
8077 level -=
SCIPgetSolVal(scip, refsol, consdata->linvars[j]) * consdata->lincoefs[j];
8079 printf(
"Summary:\n");
8080 printf(
"For cons <%s>: gauge at level %g evaluated at (refsol - intpoint) is %.10f\n",
8082 printf(
"refsol - intpoint:\n");
8084 for( j = 0; j < consdata->nquadvars; ++j )
8087 vvar = consdata->quadvarterms[j].var;
8089 consdata->interiorpoint[j],
SCIPgetSolVal(scip, refsol, vvar) - consdata->interiorpoint[j]);
8092 printf(
"refsol is in the closure of the region (gaugeval <= 1), don't modify reference point\n");
8110 for( j = 0; j < consdata->nquadvars; ++j )
8112 var = consdata->quadvarterms[j].var;
8119 intpoint = consdata->interiorpoint[j];
8120 ref[j] = (
SCIPgetSolVal(scip, refsol, var) - intpoint) / gaugeval + intpoint;
8121 ref[j] =
MIN(ub,
MAX(lb, ref[j]));
8124 #ifdef SCIP_DEBUG_GAUGE 8125 printf(
"successful application of guage: %g\n", gaugeval);
8126 printf(
"modified reference point:\n");
8127 for( j = 0; j < consdata->nquadvars; ++j )
8129 printf(
"%s = % 20.15g\n",
SCIPvarGetName(consdata->quadvarterms[j].var), ref[j]);
8164 assert(scip !=
NULL);
8165 assert(conshdlr !=
NULL);
8166 assert(cons !=
NULL);
8169 assert(consdata !=
NULL);
8172 assert(conshdlrdata !=
NULL);
8174 if( refsol ==
NULL )
8186 if( conshdlrdata->gaugecuts && consdata->isgaugeavailable )
8190 else if( conshdlrdata->projectedcuts && consdata->isedavailable )
8192 SCIPdebugMessage(
"use the projection of refsol onto the region defined by the constraint as reference point\n");
8200 SCIP_CALL(
generateCut(scip, conshdlr, cons, ref, sol, violside, row, efficacy, checkcurvmultivar, minefficacy) );
8205 SCIPdebugMsg(scip,
"%s cut fail, try without modifying\n", conshdlrdata->gaugecuts ?
"gauge" :
"projected");
8213 for( j = 0; j < consdata->nquadvars; ++j )
8215 var = consdata->quadvarterms[j].var;
8223 ref[j] =
MIN(ub,
MAX(lb, ref[j]));
8226 SCIP_CALL(
generateCut(scip, conshdlr, cons, ref, sol, violside, row, efficacy, checkcurvmultivar, minefficacy) );
8233 if( conshdlrdata->gaugecuts && consdata->isgaugeavailable )
8239 SCIP_CALL(
generateCut(scip, conshdlr, cons, ref, sol, violside, row, efficacy, checkcurvmultivar, minefficacy) );
8246 if( conshdlrdata->projectedcuts && consdata->isedavailable )
8249 SCIP_CALL(
generateCut(scip, conshdlr, cons, ref, sol, violside, row, efficacy, checkcurvmultivar, minefficacy) );
8256 for( j = 0; j < consdata->nquadvars; ++j )
8258 var = consdata->quadvarterms[j].var;
8266 ref[j] =
MIN(ub,
MAX(lb, ref[j]));
8268 SCIP_CALL(
generateCut(scip, conshdlr, cons, ref, sol, violside, row, efficacy, checkcurvmultivar, minefficacy) );
8303 assert(scip !=
NULL);
8304 assert(conshdlr !=
NULL);
8305 assert(cons !=
NULL);
8306 assert(row !=
NULL);
8310 assert(consdata !=
NULL);
8316 SCIPdebugMsg(scip,
"do not have primal ray, thus cannot resolve unboundedness\n");
8325 SCIP_CALL(
generateCutSol(scip, conshdlr, cons,
NULL,
NULL, violside, row,
NULL,
FALSE, -
SCIPinfinity(scip),
'd') );
8328 if( *row !=
NULL && rowrayprod !=
NULL )
8335 assert(var !=
NULL);
8355 for( i = 0; i < consdata->nquadvars; ++i )
8357 var = consdata->quadvarterms[i].var;
8361 matrixrayprod = 2.0 * consdata->quadvarterms[i].sqrcoef * rayval;
8362 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
8364 bilinterm = &consdata->bilinterms[consdata->quadvarterms[i].adjbilin[j]];
8375 quadrayprod += matrixrayprod * ref[i];
8376 linrayprod += consdata->quadvarterms[i].lincoef * rayval;
8388 for( i = 0; i < consdata->nlinvars; ++i )
8391 SCIPdebugMsg(scip,
"initially have <b,ray> = %g and <ref, 2*A*ref> = %g\n", linrayprod, quadrayprod);
8403 scale = 2*
REALABS(linrayprod/quadrayprod);
8405 scale = 1.0/
REALABS(quadrayprod);
8408 for( i = 0; i < consdata->nquadvars; ++i )
8410 quadrayprod *= scale;
8413 if( rowrayprod !=
NULL )
8414 *rowrayprod = quadrayprod + linrayprod;
8416 SCIPdebugMsg(scip,
"calling generateCut, expecting ray product %g\n", quadrayprod + linrayprod);
8442 assert(scip !=
NULL);
8443 assert(row !=
NULL);
8444 assert(conshdlr !=
NULL);
8445 assert(result !=
NULL);
8446 assert(cons !=
NULL);
8453 assert(conshdlrdata !=
NULL);
8456 assert(consdata !=
NULL);
8471 SCIPdebugMessage(
"add cut with efficacy %g for constraint <%s> violated by %g\n", efficacy,
8478 if( inenforcement && !conshdlrdata->enfocutsremovable )
8481 if( bestefficacy !=
NULL && efficacy > *bestefficacy )
8482 *bestefficacy = efficacy;
8513 assert(scip !=
NULL);
8514 assert(conshdlr !=
NULL);
8515 assert(conss !=
NULL || nconss == 0);
8516 assert(nusefulconss <= nconss);
8517 assert(result !=
NULL);
8522 assert(conshdlrdata !=
NULL);
8524 if( bestefficacy !=
NULL )
8525 *bestefficacy = 0.0;
8528 for( c = 0; c < nconss; ++c )
8530 assert(conss !=
NULL);
8532 assert(consdata !=
NULL);
8567 efficacy = -rayprod;
8571 switch( conshdlrdata->scaling )
8582 efficacy /=
MAX(1.0, norm);
8591 efficacy /=
MAX(1.0, minval);
8601 SCIP_CALL(
processCut(scip, &row, conshdlr, conss[c], sol, efficacy, actminefficacy, inenforcement, bestefficacy, result) );
8608 conshdlrdata->checkcurvature, actminefficacy,
'd') );
8610 SCIP_CALL(
processCut(scip, &row, conshdlr, conss[c], sol, efficacy, actminefficacy, inenforcement, bestefficacy, result) );
8651 assert(scip !=
NULL);
8652 assert(conshdlr !=
NULL);
8653 assert(conss !=
NULL || nconss == 0);
8656 assert(conshdlrdata !=
NULL);
8658 if( separatedlpsol !=
NULL )
8659 *separatedlpsol =
FALSE;
8661 for( c = 0; c < nconss; ++c )
8663 assert(conss[c] !=
NULL);
8671 assert(consdata !=
NULL);
8676 conshdlrdata->checkcurvature, -
SCIPinfinity(scip),
'l') );
8678 else if( consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs) )
8681 conshdlrdata->checkcurvature, -
SCIPinfinity(scip),
'l') );
8692 if( separatedlpsol !=
NULL )
8698 switch( conshdlrdata->scaling )
8709 efficacy /=
MAX(1.0, norm);
8718 efficacy /=
MAX(1.0, minval);
8728 if( efficacy >= minefficacy )
8732 *separatedlpsol =
TRUE;
8735 assert( ! infeasible );
8762 assert(scip !=
NULL);
8763 assert(event !=
NULL);
8764 assert(eventdata !=
NULL);
8765 assert(eventhdlr !=
NULL);
8777 assert(sol !=
NULL);
8780 assert(conshdlrdata !=
NULL);
8790 assert(conss !=
NULL);
8833 assert(scip !=
NULL);
8834 assert(conshdlr !=
NULL);
8835 assert(conss !=
NULL || nconss == 0);
8841 for( c = 0; c < nconss; ++c )
8843 assert(conss !=
NULL);
8845 assert(consdata !=
NULL);
8847 if( !consdata->nquadvars )
8853 SCIPdebugMsg(scip,
"cons %s violation: %g %g convex: %u %u\n",
SCIPconsGetName(conss[c]), consdata->lhsviol, consdata->rhsviol, consdata->isconvex, consdata->isconcave);
8856 for( j = 0; j < consdata->nquadvars; ++j )
8858 x = consdata->quadvarterms[j].var;
8859 if( (
SCIPisGT(scip, consdata->rhsviol,
SCIPfeastol(scip)) && consdata->quadvarterms[j].sqrcoef < 0) ||
8860 (
SCIPisGT(scip, consdata->lhsviol,
SCIPfeastol(scip)) && consdata->quadvarterms[j].sqrcoef > 0) )
8879 gap = (xval-xlb)*(xub-xval)/(1+2*ABS(xval));
8887 for( j = 0; j < consdata->nbilinterms; ++j )
8890 x = consdata->bilinterms[j].var1;
8896 y = consdata->bilinterms[j].var2;
8907 if( !xunbounded && !yunbounded )
8917 xval =
MAX(xlb,
MIN(xval, xub));
8918 yval =
MAX(ylb,
MIN(yval, yub));
8920 coef_ =
SCIPisGT(scip, consdata->lhsviol,
SCIPfeastol(scip)) ? -consdata->bilinterms[j].coef : consdata->bilinterms[j].coef;
8923 if( (xub-xlb)*yval + (yub-ylb)*xval <= xub*yub - xlb*ylb )
8924 gap = (xval*yval - xlb*yval - ylb*xval + xlb*ylb) / (1+
sqrt(xval*xval + yval*yval));
8926 gap = (xval*yval - xval*yub - yval*xub + xub*yub) / (1+
sqrt(xval*xval + yval*yval));
8930 if( (xub-xlb)*yval - (yub-ylb)*xval <= xub*ylb - xlb*yub )
8931 gap = -(xval*yval - xval*ylb - yval*xub + xub*ylb) / (1+
sqrt(xval*xval + yval*yval));
8933 gap = -(xval*yval - xval*yub - yval*xlb + xlb*yub) / (1+
sqrt(xval*xval + yval*yval));
8954 if( xbinary || ybinary )
8968 if( xunbounded || yunbounded )
8974 #ifdef BRANCHTOLINEARITY 8977 if(
SCIPisLT(scip, xub-xlb, yub-ylb) )
8983 if(
SCIPisGT(scip, xub-xlb, yub-ylb) )
9007 SCIPdebugMsg(scip,
"registered %d branching candidates\n", *nnotify);
9039 assert(scip !=
NULL);
9040 assert(conshdlr !=
NULL);
9041 assert(conss !=
NULL || nconss == 0);
9045 for( c = 0; c < nconss; ++c )
9047 assert(conss !=
NULL);
9049 assert(consdata !=
NULL);
9051 if( !consdata->nquadvars )
9057 SCIPdebugMsg(scip,
"cons %s violation: %g %g convex: %u %u\n",
SCIPconsGetName(conss[c]), consdata->lhsviol, consdata->rhsviol, consdata->isconvex, consdata->isconcave);
9059 for( j = 0; j < consdata->nquadvars; ++j )
9061 quadvarterm = &consdata->quadvarterms[j];
9066 x = quadvarterm->
var;
9091 SCIPdebugMsg(scip,
"registered %d branching candidates\n", *nnotify);
9125 assert(scip !=
NULL);
9126 assert(conshdlr !=
NULL);
9127 assert(conss !=
NULL || nconss == 0);
9131 for( c = 0; c < nconss; ++c )
9133 assert(conss !=
NULL);
9135 assert(consdata !=
NULL);
9137 if( !consdata->nquadvars )
9143 SCIPdebugMsg(scip,
"cons %s violation: %g %g convex: %u %u\n",
SCIPconsGetName(conss[c]), consdata->lhsviol, consdata->rhsviol, consdata->isconvex, consdata->isconcave);
9145 for( j = 0; j < consdata->nquadvars; ++j )
9147 quadvarterm = &consdata->quadvarterms[j];
9152 x = quadvarterm->
var;
9163 xval =
MAX(xlb,
MIN(xub, xval));
9178 score = 4.0 * (xval - xlb) * (xub - xval) / ((xub - xlb) * (xub - xlb));
9187 SCIPdebugMsg(scip,
"registered %d branching candidates\n", *nnotify);
9206 assert(conshdlrdata !=
NULL);
9208 switch( conshdlrdata->branchscoring )
9248 assert(scip !=
NULL);
9249 assert(conss !=
NULL || nconss == 0);
9254 for( c = 0; c < nconss; ++c )
9256 assert(conss !=
NULL);
9258 assert(consdata !=
NULL);
9263 for( i = 0; i < consdata->nquadvars; ++i )
9268 val =
SCIPgetSolVal(scip, sol, consdata->quadvarterms[i].var);
9269 if( ABS(val) > brvarval )
9271 brvarval = ABS(val);
9272 *brvar = consdata->quadvarterms[i].var;
9277 if( *brvar !=
NULL )
9305 assert(scip !=
NULL);
9306 assert(conss !=
NULL || nconss == 0);
9307 assert(addedcons !=
NULL);
9308 assert(reduceddom !=
NULL);
9309 assert(infeasible !=
NULL);
9312 *reduceddom =
FALSE;
9313 *infeasible =
FALSE;
9315 for( c = 0; c < nconss; ++c )
9317 assert(conss !=
NULL);
9319 assert(consdata !=
NULL);
9326 for( i = 0; i < consdata->nquadvars; ++i )
9332 constant += (consdata->quadvarterms[i].lincoef + consdata->quadvarterms[i].sqrcoef * val1) * val1;
9335 for( i = 0; i < consdata->nbilinterms; ++i )
9339 constant += consdata->bilinterms[i].coef * val1 * val2;
9343 if ( consdata->nlinvars == 1 )
9350 coef = *consdata->lincoefs;
9356 lhs = consdata->lhs - constant;
9361 rhs = consdata->rhs - constant;
9363 SCIPdebugMsg(scip,
"Linear constraint with one variable: %g <= %g <%s> <= %g\n", lhs, coef,
SCIPvarGetName(*consdata->linvars), rhs);
9392 SCIPdebugMsg(scip,
"node will marked as infeasible since lb/ub of %s is +/-infinity\n",
9404 SCIPdebugMsg(scip,
"Lower bound leads to infeasibility.\n");
9420 SCIPdebugMsg(scip,
"Upper bound leads to infeasibility.\n");
9434 consdata->nlinvars, consdata->linvars, consdata->lincoefs,
9442 SCIPdebugMsg(scip,
"replace quadratic constraint <%s> by linear constraint after all quadratic vars have been fixed\n",
SCIPconsGetName(conss[c]) );
9449 SCIPdebugMsg(scip,
"linear constraint is feasible and LP optimal, thus do not add\n");
9479 assert(scip !=
NULL);
9480 assert(cons !=
NULL);
9481 assert(intervalinfty > 0.0);
9482 assert(bnd > -intervalinfty);
9483 assert(var !=
NULL);
9484 assert(result !=
NULL);
9486 assert(nchgbds !=
NULL);
9507 SCIPdebugMsg(scip,
"%s found constraint <%s> infeasible due to tightened lower bound %g for variable <%s>\n",
9515 SCIPdebugMsg(scip,
"%s tightened lower bound of variable <%s> in constraint <%s> to %g\n",
9540 assert(scip !=
NULL);
9541 assert(cons !=
NULL);
9542 assert(intervalinfty > 0.0);
9543 assert(bnd < intervalinfty);
9544 assert(var !=
NULL);
9545 assert(result !=
NULL);
9547 assert(nchgbds !=
NULL);
9568 SCIPdebugMsg(scip,
"%s found constraint <%s> infeasible due to tightened upper bound %g for variable <%s>\n",
9576 SCIPdebugMsg(scip,
"%s tightened upper bound of variable <%s> in constraint <%s> to %g\n",
9602 assert(scip !=
NULL);
9603 assert(cons !=
NULL);
9604 assert(var !=
NULL);
9605 assert(result !=
NULL);
9606 assert(nchgbds !=
NULL);
9658 SCIPdebugMsg(scip,
"found <%s> infeasible because propagated domain of quadratic variable <%s> is outside of (-infty, +infty)\n",
9693 #ifndef PROPBILINNEW 9719 assert(scip !=
NULL);
9720 assert(cons !=
NULL);
9724 assert(result !=
NULL);
9726 assert(nchgbds !=
NULL);
9727 assert(bilincoef != 0.0);
9806 assert(scip !=
NULL);
9807 assert(cons !=
NULL);
9811 assert(result !=
NULL);
9813 assert(nchgbds !=
NULL);
9814 assert(bilincoef != 0.0);
9867 int* minactivityinf,
9868 int* maxactivityinf,
9881 assert(scip !=
NULL);
9882 assert(consdata !=
NULL);
9883 assert(minquadactivity !=
NULL);
9884 assert(maxquadactivity !=
NULL);
9885 assert(minactivityinf !=
NULL);
9886 assert(maxactivityinf !=
NULL);
9887 assert(quadactcontr !=
NULL);
9892 *minquadactivity =
SCIPisInfinity(scip, consdata->rhs) ? -intervalinfty : 0.0;
9893 *maxquadactivity =
SCIPisInfinity(scip, -consdata->lhs) ? intervalinfty : 0.0;
9895 *minactivityinf = 0;
9896 *maxactivityinf = 0;
9898 if( consdata->nquadvars == 0 )
9904 for( i = 0; i < consdata->nquadvars; ++i )
9917 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
9919 k = consdata->quadvarterms[i].adjbilin[j];
9920 if( consdata->bilinterms[k].var1 != consdata->quadvarterms[i].var )
9944 *maxquadactivity += bnd;
9945 quadactcontr[i].
sup = bnd;
9951 *maxquadactivity += bnd;
9953 quadactcontr[i].
sup = bnd;
9973 *minquadactivity += bnd;
9974 quadactcontr[i].
inf = bnd;
9980 *minquadactivity += bnd;
9982 quadactcontr[i].
inf = bnd;
9989 (*minactivityinf > 0 ? -intervalinfty : *minquadactivity),
9990 (*maxactivityinf > 0 ? intervalinfty : *maxquadactivity));
10022 assert(scip !=
NULL);
10023 assert(conshdlr !=
NULL);
10024 assert(cons !=
NULL);
10025 assert(result !=
NULL);
10026 assert(nchgbds !=
NULL);
10027 assert(redundant !=
NULL);
10030 assert(consdata !=
NULL);
10033 *redundant =
FALSE;
10039 quadactcontr =
NULL;
10040 quadminactinf = -1;
10041 quadmaxactinf = -1;
10049 assert(consdata->minlinactivityinf >= 0);
10050 assert(consdata->maxlinactivityinf >= 0);
10055 if( consdata->nbilinterms > 0 )
10065 propagateBoundsGetQuadActivity(scip, consdata, intervalinfty, &minquadactivity, &maxquadactivity, &quadminactinf, &quadmaxactinf, quadactcontr);
10069 SCIPdebugMsg(scip,
"linear activity: [%g, %g] quadratic activity: [%g, %g]\n",
10070 (consdata->minlinactivityinf > 0 ? -
SCIPinfinity(scip) : consdata->minlinactivity),
10071 (consdata->maxlinactivityinf > 0 ?
SCIPinfinity(scip) : consdata->maxlinactivity),
10072 consdata->quadactivitybounds.inf, consdata->quadactivitybounds.sup);
10080 SCIPintervalSetBounds(&consactivity, consdata->minlinactivityinf > 0 ? -intervalinfty : consdata->minlinactivity,
10081 consdata->maxlinactivityinf > 0 ? intervalinfty : consdata->maxlinactivity);
10082 SCIPintervalAdd(intervalinfty, &consactivity, consactivity, consdata->quadactivitybounds);
10085 SCIPdebugMsg(scip,
"found constraint <%s> to be redundant: sides: [%g, %g], activity: [%g, %g]\n",
10096 SCIPdebugMsg(scip,
"found constraint <%s> to be infeasible; sides: [%g, %g], activity: [%g, %g], infeas: %g\n",
10104 SCIPintervalSub(intervalinfty, &rhs, consbounds, consdata->quadactivitybounds);
10109 for( i = 0; i < consdata->nlinvars; ++i )
10111 coef = consdata->lincoefs[i];
10112 var = consdata->linvars[i];
10132 if( consdata->minlinactivityinf == 0 && !
SCIPisInfinity(scip, -consdata->minlinactivity) )
10139 bnd -= consdata->minlinactivity;
10154 bnd -= consdata->minlinactivity;
10168 if( consdata->maxlinactivityinf == 0 && !
SCIPisInfinity(scip, consdata->maxlinactivity) )
10175 bnd -= consdata->maxlinactivity;
10190 bnd -= consdata->maxlinactivity;
10202 assert(coef < 0.0 );
10207 if( consdata->maxlinactivityinf == 0 && !
SCIPisInfinity(scip, consdata->maxlinactivity) )
10213 bnd = consdata->maxlinactivity;
10228 bnd = consdata->maxlinactivity;
10243 if( consdata->minlinactivityinf == 0 && !
SCIPisInfinity(scip, -consdata->minlinactivity) )
10249 bnd = consdata->minlinactivity;
10264 bnd = consdata->minlinactivity;
10284 assert(consdata->minlinactivityinf > 0 || consdata->maxlinactivityinf > 0 || consdata->minlinactivity <= consdata->maxlinactivity);
10286 (consdata->minlinactivityinf > 0 ? -intervalinfty : consdata->minlinactivity),
10287 (consdata->maxlinactivityinf > 0 ? intervalinfty : consdata->maxlinactivity));
10291 if( consdata->nquadvars == 1 )
10296 assert(consdata->nbilinterms == 0);
10298 var = consdata->quadvarterms[0].var;
10304 else if( consdata->nbilinterms == 1 && consdata->nquadvars == 2 )
10307 assert(consdata->bilinterms[0].var1 == consdata->quadvarterms[0].var || consdata->bilinterms[0].var1 == consdata->quadvarterms[1].var);
10308 assert(consdata->bilinterms[0].var2 == consdata->quadvarterms[0].var || consdata->bilinterms[0].var2 == consdata->quadvarterms[1].var);
10312 consdata->quadvarterms[0].var, consdata->quadvarterms[0].sqrcoef, consdata->quadvarterms[0].lincoef,
10313 consdata->quadvarterms[1].var, consdata->quadvarterms[1].sqrcoef, consdata->quadvarterms[1].lincoef,
10314 consdata->bilinterms[0].coef,
10315 rhs, result, nchgbds) );
10320 consdata->quadvarterms[1].var, consdata->quadvarterms[1].sqrcoef, consdata->quadvarterms[1].lincoef,
10321 consdata->quadvarterms[0].var, consdata->quadvarterms[0].sqrcoef, consdata->quadvarterms[0].lincoef,
10322 consdata->bilinterms[0].coef,
10323 rhs, result, nchgbds) );
10331 if( quadminactinf == -1 )
10333 assert(quadactcontr ==
NULL);
10335 propagateBoundsGetQuadActivity(scip, consdata, intervalinfty, &minquadactivity, &maxquadactivity, &quadminactinf, &quadmaxactinf, quadactcontr);
10337 assert(quadactcontr !=
NULL);
10338 assert(quadminactinf >= 0);
10339 assert(quadmaxactinf >= 0);
10350 for( i = 0; i < consdata->nquadvars; ++i )
10352 var = consdata->quadvarterms[i].var;
10368 if( quadminactinf == 0 || (quadminactinf == 1 &&
SCIPintervalGetInf(quadactcontr[i]) <= -intervalinfty) )
10372 rhs2.
sup = rhs.
sup - minquadactivity;
10381 rhs2.
sup = intervalinfty;
10386 rhs2.
sup = intervalinfty;
10392 if( quadmaxactinf == 0 || (quadmaxactinf == 1 &&
SCIPintervalGetSup(quadactcontr[i]) >= intervalinfty) )
10396 rhs2.
inf = rhs.
inf - maxquadactivity;
10405 rhs2.
inf = -intervalinfty;
10410 rhs2.
inf = -intervalinfty;
10420 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
10422 k = consdata->quadvarterms[i].adjbilin[j];
10424 if( consdata->bilinterms[k].var1 == var )
10450 assert(consdata->bilinterms[k].var2 == var);
10452 assert(consdata->quadvarssorted);
10454 assert(otherpos >= 0);
10455 assert(consdata->quadvarterms[otherpos].var == consdata->bilinterms[k].var1);
10457 if( (consdata->quadvarterms[otherpos].sqrcoef != 0.0) || consdata->quadvarterms[otherpos].lincoef != 0.0 ||
10458 consdata->quadvarterms[otherpos].nadjbilin > 1 )
10476 if( rhs2.
inf > -intervalinfty )
10482 if( bilinbounds.
sup < intervalinfty )
10486 if( rhs2.
sup < intervalinfty )
10492 if( bilinbounds.
inf > -intervalinfty )
10502 if( consdata->bilinterms[k].var1 != var )
10547 assert(scip !=
NULL);
10548 assert(conshdlr !=
NULL);
10549 assert(conss !=
NULL || nconss == 0);
10550 assert(result !=
NULL);
10551 assert(nchgbds !=
NULL);
10556 assert(conshdlrdata !=
NULL);
10561 maxproprounds = conshdlrdata->maxproproundspresolve;
10563 maxproprounds = conshdlrdata->maxproprounds;
10570 SCIPdebugMsg(scip,
"starting domain propagation round %d of %d for %d constraints\n", roundnr, maxproprounds, nconss);
10572 for( c = 0; c < nconss && *result !=
SCIP_CUTOFF; ++c )
10574 assert(conss !=
NULL);
10586 *result = propresult;
10598 while( success && *result !=
SCIP_CUTOFF && roundnr < maxproprounds );
10614 consdata->linvar_maydecrease = -1;
10615 consdata->linvar_mayincrease = -1;
10618 for( i = 0; i < consdata->nlinvars; ++i )
10621 assert(consdata->lincoefs[i] != 0.0);
10622 if( consdata->lincoefs[i] > 0.0 )
10637 if( (consdata->linvar_maydecrease < 0) ||
10638 (
SCIPvarGetObj(consdata->linvars[consdata->linvar_maydecrease]) / consdata->lincoefs[consdata->linvar_maydecrease] >
SCIPvarGetObj(consdata->linvars[i]) / consdata->lincoefs[i]) )
10639 consdata->linvar_maydecrease = i;
10646 if( (consdata->linvar_mayincrease < 0) ||
10647 (
SCIPvarGetObj(consdata->linvars[consdata->linvar_mayincrease]) / consdata->lincoefs[consdata->linvar_mayincrease] >
SCIPvarGetObj(consdata->linvars[i]) / consdata->lincoefs[i]) )
10648 consdata->linvar_mayincrease = i;
10653 if( consdata->linvar_mayincrease >= 0 )
10655 SCIPdebugMsg(scip,
"may increase <%s> to become feasible\n",
SCIPvarGetName(consdata->linvars[consdata->linvar_mayincrease]));
10657 if( consdata->linvar_maydecrease >= 0 )
10659 SCIPdebugMsg(scip,
"may decrease <%s> to become feasible\n",
SCIPvarGetName(consdata->linvars[consdata->linvar_maydecrease]));
10690 assert(scip !=
NULL);
10691 assert(conshdlr !=
NULL);
10692 assert(conss !=
NULL || nconss == 0);
10693 assert(success !=
NULL);
10702 assert(conshdlrdata !=
NULL);
10713 SCIPdebugMsg(scip,
"attempt to make solution from <%s> feasible by shifting linear variable\n",
10716 origscaling = conshdlrdata->scaling;
10717 for( c = 0; c < nconss; ++c )
10720 assert(consdata !=
NULL);
10726 conshdlrdata->scaling =
'o';
10730 assert(!solviolbounds);
10731 viol = consdata->lhs - consdata->activity;
10736 assert(!solviolbounds);
10737 viol = consdata->rhs - consdata->activity;
10742 assert(viol != 0.0);
10743 if( consdata->linvar_mayincrease >= 0 &&
10744 ((viol > 0.0 && consdata->lincoefs[consdata->linvar_mayincrease] > 0.0) || (viol < 0.0 && consdata->lincoefs[consdata->linvar_mayincrease] < 0.0)) )
10747 var = consdata->linvars[consdata->linvar_mayincrease];
10749 delta = viol / consdata->lincoefs[consdata->linvar_mayincrease];
10750 assert(delta > 0.0);
10755 delta =
MIN(
MAX(0.0, gap), delta);
10767 viol -= consdata->lincoefs[consdata->linvar_mayincrease] * delta;
10773 assert(viol != 0.0);
10774 if( consdata->linvar_maydecrease >= 0 &&
10775 ((viol > 0.0 && consdata->lincoefs[consdata->linvar_maydecrease] < 0.0) || (viol < 0.0 && consdata->lincoefs[consdata->linvar_maydecrease] > 0.0)) )
10778 var = consdata->linvars[consdata->linvar_maydecrease];
10780 delta = viol / consdata->lincoefs[consdata->linvar_maydecrease];
10781 assert(delta < 0.0);
10786 delta =
MAX(
MIN(0.0, gap), delta);
10797 viol -= consdata->lincoefs[consdata->linvar_maydecrease] * delta;
10806 conshdlrdata->scaling = origscaling;
10815 assert(conshdlrdata->trysolheur !=
NULL);
10852 assert(scip !=
NULL);
10853 assert(conshdlr !=
NULL);
10854 assert(conss !=
NULL || nconss == 0);
10855 assert(nconss >= 0);
10856 assert(nusefulconss >= 0);
10857 assert(result !=
NULL);
10860 assert(conshdlrdata !=
NULL);
10864 if( maxviolcon ==
NULL )
10872 if( solviolbounds )
10879 assert(solinfeasible);
10884 assert(consdata !=
NULL);
10885 maxviol = consdata->lhsviol + consdata->rhsviol;
10889 sol ==
NULL ?
"LP" :
"relaxation");
10900 if( conshdlrdata->nenforounds > 100 )
10913 ++conshdlrdata->nenforounds;
10919 if( conshdlrdata->enfolplimit != -1 && conshdlrdata->nenforounds > conshdlrdata->enfolplimit )
10922 "cut off subtree because enforcement limit was reached; this might lead to incorrect results\n");
10930 conshdlrdata->nenforounds = 0;
10939 *result = propresult;
10948 minefficacy =
MIN(0.75*maxviol, conshdlrdata->mincutefficacyenfofac *
SCIPfeastol(scip));
10950 SCIP_CALL(
separatePoint(scip, conshdlr, conss, nconss, nusefulconss, sol, minefficacy,
TRUE, &separateresult, &sepaefficacy) );
10959 SCIPdebugMsg(scip,
"separation succeeded (bestefficacy = %g, minefficacy = %g)\n", sepaefficacy, minefficacy);
10968 SCIPdebugMsg(scip,
"separation failed (bestefficacy = %g < %g = minefficacy ); max viol: %g\n", sepaefficacy, minefficacy, maxviol);
10975 if( nnotify == 0 && !solinfeasible && minefficacy > leastpossibleefficacy )
10978 SCIP_CALL(
separatePoint(scip, conshdlr, conss, nconss, nusefulconss, sol, leastpossibleefficacy,
TRUE, &separateresult, &sepaefficacy) );
10987 SCIPdebugMsg(scip,
"separation fallback succeeded, efficacy = %g\n", sepaefficacy);
10993 if( nnotify == 0 && !solinfeasible )
11000 if( brvar ==
NULL )
11014 else if ( addedcons )
11016 else if ( reduceddom )
11021 SCIPwarningMessage(scip,
"could not enforce feasibility by separating or branching; declaring solution with viol %g as feasible\n", maxviol);
11028 SCIPdebugMsg(scip,
"Could not find any usual branching variable candidate. Proposed variable <%s> with LP value %g for branching.\n",
11034 assert(*result ==
SCIP_INFEASIBLE && (solinfeasible || nnotify > 0));
11046 assert(nupgdconss !=
NULL);
11047 assert(upgdconss !=
NULL);
11109 if( upgdconsssize < 1 )
11171 if( lincoefs !=
NULL )
11173 if( lincoefs[i] != 0.0 )
11181 for( i = 0; i < nquadelems; ++i )
11186 if( quadelems[i].idx1 == quadelems[i].idx2 )
11191 quadelems[i].coef) );
11199 quadelems[i].coef) );
11222 assert(scip !=
NULL);
11223 assert(conshdlr !=
NULL);
11241 assert(scip !=
NULL);
11242 assert(conshdlr !=
NULL);
11245 assert(conshdlrdata !=
NULL);
11247 for( i = 0; i < conshdlrdata->nquadconsupgrades; ++i )
11249 assert(conshdlrdata->quadconsupgrades[i] !=
NULL);
11265 assert(scip !=
NULL);
11266 assert(conshdlr !=
NULL);
11269 assert(conshdlrdata !=
NULL);
11271 conshdlrdata->subnlpheur =
SCIPfindHeur(scip,
"subnlp");
11272 conshdlrdata->trysolheur =
SCIPfindHeur(scip,
"trysol");
11284 assert(scip !=
NULL);
11285 assert(conshdlr !=
NULL);
11288 assert(conshdlrdata !=
NULL);
11290 conshdlrdata->subnlpheur =
NULL;
11291 conshdlrdata->trysolheur =
NULL;
11305 assert(scip !=
NULL);
11306 assert(conshdlr !=
NULL);
11307 assert(conss !=
NULL || nconss == 0);
11310 assert(conshdlrdata !=
NULL);
11326 assert(scip !=
NULL);
11327 assert(conshdlr !=
NULL);
11328 assert(conss !=
NULL || nconss == 0);
11330 for( c = 0; c < nconss; ++c )
11332 assert(conss !=
NULL);
11334 assert(consdata !=
NULL);
11336 if( !consdata->isremovedfixings )
11346 assert(consdata->isremovedfixings);
11347 assert(consdata->linvarsmerged);
11348 assert(consdata->quadvarsmerged);
11349 assert(consdata->bilinmerged);
11352 for( i = 0; i < consdata->nlinvars; ++i )
11355 for( i = 0; i < consdata->nquadvars; ++i )
11379 assert(scip !=
NULL);
11380 assert(conshdlr !=
NULL);
11381 assert(conss !=
NULL || nconss == 0);
11384 assert(conshdlrdata !=
NULL);
11386 for( c = 0; c < nconss; ++c )
11388 assert(conss !=
NULL);
11390 assert(consdata !=
NULL);
11397 consdata->lincoefsmax = 0.0;
11398 for( i = 0; i < consdata->nlinvars; ++i )
11400 consdata->lincoefsmin =
MIN(consdata->lincoefsmin,
REALABS(consdata->lincoefs[i]));
11401 consdata->lincoefsmax =
MAX(consdata->lincoefsmax,
REALABS(consdata->lincoefs[i]));
11407 if( consdata->nlrow ==
NULL )
11413 assert(consdata->nlrow !=
NULL);
11419 assert(consdata->sepaquadvars ==
NULL);
11420 assert(consdata->sepabilinvar2pos ==
NULL);
11421 if( consdata->nquadvars > 0 )
11429 for( i = 0; i < consdata->nquadvars; ++i )
11430 consdata->sepaquadvars[i] = consdata->quadvarterms[i].var;
11432 for( i = 0; i < consdata->nbilinterms; ++i )
11438 if( conshdlrdata->checkfactorable )
11445 if( conshdlrdata->gaugecuts &&
SCIPgetSubscipDepth(scip) == 0 && consdata->nquadvars > 0 )
11448 if( (consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs)) ||
11449 (consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs)) )
11456 if( conshdlrdata->projectedcuts &&
SCIPgetSubscipDepth(scip) == 0 && consdata->nquadvars > 0 )
11459 if( (consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs)) ||
11460 (consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs)) )
11468 consdata->ispropagated =
FALSE;
11477 conshdlrdata->newsoleventfilterpos = -1;
11478 if( nconss != 0 && conshdlrdata->linearizeheursol )
11483 assert(eventhdlr !=
NULL);
11491 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");
11495 conshdlrdata->sepanlp =
FALSE;
11496 conshdlrdata->lastenfonode =
NULL;
11497 conshdlrdata->nenforounds = 0;
11513 assert(scip !=
NULL);
11514 assert(conshdlr !=
NULL);
11515 assert(conss !=
NULL || nconss == 0);
11518 assert(conshdlrdata !=
NULL);
11520 for( c = 0; c < nconss; ++c )
11523 assert(consdata !=
NULL);
11526 if( consdata->nlrow !=
NULL )
11531 assert(!
SCIPconsIsEnabled(conss[c]) || consdata->sepaquadvars !=
NULL || consdata->nquadvars == 0);
11532 assert(!
SCIPconsIsEnabled(conss[c]) || consdata->sepabilinvar2pos !=
NULL || consdata->nquadvars == 0);
11552 if( conshdlrdata->newsoleventfilterpos >= 0 )
11557 assert(eventhdlr !=
NULL);
11560 conshdlrdata->newsoleventfilterpos = -1;
11570 assert(scip !=
NULL);
11571 assert(conshdlr !=
NULL);
11572 assert(cons !=
NULL);
11573 assert(consdata !=
NULL);
11578 assert(*consdata ==
NULL);
11592 assert(sourcedata !=
NULL);
11595 sourcedata->lhs, sourcedata->rhs,
11596 sourcedata->nlinvars, sourcedata->linvars, sourcedata->lincoefs,
11597 sourcedata->nquadvars, sourcedata->quadvarterms,
11598 sourcedata->nbilinterms, sourcedata->bilinterms,
11601 for( i = 0; i < targetdata->nlinvars; ++i )
11607 for( i = 0; i < targetdata->nquadvars; ++i )
11613 for( i = 0; i < targetdata->nbilinterms; ++i )
11618 if(
SCIPvarCompare(targetdata->bilinterms[i].var1, targetdata->bilinterms[i].var2) > 0 )
11621 tmp = targetdata->bilinterms[i].var2;
11622 targetdata->bilinterms[i].var2 = targetdata->bilinterms[i].var1;
11623 targetdata->bilinterms[i].var1 = tmp;
11634 SCIPdebugMsg(scip,
"created transformed quadratic constraint ");
11652 assert(scip !=
NULL);
11653 assert(conshdlr !=
NULL);
11654 assert(conss !=
NULL || nconss == 0);
11657 assert(conshdlrdata !=
NULL);
11659 *infeasible =
FALSE;
11661 for( c = 0; c < nconss && !(*infeasible); ++c )
11663 assert(conss[c] !=
NULL);
11668 assert(consdata !=
NULL);
11672 if( consdata->nquadvars == 0 )
11687 if( (consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs)) ||
11688 (consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs)) )
11695 for( k = 0; k < 5; ++k )
11697 lambda = 0.1 * (k+1);
11698 for( i = 0; i < consdata->nquadvars; ++i )
11700 var = consdata->quadvarterms[i].var;
11716 x[i] = lambda * ub + (1.0 - lambda) * lb;
11718 x[i] = lambda * lb + (1.0 - lambda) * ub;
11735 if( !(*infeasible) && ((! consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs))
11736 || (! consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs))) )
11749 for( k = 0; k < 2; ++k )
11759 for( i = 0; i < consdata->nquadvars; ++i )
11761 var = consdata->quadvarterms[i].var;
11770 x[i] =
MIN(0.0, ub);
11777 x[i] =
MAX(0.0, lb);
11782 lambda = 0.4 + 0.2 * ((i+k)%2) + 0.01 * i / (double)consdata->nquadvars;
11787 possquare |= consdata->quadvarterms[i].sqrcoef > 0.0;
11788 negsquare |= consdata->quadvarterms[i].sqrcoef < 0.0;
11791 if( !consdata->isconvex && !
SCIPisInfinity(scip, consdata->rhs) )
11804 if( !(*infeasible) && !consdata->isconcave && !
SCIPisInfinity(scip, -consdata->lhs) )
11821 (consdata->nbilinterms == 0 && (!possquare ||
SCIPisInfinity(scip, consdata->rhs))) ||
11822 (consdata->nbilinterms == 0 && (!negsquare ||
SCIPisInfinity(scip, -consdata->lhs))) )
11841 assert(scip !=
NULL);
11842 assert(conshdlr !=
NULL);
11843 assert(conss !=
NULL || nconss == 0);
11844 assert(result !=
NULL);
11849 assert(conshdlrdata !=
NULL);
11854 if( solviolbounds )
11858 if( maxviolcon ==
NULL )
11864 if(
SCIPgetDepth(scip) == 0 && !conshdlrdata->sepanlp &&
11881 for( c = 0; c < nconss; ++c )
11883 assert(conss[c] !=
NULL);
11886 assert(consdata !=
NULL);
11905 if( conshdlrdata->subnlpheur !=
NULL )
11920 SCIPdebugMsg(scip,
"solved NLP relax, solution status: %d\n", solstat);
11926 conshdlrdata->sepanlp =
TRUE;
11930 SCIPdebugMsg(scip,
"NLP relaxation is globally infeasible, thus can cutoff node\n");
11942 assert(nlpsol !=
NULL);
11945 if( solvednlp && conshdlrdata->trysolheur !=
NULL )
11955 if( nfracvars == 0 )
11967 if( lpsolseparated )
11969 SCIPdebugMsg(scip,
"linearization cuts separate LP solution\n");
11993 assert(scip !=
NULL);
11994 assert(conshdlr !=
NULL);
11995 assert(conss !=
NULL || nconss == 0);
11996 assert(sol !=
NULL);
11997 assert(result !=
NULL);
12000 assert(conshdlrdata !=
NULL);
12007 if( solviolbounds )
12011 if( maxviolcon ==
NULL )
12051 assert(scip !=
NULL);
12052 assert(conss !=
NULL || nconss == 0);
12057 assert(!solviolbounds);
12059 if( maxviolcon ==
NULL )
12074 *result = propresult;
12082 for( c = 0; c < nconss; ++c )
12084 assert(conss !=
NULL);
12086 assert(consdata !=
NULL);
12091 for( i = 0; i < consdata->nlinvars; ++i )
12093 var = consdata->linvars[i];
12101 for( i = 0; i < consdata->nquadvars; ++i )
12103 var = consdata->quadvarterms[i].var;
12114 SCIPdebugMsg(scip,
"All variables in violated constraints fixed (up to epsilon). Cannot find branching candidate. Forcing solution of LP.\n");
12128 assert(scip !=
NULL);
12129 assert(conshdlr !=
NULL);
12130 assert(conss !=
NULL || nconss == 0);
12131 assert(result !=
NULL);
12152 assert(scip !=
NULL);
12153 assert(conshdlr !=
NULL);
12154 assert(conss !=
NULL || nconss == 0);
12155 assert(result !=
NULL);
12165 SCIPdebugMsg(scip,
"presolving will %swait with reformulation\n", doreformulations ?
"not " :
"");
12168 assert(conshdlrdata !=
NULL);
12170 for( c = 0; c < nconss; ++c )
12172 assert(conss !=
NULL);
12174 assert(consdata !=
NULL);
12179 if( !consdata->initialmerge )
12184 consdata->initialmerge =
TRUE;
12187 havechange =
FALSE;
12188 #ifdef CHECKIMPLINBILINEAR 12192 SCIP_CALL( presolveApplyImplications(scip, conss[c], &nbilinremoved) );
12193 if( nbilinremoved > 0 )
12195 *nchgcoefs += nbilinremoved;
12199 assert(!consdata->isimpladded);
12205 if( !consdata->ispresolved || !consdata->ispropagated || nnewchgvartypes > 0 )
12217 if( !consdata->isremovedfixings )
12220 assert(consdata->isremovedfixings);
12247 if( doreformulations )
12251 naddconss_old = *naddconss;
12254 assert(*naddconss >= naddconss_old);
12256 if( *naddconss == naddconss_old )
12260 assert(*naddconss >= naddconss_old);
12263 if( conshdlrdata->disaggregate )
12269 if( *naddconss > naddconss_old )
12280 if( consdata->nlinvars == 0 && consdata->nquadvars == 0 )
12301 if( (presoltiming & SCIP_PRESOLTIMING_FAST) != 0 && !consdata->ispropagated )
12312 SCIPdebugMsg(scip,
"starting domain propagation round %d of %d\n", roundnr, conshdlrdata->maxproproundspresolve);
12314 if( !consdata->ispropagated )
12316 consdata->ispropagated =
TRUE;
12322 SCIPdebugMsg(scip,
"propagation on constraint <%s> says problem is infeasible in presolve\n",
12344 while( !consdata->ispropagated && roundnr < conshdlrdata->maxproproundspresolve );
12351 if( (nnewchgvartypes != 0 || havechange || !consdata->ispresolved)
12362 for( i = 0; !fail && i < consdata->nlinvars; ++i )
12372 else if(
SCIPisEQ(scip, ABS(consdata->lincoefs[i]), 1.0) )
12373 candidate = consdata->linvars[i];
12377 for( i = 0; !fail && i < consdata->nquadvars; ++i )
12381 for( i = 0; !fail && i < consdata->nbilinterms; ++i )
12384 if( !fail && candidate !=
NULL )
12431 if( !consdata->initialmerge )
12436 consdata->initialmerge =
TRUE;
12439 for( i = 0; i < consdata->nquadvars; ++i )
12445 var = consdata->quadvarterms[i].var;
12446 assert(var !=
NULL);
12488 consdata->ispresolved =
TRUE;
12503 assert(scip !=
NULL);
12504 assert(cons !=
NULL);
12507 assert(consdata !=
NULL);
12512 for( i = 0; i < consdata->nlinvars; ++i )
12514 if( consdata->lincoefs[i] > 0 )
12538 for( i = 0; i < consdata->nquadvars; ++i )
12553 assert(scip !=
NULL);
12554 assert(conshdlr !=
NULL);
12555 assert(cons !=
NULL);
12560 assert(conshdlrdata !=
NULL);
12578 SCIP_CALL( consInitsolQuadratic(scip, conshdlr, &cons, 1) );
12590 assert(scip !=
NULL);
12591 assert(conshdlr !=
NULL);
12592 assert(cons !=
NULL);
12596 assert(conshdlrdata !=
NULL);
12603 SCIP_CALL( consExitsolQuadratic(scip, conshdlr, &cons, 1,
FALSE) );
12618 assert(scip !=
NULL);
12619 assert(cons !=
NULL);
12622 assert(consdata !=
NULL);
12627 && !
SCIPisEQ(scip, consdata->lhs, consdata->rhs) )
12631 if( consdata->nlinvars == 0 && consdata->nquadvars == 0 )
12640 int* monomialnvars;
12645 monomialssize = consdata->nlinvars + 2 * consdata->nquadvars + consdata->nbilinterms;
12652 for( j = 0; j < consdata->nlinvars; ++j )
12654 assert(nmonomials < monomialssize);
12658 monomialvars[nmonomials][0] = consdata->linvars[j];
12659 monomialexps[nmonomials] =
NULL;
12660 monomialcoefs[nmonomials] = consdata->lincoefs[j];
12661 monomialnvars[nmonomials] = 1;
12665 for( j = 0; j < consdata->nquadvars; ++j )
12667 if( consdata->quadvarterms[j].lincoef != 0.0 )
12669 assert(nmonomials < monomialssize);
12673 monomialvars[nmonomials][0] = consdata->quadvarterms[j].var;
12674 monomialexps[nmonomials] =
NULL;
12675 monomialcoefs[nmonomials] = consdata->quadvarterms[j].lincoef;
12676 monomialnvars[nmonomials] = 1;
12680 if( consdata->quadvarterms[j].sqrcoef != 0.0 )
12682 assert(nmonomials < monomialssize);
12687 monomialvars[nmonomials][0] = consdata->quadvarterms[j].var;
12688 monomialexps[nmonomials][0] = 2.0;
12689 monomialcoefs[nmonomials] = consdata->quadvarterms[j].sqrcoef;
12690 monomialnvars[nmonomials] = 1;
12695 for( j = 0; j < consdata->nbilinterms; ++j )
12697 assert(nmonomials < monomialssize);
12701 monomialvars[nmonomials][0] = consdata->bilinterms[j].var1;
12702 monomialvars[nmonomials][1] = consdata->bilinterms[j].var2;
12703 monomialexps[nmonomials] =
NULL;
12704 monomialcoefs[nmonomials] = consdata->bilinterms[j].coef;
12705 monomialnvars[nmonomials] = 2;
12711 for( j = 0; j < nmonomials; ++j )
12724 if(
SCIPisEQ(scip, consdata->lhs, consdata->rhs) )
12756 assert(scip !=
NULL);
12757 assert(conss !=
NULL || nconss == 0);
12758 assert(result !=
NULL);
12761 assert(conshdlrdata !=
NULL);
12766 maypropfeasible = conshdlrdata->linfeasshift && (conshdlrdata->trysolheur !=
NULL) &&
12768 for( c = 0; c < nconss; ++c )
12770 assert(conss !=
NULL);
12772 assert(!solviolbounds);
12775 assert(consdata !=
NULL);
12786 SCIPinfoMessage(scip,
NULL,
"violation: left hand side is violated by %.15g (scaled: %.15g)\n", consdata->lhs - consdata->activity, consdata->lhsviol);
12790 SCIPinfoMessage(scip,
NULL,
"violation: right hand side is violated by %.15g (scaled: %.15g)\n", consdata->activity - consdata->rhs, consdata->rhsviol);
12793 if( (conshdlrdata->subnlpheur ==
NULL || sol ==
NULL) && !maypropfeasible && !completely )
12795 if( consdata->lhsviol > maxviol || consdata->rhsviol > maxviol )
12796 maxviol = consdata->lhsviol + consdata->rhsviol;
12800 maypropfeasible =
FALSE;
12802 if( maypropfeasible )
12812 if( !(consdata->linvar_mayincrease >= 0 && consdata->lincoefs[consdata->linvar_mayincrease] > 0.0) &&
12813 ! (consdata->linvar_maydecrease >= 0 && consdata->lincoefs[consdata->linvar_maydecrease] < 0.0) )
12814 maypropfeasible =
FALSE;
12821 if( !(consdata->linvar_mayincrease >= 0 && consdata->lincoefs[consdata->linvar_mayincrease] < 0.0) &&
12822 ! (consdata->linvar_maydecrease >= 0 && consdata->lincoefs[consdata->linvar_maydecrease] > 0.0) )
12823 maypropfeasible =
FALSE;
12861 assert(scip !=
NULL);
12862 assert(cons !=
NULL);
12863 assert(sourcescip !=
NULL);
12864 assert(sourceconshdlr !=
NULL);
12865 assert(sourcecons !=
NULL);
12866 assert(varmap !=
NULL);
12867 assert(valid !=
NULL);
12870 assert(consdata !=
NULL);
12873 quadvarterms =
NULL;
12878 if( consdata->nlinvars != 0 )
12881 for( i = 0; i < consdata->nlinvars; ++i )
12883 SCIP_CALL(
SCIPgetVarCopy(sourcescip, scip, consdata->linvars[i], &linvars[i], varmap, consmap, global, valid) );
12884 assert(!(*valid) || linvars[i] !=
NULL);
12892 if( consdata->nbilinterms != 0 )
12897 if( consdata->nquadvars != 0 )
12900 for( i = 0; i < consdata->nquadvars; ++i )
12902 SCIP_CALL(
SCIPgetVarCopy(sourcescip, scip, consdata->quadvarterms[i].var, &quadvarterms[i].
var, varmap, consmap, global, valid) );
12903 assert(!(*valid) || quadvarterms[i].var !=
NULL);
12909 quadvarterms[i].
lincoef = consdata->quadvarterms[i].lincoef;
12910 quadvarterms[i].
sqrcoef = consdata->quadvarterms[i].sqrcoef;
12912 quadvarterms[i].
nadjbilin = consdata->quadvarterms[i].nadjbilin;
12913 quadvarterms[i].
adjbilin = consdata->quadvarterms[i].adjbilin;
12915 assert(consdata->nbilinterms != 0 || consdata->quadvarterms[i].nadjbilin == 0);
12917 for( j = 0; j < consdata->quadvarterms[i].nadjbilin; ++j )
12919 assert(bilinterms !=
NULL);
12921 k = consdata->quadvarterms[i].adjbilin[j];
12922 assert(consdata->bilinterms[k].var1 !=
NULL);
12923 assert(consdata->bilinterms[k].var2 !=
NULL);
12924 if( consdata->bilinterms[k].var1 == consdata->quadvarterms[i].var )
12926 assert(consdata->bilinterms[k].var2 != consdata->quadvarterms[i].var);
12927 bilinterms[k].
var1 = quadvarterms[i].
var;
12931 assert(consdata->bilinterms[k].var2 == consdata->quadvarterms[i].var);
12932 bilinterms[k].
var2 = quadvarterms[i].
var;
12934 bilinterms[k].
coef = consdata->bilinterms[k].coef;
12939 assert(stickingatnode ==
FALSE);
12941 consdata->nlinvars, linvars, consdata->lincoefs,
12942 consdata->nquadvars, quadvarterms,
12943 consdata->nbilinterms, bilinterms,
12944 consdata->lhs, consdata->rhs,
12945 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable) );
12949 targetconsdata->isconvex = consdata->isconvex;
12950 targetconsdata->isconcave = consdata->isconcave;
12951 targetconsdata->iscurvchecked = consdata->iscurvchecked;
12969 int* monomialnvars;
12975 assert(scip !=
NULL);
12976 assert(success !=
NULL);
12977 assert(str !=
NULL);
12978 assert(name !=
NULL);
12979 assert(cons !=
NULL);
12985 (*success) =
FALSE;
12992 while( isspace((
unsigned char)*str) )
12996 if( isdigit((
unsigned char)str[0]) || ((str[0] ==
'-' || str[0] ==
'+') && isdigit((
unsigned char)str[1])) )
13006 while( isspace((
unsigned char)*endptr) )
13009 if( endptr[0] !=
'<' || endptr[1] !=
'=' )
13020 while( isspace((
unsigned char)*str) )
13033 while( isspace((
unsigned char)*str) )
13036 if( *str && str[0] ==
'<' && str[1] ==
'=' )
13047 else if( *str && str[0] ==
'>' && str[1] ==
'=' )
13061 else if( *str && str[0] ==
'=' && str[1] ==
'=' )
13086 assert(stickingatnode ==
FALSE);
13089 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable) );
13091 for( i = 0; i < nmonomials; ++i )
13093 if( monomialnvars[i] == 0 )
13098 else if( monomialnvars[i] == 1 && monomialexps[i][0] == 1.0 )
13103 else if( monomialnvars[i] == 1 && monomialexps[i][0] == 2.0 )
13108 else if( monomialnvars[i] == 2 && monomialexps[i][0] == 1.0 && monomialexps[i][1] == 1.0 )
13115 var1 = monomialvars[i][0];
13116 var2 = monomialvars[i][1];
13141 SCIPerrorMessage(
"polynomial in quadratic constraint does not have degree at most 2\n");
13160 assert(cons !=
NULL);
13161 assert(success !=
NULL);
13164 assert(consdata !=
NULL);
13166 if( varssize < consdata->nlinvars + consdata->nquadvars )
13167 (*success) =
FALSE;
13172 assert(vars !=
NULL);
13176 for( i = 0; i < consdata->nquadvars; ++i )
13177 vars[consdata->nlinvars+i] = consdata->quadvarterms[i].var;
13191 assert(cons !=
NULL);
13192 assert(success !=
NULL);
13195 assert(consdata !=
NULL);
13197 (*nvars) = consdata->nlinvars + consdata->nquadvars;
13223 consEnfolpQuadratic, consEnfopsQuadratic, consCheckQuadratic, consLockQuadratic,
13225 assert(conshdlr !=
NULL);
13254 "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)",
13255 &conshdlrdata->replacebinaryprodlength,
FALSE, INT_MAX, 0, INT_MAX,
NULL,
NULL) );
13258 "empathy level for using the AND constraint handler: 0 always avoid using AND; 1 use AND sometimes; 2 use AND as often as possible",
13262 "whether to make non-varbound linear constraints added due to replacing products with binary variables initial",
13266 "limit (as factor on 1/feastol) on coefficients and coef. range in linear constraints created when replacing products with binary variables",
13270 "minimal efficacy for a cut to be added to the LP during separation; overwrites separating/efficacy",
13274 "minimal target efficacy of a cut in order to add it to relaxation during enforcement as a factor of the feasibility tolerance (may be ignored)",
13278 "whether scaling of infeasibility is 'o'ff, by sup-norm of function 'g'radient, or by left/right hand 's'ide",
13279 &conshdlrdata->scaling,
TRUE,
'o',
"ogs",
NULL,
NULL) );
13282 "maximal coef range of a cut (maximal coefficient divided by minimal coefficient) in order to be added to LP relaxation",
13286 "whether linearizations of convex quadratic constraints should be added to cutpool in a solution found by some heuristic",
13290 "whether multivariate quadratic functions should be checked for convexity/concavity",
13294 "whether constraint functions should be checked to be factorable",
13298 "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)",
13299 &conshdlrdata->checkquadvarlocks,
TRUE,
't',
"bdt",
NULL,
NULL) );
13302 "whether to try to make solutions in check function feasible by shifting a linear variable (esp. useful if constraint was actually objective function)",
13306 "whether to disaggregate quadratic parts that decompose into a sum of non-overlapping quadratic terms",
13310 "limit on number of propagation rounds for a single constraint within one round of SCIP propagation during solve",
13311 &conshdlrdata->maxproprounds,
TRUE, 1, 0, INT_MAX,
NULL,
NULL) );
13314 "limit on number of propagation rounds for a single constraint within one round of SCIP presolve",
13315 &conshdlrdata->maxproproundspresolve,
TRUE, 10, 0, INT_MAX,
NULL,
NULL) );
13318 "maximum number of enforcement rounds before declaring the LP relaxation infeasible (-1: no limit); WARNING: changing this parameter might lead to incorrect results!",
13319 &conshdlrdata->enfolplimit,
TRUE, -1, -1, INT_MAX,
NULL,
NULL) );
13322 "minimal required fraction of continuous variables in problem to use solution of NLP relaxation in root for separation",
13323 &conshdlrdata->sepanlpmincont,
FALSE, 1.0, 0.0, 2.0,
NULL,
NULL) );
13326 "are cuts added during enforcement removable from the LP in the same node?",
13330 "should convex quadratics generated strong cuts via gauge function?",
13334 "how the interior point for gauge cuts should be computed: 'a'ny point per constraint, 'm'ost interior per constraint",
13335 &conshdlrdata->interiorcomputation,
TRUE,
'a',
"am",
NULL,
NULL) );
13338 "should convex quadratics generated strong cuts via projections?",
13342 "which score to give branching candidates: convexification 'g'ap, constraint 'v'iolation, 'c'entrality of variable value in domain",
13343 &conshdlrdata->branchscoring,
TRUE,
'g',
"cgv",
NULL,
NULL) );
13345 conshdlrdata->eventhdlr =
NULL;
13347 processVarEvent,
NULL) );
13348 assert(conshdlrdata->eventhdlr !=
NULL);
13351 processNewSolutionEvent,
NULL) );
13365 const char* conshdlrname
13375 assert(quadconsupgd !=
NULL);
13376 assert(conshdlrname !=
NULL );
13380 if( conshdlr ==
NULL )
13387 assert(conshdlrdata !=
NULL);
13393 quadconsupgrade->quadconsupgd = quadconsupgd;
13394 quadconsupgrade->
priority = priority;
13398 assert(conshdlrdata->nquadconsupgrades <= conshdlrdata->quadconsupgradessize);
13399 if( conshdlrdata->nquadconsupgrades+1 > conshdlrdata->quadconsupgradessize )
13405 conshdlrdata->quadconsupgradessize = newsize;
13407 assert(conshdlrdata->nquadconsupgrades+1 <= conshdlrdata->quadconsupgradessize);
13409 for( i = conshdlrdata->nquadconsupgrades; i > 0 && conshdlrdata->quadconsupgrades[i-1]->priority < quadconsupgrade->
priority; --i )
13410 conshdlrdata->quadconsupgrades[i] = conshdlrdata->quadconsupgrades[i-1];
13411 assert(0 <= i && i <= conshdlrdata->nquadconsupgrades);
13412 conshdlrdata->quadconsupgrades[i] = quadconsupgrade;
13413 conshdlrdata->nquadconsupgrades++;
13419 paramname, paramdesc,
13481 assert(linvars !=
NULL || nlinvars == 0);
13482 assert(lincoefs !=
NULL || nlinvars == 0);
13483 assert(quadvars1 !=
NULL || nquadterms == 0);
13484 assert(quadvars2 !=
NULL || nquadterms == 0);
13485 assert(quadcoefs !=
NULL || nquadterms == 0);
13487 assert(modifiable ==
FALSE);
13491 if( conshdlr ==
NULL )
13500 consdata->lhs = lhs;
13501 consdata->rhs = rhs;
13503 SCIP_CALL(
SCIPcreateCons(scip, cons, name, conshdlr, consdata, initial, separate, enforce, check, propagate,
13504 local, modifiable, dynamic, removable,
FALSE) );
13509 for( i = 0; i < nquadterms; ++i )
13516 if( quadvars1[i] == quadvars2[i] )
13517 sqrcoef = quadcoefs[i];
13525 assert(consdata->nquadvars >= 0);
13526 assert(consdata->quadvarterms[consdata->nquadvars-1].var == quadvars1[i]);
13534 assert(consdata->quadvarterms[var1pos].var == quadvars1[i]);
13535 consdata->quadvarterms[var1pos].sqrcoef += sqrcoef;
13539 if( quadvars1[i] == quadvars2[i] )
13545 assert(sqrcoef == 0.0);
13547 assert(consdata->nquadvars >= 0);
13548 assert(consdata->quadvarterms[consdata->nquadvars-1].var == quadvars2[i]);
13557 if( nbilinterms > 0 )
13560 for( i = 0; i < nquadterms; ++i )
13566 if( quadvars1[i] == quadvars2[i] )
13581 for( i = 0; i < nlinvars; ++i )
13590 assert(consdata->quadvarterms[var1pos].var == linvars[i]);
13591 consdata->quadvarterms[var1pos].lincoef += lincoefs[i];
13634 nquadterms, quadvars1, quadvars2, quadcoefs, lhs, rhs,
13676 assert(modifiable ==
FALSE);
13677 assert(nlinvars == 0 || (linvars !=
NULL && lincoefs !=
NULL));
13678 assert(nquadvarterms == 0 || quadvarterms !=
NULL);
13679 assert(nbilinterms == 0 || bilinterms !=
NULL);
13683 if( conshdlr ==
NULL )
13691 nlinvars, linvars, lincoefs, nquadvarterms, quadvarterms, nbilinterms, bilinterms,
13695 SCIP_CALL(
SCIPcreateCons(scip, cons, name, conshdlr, consdata, initial, separate, enforce, check, propagate,
13696 local, modifiable, dynamic, removable,
FALSE) );
13727 nquadvarterms, quadvarterms, nbilinterms, bilinterms, lhs, rhs,
13743 assert(scip !=
NULL);
13744 assert(cons !=
NULL);
13755 assert(consdata !=
NULL);
13756 assert(consdata->lhs <= consdata->rhs);
13759 consdata->lhs -= constant;
13761 consdata->rhs -= constant;
13763 if( consdata->lhs > consdata->rhs )
13765 assert(
SCIPisEQ(scip, consdata->lhs, consdata->rhs));
13766 consdata->lhs = consdata->rhs;
13778 assert(scip !=
NULL);
13779 assert(cons !=
NULL);
13780 assert(var !=
NULL);
13804 assert(scip !=
NULL);
13805 assert(cons !=
NULL);
13806 assert(var !=
NULL);
13836 assert(scip !=
NULL);
13837 assert(cons !=
NULL);
13838 assert(var !=
NULL);
13852 assert(consdata !=
NULL);
13860 assert(pos < consdata->nquadvars);
13861 assert(consdata->quadvarterms[pos].var == var);
13863 consdata->quadvarterms[pos].lincoef += coef;
13866 consdata->ispropagated =
FALSE;
13867 consdata->ispresolved = consdata->ispresolved && !
SCIPisZero(scip, consdata->quadvarterms[pos].lincoef);
13889 assert(scip !=
NULL);
13890 assert(cons !=
NULL);
13891 assert(var !=
NULL);
13905 assert(consdata !=
NULL);
13913 assert(pos < consdata->nquadvars);
13914 assert(consdata->quadvarterms[pos].var == var);
13916 consdata->quadvarterms[pos].sqrcoef += coef;
13919 consdata->isconvex =
FALSE;
13920 consdata->isconcave =
FALSE;
13921 consdata->iscurvchecked =
FALSE;
13922 consdata->ispropagated =
FALSE;
13923 consdata->ispresolved = consdata->ispresolved && !
SCIPisZero(scip, consdata->quadvarterms[pos].sqrcoef);
13948 assert(scip !=
NULL);
13949 assert(cons !=
NULL);
13950 assert(var1 !=
NULL);
13951 assert(var2 !=
NULL);
13968 assert(consdata !=
NULL);
13974 var1pos = consdata->nquadvars-1;
13977 if( !consdata->quadvarssorted )
13982 assert(var1pos >= 0);
13985 assert(consdata->quadvarssorted);
13990 var2pos = consdata->nquadvars-1;
13993 assert(consdata->quadvarterms[var1pos].var == var1);
13994 assert(consdata->quadvarterms[var2pos].var == var2);
14010 assert(cons !=
NULL);
14011 assert(nlrow !=
NULL);
14014 assert(consdata !=
NULL);
14016 if( consdata->nlrow ==
NULL )
14020 assert(consdata->nlrow !=
NULL);
14021 *nlrow = consdata->nlrow;
14032 assert(cons !=
NULL);
14046 assert(cons !=
NULL);
14060 assert(cons !=
NULL);
14073 assert(cons !=
NULL);
14087 assert(cons !=
NULL);
14099 assert(cons !=
NULL);
14118 assert(cons !=
NULL);
14120 assert(var !=
NULL);
14121 assert(pos !=
NULL);
14134 assert(cons !=
NULL);
14148 assert(cons !=
NULL);
14160 assert(cons !=
NULL);
14172 assert(cons !=
NULL);
14186 assert(cons !=
NULL);
14189 assert(consdata !=
NULL);
14194 return consdata->linvar_maydecrease;
14205 assert(cons !=
NULL);
14208 assert(consdata !=
NULL);
14213 return consdata->linvar_mayincrease;
14222 assert(cons !=
NULL);
14237 assert(cons !=
NULL);
14241 assert(determined);
14254 assert(cons !=
NULL);
14258 assert(determined);
14275 assert(scip !=
NULL);
14276 assert(cons !=
NULL);
14277 assert(violation !=
NULL);
14280 assert(conshdlr !=
NULL);
14286 assert(consdata !=
NULL);
14288 *violation =
MAX(consdata->lhsviol, consdata->rhsviol);
14307 assert(scip !=
NULL);
14308 assert(cons !=
NULL);
14311 assert(consdata !=
NULL);
14314 for( i = 0; i < consdata->nquadvars; ++i )
14316 if( consdata->quadvarterms[i].sqrcoef == 0.0 )
14319 var1 = consdata->quadvarterms[i].var;
14320 assert(var1 !=
NULL);
14326 for( i = 0; i < consdata->nbilinterms; ++i )
14328 var1 = consdata->bilinterms[i].var1;
14329 var2 = consdata->bilinterms[i].var2;
14331 assert(var1 !=
NULL);
14332 assert(var2 !=
NULL);
14367 assert(scip !=
NULL);
14368 assert(cons !=
NULL);
14369 assert(nlpi !=
NULL);
14370 assert(nlpiprob !=
NULL);
14371 assert(scipvar2nlpivar !=
NULL);
14374 assert(consdata !=
NULL);
14377 nlininds = consdata->nlinvars;
14378 nquadelems = consdata->nbilinterms;
14379 for( j = 0; j < consdata->nquadvars; ++j )
14381 if( consdata->quadvarterms[j].sqrcoef != 0.0 )
14383 if( consdata->quadvarterms[j].lincoef != 0.0 )
14396 for( j = 0; j < consdata->nlinvars; ++j )
14398 linvals[j] = consdata->lincoefs[j];
14403 lincnt = consdata->nlinvars;
14408 if( nquadelems > 0 )
14414 for( j = 0; j < consdata->nquadvars; ++j )
14418 if( consdata->quadvarterms[j].lincoef != 0.0 )
14420 assert(lininds !=
NULL);
14421 assert(linvals !=
NULL);
14422 lininds[lincnt] = idx1;
14423 linvals[lincnt] = consdata->quadvarterms[j].lincoef;
14427 if( consdata->quadvarterms[j].sqrcoef != 0.0 )
14429 assert(quadcnt < nquadelems);
14430 assert(quadelems !=
NULL);
14431 quadelems[quadcnt].
idx1 = idx1;
14432 quadelems[quadcnt].
idx2 = idx1;
14433 quadelems[quadcnt].
coef = consdata->quadvarterms[j].sqrcoef;
14437 for( l = 0; l < consdata->quadvarterms[j].nadjbilin; ++l )
14439 othervar = consdata->bilinterms[consdata->quadvarterms[j].adjbilin[l]].var2;
14441 if( othervar == consdata->quadvarterms[j].var )
14444 assert(quadcnt < nquadelems);
14445 assert(quadelems !=
NULL);
14448 quadelems[quadcnt].
idx1 =
MIN(idx1, idx2);
14449 quadelems[quadcnt].
idx2 =
MAX(idx1, idx2);
14450 quadelems[quadcnt].
coef = consdata->bilinterms[consdata->quadvarterms[j].adjbilin[l]].coef;
14455 assert(quadcnt == nquadelems);
14456 assert(lincnt == nlininds);
14461 &consdata->lhs, &consdata->rhs,
14462 &nlininds, &lininds, &linvals ,
14463 &nquadelems, &quadelems,
14486 assert(scip !=
NULL);
14487 assert(cons !=
NULL);
14498 SCIPerrorMessage(
"method may only be called during problem creation stage for original constraints\n");
14503 assert(consdata !=
NULL);
14511 if( !
SCIPisLE(scip, lhs, consdata->rhs) )
14514 consdata->lhs = lhs;
14531 assert(scip !=
NULL);
14532 assert(cons !=
NULL);
14543 SCIPerrorMessage(
"method may only be called during problem creation stage for original constraints\n");
14548 assert(consdata !=
NULL);
14556 if( !
SCIPisLE(scip, consdata->lhs, rhs) )
14559 consdata->rhs = rhs;
14575 assert(scip !=
NULL);
14576 assert(cons !=
NULL);
14577 assert(feasibility !=
NULL);
14588 assert(consdata !=
NULL);
14593 *feasibility = (consdata->rhs - consdata->activity);
14595 *feasibility = (consdata->activity - consdata->lhs);
14600 *feasibility =
MIN( consdata->rhs - consdata->activity, consdata->activity - consdata->lhs );
14617 assert(scip !=
NULL);
14618 assert(cons !=
NULL);
14619 assert(activity !=
NULL);
14630 assert(consdata !=
NULL);
14632 *activity = consdata->activity;
14653 assert(scip !=
NULL);
14654 assert(cons !=
NULL);
14655 assert(var !=
NULL);
14665 SCIPerrorMessage(
"method may only be called during problem creation stage for original constraints and variables\n");
14670 assert(consdata !=
NULL);
14674 for( i = 0; i < consdata->nquadvars; ++i )
14676 if( var == consdata->quadvarterms[i].var )
14680 consdata->quadvarterms[i].lincoef = 0.0;
14683 consdata->quadvarsmerged =
FALSE;
14686 consdata->quadvarterms[i].lincoef = coef;
14694 while( i < consdata->nlinvars )
14696 if( var == consdata->linvars[i] )
14721 consdata->ispropagated =
FALSE;
14722 consdata->ispresolved =
FALSE;
14746 assert(scip !=
NULL);
14747 assert(cons !=
NULL);
14748 assert(var !=
NULL);
14759 SCIPerrorMessage(
"method may only be called during problem creation stage for original constraints and variables\n");
14764 assert(consdata !=
NULL);
14768 for( i = 0; i < consdata->nquadvars; ++i )
14770 if( var == consdata->quadvarterms[i].var )
14772 consdata->quadvarterms[i].sqrcoef = (found ||
SCIPisZero(scip, coef)) ? 0.0 : coef;
14784 consdata->isconvex =
FALSE;
14785 consdata->isconcave =
FALSE;
14786 consdata->iscurvchecked =
FALSE;
14787 consdata->ispropagated =
FALSE;
14788 consdata->ispresolved =
FALSE;
14794 consdata->quadvarsmerged =
FALSE;
14816 assert(scip !=
NULL);
14817 assert(cons !=
NULL);
14818 assert(var1 !=
NULL);
14819 assert(var2 !=
NULL);
14830 SCIPerrorMessage(
"method may only be called during problem creation stage for original constraints and variables\n");
14841 assert(consdata !=
NULL);
14845 for( i = 0; i < consdata->nbilinterms; ++i )
14847 if( (consdata->bilinterms[i].var1 == var1 && consdata->bilinterms[i].var2 == var2) ||
14848 (consdata->bilinterms[i].var1 == var2 && consdata->bilinterms[i].var2 == var1) )
14852 consdata->bilinterms[i].coef = 0.0;
14855 consdata->bilinmerged =
FALSE;
14858 consdata->bilinterms[i].coef = coef;
14870 consdata->isconvex =
FALSE;
14871 consdata->isconcave =
FALSE;
14872 consdata->iscurvchecked =
FALSE;
14873 consdata->ispropagated =
FALSE;
14874 consdata->ispresolved =
FALSE;
SCIP_RETCODE SCIPaddLinearCoefsToNlRow(SCIP *scip, SCIP_NLROW *nlrow, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
enum SCIP_Result SCIP_RESULT
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 SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
static SCIP_RETCODE mergeAndCleanLinearVars(SCIP *scip, SCIP_CONS *cons)
static SCIP_Bool generateCutLTIgenMulCoeff(SCIP *scip, SCIP_Real x1, SCIP_Real y1_, SCIP_Real x2, SCIP_Real y2, SCIP_Bool whichuse, SCIP_Real *cx, SCIP_Real *cy, SCIP_Real *cw)
SCIP_Real SCIPvarGetWorstBoundLocal(SCIP_VAR *var)
void SCIPintervalMulSup(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
static SCIP_RETCODE consdataCreate(SCIP *scip, SCIP_CONSDATA **consdata, SCIP_Real lhs, SCIP_Real rhs, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadvars, SCIP_QUADVARTERM *quadvarterms, int nbilinterms, SCIP_BILINTERM *bilinterms, SCIP_Bool capturevars)
SCIP_RETCODE SCIPsetConshdlrDelete(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSDELETE((*consdelete)))
static SCIP_RETCODE propagateBoundsQuadVar(SCIP *scip, SCIP_CONS *cons, SCIP_Real intervalinfty, SCIP_VAR *var, SCIP_Real a, SCIP_INTERVAL b, SCIP_INTERVAL rhs, SCIP_RESULT *result, int *nchgbds)
SCIP_EXPRGRAPH * SCIPgetExprgraphNonlinear(SCIP *scip, SCIP_CONSHDLR *conshdlr)
static SCIP_DECL_CONSENFOPS(consEnfopsQuadratic)
SCIP_RETCODE SCIPincludeNonlinconsUpgrade(SCIP *scip, SCIP_DECL_NONLINCONSUPGD((*nonlinconsupgd)), SCIP_DECL_EXPRGRAPHNODEREFORM((*nodereform)), int priority, SCIP_Bool active, const char *conshdlrname)
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)
SCIP_NODE * SCIPgetCurrentNode(SCIP *scip)
SCIP_STAGE SCIPgetStage(SCIP *scip)
#define SCIP_EVENTTYPE_VARFIXED
SCIP_Bool SCIPconsIsDynamic(SCIP_CONS *cons)
SCIP_Real * SCIPvarGetMultaggrScalars(SCIP_VAR *var)
SCIP_RETCODE SCIPincSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real incval)
static SCIP_RETCODE separatePoint(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, int nusefulconss, SCIP_SOL *sol, SCIP_Real minefficacy, SCIP_Bool inenforcement, SCIP_RESULT *result, SCIP_Real *bestefficacy)
SCIP_RETCODE SCIPsetConshdlrTrans(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSTRANS((*constrans)))
#define CONSHDLR_PRESOLTIMING
static SCIP_DECL_CONSSEPASOL(consSepasolQuadratic)
void SCIPaddConstantQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_Real constant)
static SCIP_RETCODE consdataEnsureQuadVarTermsSize(SCIP *scip, SCIP_CONSDATA *consdata, int num)
static SCIP_DECL_CONSINITSOL(consInitsolQuadratic)
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Constraint handler for variable bound constraints .
static SCIP_RETCODE generateCutNonConvex(SCIP *scip, SCIP_CONS *cons, SCIP_SIDETYPE violside, SCIP_Real *ref, SCIP_Real *coef, SCIP_Real *lhs, SCIP_Real *rhs, SCIP_Bool *islocal, SCIP_Bool *success, char *name)
SCIP_Bool SCIPisRelEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPaddSquareCoefQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
static SCIP_RETCODE propagateBoundsBilinearTerm(SCIP *scip, SCIP_CONS *cons, SCIP_Real intervalinfty, SCIP_VAR *x, SCIP_Real xsqrcoef, SCIP_Real xlincoef, SCIP_VAR *y, SCIP_Real ysqrcoef, SCIP_Real ylincoef, SCIP_Real bilincoef, SCIP_INTERVAL rhs, SCIP_RESULT *result, int *nchgbds)
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 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)
#define CONSHDLR_PROPFREQ
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
static SCIP_DECL_CONSSEPALP(consSepalpQuadratic)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
internal methods for NLPI solver interfaces
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)
static SCIP_RETCODE generateCutConvex(SCIP *scip, SCIP_CONS *cons, SCIP_SIDETYPE violside, SCIP_Real *ref, SCIP_Real *coef, SCIP_Real *lhs, SCIP_Real *rhs, SCIP_Bool *islocal, SCIP_Bool *success, char *name)
SCIP_RETCODE SCIPgetTransformedVar(SCIP *scip, SCIP_VAR *var, SCIP_VAR **transvar)
static void consdataUpdateLinearActivityUbChange(SCIP *scip, SCIP_CONSDATA *consdata, SCIP_Real coef, SCIP_Real oldbnd, SCIP_Real newbnd)
static SCIP_RETCODE dropLinearVarEvents(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons, int linvarpos)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
static SCIP_RETCODE addQuadVarTerm(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real lincoef, SCIP_Real sqrcoef)
SCIP_Bool SCIPisFeasNegative(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPvarGetBestBoundLocal(SCIP_VAR *var)
static SCIP_DECL_CONSENABLE(consEnableQuadratic)
static SCIP_RETCODE generateCut(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_Real *ref, SCIP_SOL *sol, SCIP_SIDETYPE violside, SCIP_ROW **row, SCIP_Real *efficacy, SCIP_Bool checkcurvmultivar, SCIP_Real minefficacy)
static void consdataUpdateLinearActivityLbChange(SCIP *scip, SCIP_CONSDATA *consdata, SCIP_Real coef, SCIP_Real oldbnd, SCIP_Real newbnd)
SCIP_Bool SCIPisFeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_DECL_NONLINCONSUPGD(nonlinconsUpgdQuadratic)
SCIP_Real SCIPgetRelaxFeastolFactor(SCIP *scip)
#define CONSHDLR_MAXPREROUNDS
SCIP_RETCODE SCIPchgLinearCoefQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
void SCIPintervalSetRoundingMode(SCIP_ROUNDMODE roundmode)
static SCIP_DECL_CONSEXITPRE(consExitpreQuadratic)
SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr)
SCIP_Real SCIProwGetLhs(SCIP_ROW *row)
SCIP_Real SCIPadjustedVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real ub)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
static SCIP_Real getGradientMaxElement(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol)
static SCIP_RETCODE evaluateGauge(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *refsol, SCIP_Real *gaugeval, SCIP_Bool *success)
static SCIP_RETCODE presolveSolve(SCIP *scip, SCIP_CONS *cons, SCIP_RESULT *result, SCIP_Bool *redundant, int *naggrvars)
SCIP_RETCODE SCIPnlpiAddConstraints(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int nconss, const SCIP_Real *lhss, const SCIP_Real *rhss, const int *nlininds, int *const *lininds, SCIP_Real *const *linvals, const int *nquadelems, SCIP_QUADELEM *const *quadelems, int *const *exprvaridxs, SCIP_EXPRTREE *const *exprtrees, const char **names)
int SCIPgetSubscipDepth(SCIP *scip)
SCIP_RETCODE SCIPincludeConshdlrBasic(SCIP *scip, SCIP_CONSHDLR **conshdlrptr, const char *name, const char *desc, int enfopriority, int chckpriority, int eagerfreq, SCIP_Bool needscons, SCIP_DECL_CONSENFOLP((*consenfolp)), SCIP_DECL_CONSENFOPS((*consenfops)), SCIP_DECL_CONSCHECK((*conscheck)), SCIP_DECL_CONSLOCK((*conslock)), SCIP_CONSHDLRDATA *conshdlrdata)
SCIP_Real * SCIPgetLinearCoefsNonlinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPinfinity(SCIP *scip)
#define CONSHDLR_SEPAPRIORITY
int SCIPsnprintf(char *t, int len, const char *s,...)
SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPunmarkConsPropagate(SCIP *scip, SCIP_CONS *cons)
enum SCIP_Retcode SCIP_RETCODE
SCIP_RETCODE SCIPsolveNLP(SCIP *scip)
SCIP_RETCODE SCIPaddVarLocks(SCIP *scip, SCIP_VAR *var, int nlocksdown, int nlocksup)
SCIP_Bool SCIPconsIsStickingAtNode(SCIP_CONS *cons)
#define SCIP_PRESOLTIMING_EXHAUSTIVE
static void consdataFindUnlockedLinearVar(SCIP *scip, SCIP_CONSDATA *consdata)
static void checkCurvatureEasy(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *determined, SCIP_Bool checkmultivariate)
void SCIPintervalSetBounds(SCIP_INTERVAL *resultant, SCIP_Real inf, SCIP_Real sup)
SCIP_Real SCIPgetRhsNonlinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPconsIsTransformed(SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateConsBasicQuadratic2(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadvarterms, SCIP_QUADVARTERM *quadvarterms, int nbilinterms, SCIP_BILINTERM *bilinterms, SCIP_Real lhs, SCIP_Real rhs)
static GRAPHNODE ** active
SCIP_RETCODE SCIPtightenVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened)
static SCIP_RETCODE removeBilinearTermsPos(SCIP *scip, SCIP_CONS *cons, int nterms, int *termposs)
#define SCIPfreeBlockMemory(scip, ptr)
void SCIPaddBilinLinearization(SCIP *scip, SCIP_Real bilincoef, SCIP_Real refpointx, SCIP_Real refpointy, SCIP_Real *lincoefx, SCIP_Real *lincoefy, SCIP_Real *linconstant, SCIP_Bool *success)
SCIP_RETCODE SCIPsetConshdlrSepa(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSSEPALP((*conssepalp)), SCIP_DECL_CONSSEPASOL((*conssepasol)), int sepafreq, int sepapriority, SCIP_Bool delaysepa)
SCIP_Real SCIPselectSimpleValue(SCIP_Real lb, SCIP_Real ub, SCIP_Longint maxdnom)
static SCIP_RETCODE presolveTryAddAND(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, int *naddconss)
SCIP_EVENTHDLR * SCIPfindEventhdlr(SCIP *scip, const char *name)
Constraint handler for AND constraints, .
SCIP_RETCODE SCIPnlpiGetSolution(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_Real **primalvalues, SCIP_Real **consdualvalues, SCIP_Real **varlbdualvalues, SCIP_Real **varubdualvalues)
SCIP_RETCODE SCIPwriteVarsPolynomial(SCIP *scip, FILE *file, SCIP_VAR ***monomialvars, SCIP_Real **monomialexps, SCIP_Real *monomialcoefs, int *monomialnvars, int nmonomials, SCIP_Bool type)
static SCIP_RETCODE mergeAndCleanBilinearTerms(SCIP *scip, SCIP_CONS *cons)
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_RETCODE chgLinearCoefPos(SCIP *scip, SCIP_CONS *cons, int pos, SCIP_Real newcoef)
static SCIP_RETCODE propagateBoundsCons(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_RESULT *result, int *nchgbds, SCIP_Bool *redundant)
SCIP_RETCODE SCIPcreateLPSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
static SCIP_DECL_CONSENFOLP(consEnfolpQuadratic)
#define SCIPfreeBufferArray(scip, ptr)
SCIP_Real SCIPadjustedVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real lb)
SCIP_Bool SCIPvarIsRemovable(SCIP_VAR *var)
#define SCIPallocBlockMemory(scip, ptr)
#define SCIPdebugPrintCons(x, y, z)
static SCIP_RETCODE dropQuadVarEvents(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons, int quadvarpos)
SCIP_RETCODE SCIPcreateConsBasicQuadratic(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadterms, SCIP_VAR **quadvars1, SCIP_VAR **quadvars2, SCIP_Real *quadcoefs, SCIP_Real lhs, SCIP_Real rhs)
SCIP_Bool SCIPconsIsRemovable(SCIP_CONS *cons)
#define SCIP_EVENTTYPE_BOUNDCHANGED
SCIP_RETCODE SCIPsetConshdlrInitlp(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINITLP((*consinitlp)))
static SCIP_RETCODE registerBranchingCandidatesViolation(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, int *nnotify)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
#define SCIPdebugMsgPrint
SCIP_RETCODE SCIPaddIntParam(SCIP *scip, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
static void consdataUpdateLinearActivity(SCIP *scip, SCIP_CONSDATA *consdata, SCIP_Real intervalinfty)
SCIP_RETCODE SCIPsetConshdlrParse(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPARSE((*consparse)))
SCIP_Real SCIPgetLhsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPconsIsActive(SCIP_CONS *cons)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
int SCIPgetNContVars(SCIP *scip)
SCIP_RETCODE SCIPcreateCons(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_CONSHDLR *conshdlr, SCIP_CONSDATA *consdata, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
SCIP_Real SCIPepsilon(SCIP *scip)
static SCIP_RETCODE lockQuadraticVariable(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
#define SCIP_PRESOLTIMING_FAST
SCIP_Real SCIPgetRowMaxCoef(SCIP *scip, SCIP_ROW *row)
SCIP_RETCODE SCIPaddLinearVarQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
void SCIPintervalSolveUnivariateQuadExpression(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL sqrcoeff, SCIP_INTERVAL lincoeff, SCIP_INTERVAL rhs)
SCIP_RETCODE SCIPcreateConsQuadratic(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadterms, SCIP_VAR **quadvars1, SCIP_VAR **quadvars2, SCIP_Real *quadcoefs, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable)
static SCIP_RETCODE unlockQuadraticVariable(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
int SCIPgetNQuadVarTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPconsIsOriginal(SCIP_CONS *cons)
int SCIPnlrowGetNQuadElems(SCIP_NLROW *nlrow)
SCIP_RETCODE SCIPcreateConsVarbound(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *var, SCIP_VAR *vbdvar, SCIP_Real vbdcoef, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
#define SCIP_EVENTTYPE_LBCHANGED
const char * SCIPgetProbName(SCIP *scip)
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
static SCIP_RETCODE registerBranchingCandidatesGap(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, int *nnotify)
int SCIPgetNBilinTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPnlpiSolve(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem)
SCIP_RETCODE SCIPheurPassSolTrySol(SCIP *scip, SCIP_HEUR *heur, SCIP_SOL *sol)
SCIP_EXPROP SCIPexprgraphGetNodeOperator(SCIP_EXPRGRAPHNODE *node)
static SCIP_RETCODE consdataSortQuadVarTerms(SCIP *scip, SCIP_CONSDATA *consdata)
#define CONSHDLR_EAGERFREQ
SCIP_RETCODE SCIPnlpiAddVars(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int nvars, const SCIP_Real *lbs, const SCIP_Real *ubs, const char **varnames)
SCIP_RETCODE SCIPchgVarType(SCIP *scip, SCIP_VAR *var, SCIP_VARTYPE vartype, SCIP_Bool *infeasible)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
SCIP_RETCODE SCIPsetConshdlrInitsol(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINITSOL((*consinitsol)))
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
SCIP_Bool SCIPisConcaveQuadratic(SCIP *scip, SCIP_CONS *cons)
#define SCIP_EVENTTYPE_SOLFOUND
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 void 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_Real *cutcoef, SCIP_Real *cutrhs, SCIP_Bool *islocal, SCIP_Bool *success, char *name)
void SCIPmarkRowNotRemovableLocal(SCIP *scip, SCIP_ROW *row)
SCIP_RETCODE SCIPsetConshdlrCopy(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), SCIP_DECL_CONSCOPY((*conscopy)))
SCIP_RETCODE SCIPaddLinearConsToNlpHeurSubNlp(SCIP *scip, SCIP_HEUR *heur, SCIP_Bool addcombconss, SCIP_Bool addcontconss)
static SCIP_DECL_CONSEXIT(consExitQuadratic)
const char * SCIPheurGetName(SCIP_HEUR *heur)
struct SCIP_QuadVarEventData SCIP_QUADVAREVENTDATA
SCIP_Bool SCIPintervalIsEntire(SCIP_Real infinity, SCIP_INTERVAL operand)
void SCIPaddBilinMcCormick(SCIP *scip, SCIP_Real bilincoef, SCIP_Real lbx, SCIP_Real ubx, SCIP_Real refpointx, SCIP_Real lby, SCIP_Real uby, SCIP_Real refpointy, SCIP_Bool overestimate, SCIP_Real *lincoefx, SCIP_Real *lincoefy, SCIP_Real *linconstant, SCIP_Bool *success)
SCIP_HEUR * SCIPfindHeur(SCIP *scip, const char *name)
SCIP_RETCODE SCIPfindQuadVarTermQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, int *pos)
static void propagateBoundsGetQuadActivity(SCIP *scip, SCIP_CONSDATA *consdata, SCIP_Real intervalinfty, SCIP_Real *minquadactivity, SCIP_Real *maxquadactivity, int *minactivityinf, int *maxactivityinf, SCIP_INTERVAL *quadactcontr)
static SCIP_RETCODE addLinearizationCuts(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *ref, SCIP_Bool *separatedlpsol, SCIP_Real minefficacy)
SCIP_RETCODE SCIPcreateConsAnd(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *resvar, int nvars, SCIP_VAR **vars, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
interval arithmetics for provable bounds
static SCIP_RETCODE removeFixedVariables(SCIP *scip, SCIP_CONS *cons)
void SCIPintervalSetEmpty(SCIP_INTERVAL *resultant)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPaddConsLocal(SCIP *scip, SCIP_CONS *cons, SCIP_NODE *validnode)
SCIP_RETCODE SCIPaddNlRow(SCIP *scip, SCIP_NLROW *nlrow)
enum SCIP_NlpSolStat SCIP_NLPSOLSTAT
SCIP_RETCODE SCIPdelConsLocal(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPintervalGetInf(SCIP_INTERVAL interval)
static SCIP_DECL_CONSDELETE(consDeleteQuadratic)
static SCIP_DECL_CONSPARSE(consParseQuadratic)
SCIP_Bool SCIProwIsLocal(SCIP_ROW *row)
SCIP_RETCODE SCIPreleaseNlRow(SCIP *scip, SCIP_NLROW **nlrow)
static SCIP_RETCODE presolveUpgrade(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_Bool *upgraded, int *nupgdconss, int *naddconss, SCIP_PRESOLTIMING presoltiming)
SCIP_RETCODE SCIPgetProbvarSum(SCIP *scip, SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
static SCIP_RETCODE catchQuadVarEvents(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons, int quadvarpos)
SCIP_Real * SCIPgetCoefsLinearVarsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIPInterval sqrt(const SCIPInterval &x)
#define SCIPfreeBufferArrayNull(scip, ptr)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
int SCIPgetLinvarMayDecreaseQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPcheckCons(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool printreason, SCIP_RESULT *result)
SCIP_Bool SCIPsortedvecFindPtr(void **ptrarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), void *val, int len, int *pos)
SCIP_RETCODE SCIPunlockVarCons(SCIP *scip, SCIP_VAR *var, SCIP_CONS *cons, SCIP_Bool lockdown, SCIP_Bool lockup)
static SCIP_DECL_CONSCHECK(consCheckQuadratic)
const char * SCIPconsGetName(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsPropagated(SCIP_CONS *cons)
#define SCIP_EVENTTYPE_IMPLADDED
static SCIP_DECL_CONSPRESOL(consPresolQuadratic)
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)
static SCIP_RETCODE generateCutFactorable(SCIP *scip, SCIP_CONS *cons, SCIP_SIDETYPE violside, SCIP_Real *ref, SCIP_Real *cutcoef, SCIP_Real *cutlhs, SCIP_Real *cutrhs, SCIP_Bool *islocal, SCIP_Bool *success, char *name)
#define CONSHDLR_CHECKPRIORITY
SCIP_RETCODE SCIPmarkConsPropagate(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE registerBranchingCandidates(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, int *nnotify)
SCIP_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
SCIP_Real SCIPgetSolTransObj(SCIP *scip, SCIP_SOL *sol)
int SCIPgetNNlpis(SCIP *scip)
SCIP_RETCODE SCIPsetNLPInitialGuessSol(SCIP *scip, SCIP_SOL *sol)
SCIP_RETCODE SCIPgetNlRowQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_NLROW **nlrow)
SCIP_RETCODE SCIPcreateChild(SCIP *scip, SCIP_NODE **node, SCIP_Real nodeselprio, SCIP_Real estimate)
SCIP_QUADELEM * SCIPnlrowGetQuadElems(SCIP_NLROW *nlrow)
#define SCIP_EVENTTYPE_LBTIGHTENED
unsigned int SCIP_PRESOLTIMING
static SCIP_RETCODE disaggregate(SCIP *scip, SCIP_CONS *cons, SCIP_CONSDATA *consdata, int *naddconss, int *ndelconss, SCIP_Bool *success)
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define CONSHDLR_ENFOPRIORITY
SCIP_Real SCIPvarGetMultaggrConstant(SCIP_VAR *var)
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
void SCIPintervalSet(SCIP_INTERVAL *resultant, SCIP_Real value)
SCIP_Real SCIProwGetRhs(SCIP_ROW *row)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
SCIP_Bool SCIPconsIsLocal(SCIP_CONS *cons)
#define SCIPdebugGetSolVal(scip, var, val)
SCIP_RETCODE SCIPaddCut(SCIP *scip, SCIP_SOL *sol, SCIP_ROW *cut, SCIP_Bool forcecut, SCIP_Bool *infeasible)
struct SCIP_ConsData SCIP_CONSDATA
SCIP_BILINTERM * SCIPgetBilinTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
#define SCIP_EVENTTYPE_BOUNDTIGHTENED
SCIP_RETCODE LapackDsyev(SCIP_Bool computeeigenvectors, int N, SCIP_Real *a, SCIP_Real *w)
SCIP_COL ** SCIProwGetCols(SCIP_ROW *row)
SCIP_NLPSOLSTAT SCIPnlpiGetSolstat(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem)
SCIP_RETCODE SCIPnlpiSetObjective(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, int nlins, const int *lininds, const SCIP_Real *linvals, int nquadelems, const SCIP_QUADELEM *quadelems, const int *exprvaridxs, const SCIP_EXPRTREE *exprtree, const SCIP_Real constant)
#define SCIP_EVENTTYPE_UBCHANGED
SCIP_Bool SCIPhasPrimalRay(SCIP *scip)
void SCIPaddSquareSecant(SCIP *scip, SCIP_Real sqrcoef, SCIP_Real lb, SCIP_Real ub, SCIP_Real refpoint, SCIP_Real *lincoef, SCIP_Real *linconstant, SCIP_Bool *success)
int SCIPconshdlrGetNConss(SCIP_CONSHDLR *conshdlr)
static SCIP_RETCODE consdataEnsureAdjBilinSize(SCIP *scip, SCIP_QUADVARTERM *quadvarterm, int num)
SCIP_Bool SCIPisHugeValue(SCIP *scip, SCIP_Real val)
static SCIP_RETCODE proposeFeasibleSolution(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, SCIP_Bool *success)
SCIP_Real SCIPgetRhsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPexprgraphGetNodeQuadraticConstant(SCIP_EXPRGRAPHNODE *node)
SCIP_RETCODE SCIPgetViolationQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Real *violation)
SCIP_Bool SCIPvarIsOriginal(SCIP_VAR *var)
SCIP_RETCODE SCIPaddBilinTermQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var1, SCIP_VAR *var2, SCIP_Real coef)
SCIP_RETCODE SCIPnlpiFreeProblem(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM **problem)
static SCIP_RETCODE computeInteriorPoint(SCIP *scip, SCIP_CONS *cons, char method, SCIP_Bool *success)
static SCIP_RETCODE propagateBoundsTightenVarUb(SCIP *scip, SCIP_CONS *cons, SCIP_Real intervalinfty, SCIP_VAR *var, SCIP_Real bnd, SCIP_RESULT *result, int *nchgbds)
#define SCIPallocBufferArray(scip, ptr, num)
SCIP_Real * SCIProwGetVals(SCIP_ROW *row)
SCIP_BOUNDTYPE * SCIPvarGetImplTypes(SCIP_VAR *var, SCIP_Bool varfixing)
#define CONSHDLR_NEEDSCONS
SCIP_VAR * SCIPeventGetVar(SCIP_EVENT *event)
static SCIP_DECL_CONSINITLP(consInitlpQuadratic)
static SCIP_DECL_CONSFREE(consFreeQuadratic)
SCIP_RETCODE SCIPcatchEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
static SCIP_RETCODE presolveDisaggregate(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, int *naddconss)
SCIP_Bool SCIPexprgraphAreAllNodeChildrenVars(SCIP_EXPRGRAPHNODE *node)
#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 const char * paramname[]
SCIP_RETCODE SCIPcreateEmptyRowCons(SCIP *scip, SCIP_ROW **row, SCIP_CONSHDLR *conshdlr, const char *name, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool removable)
SCIP_Real SCIPgetLhsNonlinear(SCIP *scip, SCIP_CONS *cons)
#define NONLINCONSUPGD_PRIORITY
int SCIPgetDepth(SCIP *scip)
SCIP_RETCODE SCIPnlpiSetIntPar(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem, SCIP_NLPPARAM type, int ival)
constraint handler for nonlinear constraints
int SCIPvarGetNImpls(SCIP_VAR *var, SCIP_Bool varfixing)
void SCIPintervalSolveBivariateQuadExpressionAllScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_Real ax, SCIP_Real ay, SCIP_Real axy, SCIP_Real bx, SCIP_Real by, SCIP_INTERVAL rhs, SCIP_INTERVAL xbnds, SCIP_INTERVAL ybnds)
SCIP_RETCODE SCIPprintCons(SCIP *scip, SCIP_CONS *cons, FILE *file)
int SCIPvarGetNLocksUp(SCIP_VAR *var)
SCIP_Bool SCIPstrToRealValue(const char *str, SCIP_Real *value, char **endptr)
SCIP_NLPTERMSTAT SCIPnlpiGetTermstat(SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *problem)
static SCIP_DECL_CONSEXITSOL(consExitsolQuadratic)
static SCIP_RETCODE replaceByLinearConstraints(SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_Bool *addedcons, SCIP_Bool *reduceddom, SCIP_Bool *infeasible)
SCIP_RETCODE SCIPaddPoolCut(SCIP *scip, SCIP_ROW *row)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
int SCIPvarCompare(SCIP_VAR *var1, SCIP_VAR *var2)
static 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)
SCIP_RETCODE SCIPlockVarCons(SCIP *scip, SCIP_VAR *var, SCIP_CONS *cons, SCIP_Bool lockdown, SCIP_Bool lockup)
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
#define infty2infty(infty1, infty2, val)
SCIP_RETCODE SCIPsetConshdlrPrint(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPRINT((*consprint)))
static SCIP_RETCODE consdataFree(SCIP *scip, SCIP_CONSDATA **consdata)
#define SCIP_EVENTTYPE_UBTIGHTENED
Constraint handler for linear constraints in their most general form, .
static SCIP_RETCODE createNlRow(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE computeViolations(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, SCIP_Bool *solviolbounds, SCIP_CONS **maxviolcon)
SCIP_Bool SCIPisCutApplicable(SCIP *scip, SCIP_ROW *cut)
int SCIPvarGetMultaggrNVars(SCIP_VAR *var)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_Real * SCIPvarGetImplBounds(SCIP_VAR *var, SCIP_Bool varfixing)
#define BMSclearMemory(ptr)
static SCIP_Bool consdataCheckBilinTermsSort(SCIP_CONSDATA *consdata)
SCIP_RETCODE 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)
int SCIPgetNVars(SCIP *scip)
SCIP_RETCODE SCIPcheckCurvatureQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPnodeGetEstimate(SCIP_NODE *node)
void SCIPenableNLP(SCIP *scip)
static SCIP_RETCODE registerLargeRelaxValueVariableForBranching(SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, SCIP_VAR **brvar)
SCIP_QUADVAREVENTDATA * eventdata
SCIP_VAR ** SCIPvarGetImplVars(SCIP_VAR *var, SCIP_Bool varfixing)
SCIP_RETCODE SCIPcreateConsLinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
SCIP_RETCODE SCIPsetConshdlrExitpre(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSEXITPRE((*consexitpre)))
enum SCIP_ExprCurv SCIP_EXPRCURV
SCIP_RETCODE SCIPreleaseRow(SCIP *scip, SCIP_ROW **row)
int SCIPgetLinvarMayIncreaseQuadratic(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNLinearVarsQuadratic(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE addBilinearTerm(SCIP *scip, SCIP_CONS *cons, int var1pos, int var2pos, SCIP_Real coef)
SCIP_RETCODE SCIPcreateNLPSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
static void consdataMoveQuadVarTerm(SCIP_CONSDATA *consdata, int oldpos, int newpos)
int SCIPvarGetNLocksDown(SCIP_VAR *var)
static SCIP_RETCODE processCut(SCIP *scip, SCIP_ROW **row, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Real efficacy, SCIP_Real actminefficacy, SCIP_Bool inenforcement, SCIP_Real *bestefficacy, SCIP_RESULT *result)
void SCIPsort(int *perm, SCIP_DECL_SORTINDCOMP((*indcomp)), void *dataptr, int len)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
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 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 generateCutLTI(SCIP *scip, SCIP_CONS *cons, SCIP_SIDETYPE violside, SCIP_Real *ref, SCIP_SOL *sol, SCIP_Real **cutcoeflin, SCIP_Real *cutcoefquad, SCIP_Real *cutlhs, SCIP_Real *cutrhs, SCIP_Bool *islocal, SCIP_Bool *success, char *name)
static SCIP_RETCODE computeReferencePointProjection(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *refsol, SCIP_Real *ref)
SCIP_RETCODE SCIPsetConshdlrPresol(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPRESOL((*conspresol)), int maxprerounds, SCIP_PRESOLTIMING presoltiming)
NLP local search primal heuristic using sub-SCIPs.
static SCIP_RETCODE generateCutSol(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_SOL *refsol, SCIP_SIDETYPE violside, SCIP_ROW **row, SCIP_Real *efficacy, SCIP_Bool checkcurvmultivar, SCIP_Real minefficacy, char mode)
SCIP_Real SCIPgetRowLPFeasibility(SCIP *scip, SCIP_ROW *row)
SCIP_RETCODE SCIPgetFeasibilityQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Real *feasibility)
SCIP_RETCODE SCIPsortQuadVarTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPeventGetOldbound(SCIP_EVENT *event)
SCIP_Bool SCIPisFeasPositive(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPgetNLPFracVars(SCIP *scip, SCIP_VAR ***fracvars, SCIP_Real **fracvarssol, SCIP_Real **fracvarsfrac, int *nfracvars, int *npriofracvars)
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
SCIP_RETCODE SCIPaggregateVars(SCIP *scip, SCIP_VAR *varx, SCIP_VAR *vary, SCIP_Real scalarx, SCIP_Real scalary, SCIP_Real rhs, SCIP_Bool *infeasible, SCIP_Bool *redundant, SCIP_Bool *aggregated)
SCIP_RETCODE SCIPcaptureVar(SCIP *scip, SCIP_VAR *var)
SCIP_Bool SCIPconsIsModifiable(SCIP_CONS *cons)
SCIP_RETCODE SCIPaddVarsToRow(SCIP *scip, SCIP_ROW *row, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
SCIP_RETCODE SCIPaddToNlpiProblemQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *nlpiprob, SCIP_HASHMAP *scipvar2nlpivar, SCIP_Bool names)
SCIP_VAR ** SCIPgetLinearVarsNonlinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPisStopped(SCIP *scip)
SCIP_RETCODE SCIPsetConshdlrGetNVars(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSGETNVARS((*consgetnvars)))
void SCIPintervalMulScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
SCIP_Bool SCIPhaveVarsCommonClique(SCIP *scip, SCIP_VAR *var1, SCIP_Bool value1, SCIP_VAR *var2, SCIP_Bool value2, SCIP_Bool regardimplics)
static SCIP_RETCODE computeReferencePointGauge(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *refsol, SCIP_Real *ref, SCIP_Bool *success)
SCIP_Bool SCIPconsIsEnforced(SCIP_CONS *cons)
static SCIP_RETCODE checkFactorable(SCIP *scip, SCIP_CONS *cons)
SCIP_EXPRGRAPHNODE ** SCIPexprgraphGetNodeChildren(SCIP_EXPRGRAPHNODE *node)
SCIP_Bool SCIPconsIsSeparated(SCIP_CONS *cons)
void SCIPsortPtrReal(void **ptrarray, SCIP_Real *realarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
SCIP_RETCODE SCIPprintRow(SCIP *scip, SCIP_ROW *row, FILE *file)
void SCIPsortInt(int *intarray, int len)
static SCIP_RETCODE propagateBoundsTightenVarLb(SCIP *scip, SCIP_CONS *cons, SCIP_Real intervalinfty, SCIP_VAR *var, SCIP_Real bnd, SCIP_RESULT *result, int *nchgbds)
SCIP_RETCODE SCIPcreateConsQuadratic2(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadvarterms, SCIP_QUADVARTERM *quadvarterms, int nbilinterms, SCIP_BILINTERM *bilinterms, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable)
static SCIP_RETCODE delLinearCoefPos(SCIP *scip, SCIP_CONS *cons, int pos)
static SCIP_RETCODE consdataEnsureBilinSize(SCIP *scip, SCIP_CONSDATA *consdata, int num)
SCIP_RETCODE SCIPaddQuadVarLinearCoefQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
SCIP_BOUNDTYPE SCIPvarGetBestBoundType(SCIP_VAR *var)
SCIP_RETCODE SCIPunlinkSol(SCIP *scip, SCIP_SOL *sol)
#define SCIPdebugAddSolVal(scip, var, val)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
static SCIP_DECL_CONSLOCK(consLockQuadratic)
SCIP_RETCODE SCIPcreateConsBounddisjunction(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_BOUNDTYPE *boundtypes, SCIP_Real *bounds, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
SCIP_RETCODE SCIPparseVarsPolynomial(SCIP *scip, const char *str, SCIP_VAR ****monomialvars, SCIP_Real ***monomialexps, SCIP_Real **monomialcoefs, int **monomialnvars, int *nmonomials, char **endptr, SCIP_Bool *success)
void SCIPintervalMulInf(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
void SCIPintervalSub(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
struct SCIP_ConshdlrData SCIP_CONSHDLRDATA
static SCIP_DECL_EVENTEXEC(processVarEvent)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
static SCIP_RETCODE addLinearCoef(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
SCIP_Bool SCIPvarIsTransformed(SCIP_VAR *var)
SCIP_RETCODE SCIPupdateStartpointHeurSubNlp(SCIP *scip, SCIP_HEUR *heur, SCIP_SOL *solcand, SCIP_Real violation)
SCIP_Bool SCIPconsIsMarkedPropagate(SCIP_CONS *cons)
#define CONSHDLR_PROP_TIMING
#define SCIP_DECL_QUADCONSUPGD(x)
static SCIP_DECL_CONSPROP(consPropQuadratic)
SCIP_NLPI ** SCIPgetNlpis(SCIP *scip)
static SCIP_RETCODE delQuadVarTermPos(SCIP *scip, SCIP_CONS *cons, int pos)
SCIP_Real SCIPgetUpperbound(SCIP *scip)
static SCIP_DECL_CONSPRINT(consPrintQuadratic)
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
#define BMSclearMemoryArray(ptr, num)
SCIP_Bool SCIPisSumLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_RETCODE presolveDisaggregateMarkComponent(SCIP *scip, SCIP_CONSDATA *consdata, int quadvaridx, SCIP_HASHMAP *var2component, int componentnr)
#define CONSHDLR_SEPAFREQ
static SCIP_RETCODE computeED(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
SCIP_QUADVARTERM * SCIPgetQuadVarTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateNlRow(SCIP *scip, SCIP_NLROW **nlrow, const char *name, SCIP_Real constant, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadvars, SCIP_VAR **quadvars, int nquadelems, SCIP_QUADELEM *quadelems, SCIP_EXPRTREE *expression, SCIP_Real lhs, SCIP_Real rhs, SCIP_EXPRCURV curvature)
static SCIP_RETCODE propagateBounds(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_RESULT *result, int *nchgbds)
int SCIPexprgraphGetNodeQuadraticNQuadElements(SCIP_EXPRGRAPHNODE *node)
SCIP_EXPRGRAPHNODE * SCIPgetExprgraphNodeNonlinear(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE computeViolation(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool *solviolbounds)
SCIP_Real SCIPceil(SCIP *scip, SCIP_Real val)
constraint handler for bound disjunction constraints
void SCIPintervalAddScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
SCIP_RETCODE SCIPsetConshdlrExitsol(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSEXITSOL((*consexitsol)))
SCIP_Longint SCIPgetNLPs(SCIP *scip)
SCIP_Real SCIPround(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPvarIsIntegral(SCIP_VAR *var)
static SCIP_RETCODE consdataFindQuadVarTerm(SCIP *scip, SCIP_CONSDATA *consdata, SCIP_VAR *var, int *pos)
SCIP_ROUNDMODE SCIPintervalGetRoundingMode(void)
SCIP_Longint SCIPcalcGreComDiv(SCIP_Longint val1, SCIP_Longint val2)
SCIP_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)
static SCIP_RETCODE consdataEnsureLinearVarsSize(SCIP *scip, SCIP_CONSDATA *consdata, int num)
static SCIP_RETCODE enforceConstraint(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, int nusefulconss, SCIP_SOL *sol, SCIP_Bool solinfeasible, SCIP_RESULT *result)
void SCIPintervalSetRoundingModeDownwards(void)
SCIP_Real SCIPfloor(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisConvexQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetPrimalRayVal(SCIP *scip, SCIP_VAR *var)
static SCIP_DECL_CONSDISABLE(consDisableQuadratic)
SCIP_RETCODE SCIPgetActivityQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Real *activity)
static SCIP_Bool hasQuadvarHpProperty(SCIP *scip, SCIP_CONSDATA *consdata, int idx)
SCIP_Bool SCIPintervalIsSubsetEQ(SCIP_Real infinity, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
void SCIPintervalSolveUnivariateQuadExpressionPositive(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL sqrcoeff, SCIP_INTERVAL lincoeff, SCIP_INTERVAL rhs)
static SCIP_RETCODE catchLinearVarEvents(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons, int linvarpos)
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)
void SCIPaddSquareLinearization(SCIP *scip, SCIP_Real sqrcoef, SCIP_Real refpoint, SCIP_Bool isint, SCIP_Real *lincoef, SCIP_Real *linconstant, SCIP_Bool *success)
#define SCIPreallocBufferArray(scip, ptr, num)
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)