41 #include "scip/cons_eqknapsack.h" 52 #define CONSHDLR_NAME "pseudoboolean" 53 #define CONSHDLR_DESC "constraint handler dealing with pseudo Boolean constraints" 54 #define CONSHDLR_ENFOPRIORITY -1000000 55 #define CONSHDLR_CHECKPRIORITY -5000000 56 #define CONSHDLR_EAGERFREQ 100 58 #define CONSHDLR_MAXPREROUNDS -1 59 #define CONSHDLR_NEEDSCONS TRUE 61 #define CONSHDLR_PRESOLTIMING SCIP_PRESOLTIMING_MEDIUM 63 #define DEFAULT_DECOMPOSENORMALPBCONS FALSE 64 #define DEFAULT_DECOMPOSEINDICATORPBCONS TRUE 66 #define DEFAULT_SEPARATENONLINEAR TRUE 67 #define DEFAULT_PROPAGATENONLINEAR TRUE 68 #define DEFAULT_REMOVABLENONLINEAR TRUE 69 #define USEINDICATOR TRUE 74 #define HASHSIZE_PSEUDOBOOLEANNONLINEARTERMS 500 173 unsigned int issoftcons:1;
174 unsigned int changed:1;
175 unsigned int propagated:1;
176 unsigned int presolved:1;
177 unsigned int cliquesadded:1;
178 unsigned int upgradetried:1;
182 struct SCIP_ConshdlrData
186 int nallconsanddatas;
188 int sallconsanddatas;
258 assert(var1 !=
NULL);
259 assert(var2 !=
NULL);
267 assert(var1 == var2);
296 scip = (
SCIP*)userptr;
298 assert(scip !=
NULL);
299 assert(cdata1 !=
NULL);
300 assert(cdata2 !=
NULL);
302 assert(cdata1->
nvars > 1);
304 assert(cdata2->
nvars > 1);
308 for( v = cdata1->
nvars - 1; v > 0; --v )
311 for( v = cdata2->
nvars - 1; v > 0; --v )
324 for( v = cdata1->
nvars - 1; v >= 0; --v )
330 if( cdata1->
vars[v] != cdata2->
vars[v] )
353 assert(cdata !=
NULL);
355 assert(cdata->
nvars > 1);
360 for( v = cdata->
nvars - 1; v > 0; --v )
368 assert(minidx >= 0 && minidx <= maxidx);
383 if( ((*conshdlrdata)->inithashmapandtable) )
385 assert((*conshdlrdata)->hashtable !=
NULL);
386 assert((*conshdlrdata)->hashmap !=
NULL);
391 assert((*conshdlrdata)->hashtable ==
NULL);
392 assert((*conshdlrdata)->hashmap ==
NULL);
397 hashGetKeyAndConsDatas, hashKeyEqAndConsDatas, hashKeyValAndConsDatas, (
void*) scip) );
403 (*conshdlrdata)->inithashmapandtable =
TRUE;
415 assert(scip !=
NULL);
416 assert(conshdlrdata !=
NULL);
420 (*conshdlrdata)->allconsanddatas =
NULL;
421 (*conshdlrdata)->nallconsanddatas = 0;
422 (*conshdlrdata)->sallconsanddatas = 10;
427 (*conshdlrdata)->inithashmapandtable =
FALSE;
428 (*conshdlrdata)->hashtable =
NULL;
429 (*conshdlrdata)->hashtablesize = 0;
430 (*conshdlrdata)->hashmap =
NULL;
431 (*conshdlrdata)->hashmapsize = 0;
434 (*conshdlrdata)->nlinconss = 0;
437 (*conshdlrdata)->noriguses = 0;
450 assert(scip !=
NULL);
451 assert(conshdlrdata !=
NULL);
452 assert(*conshdlrdata !=
NULL);
453 assert((*conshdlrdata)->nallconsanddatas == 0);
456 if( (*conshdlrdata)->inithashmapandtable )
459 (*conshdlrdata)->hashmapsize = 0;
461 (*conshdlrdata)->hashtablesize = 0;
465 assert((*conshdlrdata)->hashmap ==
NULL);
466 assert((*conshdlrdata)->hashtable ==
NULL);
468 (*conshdlrdata)->inithashmapandtable =
FALSE;
473 (*conshdlrdata)->allconsanddatas =
NULL;
474 (*conshdlrdata)->nallconsanddatas = 0;
475 (*conshdlrdata)->sallconsanddatas = 0;
491 assert(scip !=
NULL);
492 assert(cons !=
NULL);
510 #ifdef WITHEQKNAPSACK 511 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
512 *
nvars = SCIPgetNVarsEQKnapsack(scip, cons);
573 #ifdef WITHEQKNAPSACK 574 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
575 *lhs = SCIPgetCapacityEQKnapsack(scip, cons);
602 assert(scip !=
NULL);
603 assert(cons !=
NULL);
604 assert(vars !=
NULL);
621 for( v = 0; v < *
nvars; ++v )
623 vars[v] = linvars[v];
624 coefs[v] = lincoefs[v];
629 for( v = 0; v < *
nvars; ++v )
630 vars[v] = linvars[v];
638 assert( linvars !=
NULL );
642 for( v = 0; v < *
nvars; ++v )
644 vars[v] = linvars[v];
650 for( v = 0; v < *
nvars; ++v )
651 vars[v] = linvars[v];
661 assert( linvars !=
NULL );
667 for( v = 0; v < *
nvars; ++v )
669 vars[v] = linvars[v];
675 for( v = 0; v < *
nvars; ++v )
676 vars[v] = linvars[v];
684 assert( linvars !=
NULL );
688 for( v = 0; v < *
nvars; ++v )
690 vars[v] = linvars[v];
696 for( v = 0; v < *
nvars; ++v )
697 vars[v] = linvars[v];
701 #ifdef WITHEQKNAPSACK 702 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
706 *
nvars = SCIPgetNVarsEQKnapsack(scip, cons);
707 linvars = SCIPgetVarsEQKnapsack(scip, cons);
708 assert( linvars !=
NULL );
712 weights = SCIPgetWeightsEQKnapsack(scip, cons);
714 for( v = 0; v < *
nvars; ++v )
716 vars[v] = linvars[v];
722 for( v = 0; v < *
nvars; ++v )
723 vars[v] = linvars[v];
775 assert(scip !=
NULL);
776 assert(cons !=
NULL);
777 assert(vars !=
NULL);
778 assert((linvars !=
NULL) == (nlinvars !=
NULL));
779 assert((andress ==
NULL) || (nandress !=
NULL));
780 assert((andcoefs !=
NULL) == (andnegs !=
NULL));
781 assert((coefs !=
NULL) == ((lincoefs !=
NULL) || (andcoefs !=
NULL)));
782 assert(linvars !=
NULL || andress !=
NULL);
784 if( nlinvars !=
NULL )
786 if( nandress !=
NULL )
790 assert(conshdlr !=
NULL);
792 assert(conshdlrdata !=
NULL);
793 assert(conshdlrdata->hashmap !=
NULL);
801 for( v =
nvars - 1; v > 0; --v )
806 for( v = 0; v <
nvars; ++v )
811 assert(vars[v] !=
NULL);
818 hashmapentryexists =
SCIPhashmapExists(conshdlrdata->hashmap, (
void*)(hashmapvar));
821 hashmapvar = vars[v];
826 if( hashmapentryexists )
831 assert(consanddata !=
NULL);
835 if( hashmapentryexists )
843 if( !hashmapentryexists && linvars !=
NULL )
845 assert(nlinvars !=
NULL);
847 linvars[*nlinvars] = vars[v];
848 if( lincoefs !=
NULL )
850 assert(coefs !=
NULL);
851 lincoefs[*nlinvars] = coefs[v];
855 else if( hashmapentryexists && nandress !=
NULL )
857 if( andress !=
NULL )
859 andress[*nandress] = hashmapvar;
861 if( andcoefs !=
NULL )
863 assert(andnegs !=
NULL);
864 assert(coefs !=
NULL);
865 andcoefs[*nandress] = coefs[v];
866 andnegs[*nandress] = (vars[v] != hashmapvar);
874 if( andress !=
NULL )
876 assert(nandress !=
NULL);
879 if( andcoefs !=
NULL )
881 assert(andnegs !=
NULL);
886 SCIPsortPtr((
void**)andress, SCIPvarComp, *nandress);
894 #ifdef CHECK_CONSISTENCY 920 assert(scip !=
NULL);
921 assert(cons !=
NULL);
927 assert(consdata !=
NULL);
930 assert(consdata->lincons !=
NULL);
933 assert(consdata->consanddatas !=
NULL);
934 assert(consdata->nconsanddatas > 0);
935 assert(consdata->nconsanddatas <= consdata->sconsanddatas);
941 assert(
SCIPisLE(scip, newlhs, newrhs));
942 assert(
SCIPisEQ(scip, newrhs, consdata->rhs) ||
SCIPisEQ(scip, newrhs, -consdata->lhs));
943 assert(
SCIPisEQ(scip, newlhs, consdata->lhs) ||
SCIPisEQ(scip, newlhs, -consdata->rhs));
947 assert(nvars == consdata->nlinvars + consdata->nconsanddatas);
961 assert(nvars == 0 || (coefs !=
NULL));
965 andress, andcoefs, andnegs, &nandress) );
966 assert(nlinvars == consdata->nlinvars);
967 assert(nandress == consdata->nconsanddatas);
969 for( v = nandress - 1; v >= 0; --v )
971 SCIP_VAR* andresultant = andress[v];
974 for( c = consdata->nconsanddatas - 1; c >= 0; --c )
976 assert(consdata->consanddatas[c] !=
NULL);
977 if( consdata->consanddatas[c]->cons !=
NULL )
982 if( res == andresultant && consdata->andnegs[c] == andnegs[v] && consdata->andcoefs[c] == andcoefs[v] )
986 assert(!alreadyfound[c]);
989 alreadyfound[c] =
TRUE;
998 for( c = consdata->nconsanddatas - 1; c >= 0; --c )
1000 assert(alreadyfound[c]);
1014 #define checkConsConsistency(scip, cons) 1033 assert(scip !=
NULL);
1034 assert(consanddata !=
NULL);
1035 assert(conshdlrdata !=
NULL);
1039 tmpvars = consanddata->
vars;
1040 ntmpvars = consanddata->
nvars;
1043 for( v = ntmpvars - 1; v >= 0; --v )
1045 assert(tmpvars[v] !=
NULL);
1053 tmpvars = consanddata->
newvars;
1057 for( v = ntmpvars - 1; v >= 0; --v )
1059 assert(tmpvars[v] !=
NULL);
1068 if( !origdata || consanddata->
nvars == 0 )
1073 consanddata->
nuses = 0;
1074 consanddata->
nvars = 0;
1075 consanddata->
svars = 0;
1090 if( consanddata->
nvars > 0 )
1099 if( conshdlrdata->inithashmapandtable )
1101 assert(conshdlrdata->hashmap !=
NULL);
1102 assert(conshdlrdata->hashtable !=
NULL);
1115 assert(consanddata->
nuses == 0);
1116 assert(consanddata->
nnewvars == 0);
1117 assert(consanddata->
snewvars == 0);
1125 assert(consanddata->
nvars > 0);
1126 assert(consanddata->
svars > 0);
1131 if( conshdlrdata->inithashmapandtable )
1133 assert(conshdlrdata->hashmap !=
NULL);
1134 assert(conshdlrdata->hashtable !=
NULL);
1160 int const nandconss,
1176 assert(scip !=
NULL);
1177 assert(conshdlr !=
NULL);
1178 assert(consdata !=
NULL);
1180 assert(nandconss == 0 || (andconss !=
NULL && andcoefs !=
NULL));
1181 assert(!issoftcons || (!
SCIPisZero(scip, weight) && indvar !=
NULL));
1198 SCIPerrorMessage(
"left hand side of pseudo boolean constraint greater than right hand side\n");
1209 (*consdata)->issoftcons = issoftcons;
1212 (*consdata)->weight = weight;
1218 (*consdata)->indvar = indvar;
1221 (*consdata)->indvar =
NULL;
1224 if( intvar !=
NULL )
1231 (*consdata)->intvar = intvar;
1234 (*consdata)->intvar =
NULL;
1237 (*consdata)->lincons = lincons;
1238 (*consdata)->linconstype = linconstype;
1247 assert((*consdata)->lincons !=
NULL);
1250 if( transforming || transformed )
1260 (*consdata)->nlinvars =
nvars - nandconss;
1271 if( andnegs !=
NULL )
1279 (*consdata)->nconsanddatas = nandconss;
1280 (*consdata)->sconsanddatas = nandconss;
1286 assert(conshdlrdata !=
NULL);
1287 assert(conshdlrdata->hashmap !=
NULL);
1290 for( c = nandconss - 1; c >= 0; --c )
1292 assert(andconss[c] !=
NULL);
1295 assert(andress[c] !=
NULL);
1298 assert((*consdata)->consanddatas[c] !=
NULL);
1299 assert((*consdata)->consanddatas[c]->origcons == andconss[c] || (*consdata)->consanddatas[c]->cons == andconss[c]);
1304 if( (*consdata)->consanddatas[c]->origcons !=
NULL && (*consdata)->consanddatas[c]->cons ==
NULL )
1314 assert((*consdata)->consanddatas[c]->cons !=
NULL);
1315 assert((*consdata)->consanddatas[c]->newvars ==
NULL);
1316 assert((*consdata)->consanddatas[c]->isoriginal);
1318 (*consdata)->consanddatas[c]->istransformed =
TRUE;
1320 vars = (*consdata)->consanddatas[c]->vars;
1321 ncvars = (*consdata)->consanddatas[c]->nvars;
1322 assert(vars !=
NULL || ncvars == 0);
1331 for( v = ncvars - 1; v >= 0; --v )
1336 else if( (*consdata)->consanddatas[c]->cons !=
NULL )
1337 assert((*consdata)->consanddatas[c]->istransformed);
1339 ++((*consdata)->consanddatas[c]->nuses);
1341 else if( transformed )
1343 assert((*consdata)->consanddatas[c]->cons == andconss[c]);
1345 assert((*consdata)->consanddatas[c]->istransformed);
1350 SCIPsortPtrPtrRealBool((
void**)andress, (
void**)((*consdata)->consanddatas), (*consdata)->andcoefs, (*consdata)->andnegs, SCIPvarComp, nandconss);
1357 (*consdata)->consanddatas =
NULL;
1358 (*consdata)->andcoefs =
NULL;
1359 (*consdata)->andnegs =
NULL;
1360 (*consdata)->nconsanddatas = 0;
1361 (*consdata)->sconsanddatas = 0;
1365 (*consdata)->lhs = lhs;
1366 (*consdata)->rhs = rhs;
1368 (*consdata)->changed =
TRUE;
1369 (*consdata)->propagated =
FALSE;
1370 (*consdata)->presolved =
FALSE;
1371 (*consdata)->cliquesadded =
FALSE;
1372 (*consdata)->upgradetried =
TRUE;
1379 assert(conshdlrdata !=
NULL);
1381 conshdlrdata->noriguses += (*consdata)->nconsanddatas;
1400 assert(scip !=
NULL);
1401 assert(consdata !=
NULL);
1402 assert(*consdata !=
NULL);
1403 assert((*consdata)->nconsanddatas == 0 || (*consdata)->consanddatas !=
NULL);
1404 assert(conshdlrdata !=
NULL);
1407 if( (*consdata)->lincons !=
NULL )
1412 nconsanddatas = (*consdata)->nconsanddatas;
1413 consanddatas = (*consdata)->consanddatas;
1416 for( c = nconsanddatas - 1; c >= 0; --c )
1419 assert((consanddatas[c]->cons ==
NULL) == (consanddatas[c]->
nuses == 0));
1420 assert(consanddatas[c]->
nuses >= 0);
1421 assert(consanddatas[c]->
noriguses >= 0);
1422 assert(isorig ? consanddatas[c]->cons ==
NULL :
TRUE);
1425 if( !isorig && consanddatas[c]->cons !=
NULL )
1429 --(consanddatas[c]->
nuses);
1432 if( consanddatas[c]->
nuses == 0 )
1434 if( conshdlrdata->inithashmapandtable )
1436 assert(conshdlrdata->hashmap !=
NULL);
1437 assert(conshdlrdata->hashtable !=
NULL);
1456 assert(conshdlrdata->nallconsanddatas > 0);
1458 for( d = conshdlrdata->nallconsanddatas - 1; d >= 0; --d )
1460 if( conshdlrdata->allconsanddatas[d] == consanddatas[c] )
1462 --conshdlrdata->nallconsanddatas;
1466 conshdlrdata->allconsanddatas[d] = conshdlrdata->allconsanddatas[conshdlrdata->nallconsanddatas];
1479 assert(consanddatas[c]->
nuses == 0);
1480 assert(consanddatas[c]->
nnewvars == 0);
1481 assert(consanddatas[c]->
snewvars == 0);
1491 if( conshdlrdata->inithashmapandtable )
1493 assert(conshdlrdata->hashmap !=
NULL);
1494 assert(conshdlrdata->hashtable !=
NULL);
1503 if( consanddatas[c]->vars !=
NULL )
1505 assert(consanddatas[c]->
nvars > 0);
1506 assert(consanddatas[c]->
svars > 0);
1507 assert(consanddatas[c]->
svars >= consanddatas[c]->
nvars);
1510 consanddatas[c]->
nvars = 0;
1511 consanddatas[c]->
svars = 0;
1515 assert(consanddatas[c]->
nvars == 0);
1516 assert(consanddatas[c]->
svars == 0);
1523 assert(conshdlrdata->nallconsanddatas > 0);
1524 for( d = conshdlrdata->nallconsanddatas - 1; d >= 0; --d )
1526 if( conshdlrdata->allconsanddatas[d] == consanddatas[c] )
1528 --conshdlrdata->nallconsanddatas;
1532 conshdlrdata->allconsanddatas[d] = conshdlrdata->allconsanddatas[conshdlrdata->nallconsanddatas];
1544 assert(consanddatas[c]->cons ==
NULL);
1553 else if( consanddatas[c]->
nuses == 0 )
1559 assert(consanddatas[c]->
nnewvars == 0);
1560 assert(consanddatas[c]->
snewvars == 0);
1563 tmpvars = consanddatas[c]->
vars;
1564 ntmpvars = consanddatas[c]->
nvars;
1567 for( v = ntmpvars - 1; v >= 0; --v )
1569 assert(tmpvars[v] !=
NULL);
1579 assert(consanddatas[c]->
nuses == 0);
1580 assert(consanddatas[c]->
nnewvars == 0);
1581 assert(consanddatas[c]->
snewvars == 0);
1583 assert(consanddatas[c]->
nvars > 0);
1584 assert(consanddatas[c]->
svars > 0);
1585 assert(consanddatas[c]->
svars >= consanddatas[c]->
nvars);
1586 assert(consanddatas[c]->vars !=
NULL);
1593 if( conshdlrdata->inithashmapandtable )
1595 assert(conshdlrdata->hashmap !=
NULL);
1596 assert(conshdlrdata->hashtable !=
NULL);
1623 assert(scip !=
NULL);
1624 assert(res !=
NULL);
1654 assert(scip !=
NULL);
1655 assert(cons !=
NULL);
1656 assert(consanddata !=
NULL);
1670 vars = consanddata->
vars;
1686 for( v =
nvars - 1; v >= 0; --v )
1693 for( v =
nvars - 1; v >= 0; --v )
1722 assert(scip !=
NULL);
1723 assert(cons !=
NULL);
1724 assert(consanddata !=
NULL);
1730 vars = consanddata->
vars;
1748 for( v =
nvars - 1; v >= 0; --v )
1755 for( v =
nvars - 1; v >= 0; --v )
1802 assert(scip !=
NULL);
1803 assert(cons !=
NULL);
1805 #ifdef WITHEQKNAPSACK 1811 assert(consdata !=
NULL);
1812 assert(consdata->lincons !=
NULL);
1814 assert(consdata->nconsanddatas >= 0);
1843 andress, andcoefs, andnegs, &nandress) );
1844 assert(consdata->nconsanddatas == nandress);
1849 assert(consdata->nlinvars + consdata->nconsanddatas ==
nvars);
1867 assert(conshdlr !=
NULL);
1869 assert(conshdlrdata !=
NULL);
1870 assert(conshdlrdata->hashmap !=
NULL);
1873 for( v = nandress - 1; v >= 0; --v )
1898 assert(aggrvar !=
NULL);
1909 assert(consanddata !=
NULL);
1914 andcons = consanddata->
cons;
1915 assert(andcons !=
NULL);
1919 assert(nandvars == 0 || andvars !=
NULL);
1924 SCIPinfoMessage(scip, file,
" %+.15g %s(", andcoefs[v], andnegs[v] ?
"~" :
"");
2001 assert(scip !=
NULL);
2002 assert(conshdlr !=
NULL);
2003 assert(vars !=
NULL);
2005 assert(andcons !=
NULL);
2008 assert(conshdlrdata !=
NULL);
2009 assert(conshdlrdata->hashtable !=
NULL);
2035 if( tmpdata !=
NULL )
2043 *andcons = tmpdata->
cons;
2045 assert(tmpdata->
nuses > 0);
2058 assert(*andcons !=
NULL);
2062 assert(res !=
NULL);
2089 #ifdef SCIP_DEBUG_SOLUTION 2090 if( SCIPdebugIsMainscip(scip) )
2096 for( v =
nvars - 1; v >= 0; --v )
2104 val = ((val < 0.5) ? 0.0 : 1.0);
2109 SCIPerrorMessage(
"computed solution value %g for resultant <%s> violates debug solution value %g\n", val,
SCIPvarGetName(resultant), debugsolval);
2130 initial, separate, enforce, check &&
FALSE, propagate,
2131 local, modifiable, dynamic, removable, stickingatnode) );
2140 assert(*andcons !=
NULL);
2143 if( conshdlrdata->nallconsanddatas == conshdlrdata->sallconsanddatas )
2149 conshdlrdata->allconsanddatas[conshdlrdata->nallconsanddatas] = newdata;
2150 ++(conshdlrdata->nallconsanddatas);
2156 newdata->
cons = newcons;
2163 for( v = newdata->
nvars - 1; v >= 0; --v )
2214 assert(scip !=
NULL);
2215 assert(cons !=
NULL);
2222 assert(consdata !=
NULL);
2225 assert(conshdlr !=
NULL);
2228 assert(conshdlrdata !=
NULL);
2235 assert(andcons !=
NULL);
2238 if( consdata->nconsanddatas == consdata->sconsanddatas )
2244 assert(res !=
NULL);
2248 ++(consdata->nconsanddatas);
2251 switch( consdata->linconstype )
2274 #ifdef WITHEQKNAPSACK 2275 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
2292 consdata->changed =
TRUE;
2293 consdata->propagated =
FALSE;
2294 consdata->presolved =
FALSE;
2295 consdata->cliquesadded =
FALSE;
2296 consdata->upgradetried =
FALSE;
2318 SCIPerrorMessage(
"changing left hand side only allowed on standard lienar constraint \n");
2320 #ifdef WITHEQKNAPSACK 2321 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
2349 SCIPerrorMessage(
"changing left hand side only allowed on standard lienar constraint \n");
2351 #ifdef WITHEQKNAPSACK 2352 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
2385 assert(scip !=
NULL);
2386 assert(cons !=
NULL);
2394 assert(consdata !=
NULL);
2400 assert(
SCIPisLE(scip, oldlhs, oldrhs));
2426 SCIP_CALL(
getLinVarsAndAndRess(scip, cons, vars, coefs,
nvars, linvars, lincoefs, &nlinvars, andress, andcoefs, andnegs, &nandress) );
2427 assert(consdata->nconsanddatas == nandress);
2443 for( c = consdata->nconsanddatas - 1; c >= 0; --c )
2448 consanddata = consdata->consanddatas[c];
2449 assert(consanddata !=
NULL);
2451 andcons = consanddata->
cons;
2452 assert(andcons !=
NULL);
2456 val = andnegs[c] ? -andcoefs[c] : andcoefs[c];
2461 for( v = nandvars - 1; v >= 0; --v )
2468 for( v = nandvars - 1; v >= 0; --v )
2478 for( c = consdata->nconsanddatas - 1; c >= 0; --c )
2483 consanddata = consdata->consanddatas[c];
2484 assert(consanddata !=
NULL);
2486 andcons = consanddata->
cons;
2487 assert(andcons !=
NULL);
2491 val = andnegs[c] ? -andcoefs[c] : andcoefs[c];
2496 for( v = nandvars - 1; v >= 0; --v )
2503 for( v = nandvars - 1; v >= 0; --v )
2515 consdata->propagated =
FALSE;
2520 consdata->lhs = lhs;
2521 consdata->presolved =
FALSE;
2522 consdata->changed =
TRUE;
2558 assert(scip !=
NULL);
2559 assert(cons !=
NULL);
2567 assert(consdata !=
NULL);
2573 assert(
SCIPisLE(scip, oldlhs, oldrhs));
2599 SCIP_CALL(
getLinVarsAndAndRess(scip, cons, vars, coefs,
nvars, linvars, lincoefs, &nlinvars, andress, andcoefs, andnegs, &nandress) );
2600 assert(consdata->nconsanddatas == nandress);
2616 for( c = consdata->nconsanddatas - 1; c >= 0; --c )
2621 consanddata = consdata->consanddatas[c];
2622 assert(consanddata !=
NULL);
2624 andcons = consanddata->
cons;
2625 assert(andcons !=
NULL);
2629 val = andnegs[c] ? -andcoefs[c] : andcoefs[c];
2634 for( v = nandvars - 1; v >= 0; --v )
2641 for( v = nandvars - 1; v >= 0; --v )
2651 for( c = consdata->nconsanddatas - 1; c >= 0; --c )
2656 consanddata = consdata->consanddatas[c];
2657 assert(consanddata !=
NULL);
2659 andcons = consanddata->
cons;
2660 assert(andcons !=
NULL);
2664 val = andnegs[c] ? -andcoefs[c] : andcoefs[c];
2669 for( v = nandvars - 1; v >= 0; --v )
2676 for( v = nandvars - 1; v >= 0; --v )
2688 consdata->propagated =
FALSE;
2693 consdata->rhs = rhs;
2694 consdata->presolved =
FALSE;
2695 consdata->changed =
TRUE;
2717 int const*
const ntermvars,
2747 assert(scip !=
NULL);
2748 assert(conshdlr !=
NULL);
2749 assert(nterms == 0 || (terms !=
NULL && ntermvars !=
NULL));
2750 assert(andconss !=
NULL);
2751 assert(andvals !=
NULL);
2752 assert(nandconss !=
NULL);
2760 for( t = 0; t < nterms; ++t )
2762 if( !
SCIPisZero(scip, termcoefs[t]) && ntermvars[t] > 0 )
2765 initial, enforce, check, local, modifiable, dynamic, stickingatnode,
2766 &(andconss[*nandconss])) );
2767 assert(andconss[*nandconss] !=
NULL);
2768 andvals[*nandconss] = termcoefs[t];
2769 andnegs[*nandconss] =
FALSE;
2836 assert(scip !=
NULL);
2837 assert(conshdlr !=
NULL);
2838 assert(nlinvars == 0 || (linvars !=
NULL && linvals !=
NULL));
2839 assert(nandress == 0 || (andress !=
NULL && andvals !=
NULL));
2840 assert(lhs !=
NULL);
2841 assert(rhs !=
NULL);
2842 assert(lincons !=
NULL);
2843 assert(linconstype !=
NULL);
2844 assert(nlinvars > 0 || nandress > 0);
2847 assert(conshdlrdata !=
NULL);
2854 ++(conshdlrdata->nlinconss);
2870 nvars = nlinvars + nandress;
2873 for( v = nlinvars - 1; v >= 0; --v )
2884 else if(
SCIPisEQ(scip, val, -1.0) )
2903 for( v = nandress - 1; v >= 0; --v )
2914 else if(
SCIPisEQ(scip, val, -1.0) )
2931 SCIPdebugMsg(scip,
"While creating the linear constraint of the pseudoboolean constraint we found %d zero coefficients that were removed\n", nzero);
2949 if( upgrconshdlr !=
NULL && nvars > 2 && ncoeffspone + ncoeffsnone == nvars
2956 SCIPdebugMsg(scip,
"linear constraint will be logic-or constraint\n");
2965 for( v = 0; v < nlinvars; ++v )
2967 if( mult * linvals[v] > 0.0 )
2968 transvars[v] = linvars[v];
2973 assert(transvars[v] !=
NULL);
2977 for( v = 0; v < nandress; ++v )
2979 if( mult * andvals[v] > 0.0 )
2980 transvars[nlinvars + v] = andress[v];
2986 assert(transvars[nlinvars + v] !=
NULL);
2989 assert(!modifiable);
2992 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) );
3021 if( upgrconshdlr !=
NULL && !created && ncoeffspone + ncoeffsnone == nvars )
3026 if(
SCIPisEQ(scip, *lhs, *rhs) && (
SCIPisEQ(scip, *lhs, 1.0 - ncoeffsnone) ||
SCIPisEQ(scip, *lhs, ncoeffspone - 1.0)) )
3028 SCIPdebugMsg(scip,
"linear pseudoboolean constraint will be a set partitioning constraint\n");
3031 mult =
SCIPisEQ(scip, *lhs, 1.0 - ncoeffsnone) ? +1 : -1;
3037 for( v = 0; v < nlinvars; ++v )
3039 if( mult * linvals[v] > 0.0 )
3040 transvars[v] = linvars[v];
3045 assert(transvars[v] !=
NULL);
3049 for( v = 0; v < nandress; ++v )
3051 if( mult * andvals[v] > 0.0 )
3052 transvars[nlinvars + v] = andress[v];
3058 assert(transvars[nlinvars + v] !=
NULL);
3062 assert(!modifiable);
3064 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) );
3078 SCIPdebugMsg(scip,
"linear pseudoboolean constraint will be a set packing constraint\n");
3087 for( v = 0; v < nlinvars; ++v )
3089 if( mult * linvals[v] > 0.0 )
3090 transvars[v] = linvars[v];
3095 assert(transvars[v] !=
NULL);
3099 for( v = 0; v < nandress; ++v )
3101 if( mult * andvals[v] > 0.0 )
3102 transvars[nlinvars + v] = andress[v];
3108 assert(transvars[nlinvars + v] !=
NULL);
3112 assert(!modifiable);
3114 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) );
3132 SCIPwarningMessage(scip,
"Does not expect this, because this constraint should be a set packing constraint.\n");
3136 SCIPwarningMessage(scip,
"Does not expect this, because this constraint should be a logicor constraint.\n");
3139 SCIPdebugMsg(scip,
"linear pseudoboolean constraint will be a set covering constraint\n");
3148 for( v = 0; v < nlinvars; ++v )
3150 if( mult * linvals[v] > 0.0 )
3151 transvars[v] = linvars[v];
3156 assert(transvars[v] !=
NULL);
3160 for( v = 0; v < nandress; ++v )
3162 if( mult * andvals[v] > 0.0 )
3163 transvars[nlinvars + v] = andress[v];
3169 assert(transvars[nlinvars + v] !=
NULL);
3173 assert(!modifiable);
3175 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) );
3195 if( upgrconshdlr !=
NULL && !created && (ncoeffspone + ncoeffsnone + ncoeffspint + ncoeffsnint == nvars) && (
SCIPisInfinity(scip, -*lhs) !=
SCIPisInfinity(scip, *rhs)) )
3203 SCIPdebugMsg(scip,
"linear pseudoboolean constraint will be a knapsack constraint\n");
3224 for( v = 0; v < nlinvars; ++v )
3230 transvars[v] = linvars[v];
3231 weights[v] = weight;
3236 weights[v] = -weight;
3239 assert(transvars[v] !=
NULL);
3242 for( v = 0; v < nandress; ++v )
3248 transvars[nlinvars + v] = andress[v];
3249 weights[nlinvars + v] = weight;
3255 weights[nlinvars + v] = -weight;
3258 assert(transvars[nlinvars + v] !=
NULL);
3263 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) );
3275 #ifdef WITHEQKNAPSACK 3284 if( upgrconshdlr !=
NULL && !created && (ncoeffspone + ncoeffsnone + ncoeffspint + ncoeffsnint == nvars) &&
SCIPisEQ(scip, *lhs, *rhs) )
3294 SCIPdebugMsg(scip,
"linear pseudoboolean constraint will be a equality-knapsack constraint\n");
3312 for( v = 0; v < nlinvars; ++v )
3318 transvars[v] = linvars[v];
3319 weights[v] = weight;
3324 weights[v] = -weight;
3327 assert(transvars[v] !=
NULL);
3330 for( v = 0; v < nandress; ++v )
3336 transvars[nlinvars + v] = andress[v];
3337 weights[nlinvars + v] = weight;
3343 weights[nlinvars + v] = -weight;
3346 assert(transvars[nlinvars + v] !=
NULL);
3350 SCIP_CALL( SCIPcreateConsEqKnapsack(scip, &cons, name, nvars, transvars, weights, capacity,
3351 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) );
3354 (*linconstype) = SCIP_LINEARCONSTYPE_EQKNAPSACK;
3368 assert(created || upgrconshdlr !=
NULL);
3373 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) );
3378 for( v = 0; v < nandress; ++v )
3380 assert(andress[v] !=
NULL);
3437 assert(scip !=
NULL);
3438 assert(cons !=
NULL);
3440 assert(violated !=
NULL);
3448 assert(consdata !=
NULL);
3449 assert(consdata->lincons !=
NULL);
3477 assert(consdata->nlinvars + consdata->nconsanddatas ==
nvars);
3482 assert(conshdlr !=
NULL);
3484 assert(conshdlrdata !=
NULL);
3485 assert(conshdlrdata->hashmap !=
NULL);
3494 for( v = 0; v <
nvars; ++v )
3499 assert(vars[v] !=
NULL);
3509 hashmapvar = vars[v];
3512 assert(hashmapvar !=
NULL);
3520 linvars[nlinvars] = vars[v];
3521 lincoefs[nlinvars] = coefs[v];
3527 andress[nandress] = hashmapvar;
3534 andcoefs[nandress] = -coefs[v];
3537 andcoefs[nandress] = coefs[v];
3541 assert(nandress == consdata->nconsanddatas);
3545 SCIPdebugMsg(scip,
"nlinvars = %d, nandress = %d\n", nlinvars, nandress);
3546 SCIPdebugMsg(scip,
"linear activity = %g\n", activity);
3549 for( c = consdata->nconsanddatas - 1; c >= 0; --c )
3556 andcons = consdata->consanddatas[c]->origcons;
3561 if( andcons ==
NULL )
3563 andcons = consdata->consanddatas[c]->cons;
3565 assert(andcons !=
NULL);
3572 assert(nandvars == 0 || (andvars !=
NULL && res !=
NULL));
3573 assert(res == andress[c]);
3578 for( v = nandvars - 1; v >= 0; --v )
3584 activity += andvalue * andcoefs[c];
3586 SCIPdebugMsg(scip,
"lhs = %g, overall activity = %g, rhs = %g\n", lhs, activity, rhs);
3595 SCIPinfoMessage(scip,
NULL,
"violation: left hand side is violated by %.15g\n", lhs - activity);
3611 SCIPinfoMessage(scip,
NULL,
"violation: right hand side is violated by %.15g\n", activity - rhs);
3648 assert(scip !=
NULL);
3649 assert(conshdlr !=
NULL);
3650 assert(violated !=
NULL);
3653 assert(conshdlrdata !=
NULL);
3657 for( c = conshdlrdata->nallconsanddatas - 1; c >= 0; --c )
3659 if( !conshdlrdata->allconsanddatas[c]->istransformed )
3662 andcons = conshdlrdata->allconsanddatas[c]->cons;
3665 if( andcons ==
NULL )
3675 for( v =
nvars - 1; v >= 0; --v )
3694 else if( sol ==
NULL )
3708 SCIP*
const sourcescip,
3733 assert(targetscip !=
NULL);
3734 assert(targetcons !=
NULL);
3735 assert(sourcescip !=
NULL);
3736 assert(sourcecons !=
NULL);
3738 assert(valid !=
NULL);
3743 assert(sourceconsdata !=
NULL);
3746 sourcelincons = sourceconsdata->lincons;
3747 assert(sourcelincons !=
NULL);
3756 int ntargetandconss;
3759 targetlinconstype = sourceconsdata->linconstype;
3761 switch( targetlinconstype )
3765 assert(conshdlrlinear !=
NULL);
3769 assert(conshdlrlinear !=
NULL);
3773 assert(conshdlrlinear !=
NULL);
3777 assert(conshdlrlinear !=
NULL);
3779 #ifdef WITHEQKNAPSACK 3780 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
3782 assert(conshdlrlinear !=
NULL);
3791 if( conshdlrlinear ==
NULL )
3797 targetlincons =
NULL;
3807 assert(targetlincons !=
NULL);
3817 targetandconss =
NULL;
3818 targetandcoefs =
NULL;
3819 ntargetandconss = 0;
3825 int nsourceandconss;
3832 assert(conshdlrand !=
NULL);
3834 nsourceandconss = sourceconsdata->nconsanddatas;
3849 targetlinvars, targetlincoefs, &ntargetlinvars) );
3856 SCIPvarIsHashkeyEq, SCIPvarGetHashkeyVal,
NULL) );
3858 for( c = 0 ; c < ntargetlinvars; ++c )
3867 for( c = 0 ; c < nsourceandconss; ++c )
3874 consanddata = sourceconsdata->consanddatas[c];
3875 assert(consanddata !=
NULL);
3877 oldcons = consanddata->
cons;
3878 assert(oldcons !=
NULL);
3881 assert(targetandresultant !=
NULL);
3891 targetandconss[ntargetandconss] =
NULL;
3903 targetandcoefs[ntargetandconss] = sourceconsdata->andcoefs[c];
3909 assert(ntargetandconss <= ntargetlinvars);
3913 if( ntargetandconss == 0 )
3926 const char* consname;
3929 assert(sourceconsdata->issoftcons == (sourceconsdata->indvar !=
NULL));
3930 indvar = sourceconsdata->indvar;
3931 intvar = sourceconsdata->intvar;
3934 if( indvar !=
NULL )
3938 assert(!(*valid) || indvar !=
NULL);
3941 if( intvar !=
NULL && *valid )
3944 assert(!(*valid) || intvar !=
NULL);
3959 targetlincons, targetlinconstype, targetandconss, targetandcoefs, ntargetandconss,
3960 indvar, sourceconsdata->weight, sourceconsdata->issoftcons, intvar, targetlhs, targetrhs,
3961 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) );
3969 if( targetlincons !=
NULL )
3975 if( targetandconss !=
NULL )
3979 assert(ntargetandconss <= sourceconsdata->nconsanddatas);
3981 for( c = 0 ; c < ntargetandconss; ++c )
3983 if( targetandconss[c] !=
NULL )
4011 assert(scip !=
NULL);
4012 assert(conshdlrdata !=
NULL);
4014 allconsanddatas = conshdlrdata->allconsanddatas;
4015 assert(allconsanddatas !=
NULL);
4016 assert(conshdlrdata->nallconsanddatas > 0);
4017 assert(conshdlrdata->nallconsanddatas <= conshdlrdata->sallconsanddatas);
4019 for( c = conshdlrdata->nallconsanddatas - 1; c >= 0; --c )
4028 consanddata = allconsanddatas[c];
4033 if( consanddata->
nuses == 0 )
4036 vars = consanddata->
vars;
4037 nvars = consanddata->
nvars;
4038 assert(nvars == 0 || vars !=
NULL);
4051 cons = consanddata->
cons;
4052 assert(cons !=
NULL);
4074 for( v = nvars - 1; v > 0; --v )
4077 for( v = nnewvars - 1; v > 0; --v )
4082 if( nvars == nnewvars )
4089 for( v = nvars - 1; v >= 0; --v )
4091 if( vars[v] != newvars[v] )
4103 if( nnewvars > consanddata->
snewvars )
4113 for( v = consanddata->
nnewvars - 1; v >= 0; --v )
4136 assert(scip !=
NULL);
4137 assert(cons !=
NULL);
4138 assert(consanddata !=
NULL);
4164 assert(scip !=
NULL);
4165 assert(cons !=
NULL);
4166 assert(consanddata !=
NULL);
4195 int nnewconsanddatas;
4196 int snewconsanddatas;
4208 assert(scip !=
NULL);
4209 assert(cons !=
NULL);
4210 assert(conshdlrdata !=
NULL);
4211 assert(conshdlrdata->hashmap !=
NULL);
4212 assert(nandress == 0 || (andress !=
NULL && andcoefs !=
NULL));
4215 assert(
SCIPisLE(scip, newlhs, newrhs));
4218 assert(consdata !=
NULL);
4221 SCIPsortPtrRealBool((
void**)(consdata->consanddatas), consdata->andcoefs, consdata->andnegs, resvarCompWithInactive, consdata->nconsanddatas);
4223 consanddatas = consdata->consanddatas;
4224 oldandcoefs = consdata->andcoefs;
4225 oldandnegs = consdata->andnegs;
4226 nconsanddatas = consdata->nconsanddatas;
4227 assert(nconsanddatas == 0 || (consanddatas !=
NULL && oldandcoefs !=
NULL));
4231 for( c = nandress - 1; c > 0; --c )
4239 for( c = nconsanddatas - 1; c > 0; --c )
4244 assert(consanddatas[c] !=
NULL);
4250 assert(consanddatas[c - 1] !=
NULL);
4255 assert(!
SCIPisZero(scip, oldandcoefs[c - 1]));
4260 assert(consanddatas[c]->cons !=
NULL);
4262 assert(res1 !=
NULL);
4263 assert(consanddatas[c - 1]->cons !=
NULL);
4265 assert(res2 !=
NULL);
4271 snewconsanddatas = nconsanddatas + nandress;
4278 nnewconsanddatas = 0;
4281 for( c = 0, c1 = 0; c < nconsanddatas && c1 < nandress; )
4287 assert(consanddatas[c] !=
NULL);
4293 consdata->changed =
TRUE;
4294 consdata->upgradetried =
FALSE;
4298 andcons = consanddatas[c]->
cons;
4299 assert(andcons !=
NULL);
4301 if( andcons ==
NULL )
4304 consdata->changed =
TRUE;
4305 consdata->upgradetried =
FALSE;
4312 oldandnegs[c] ? -oldandcoefs[c] : oldandcoefs[c], consdata->lhs, consdata->rhs) );
4314 consdata->changed =
TRUE;
4315 consdata->upgradetried =
FALSE;
4318 assert(andcons !=
NULL);
4322 assert(res1 !=
NULL);
4327 assert(res2 !=
NULL);
4333 assert(consanddatas[c]->
nuses > 0);
4334 --(consanddatas[c]->
nuses);
4338 consdata->lhs, consdata->rhs) );
4340 consdata->changed =
TRUE;
4341 consdata->upgradetried =
FALSE;
4342 consdata->propagated =
FALSE;
4343 consdata->presolved =
FALSE;
4349 newandcoefs[nnewconsanddatas] = andcoefs[c1];
4350 newandnegs[nnewconsanddatas] = andnegs[c1];
4351 ++(newconsanddatas[nnewconsanddatas]->
nuses);
4354 SCIP_CALL(
addNewLocks(scip, cons, newconsanddatas[nnewconsanddatas], newandnegs[nnewconsanddatas] ?
4355 -newandcoefs[nnewconsanddatas] : newandcoefs[nnewconsanddatas], newlhs, newrhs) );
4357 consdata->changed =
TRUE;
4358 consdata->upgradetried =
FALSE;
4359 consdata->cliquesadded =
FALSE;
4360 consdata->propagated =
FALSE;
4361 consdata->presolved =
FALSE;
4374 newconsanddatas[nnewconsanddatas] = consanddatas[c];
4376 newandcoefs[nnewconsanddatas] = andcoefs[c1];
4377 newandnegs[nnewconsanddatas] = andnegs[c1];
4379 if( ((oldandnegs[c] == andnegs[c1]) && !
SCIPisEQ(scip, oldandcoefs[c], newandcoefs[c1]))
4380 || ((oldandnegs[c] != newandnegs[c1]) && !
SCIPisEQ(scip, oldandcoefs[c], -newandcoefs[c1])) )
4381 consdata->upgradetried =
FALSE;
4383 coefsignchanged = (oldandnegs[c] == andnegs[c1]) &&
4384 ((oldandcoefs[c] < 0 && andcoefs[c1] > 0) || (oldandcoefs[c] > 0 && andcoefs[c1] < 0));
4385 coefsignchanged = coefsignchanged || ((oldandnegs[c] != andnegs[c1]) &&
4386 ((oldandcoefs[c] < 0 && andcoefs[c1] < 0) || (oldandcoefs[c] > 0 && andcoefs[c1] > 0)));
4388 || (consdata->lhs < 0 && newlhs > 0) || (consdata->lhs > 0 && newlhs < 0);
4390 || (consdata->rhs < 0 && newrhs > 0) || (consdata->rhs > 0 && newrhs < 0);
4393 if( coefsignchanged || lhschanged || rhschanged || newconsanddatas[nnewconsanddatas]->
nnewvars > 0)
4397 -oldandcoefs[c] : oldandcoefs[c], consdata->lhs, consdata->rhs) );
4398 SCIP_CALL(
addNewLocks(scip, cons, newconsanddatas[nnewconsanddatas], newandnegs[nnewconsanddatas] ?
4399 -newandcoefs[nnewconsanddatas] : newandcoefs[nnewconsanddatas], newlhs, newrhs) );
4401 consdata->changed =
TRUE;
4402 consdata->upgradetried =
FALSE;
4403 consdata->cliquesadded =
FALSE;
4404 consdata->propagated =
FALSE;
4405 consdata->presolved =
FALSE;
4415 if( c < nconsanddatas )
4417 assert(c1 == nandress);
4419 for( ; c < nconsanddatas; ++c )
4425 assert(consanddatas[c] !=
NULL);
4427 andcons = consanddatas[c]->
cons;
4429 if( andcons !=
NULL )
4432 assert(res1 !=
NULL);
4436 if( andcons ==
NULL )
4438 consdata->changed =
TRUE;
4439 consdata->upgradetried =
FALSE;
4443 assert(consanddatas[c]->
nuses > 0);
4444 --(consanddatas[c]->
nuses);
4448 consdata->lhs, consdata->rhs) );
4449 consdata->changed =
TRUE;
4450 consdata->upgradetried =
FALSE;
4451 consdata->propagated =
FALSE;
4452 consdata->presolved =
FALSE;
4455 else if( c1 < nandress )
4457 for( ; c1 < nandress; ++c1 )
4462 assert(res2 !=
NULL);
4465 newandcoefs[nnewconsanddatas] = andcoefs[c1];
4466 newandnegs[nnewconsanddatas] = andnegs[c1];
4467 ++(newconsanddatas[nnewconsanddatas]->
nuses);
4470 SCIP_CALL(
addNewLocks(scip, cons, newconsanddatas[nnewconsanddatas], newandnegs[nnewconsanddatas] ?
4471 -newandcoefs[nnewconsanddatas] : newandcoefs[nnewconsanddatas], newlhs, newrhs) );
4474 consdata->changed =
TRUE;
4475 consdata->upgradetried =
FALSE;
4476 consdata->cliquesadded =
FALSE;
4477 consdata->propagated =
FALSE;
4478 consdata->presolved =
FALSE;
4481 assert(c == nconsanddatas && c1 == nandress);
4488 if( !
SCIPisEQ(scip, consdata->lhs, newlhs) || !
SCIPisEQ(scip, consdata->rhs, newrhs) )
4490 consdata->upgradetried =
FALSE;
4491 consdata->lhs = newlhs;
4492 consdata->rhs = newrhs;
4495 consdata->consanddatas = newconsanddatas;
4496 consdata->andcoefs = newandcoefs;
4497 consdata->andnegs = newandnegs;
4498 consdata->nconsanddatas = nnewconsanddatas;
4499 consdata->sconsanddatas = snewconsanddatas;
4501 oldnvars = consdata->nlinvars;
4504 consdata->nlinvars -= nnewconsanddatas;
4506 if( oldnvars != consdata->nlinvars )
4508 consdata->changed =
TRUE;
4509 consdata->upgradetried =
FALSE;
4510 consdata->cliquesadded =
FALSE;
4511 consdata->propagated =
FALSE;
4512 consdata->presolved =
FALSE;
4518 SCIPsortPtrRealBool((
void**)(consdata->consanddatas), consdata->andcoefs, consdata->andnegs, resvarCompWithInactive, consdata->nconsanddatas);
4521 consanddatas = consdata->consanddatas;
4522 nconsanddatas = consdata->nconsanddatas;
4523 assert(nconsanddatas == 0 || consanddatas !=
NULL);
4526 for( c = nconsanddatas - 1; c > 0; --c )
4531 assert(consanddatas[c] !=
NULL);
4532 assert(consanddatas[c]->cons !=
NULL);
4534 assert(res1 !=
NULL);
4535 assert(consanddatas[c - 1] !=
NULL);
4536 assert(consanddatas[c - 1]->cons !=
NULL);
4538 assert(res2 !=
NULL);
4553 int*
const naggrvars,
4570 assert(scip !=
NULL);
4571 assert(cons !=
NULL);
4572 assert(cutoff !=
NULL);
4573 assert(naggrvars !=
NULL);
4574 assert(nchgbds !=
NULL);
4580 assert(consdata !=
NULL);
4582 assert(consdata->nconsanddatas > 0);
4585 if( consdata->cliquesadded )
4588 consdata->cliquesadded =
TRUE;
4593 assert(consdata->lincons !=
NULL);
4596 assert(consdata->consanddatas !=
NULL);
4597 assert(consdata->nconsanddatas > 0);
4598 assert(consdata->nconsanddatas <= consdata->sconsanddatas);
4602 assert(
nvars == consdata->nlinvars + consdata->nconsanddatas);
4619 assert(nandress == consdata->nconsanddatas);
4620 assert(consdata->consanddatas !=
NULL);
4623 for( c = nandress - 1; c >= 0; --c )
4629 consanddata = consdata->consanddatas[c];
4630 assert(consanddata !=
NULL);
4637 andvars = consanddata->
newvars;
4642 andvars = consanddata->
vars;
4643 nandvars = consanddata->
nvars;
4646 for( v1 = nandvars - 1; v1 >= 0; --v1 )
4664 for( v2 = nlinvars - 1; v2 >= 0; --v2 )
4694 if( values[0] != values[1] && var1 == var2 )
4700 clqvars[0] = andres;
4702 assert(clqvars[1] !=
NULL);
4711 *nchgbds += nchgbdslocal;
4743 clqvars[0] = andres;
4745 assert(clqvars[1] !=
NULL);
4754 *nchgbds += nchgbdslocal;
4774 for( c = nandress - 1; c > 0; --c )
4783 consanddata1 = consdata->consanddatas[c];
4784 assert(consanddata1 !=
NULL);
4785 consanddata2 = consdata->consanddatas[c - 1];
4786 assert(consanddata2 !=
NULL);
4794 andvars1 = consanddata1->
newvars;
4795 nandvars1 = consanddata1->
nnewvars;
4799 andvars1 = consanddata1->
vars;
4800 nandvars1 = consanddata1->
nvars;
4806 andvars2 = consanddata2->
newvars;
4807 nandvars2 = consanddata2->
nnewvars;
4811 andvars2 = consanddata2->
vars;
4812 nandvars2 = consanddata2->
nvars;
4816 for( v1 = nandvars1 - 1; v1 >= 0; --v1 )
4821 var1 = andvars1[v1];
4834 for( v2 = nandvars2 - 1; v2 >= 0; --v2 )
4838 var2 = andvars2[v2];
4864 if( values[0] != values[1] && var1 == var2 )
4870 clqvars[0] = andres;
4871 clqvars[1] = andres2;
4880 *nchgbds += nchgbdslocal;
4913 clqvars[0] = andres;
4915 assert(clqvars[1] !=
NULL);
4924 *nchgbds += nchgbdslocal;
4962 assert(scip !=
NULL);
4963 assert(cons !=
NULL);
4964 assert(cutoff !=
NULL);
4965 assert(ndelconss !=
NULL);
4970 assert(consdata !=
NULL);
4971 assert(consdata->lincons !=
NULL);
4981 if( consdata->propagated )
4985 consdata->propagated =
TRUE;
5002 assert(scip !=
NULL);
5003 assert(cons !=
NULL);
5006 assert(consdata !=
NULL);
5008 consanddatas = consdata->consanddatas;
5009 nconsanddatas = consdata->nconsanddatas;
5010 assert(nconsanddatas == 0 || consanddatas !=
NULL);
5016 for( c = nconsanddatas - 1; c >= 0; --c )
5020 assert(consanddatas[c] !=
NULL);
5025 andcons = consanddatas[c]->
cons;
5026 assert(andcons !=
NULL);
5046 assert(scip !=
NULL);
5047 assert(conshdlrdata !=
NULL);
5048 assert(ndelconss !=
NULL);
5050 allconsanddatas = conshdlrdata->allconsanddatas;
5051 assert(allconsanddatas !=
NULL);
5052 assert(conshdlrdata->nallconsanddatas > 0);
5053 assert(conshdlrdata->nallconsanddatas <= conshdlrdata->sallconsanddatas);
5055 for( c = conshdlrdata->nallconsanddatas - 1; c >= 0; --c )
5062 consanddata = allconsanddatas[c];
5064 assert(consanddata->
nvars == 0 || (consanddata->
vars !=
NULL && consanddata->
svars > 0));
5073 assert(consanddata->
nnewvars == 0);
5074 assert(consanddata->
snewvars == 0);
5080 if( consanddata->
nvars == 0 )
5085 assert(consanddata->
nnewvars == 0);
5086 assert(consanddata->
nuses > 0);
5087 assert(resvar !=
NULL);
5097 consanddata->
nuses = 0;
5112 if( consanddata->
nuses == 0 )
5125 assert(consanddata->
nnewvars == 0);
5126 assert(consanddata->
snewvars == 0);
5146 if( nfixedvars > 0 )
5165 for( w = nfixedvars - 1; w >= 0; --w )
5169 if( activevars ==
NULL )
5174 assert(activevars !=
NULL);
5175 assert(activescalars !=
NULL);
5177 activevars[0] = fixedvars[w];
5178 activescalars[0] = 1.0;
5179 activeconstant = 0.0;
5183 &activeconstant, &requiredsize,
TRUE) );
5186 if( nactivevars == 0 )
5189 fixedvars[w] = fixedvars[nfixedvars];
5193 fixedvars[w] = activevars[0];
5195 if( nactivevars > 1 )
5200 for( i = 1; i < nactivevars; ++i )
5203 fixedvars[nfixedvars] = activevars[i];
5213 if( activevars !=
NULL )
5219 SCIPsortPtr((
void**)fixedvars, SCIPvarComp, nfixedvars);
5237 if( !looseorcolumn )
5262 cons = consanddata->
cons;
5263 assert(cons !=
NULL);
5270 assert(consanddata->
nuses > 0);
5271 assert(resvar !=
NULL);
5277 consanddata->
nuses = 0;
5295 tmpvars = consanddata->
vars;
5297 for( v = consanddata->
nvars - 1; v >= 0; --v )
5300 assert(tmpvars[v] !=
NULL);
5305 tmpvars = consanddata->
vars;
5306 stmpvars = consanddata->
svars;
5310 consanddata->
newvars = tmpvars;
5335 assert(scip !=
NULL);
5336 assert(cons !=
NULL);
5337 assert(conshdlrdata !=
NULL);
5338 assert(ndelconss !=
NULL);
5344 assert(consdata !=
NULL);
5346 consanddatas = consdata->consanddatas;
5347 nconsanddatas = consdata->nconsanddatas;
5348 assert(nconsanddatas > 0 && consanddatas !=
NULL);
5351 if( nconsanddatas > 0 )
5353 assert(consdata->andcoefs !=
NULL);
5355 for( c = nconsanddatas - 1; c >= 0; --c )
5359 consanddata = consanddatas[c];
5360 assert(consanddata !=
NULL);
5370 for( c = nconsanddatas - 1; c >= 0; --c )
5374 consanddata = consanddatas[c];
5375 assert(consanddata !=
NULL);
5378 assert(consanddata->
nuses > 0);
5380 if( consanddata->
nuses > 0 )
5381 --(consanddata->
nuses);
5384 if( consanddata->
nuses == 0 )
5393 assert(resvar !=
NULL);
5409 if( nfixedvars > 0 )
5426 for( w = nfixedvars - 1; w >= 0; --w )
5429 foundmultiaggrvar =
TRUE;
5434 SCIPsortPtr((
void**)fixedvars, SCIPvarComp, nfixedvars);
5436 if( foundmultiaggrvar )
5478 if( !looseorcolumn )
5502 consdata->nconsanddatas = 0;
5532 int const nconsanddatas,
5549 assert(scip !=
NULL);
5550 assert(vars !=
NULL);
5552 assert(values !=
NULL);
5553 assert(linvars !=
NULL || nlinvars == 0);
5554 assert(lincoefs !=
NULL || nlinvars == 0);
5555 assert(nvars >= nlinvars);
5557 assert(consanddatas !=
NULL);
5558 assert(consanddatacoefs !=
NULL);
5559 assert(nconsanddatas > 0);
5560 assert(*xortype >= -1 && *xortype <= 1);
5563 SCIPsortPtr((
void**)linvars, SCIPvarCompActiveAndNegated, nlinvars);
5564 SCIPsortPtr((
void**)vars, SCIPvarCompActiveAndNegated, nvars);
5567 for( v = nlinvars - 1; v >= 0; --v )
5572 value += lincoefs[v];
5587 for( c = nconsanddatas - 1; c >= 0; --c )
5591 consanddata = consanddatas[c];
5592 assert(consanddata !=
NULL);
5598 termvars = consanddata->
newvars;
5603 termvars = consanddata->
vars;
5604 ntermvars = consanddata->
nvars;
5606 assert(ntermvars > 0 && termvars !=
NULL);
5612 SCIPsortPtrBool((
void**)repvars, negated, SCIPvarCompActiveAndNegated, ntermvars);
5614 for( v = ntermvars - 1; v >= 0; --v )
5623 if( (negated[v] && values[pos]) || (!negated[v] && !values[pos]) )
5639 if( val != consanddatanegs[c] )
5640 value += consanddatacoefs[c];
5646 if( *xortype == -1 )
5654 else if( *xortype == 1 && cnt % 2 == 0 )
5656 else if( *xortype == 0 && cnt % 2 == 1 )
5662 if( *xortype == -1 )
5670 else if( *xortype == 1 && cnt % 2 == 1 )
5672 else if( *xortype == 0 && cnt % 2 == 0 )
5693 int*
const ndelconss,
5694 int*
const naddconss,
5695 int*
const nfixedvars,
5696 int*
const nchgcoefs,
5697 int*
const nchgsides,
5732 assert(scip !=
NULL);
5733 assert(cons !=
NULL);
5734 assert(conshdlrdata !=
NULL);
5735 assert(ndelconss !=
NULL);
5736 assert(nfixedvars !=
NULL);
5737 assert(nchgcoefs !=
NULL);
5738 assert(nchgsides !=
NULL);
5739 assert(cutoff !=
NULL);
5743 assert(consdata !=
NULL);
5745 consanddatas = consdata->consanddatas;
5746 andcoefs = consdata->andcoefs;
5747 andnegs = consdata->andnegs;
5748 nconsanddatas = consdata->nconsanddatas;
5749 assert(nconsanddatas > 0 && consanddatas !=
NULL);
5751 assert(consdata->lincons !=
NULL);
5755 if( !
SCIPisEQ(scip, consdata->lhs, consdata->rhs) || (!
SCIPisEQ(scip, consdata->lhs, 1.0) && !
SCIPisZero(scip, consdata->lhs)) )
5758 assert(consanddatas[0] !=
NULL);
5759 assert(consanddatas[0]->cons !=
NULL);
5761 lincons = consdata->lincons;
5765 assert(nallvars - nconsanddatas == consdata->nlinvars);
5766 nlinvars = consdata->nlinvars;
5783 assert(nallvars > 0);
5788 assert(nlinvars == consdata->nlinvars);
5789 assert(nandress == nallvars-nlinvars);
5800 firstnlinvars = nlinvars;
5803 SCIPsortPtr((
void**)linvars, SCIPvarCompActiveAndNegated, nlinvars);
5805 for( c = nconsanddatas - 1; c >= 0; --c )
5807 consanddata = consanddatas[c];
5808 assert(consanddata !=
NULL);
5819 vars = consanddata->
vars;
5833 oldnlinvars = nlinvars;
5836 for( v =
nvars - 1, v1 = nlinvars - 1; v >= 0 && v1 >= 0; )
5856 linvars[nlinvars] = var;
5878 for( ; v >= 0; --v )
5893 linvars[nlinvars] = var;
5902 if( nlinvars > oldnlinvars )
5905 SCIPsortPtr((
void**)linvars, SCIPvarCompActiveAndNegated, nlinvars);
5913 for( v = (1 << nlinvars) - 1; v >= 0; --v )
5916 for( v1 = nlinvars - 1; v1 >= 0; --v1 )
5926 assert(cnt <= nlinvars);
5928 SCIP_CALL(
checkSolution(scip, linvars, nlinvars, values, activelinvars, lincoefs, firstnlinvars, constant,
5929 consdata->lhs, consanddatas, andcoefs, andnegs, nconsanddatas, cnt, &xortype) );
5936 assert(xortype >= -1 && xortype <= 1);
5950 SCIPdebugMsg(scip,
"created upgraded XOR constraint:\n");
5984 int*
const ndelconss,
5985 int*
const naddconss,
5986 int*
const nfixedvars,
5987 int*
const nchgcoefs,
5988 int*
const nchgsides,
6003 assert(scip !=
NULL);
6004 assert(cons !=
NULL);
6005 assert(conshdlrdata !=
NULL);
6006 assert(ndelconss !=
NULL);
6007 assert(nfixedvars !=
NULL);
6008 assert(nchgcoefs !=
NULL);
6009 assert(nchgsides !=
NULL);
6010 assert(cutoff !=
NULL);
6014 assert(consdata !=
NULL);
6016 consanddatas = consdata->consanddatas;
6017 nconsanddatas = consdata->nconsanddatas;
6018 assert(nconsanddatas > 0 && consanddatas !=
NULL);
6020 assert(consdata->lincons !=
NULL);
6023 assert(consanddatas[0] !=
NULL);
6024 assert(consanddatas[0]->cons !=
NULL);
6026 if( nconsanddatas == 1 )
6046 if( consdata->nlinvars == 0 )
6058 lincons = consdata->lincons;
6060 consanddata = consanddatas[0];
6061 assert(consanddata !=
NULL);
6072 vars = consanddata->
vars;
6073 nvars = consanddata->
nvars;
6075 assert(nvars > 0 && vars !=
NULL);
6089 assert(nallvars == consdata->nlinvars + 1);
6091 nlinvars = consdata->nlinvars;
6101 assert(allcoefs !=
NULL);
6106 assert(nlinvars == consdata->nlinvars);
6109 for( v = 0; v < nlinvars; ++v )
6115 for( v = 0; v <
nvars; ++v )
6123 SCIPdebugMsg(scip,
"created upgraded linear constraint:\n");
6147 c = nconsanddatas - 1;
6151 if( consanddatas[c]->
nnewvars > 0 )
6153 neqvars = consanddatas[c]->
nnewvars;
6159 neqvars = consanddatas[c]->
nvars;
6165 assert(neqvars > 0 && eqvars !=
NULL);
6169 for( v = neqvars - 1; v > 0; --v )
6173 for( --c ; c >= 0; --c )
6180 consanddata = consanddatas[c];
6181 assert(consanddata !=
NULL);
6192 vars = consanddata->
vars;
6193 nvars = consanddata->
nvars;
6195 assert(nvars > 0 && vars !=
NULL);
6199 for( v = nvars - 1; v > 0; --v )
6204 if( nvars < nminvars )
6207 else if( nvars > nmaxvars )
6209 assert(nminvars > 0);
6210 assert(nminvars <= nmaxvars);
6213 for( v = 0, v2 = 0; v < neqvars && v2 <
nvars; )
6218 assert(eqvars[v] !=
NULL);
6219 assert(vars[v2] !=
NULL);
6224 if( index1 < index2 )
6226 else if( index1 > index2 )
6230 assert(index1 == index2);
6231 assert(nneweqvars <= v);
6233 if( nneweqvars < v )
6234 eqvars[nneweqvars] = eqvars[v];
6240 neqvars = nneweqvars;
6245 if( nminvars > neqvars + 1 )
6287 if( neqvars > 0 && consdata->nlinvars == 0 )
6293 for( v = 0; v < neqvars; ++v )
6310 if( nminvars == neqvars )
6322 if( neqvars > 0 && nminvars == nmaxvars && nminvars == neqvars + 1 )
6333 lincons = consdata->lincons;
6345 for( c = nconsanddatas - 1; c >= 0; --c )
6351 consanddata = consanddatas[c];
6352 assert(consanddata !=
NULL);
6363 vars = consanddata->
vars;
6364 nvars = consanddata->
nvars;
6366 assert(nvars > 0 && vars !=
NULL);
6368 for( v = 0, v2 = 0; v < neqvars && v2 <
nvars; )
6373 assert(eqvars[v] !=
NULL);
6374 assert(vars[v2] !=
NULL);
6379 assert(index1 >= index2);
6381 if( index1 > index2 )
6388 assert(index1 == index2);
6397 assert(v == neqvars);
6398 for( ; v2 <
nvars; ++v2)
6403 assert(v == neqvars && v2 == nvars);
6410 if( consdata->nlinvars > 0 )
6420 for( v = 0; v < neqvars; ++v )
6427 assert(nvars == consdata->nlinvars + consdata->nconsanddatas);
6437 assert(nvars == 0 || (coefs !=
NULL));
6441 for( v = 0; v <
nvars; ++v )
6442 assert(
SCIPisEQ(scip, coefs[v], 1.0));
6447 assert(nlinvars == consdata->nlinvars);
6450 for( v = 0; v < nlinvars; ++v )
6468 SCIPdebugMsg(scip,
"created upgraded linear constraint:\n");
6496 int*
const ndelconss,
6497 int*
const naddconss,
6498 int*
const nfixedvars,
6499 int*
const nchgcoefs,
6500 int*
const nchgsides,
6516 assert(scip !=
NULL);
6517 assert(cons !=
NULL);
6518 assert(conshdlrdata !=
NULL);
6519 assert(ndelconss !=
NULL);
6520 assert(nfixedvars !=
NULL);
6521 assert(nchgcoefs !=
NULL);
6522 assert(nchgsides !=
NULL);
6523 assert(cutoff !=
NULL);
6527 assert(consdata !=
NULL);
6529 consanddatas = consdata->consanddatas;
6530 nconsanddatas = consdata->nconsanddatas;
6531 assert(nconsanddatas > 0 && consanddatas !=
NULL);
6533 assert(consdata->lincons !=
NULL);
6550 assert(consanddatas[0] !=
NULL);
6551 assert(consanddatas[0]->cons !=
NULL);
6553 if( nconsanddatas == 1 )
6556 if( consdata->nlinvars == 0 )
6585 if( consdata->nlinvars > 0 )
6590 assert(consdata->nlinvars == 0 && nconsanddatas > 1);
6592 c = nconsanddatas - 1;
6596 if( consanddatas[c]->
nnewvars > 0 )
6598 neqvars = consanddatas[c]->
nnewvars;
6604 neqvars = consanddatas[c]->
nvars;
6610 assert(neqvars > 0 && eqvars !=
NULL);
6614 for( v = neqvars - 1; v > 0; --v )
6618 for( --c ; c >= 0; --c )
6625 consanddata = consanddatas[c];
6626 assert(consanddata !=
NULL);
6637 vars = consanddata->
vars;
6638 nvars = consanddata->
nvars;
6640 assert(nvars > 0 && vars !=
NULL);
6644 for( v = nvars - 1; v > 0; --v )
6649 if( nvars < nminvars )
6652 else if( nvars > nmaxvars )
6654 assert(nminvars > 0);
6655 assert(nminvars <= nmaxvars);
6658 for( v = 0, v2 = 0; v < neqvars && v2 <
nvars; )
6663 assert(eqvars[v] !=
NULL);
6664 assert(vars[v2] !=
NULL);
6669 if( index1 < index2 )
6671 else if( index1 > index2 )
6675 assert(index1 == index2);
6676 assert(nneweqvars <= v);
6678 if( nneweqvars < v )
6679 eqvars[nneweqvars] = eqvars[v];
6685 neqvars = nneweqvars;
6727 if( neqvars > 0 && ((nminvars == nmaxvars && nminvars == neqvars + 1) || (nminvars == neqvars) || (type ==
SCIP_SETPPCTYPE_PARTITIONING)) )
6757 if( neqvars == nminvars )
6760 createcons = (
SCIPisLE(scip, lhs, rhs) && ((nminvars == nmaxvars && nminvars == neqvars + 1) || (nminvars == neqvars)));
6765 lincons = consdata->lincons;
6783 for( c = nconsanddatas - 1; c >= 0; --c )
6789 consanddata = consanddatas[c];
6790 assert(consanddata !=
NULL);
6801 vars = consanddata->
vars;
6802 nvars = consanddata->
nvars;
6804 assert(nvars > 0 && vars !=
NULL);
6807 if( deletecons && neqvars + 1 < nvars )
6826 for( v = 0, v2 = 0; v < neqvars && v2 <
nvars; )
6831 assert(eqvars[v] !=
NULL);
6832 assert(vars[v2] !=
NULL);
6837 assert(index1 >= index2);
6839 if( index1 > index2 )
6843 assert(newcons !=
NULL);
6846 else if( deletecons )
6863 assert(index1 == index2);
6873 assert(v == neqvars);
6874 for( ; v2 <
nvars; ++v2)
6880 else if( deletecons )
6895 assert(v == neqvars && v2 == nvars);
6901 for( v = 0; v < neqvars; ++v )
6927 assert(newcons !=
NULL);
6937 SCIPdebugMsg(scip,
"created upgraded linear constraint:\n");
6946 assert(!deletecons);
6972 int*
const ndelconss,
6973 int*
const naddconss,
6974 int*
const nfixedvars,
6975 int*
const nchgcoefs,
6976 int*
const nchgsides,
6986 assert(scip !=
NULL);
6987 assert(cons !=
NULL);
6988 assert(conshdlrdata !=
NULL);
6989 assert(ndelconss !=
NULL);
6990 assert(nfixedvars !=
NULL);
6991 assert(nchgcoefs !=
NULL);
6992 assert(nchgsides !=
NULL);
6993 assert(cutoff !=
NULL);
6997 assert(consdata !=
NULL);
6998 assert(consdata->lincons !=
NULL);
7001 consanddatas = consdata->consanddatas;
7002 assert(consdata->nconsanddatas == 0 || consanddatas !=
NULL);
7006 if( consdata->nconsanddatas == 0 )
7022 assert(consdata->nlinvars + consdata->nconsanddatas ==
nvars);
7024 switch( consdata->linconstype )
7027 SCIP_CALL(
tryUpgradingXor(scip, cons, conshdlrdata, ndelconss, naddconss, nfixedvars, nchgcoefs, nchgsides, cutoff) );
7038 SCIP_CALL(
tryUpgradingXor(scip, cons, conshdlrdata, ndelconss, naddconss, nfixedvars, nchgcoefs, nchgsides, cutoff) );
7041 #ifdef WITHEQKNAPSACK 7042 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
7043 SCIP_CALL(
tryUpgradingXor(scip, cons, conshdlrdata, ndelconss, naddconss, nfixedvars, nchgcoefs, nchgsides, cutoff) );
7059 consdata->upgradetried =
TRUE;
7070 int*
const ndelconss,
7071 int*
const naggrvars,
7092 assert(scip !=
NULL);
7093 assert(cons !=
NULL);
7094 assert(conshdlrdata !=
NULL);
7095 assert(ndelconss !=
NULL);
7096 assert(naggrvars !=
NULL);
7097 assert(cutoff !=
NULL);
7104 assert(consdata !=
NULL);
7105 assert(consdata->lincons !=
NULL);
7107 consanddatas = consdata->consanddatas;
7108 nconsanddatas = consdata->nconsanddatas;
7109 assert(nconsanddatas == 0 || consanddatas !=
NULL);
7115 assert(
SCIPisEQ(scip, consdata->rhs, consdata->lhs));
7116 assert(
SCIPisEQ(scip, consdata->rhs, 1.0));
7118 if( nconsanddatas < 2 || nconsanddatas > 3 )
7124 assert(consdata->nlinvars + nconsanddatas ==
nvars);
7127 if( consdata->nlinvars != 1 )
7131 if( consanddatas[0]->
nnewvars > 0 )
7136 if( consanddatas[1]->
nnewvars > 0 )
7156 if( consanddatas[nconsanddatas - 1]->
nnewvars > 0 )
7157 vars = consanddatas[nconsanddatas - 1]->
newvars;
7159 vars = consanddatas[nconsanddatas - 1]->
vars;
7167 for( v = 1; v <
nvars; ++v )
7187 assert(var1 != var2);
7192 for( v =
nvars - 1; v >= 0; --v )
7203 ++(varcount[negated[v]][v]);
7206 for( c = nconsanddatas - 2; c >= 0; --c )
7211 if( consanddatas[nconsanddatas - 1]->
nnewvars > 0 )
7212 vars = consanddatas[c]->
newvars;
7214 vars = consanddatas[c]->
vars;
7225 for( v = 1; v <
nvars; ++v )
7245 assert(var1 != var2);
7250 for( v = nvars - 1; v >= 0; --v )
7260 if(
SCIPsortedvecFindPtr((
void**)allvars, SCIPvarCompActiveAndNegated, repvars[v], nvars, &pos) )
7262 assert(pos >= 0 && pos < nvars);
7264 ++(varcount[negated[v]][pos]);
7277 for( i = 1; i >= 0; --i )
7279 for( v =
nvars - 1; v >= 0; --v )
7283 if( varcount[i][v] == 0 )
7285 else if( varcount[i][v] == 1 )
7287 else if( varcount[i][v] == 2 )
7295 if( othercount == 0 )
7300 if( nconsanddatas == 2 && twocount ==
nvars - 1 && onecount == 2 && zerocount == 1 )
7315 assert(nconsvars == consdata->nlinvars + nconsanddatas);
7316 assert(conscoefs !=
NULL);
7320 for( v = 0; v < nconsvars; ++v )
7321 assert(
SCIPisEQ(scip, conscoefs[v], 1.0));
7328 assert(nlinvars == 1);
7329 assert(linvar !=
NULL);
7347 for( i = 1; i >= 0; --i )
7349 for( v =
nvars - 1; v >= 0; --v )
7352 if( varcount[i][v] == 2 )
7364 assert(var !=
NULL);
7408 else if(
nvars == 2 && nconsanddatas == 3 && twocount == 2 && onecount == 2 && zerocount == 0)
7427 assert(nconsvars == consdata->nlinvars + nconsanddatas);
7428 assert(conscoefs !=
NULL);
7432 for( v = 0; v < nconsvars; ++v )
7433 assert(
SCIPisEQ(scip, conscoefs[v], 1.0));
7440 assert(nlinvars == 1);
7441 assert(linvar !=
NULL);
7446 newandvars[0] =
NULL;
7447 newandvars[1] =
NULL;
7451 for( i = 1; i >= 0; --i )
7453 for( v =
nvars - 1; v >= 0; --v )
7456 if( varcount[i][v] == 1 )
7458 if( newandvars[0] ==
NULL )
7462 assert(newandvars[1] ==
NULL);
7474 assert(newandvars[0] !=
NULL && newandvars[1] !=
NULL);
7519 assert(scip !=
NULL);
7520 assert(conshdlr !=
NULL);
7537 assert(scip !=
NULL);
7538 assert(conshdlr !=
NULL);
7543 assert(conshdlrdata !=
NULL);
7560 assert(scip !=
NULL);
7561 assert(conshdlr !=
NULL);
7565 assert(conshdlrdata !=
NULL);
7568 for( c = conshdlrdata->nallconsanddatas - 1; c >= 0; --c )
7577 assert(conshdlrdata->allconsanddatas[c] !=
NULL);
7578 assert(conshdlrdata->allconsanddatas[c]->newvars ==
NULL);
7580 vars = conshdlrdata->allconsanddatas[c]->vars;
7581 nvars = conshdlrdata->allconsanddatas[c]->nvars;
7582 assert(vars !=
NULL || nvars == 0);
7585 for( v = nvars - 1; v > 0; --v )
7593 andcons = conshdlrdata->allconsanddatas[c]->cons;
7594 assert(andcons !=
NULL);
7604 SCIPconsGetName(conshdlrdata->allconsanddatas[c]->cons), (
void*)(conshdlrdata->allconsanddatas[c]),
7605 (
void*)(conshdlrdata->allconsanddatas[c]->cons));
7618 assert(scip !=
NULL);
7619 assert(conshdlr !=
NULL);
7623 assert(conshdlrdata !=
NULL);
7626 if( conshdlrdata->decomposeindicatorpbcons || conshdlrdata->decomposenormalpbcons )
7628 for( c = 0; c < nconss; ++c )
7637 assert(cons !=
NULL);
7644 assert(consdata !=
NULL);
7655 assert(nvars == 0 || (coefs !=
NULL));
7657 if( consdata->issoftcons && conshdlrdata->decomposeindicatorpbcons )
7666 #if USEINDICATOR == FALSE 7676 assert(consdata->weight != 0);
7677 assert(consdata->indvar !=
NULL);
7680 assert(consdata->intvar ==
NULL);
7684 assert(negindvar !=
NULL);
7692 updateandconss =
FALSE;
7694 #if USEINDICATOR == FALSE 7699 for( v = nvars - 1; v >= 0; --v )
7733 updateandconss =
TRUE;
7745 ub = lhs - maxact - 1;
7776 if( !updateandconss )
7792 lb = rhs - minact + 1;
7827 updateandconss =
TRUE;
7840 for( v = nvars - 1; v >= 0; --v )
7850 if( !updateandconss )
7868 else if( !consdata->issoftcons && conshdlrdata->decomposenormalpbcons )
7879 if( consdata->intvar !=
NULL )
7905 assert(scip !=
NULL);
7906 assert(conshdlr !=
NULL);
7907 assert(cons !=
NULL);
7908 assert(consdata !=
NULL);
7909 assert(*consdata !=
NULL);
7913 assert(conshdlrdata !=
NULL);
7924 for( c = (*consdata)->nconsanddatas - 1; c >= 0; --c )
7926 assert((*consdata)->consanddatas[c]->nuses == 0);
7927 assert((*consdata)->consanddatas[c]->cons ==
NULL);
7928 assert((*consdata)->consanddatas[c]->noriguses == 0 || ((*consdata)->consanddatas[c]->origcons !=
NULL &&
SCIPconsIsOriginal((*consdata)->consanddatas[c]->origcons)));
7931 conshdlrdata->noriguses -= (*consdata)->nconsanddatas;
7933 assert(conshdlrdata->noriguses >= 0);
7950 assert(scip !=
NULL);
7951 assert(conshdlr !=
NULL);
7954 assert(sourcecons !=
NULL);
7955 assert(targetcons !=
NULL);
7958 assert(sourcedata !=
NULL);
7960 assert(sourcedata->nconsanddatas == 0 || sourcedata->consanddatas !=
NULL);
7966 for( c = sourcedata->nconsanddatas - 1; c >= 0; --c )
7968 assert(sourcedata->consanddatas[c] !=
NULL);
7969 andconss[c] = sourcedata->consanddatas[c]->origcons;
7970 assert(andconss[c] !=
NULL);
7976 andconss, sourcedata->andcoefs, sourcedata->andnegs, sourcedata->nconsanddatas, sourcedata->indvar, sourcedata->weight,
7977 sourcedata->issoftcons, sourcedata->intvar, sourcedata->lhs, sourcedata->rhs,
SCIPconsIsChecked(sourcecons),
7999 assert(scip !=
NULL);
8000 assert(conshdlr !=
NULL);
8002 assert(result !=
NULL);
8024 assert(scip !=
NULL);
8025 assert(conshdlr !=
NULL);
8027 assert(result !=
NULL);
8049 assert(scip !=
NULL);
8050 assert(conshdlr !=
NULL);
8052 assert(result !=
NULL);
8075 assert(scip !=
NULL);
8076 assert(conshdlr !=
NULL);
8077 assert(sol !=
NULL);
8079 assert(result !=
NULL);
8089 for( c = nconss - 1; c >= 0 && (*result ==
SCIP_FEASIBLE || completely); --c )
8092 assert(consdata !=
NULL);
8094 if( consdata->issoftcons )
8096 assert(consdata->indvar !=
NULL);
8127 int firstupgradetry;
8137 assert(scip !=
NULL);
8138 assert(conshdlr !=
NULL);
8140 assert(result !=
NULL);
8143 oldnfixedvars = *nfixedvars;
8144 oldnaggrvars = *naggrvars;
8145 oldnchgbds = *nchgbds;
8146 oldndelconss = *ndelconss;
8147 oldnupgdconss = *nupgdconss;
8148 oldnchgcoefs = *nchgcoefs;
8149 oldnchgsides = *nchgsides;
8157 firstchange = INT_MAX;
8158 firstupgradetry = INT_MAX;
8161 for( c = 0; c < nconss && !cutoff && !
SCIPisStopped(scip); ++c )
8179 assert(cons !=
NULL);
8183 assert(consdata !=
NULL);
8184 assert(consdata->lincons !=
NULL);
8201 assert(
SCIPisLE(scip, newlhs, newrhs));
8217 assert(nvars == 0 || (coefs !=
NULL));
8224 andress, andcoefs, andnegs, &nandress) );
8237 if( firstchange == INT_MAX && consdata->changed )
8250 if( consdata->changed )
8253 SCIP_CALL(
tryUpgrading(scip, cons, conshdlrdata, ndelconss, naddconss, nfixedvars, nchgcoefs, nchgsides, &cutoff) );
8263 if( firstupgradetry == INT_MAX && !consdata->upgradetried )
8264 firstupgradetry = c;
8269 consdata->presolved =
TRUE;
8287 consdata->changed =
FALSE;
8306 else if( *nfixedvars > oldnfixedvars || *naggrvars > oldnaggrvars || *nchgbds > oldnchgbds || *ndelconss > oldndelconss
8307 || *nupgdconss > oldnupgdconss || *nchgcoefs > oldnchgcoefs || *nchgsides > oldnchgsides )
8327 assert(scip !=
NULL);
8328 assert(cons !=
NULL);
8329 assert(conshdlr !=
NULL);
8333 assert(consdata !=
NULL);
8335 lhs = consdata->lhs;
8336 rhs = consdata->rhs;
8344 SCIPdebugMsg(scip,
"%socking constraint <%s> by [%d;%d].\n", (nlocksneg < 0) || (nlockspos < 0) ?
"Unl" :
"L",
SCIPconsGetName(cons), nlocksneg, nlockspos);
8347 for( c = consdata->nconsanddatas - 1; c >= 0; --c )
8356 consanddata = consdata->consanddatas[c];
8357 assert( consanddata !=
NULL );
8362 andcons = consanddata->
cons;
8364 if( andcons ==
NULL )
8367 assert(consanddata->
nnewvars == 0);
8368 assert(consanddata->
nvars == 0);
8373 consanddata->
nvars = 0;
8374 consanddata->
svars = 0;
8381 assert(andcons !=
NULL);
8384 andvars = consanddata->
newvars;
8389 andvars = consanddata->
vars;
8390 nandvars = consanddata->
nvars;
8395 assert(nandvars == 0 || andvars !=
NULL);
8396 assert(andres !=
NULL);
8397 val = consdata->andnegs[c] ? -consdata->andcoefs[c] : consdata->andcoefs[c];
8404 for( v = nandvars - 1; v >= 0; --v )
8414 for( v = nandvars - 1; v >= 0; --v )
8431 for( v = nandvars - 1; v >= 0; --v )
8441 for( v = nandvars - 1; v >= 0; --v )
8463 assert(scip !=
NULL);
8464 assert(conshdlr !=
NULL);
8466 assert(cons !=
NULL);
8477 const char* consname;
8479 assert(scip !=
NULL);
8480 assert(sourcescip !=
NULL);
8481 assert(sourcecons !=
NULL);
8489 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode, global,
8491 assert(cons !=
NULL || *valid ==
FALSE);
8513 assert(scip !=
NULL);
8514 assert(conshdlr !=
NULL);
8515 assert(cons !=
NULL);
8516 assert(vars !=
NULL);
8517 assert(varssize >= 0);
8518 assert(success !=
NULL);
8534 assert(consdata !=
NULL);
8535 assert(consdata->lincons !=
NULL);
8547 assert(nlinconsvars >= 0);
8550 if( nlinconsvars == 0 )
8557 else if( varssize < nlinconsvars )
8578 assert(nlinconsvars == nlinvars + nandress);
8584 assert(linvars !=
NULL);
8591 assert(andress !=
NULL);
8595 assert(conshdlrdata !=
NULL);
8596 assert(conshdlrdata->hashmap !=
NULL);
8600 for( r = nandress - 1; r >= 0; --r )
8604 assert(andress[r] !=
NULL);
8608 assert(consanddata !=
NULL);
8612 andcons = consanddata->
cons;
8616 assert(andcons !=
NULL);
8619 if( varssize <= nvars )
8627 vars[
nvars] = andress[r];
8635 assert(noperands >= 0);
8638 if( varssize < nvars + noperands )
8681 assert(scip !=
NULL);
8682 assert(conshdlr !=
NULL);
8683 assert(cons !=
NULL);
8685 assert(success !=
NULL);
8698 assert(consdata !=
NULL);
8699 assert(consdata->lincons !=
NULL);
8711 assert(nlinconsvars >= 0);
8714 if( nlinconsvars == 0 )
8735 assert(nlinconsvars == nlinvars + nandress);
8742 assert(andress !=
NULL);
8746 assert(conshdlrdata !=
NULL);
8747 assert(conshdlrdata->hashmap !=
NULL);
8751 for( r = nandress - 1; r >= 0; --r )
8755 assert(andress[r] !=
NULL);
8759 assert(consanddata !=
NULL);
8763 andcons = consanddata->
cons;
8767 assert(andcons !=
NULL);
8808 consEnfolpPseudoboolean, consEnfopsPseudoboolean, consCheckPseudoboolean, consLockPseudoboolean,
8810 assert(conshdlr !=
NULL);
8829 "decompose all normal pseudo boolean constraint into a \"linear\" constraint and \"and\" constraints",
8833 "decompose all indicator pseudo boolean constraint into a \"linear\" constraint and \"and\" constraints",
8836 "constraints/" CONSHDLR_NAME "/nlcseparate",
"should the nonlinear constraints be separated during LP processing?",
8839 "constraints/" CONSHDLR_NAME "/nlcpropagate",
"should the nonlinear constraints be propagated during node processing?",
8842 "constraints/" CONSHDLR_NAME "/nlcremovable",
"should the nonlinear constraints be removable?",
8903 assert(scip !=
NULL);
8904 assert(cons !=
NULL);
8905 assert(lincons !=
NULL);
8907 assert(andconss !=
NULL);
8908 assert(andcoefs !=
NULL);
8909 assert(nandconss >= 1);
8910 assert(issoftcons == (indvar !=
NULL));
8914 if( conshdlr ==
NULL )
8922 assert(conshdlrdata !=
NULL);
8927 assert(conshdlrdata->hashmap !=
NULL);
8928 assert(conshdlrdata->hashtable !=
NULL);
8929 assert(conshdlrdata->allconsanddatas !=
NULL);
8930 assert(conshdlrdata->nallconsanddatas <= conshdlrdata->sallconsanddatas);
8932 memisinvalid =
TRUE;
8938 for( c = nandconss - 1; c >= 0; --c )
8940 assert(andconss[c] !=
NULL);
8945 assert(res !=
NULL);
8970 assert(newdata !=
NULL);
8992 assert(transformed);
8993 newdata->
cons = andconss[c];
8996 for( v = newdata->
nvars - 1; v >= 0; --v )
9004 assert(!transformed);
9012 if( tmpdata ==
NULL || (tmpdata->
cons != andconss[c] && tmpdata->
origcons != andconss[c]))
9016 SCIPwarningMessage(scip,
"Another and-constraint with the same variables but different and-resultant is added to the global and-constraint hashtable of pseudoboolean constraint handler.\n");
9020 if( conshdlrdata->nallconsanddatas == conshdlrdata->sallconsanddatas )
9025 conshdlrdata->allconsanddatas[conshdlrdata->nallconsanddatas] = newdata;
9026 ++(conshdlrdata->nallconsanddatas);
9032 memisinvalid =
TRUE;
9048 newdata->noriguses = 1;
9058 memisinvalid =
FALSE;
9062 assert(tmpdata->
nuses > 0);
9079 assert(newdata !=
NULL);
9102 indvar, weight, issoftcons, intvar, lhs, rhs, check,
FALSE) );
9103 assert(consdata !=
NULL);
9106 SCIP_CALL(
SCIPcreateCons(scip, cons, name, conshdlr, consdata, initial, separate, enforce, check, propagate,
9107 local, modifiable, dynamic, removable, stickingatnode) );
9175 assert(scip !=
NULL);
9176 assert(cons !=
NULL);
9177 assert(nlinvars == 0 || (linvars !=
NULL && linvals !=
NULL));
9178 assert(nterms == 0 || (terms !=
NULL && termvals !=
NULL && ntermvars !=
NULL));
9179 assert(issoftcons == (indvar !=
NULL));
9183 if( conshdlr ==
NULL )
9189 #if USEINDICATOR == TRUE 9190 if( issoftcons && modifiable )
9192 SCIPerrorMessage(
"Indicator constraint handler can't work with modifiable constraints\n");
9199 assert(conshdlrdata !=
NULL);
9213 initial, enforce, check, local, modifiable, dynamic, stickingatnode,
9214 andconss, andcoefs, andnegs, &nandconss) );
9215 assert(nterms >= nandconss);
9218 for( c = nandconss - 1; c >= 0; --c )
9220 assert(andconss[c] !=
NULL);
9237 &lhs, &rhs, initial, separate, enforce,
FALSE, propagate, local, modifiable, dynamic, removable,
9238 stickingatnode, &lincons, &linconstype) );
9239 assert(lincons !=
NULL);
9244 SCIP_CALL(
consdataCreate(scip, conshdlr, &consdata, lincons, linconstype, andconss, andcoefs, andnegs, nandconss,
9245 indvar, weight, issoftcons, intvar, lhs, rhs, check,
FALSE) );
9246 assert(consdata !=
NULL);
9255 SCIP_CALL(
SCIPcreateCons(scip, cons, name, conshdlr, consdata, initial, separate, enforce, check, propagate,
9256 local, modifiable, dynamic, removable, stickingatnode) );
9288 terms, nterms, ntermvars, termvals, indvar, weight, issoftcons, intvar, lhs, rhs,
9310 assert(scip !=
NULL);
9311 assert(cons !=
NULL);
9312 assert(var !=
NULL);
9325 assert(consdata !=
NULL);
9327 switch( consdata->linconstype )
9350 #ifdef WITHEQKNAPSACK 9351 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
9364 consdata->propagated =
FALSE;
9365 consdata->presolved =
FALSE;
9366 consdata->cliquesadded =
FALSE;
9386 assert(scip !=
NULL);
9387 assert(cons !=
NULL);
9410 assert(scip !=
NULL);
9411 assert(cons !=
NULL);
9421 assert(consdata !=
NULL);
9423 return consdata->indvar;
9434 assert(scip !=
NULL);
9435 assert(cons !=
NULL);
9445 assert(consdata !=
NULL);
9447 return consdata->lincons;
9458 assert(scip !=
NULL);
9459 assert(cons !=
NULL);
9469 assert(consdata !=
NULL);
9471 return consdata->linconstype;
9482 assert(scip !=
NULL);
9483 assert(cons !=
NULL);
9495 assert(consdata !=
NULL);
9497 return consdata->nlinvars;
9515 assert(scip !=
NULL);
9516 assert(cons !=
NULL);
9517 assert(nlinvars !=
NULL);
9518 assert(*nlinvars == 0 || linvars !=
NULL);
9519 assert(*nlinvars == 0 || lincoefs !=
NULL);
9529 assert(consdata !=
NULL);
9533 if( *nlinvars < consdata->nlinvars )
9535 *nlinvars = consdata->nlinvars;
9550 SCIP_CALL(
getLinVarsAndAndRess(scip, cons, vars, coefs,
nvars, linvars, lincoefs, nlinvars,
NULL,
NULL,
NULL,
NULL) );
9574 assert(scip !=
NULL);
9575 assert(cons !=
NULL);
9576 assert(nandconss !=
NULL);
9577 assert(*nandconss == 0 || andconss !=
NULL);
9578 assert(*nandconss == 0 || andcoefs !=
NULL);
9588 assert(consdata !=
NULL);
9592 if( *nandconss < consdata->nconsanddatas )
9594 *nandconss = consdata->nconsanddatas;
9598 *nandconss = consdata->nconsanddatas;
9599 assert(*nandconss == 0 || consdata->consanddatas !=
NULL);
9603 for( c = *nandconss - 1; c >= 0; --c )
9605 assert(consdata->consanddatas[c] !=
NULL);
9606 assert(consdata->consanddatas[c]->istransformed ? (consdata->consanddatas[c]->cons !=
NULL) :
TRUE);
9607 assert(consdata->consanddatas[c]->isoriginal ? (consdata->consanddatas[c]->origcons !=
NULL) : TRUE);
9608 assert(consdata->consanddatas[c]->cons !=
NULL || consdata->consanddatas[c]->origcons !=
NULL);
9609 assert(isorig ? consdata->consanddatas[c]->origcons !=
NULL : consdata->consanddatas[c]->cons !=
NULL);
9611 andconss[c] = (isorig ? consdata->consanddatas[c]->origcons : consdata->consanddatas[c]->cons);
9612 assert(andconss[c] !=
NULL);
9614 andcoefs[c] = consdata->andcoefs[c];
9628 assert(scip !=
NULL);
9629 assert(cons !=
NULL);
9641 assert(consdata !=
NULL);
9643 return consdata->nconsanddatas;
9661 assert(scip !=
NULL);
9662 assert(cons !=
NULL);
9673 assert(consdata !=
NULL);
9675 switch( consdata->linconstype )
9683 #ifdef WITHEQKNAPSACK 9684 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
9686 SCIPerrorMessage(
"changing left hand side only allowed on standard linear constraint \n");
9721 assert(consdata !=
NULL);
9723 switch( consdata->linconstype )
9731 #ifdef WITHEQKNAPSACK 9732 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
9734 SCIPerrorMessage(
"changing right hand side only allowed on standard linear constraint \n");
9763 assert(consdata !=
NULL);
9765 return consdata->lhs;
9786 assert(consdata !=
NULL);
9788 return consdata->rhs;
void SCIPsortPtrPtrRealBool(void **ptrarray1, void **ptrarray2, SCIP_Real *realarray, SCIP_Bool *boolarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
static SCIP_RETCODE checkLocksAndRes(SCIP *const scip, SCIP_VAR *res)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
SCIP_RETCODE SCIPaddCoefLogicor(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
void SCIPconshdlrSetData(SCIP_CONSHDLR *conshdlr, SCIP_CONSHDLRDATA *conshdlrdata)
SCIP_Bool SCIPisFeasZero(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPincConsAge(SCIP *scip, SCIP_CONS *cons)
static SCIP_DECL_CONSENFOLP(consEnfolpPseudoboolean)
SCIP_RETCODE SCIPsetConshdlrDelete(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSDELETE((*consdelete)))
#define ARTIFICIALVARNAMEPREFIX
SCIP_Bool SCIPvarsHaveCommonClique(SCIP_VAR *var1, SCIP_Bool value1, SCIP_VAR *var2, SCIP_Bool value2, SCIP_Bool regardimplics)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPaddCoefSetppc(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
SCIP_STAGE SCIPgetStage(SCIP *scip)
SCIP_Bool SCIPconsIsDynamic(SCIP_CONS *cons)
SCIP_RETCODE SCIPsetConshdlrTrans(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSTRANS((*constrans)))
SCIP_RETCODE SCIPgetBinvarRepresentative(SCIP *scip, SCIP_VAR *var, SCIP_VAR **repvar, SCIP_Bool *negated)
static SCIP_DECL_CONSCHECK(consCheckPseudoboolean)
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPhashtableInsert(SCIP_HASHTABLE *hashtable, void *element)
static SCIP_DECL_CONSINIT(consInitPseudoboolean)
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
SCIP_RETCODE SCIPgetAndDatasPseudoboolean(SCIP *const scip, SCIP_CONS *const cons, SCIP_CONS **const andconss, SCIP_Real *const andcoefs, int *const nandconss)
int SCIPgetNVarsSetppc(SCIP *scip, SCIP_CONS *cons)
#define SCIPallocClearBufferArray(scip, ptr, num)
SCIP_RETCODE SCIPsortAndCons(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE addCliques(SCIP *const scip, SCIP_CONS *const cons, SCIP_Bool *const cutoff, int *const naggrvars, int *const nchgbds)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_RETCODE SCIPsetConshdlrGetVars(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSGETVARS((*consgetvars)))
int SCIPgetNVarsLogicor(SCIP *scip, SCIP_CONS *cons)
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)
SCIP_RETCODE SCIPdelCons(SCIP *scip, SCIP_CONS *cons)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
static SCIP_RETCODE computeConsAndDataChanges(SCIP *const scip, SCIP_CONSHDLRDATA *const conshdlrdata)
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
SCIP_RETCODE SCIPcreateConsSetcover(SCIP *scip, SCIP_CONS **cons, const char *name, 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)
static SCIP_DECL_CONSCOPY(consCopyPseudoboolean)
static SCIP_RETCODE getLinearConsNVars(SCIP *const scip, SCIP_CONS *const cons, SCIP_LINEARCONSTYPE const constype, int *const nvars)
SCIP_Bool SCIPconsIsAdded(SCIP_CONS *cons)
SCIP_RETCODE SCIPgetTransformedVar(SCIP *scip, SCIP_VAR *var, SCIP_VAR **transvar)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
SCIP_RETCODE SCIPsetConshdlrInitpre(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINITPRE((*consinitpre)))
constraint handler for indicator constraints
SCIP_RETCODE SCIPincludeConshdlrPseudoboolean(SCIP *scip)
#define CONSHDLR_ENFOPRIORITY
#define DEFAULT_REMOVABLENONLINEAR
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
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 SCIPinfinity(SCIP *scip)
int SCIPsnprintf(char *t, int len, const char *s,...)
enum SCIP_Retcode SCIP_RETCODE
SCIP_RETCODE SCIPaddVarLocks(SCIP *scip, SCIP_VAR *var, int nlocksdown, int nlocksup)
SCIP_Bool SCIPconsIsStickingAtNode(SCIP_CONS *cons)
enum SCIP_Varstatus SCIP_VARSTATUS
SCIP_RETCODE SCIPcreateConsXor(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_Bool rhs, 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)
SCIP_RETCODE SCIPchgLhsPseudoboolean(SCIP *const scip, SCIP_CONS *const cons, SCIP_Real const lhs)
static SCIP_RETCODE tryUpgradingXor(SCIP *const scip, SCIP_CONS *const cons, SCIP_CONSHDLRDATA *const conshdlrdata, int *const ndelconss, int *const naddconss, int *const nfixedvars, int *const nchgcoefs, int *const nchgsides, SCIP_Bool *const cutoff)
SCIP_RETCODE SCIPcreateConsPseudoboolean(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR **linvars, int nlinvars, SCIP_Real *linvals, SCIP_VAR ***terms, int nterms, int *ntermvars, SCIP_Real *termvals, SCIP_VAR *indvar, SCIP_Real weight, SCIP_Bool issoftcons, SCIP_VAR *intvar, 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_Bool SCIPconsIsTransformed(SCIP_CONS *cons)
static SCIP_RETCODE addCoefTerm(SCIP *const scip, SCIP_CONS *const cons, SCIP_VAR **const vars, int const nvars, SCIP_Real const val)
public methods for problem variables
SCIP_VAR ** SCIPgetVarsKnapsack(SCIP *scip, SCIP_CONS *cons)
#define SCIPfreeBlockMemory(scip, ptr)
static SCIP_RETCODE consdataFree(SCIP *const scip, SCIP_CONSDATA **consdata, SCIP_Bool isorig, SCIP_CONSHDLRDATA *conshdlrdata)
Constraint handler for AND constraints, .
#define DEFAULT_SEPARATENONLINEAR
#define SCIPduplicateBufferArray(scip, ptr, source, num)
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_VAR * SCIPgetIndVarPseudoboolean(SCIP *const scip, SCIP_CONS *const cons)
SCIP_RETCODE SCIPaddCoefKnapsack(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Longint weight)
#define SCIPfreeBufferArray(scip, ptr)
#define HASHSIZE_PSEUDOBOOLEANNONLINEARTERMS
Constraint handler for the set partitioning / packing / covering constraints .
#define SCIPallocBlockMemory(scip, ptr)
#define SCIPdebugPrintCons(x, y, z)
SCIP_Bool SCIPisTransformed(SCIP *scip)
SCIP_VAR * SCIPvarGetNegationVar(SCIP_VAR *var)
SCIP_Bool SCIPconsIsRemovable(SCIP_CONS *cons)
#define DEFAULT_PROPAGATENONLINEAR
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
SCIP_RETCODE SCIPgetTransformedVars(SCIP *scip, int nvars, SCIP_VAR **vars, SCIP_VAR **transvars)
SCIP_Real SCIPgetRhsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPconsIsActive(SCIP_CONS *cons)
SCIP_RETCODE SCIPaddCoefLinear(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real val)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
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)
static SCIP_RETCODE checkOrigPbCons(SCIP *const scip, SCIP_CONS *const cons, SCIP_SOL *const sol, SCIP_Bool *const violated, SCIP_Bool const printreason)
SCIP_RETCODE SCIPhashtableCreate(SCIP_HASHTABLE **hashtable, BMS_BLKMEM *blkmem, int tablesize, SCIP_DECL_HASHGETKEY((*hashgetkey)), SCIP_DECL_HASHKEYEQ((*hashkeyeq)), SCIP_DECL_HASHKEYVAL((*hashkeyval)), void *userptr)
SCIP_Real SCIPfeasFloor(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPconsIsOriginal(SCIP_CONS *cons)
SCIP_Bool SCIPisAndConsSorted(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE transformToOrig(SCIP *const scip, CONSANDDATA *consanddata, SCIP_CONSHDLRDATA *conshdlrdata)
SCIP_VAR * SCIPvarGetNegatedVar(SCIP_VAR *var)
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
static SCIP_RETCODE chgLhsLinearCons(SCIP *const scip, SCIP_CONS *const cons, SCIP_LINEARCONSTYPE const constype, SCIP_Real const lhs)
static SCIP_RETCODE updateAndConss(SCIP *const scip, SCIP_CONS *const cons)
int SCIPgetNFixedVars(SCIP *scip)
static SCIP_RETCODE createAndAddAndCons(SCIP *const scip, SCIP_CONSHDLR *const conshdlr, SCIP_VAR **const vars, int const nvars, SCIP_Bool const initial, SCIP_Bool const enforce, SCIP_Bool const check, SCIP_Bool const local, SCIP_Bool const modifiable, SCIP_Bool const dynamic, SCIP_Bool const stickingatnode, SCIP_CONS **const andcons)
SCIP_VAR ** SCIPgetFixedVars(SCIP *scip)
SCIP_RETCODE SCIPsetConsSeparated(SCIP *scip, SCIP_CONS *cons, SCIP_Bool separate)
static SCIP_DECL_CONSLOCK(consLockPseudoboolean)
SCIP_RETCODE SCIPaddClique(SCIP *scip, SCIP_VAR **vars, SCIP_Bool *values, int nvars, SCIP_Bool isequation, SCIP_Bool *infeasible, int *nbdchgs)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
Constraint handler for knapsack constraints of the form , x binary and .
static SCIP_DECL_SORTPTRCOMP(resvarCompWithInactive)
static SCIP_RETCODE propagateCons(SCIP *const scip, SCIP_CONS *const cons, SCIP_Bool *const cutoff, int *const ndelconss)
unsigned int istransformed
SCIP_Bool SCIPconsIsLocked(SCIP_CONS *cons)
void SCIPsortPtrRealBool(void **ptrarray, SCIP_Real *realarray, SCIP_Bool *boolarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
SCIP_VAR ** SCIPgetVarsAnd(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE getLinearConsSides(SCIP *const scip, SCIP_CONS *const cons, SCIP_LINEARCONSTYPE const constype, SCIP_Real *const lhs, SCIP_Real *const rhs)
SCIP_RETCODE SCIPsetConshdlrCopy(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), SCIP_DECL_CONSCOPY((*conscopy)))
static SCIP_DECL_CONSPRESOL(consPresolPseudoboolean)
SCIP_RETCODE SCIPaddTermPseudoboolean(SCIP *const scip, SCIP_CONS *const cons, SCIP_VAR **const vars, int const nvars, SCIP_Real const val)
static SCIP_RETCODE findAggregation(SCIP *const scip, SCIP_CONS *const cons, SCIP_CONSHDLRDATA *const conshdlrdata, int *const ndelconss, int *const naggrvars, SCIP_Bool *const cutoff)
SCIP_RETCODE SCIPgetBinvarRepresentatives(SCIP *scip, int nvars, SCIP_VAR **vars, SCIP_VAR **repvars, SCIP_Bool *negated)
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)
SCIP_VAR * SCIPgetResultantAnd(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_DECL_CONSHDLRCOPY(conshdlrCopyPseudoboolean)
static SCIP_DECL_CONSPRINT(consPrintPseudoboolean)
void SCIPsortPtrBool(void **ptrarray, SCIP_Bool *boolarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
SCIP_RETCODE SCIPdelConsLocal(SCIP *scip, SCIP_CONS *cons)
Constraint handler for logicor constraints (equivalent to set covering, but algorithms are suited fo...
static SCIP_RETCODE copyConsPseudoboolean(SCIP *const targetscip, SCIP_CONS **targetcons, SCIP *const sourcescip, SCIP_CONS *const sourcecons, const char *name, SCIP_HASHMAP *const varmap, SCIP_HASHMAP *const consmap, SCIP_Bool const initial, SCIP_Bool const separate, SCIP_Bool const enforce, SCIP_Bool const check, SCIP_Bool const propagate, SCIP_Bool const local, SCIP_Bool const modifiable, SCIP_Bool const dynamic, SCIP_Bool const removable, SCIP_Bool const stickingatnode, SCIP_Bool const global, SCIP_Bool *const valid)
SCIP_Bool SCIPvarIsTransformedOrigvar(SCIP_VAR *var)
static SCIP_RETCODE checkAndConss(SCIP *const scip, SCIP_CONSHDLR *const conshdlr, SCIP_SOL *const sol, SCIP_Bool *const violated)
#define SCIPfreeBufferArrayNull(scip, ptr)
SCIP_RETCODE SCIPcreateConsPseudobooleanWithConss(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_CONS *lincons, SCIP_LINEARCONSTYPE linconstype, SCIP_CONS **andconss, SCIP_Real *andcoefs, int nandconss, SCIP_VAR *indvar, SCIP_Real weight, SCIP_Bool issoftcons, SCIP_VAR *intvar, 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)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
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)
SCIP_RETCODE SCIPsetConsChecked(SCIP *scip, SCIP_CONS *cons, SCIP_Bool check)
const char * SCIPconsGetName(SCIP_CONS *cons)
#define CONSHDLR_NEEDSCONS
SCIP_Bool SCIPconsIsPropagated(SCIP_CONS *cons)
static SCIP_RETCODE consdataPrint(SCIP *const scip, SCIP_CONS *const cons, FILE *const file)
SCIP_VAR ** SCIPgetVarsLogicor(SCIP *scip, SCIP_CONS *cons)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_RETCODE SCIPcreateConsSetpart(SCIP *scip, SCIP_CONS **cons, const char *name, 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)
SCIP_RETCODE SCIPsetConshdlrFree(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSFREE((*consfree)))
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
static SCIP_DECL_CONSINITPRE(consInitprePseudoboolean)
SCIP_RETCODE SCIPgetLinDatasWithoutAndPseudoboolean(SCIP *const scip, SCIP_CONS *const cons, SCIP_VAR **const linvars, SCIP_Real *const lincoefs, int *const nlinvars)
SCIP_CONSHDLRDATA * SCIPconshdlrGetData(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
int SCIPgetNLinVarsWithoutAndPseudoboolean(SCIP *const scip, SCIP_CONS *const cons)
#define CONSHDLR_MAXPREROUNDS
#define CONSHDLR_CHECKPRIORITY
enum SCIP_LinearConsType SCIP_LINEARCONSTYPE
SCIP_RETCODE SCIPcreateConsKnapsack(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Longint *weights, SCIP_Longint capacity, 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 SCIPtransformCons(SCIP *scip, SCIP_CONS *cons, SCIP_CONS **transcons)
void SCIPsortPtr(void **ptrarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
#define SCIPhashTwo(a, b)
SCIP_RETCODE SCIPchgAndConsRemovableFlagWhenUpgr(SCIP *scip, SCIP_CONS *cons, SCIP_Bool flag)
#define SCIPensureBlockMemoryArray(scip, ptr, arraysizeptr, minsize)
static SCIP_RETCODE unlockRoundingAndCons(SCIP *const scip, SCIP_CONS *const cons, CONSANDDATA *const consanddata, SCIP_Real const coef, SCIP_Real const lhs, SCIP_Real const rhs)
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPgetProbvarLinearSum(SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, int varssize, SCIP_Real *constant, int *requiredsize, SCIP_Bool mergemultiples)
SCIP_RETCODE SCIPremoveVarFromGlobalStructures(SCIP *scip, SCIP_VAR *var)
SCIP_RETCODE SCIPhashtableRemove(SCIP_HASHTABLE *hashtable, void *element)
SCIP_Real SCIPgetLhsPseudoboolean(SCIP *const scip, SCIP_CONS *const cons)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
SCIP_Bool SCIPconsIsLocal(SCIP_CONS *cons)
static SCIP_DECL_CONSTRANS(consTransPseudoboolean)
SCIP_RETCODE SCIPcaptureCons(SCIP *scip, SCIP_CONS *cons)
#define SCIPdebugGetSolVal(scip, var, val)
struct SCIP_ConsData SCIP_CONSDATA
SCIP_RETCODE SCIPaddCoefPseudoboolean(SCIP *const scip, SCIP_CONS *const cons, SCIP_VAR *const var, SCIP_Real const val)
#define checkConsConsistency(scip, cons)
static SCIP_RETCODE consdataCreate(SCIP *const scip, SCIP_CONSHDLR *const conshdlr, SCIP_CONSDATA **consdata, SCIP_CONS *const lincons, SCIP_LINEARCONSTYPE const linconstype, SCIP_CONS **const andconss, SCIP_Real *const andcoefs, SCIP_Bool *const andnegs, int const nandconss, SCIP_VAR *const indvar, SCIP_Real const weight, SCIP_Bool const issoftcons, SCIP_VAR *const intvar, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool check, SCIP_Bool transforming)
static SCIP_RETCODE tryUpgradingLogicor(SCIP *const scip, SCIP_CONS *const cons, SCIP_CONSHDLRDATA *const conshdlrdata, int *const ndelconss, int *const naddconss, int *const nfixedvars, int *const nchgcoefs, int *const nchgsides, SCIP_Bool *const cutoff)
SCIP_Longint SCIPgetCapacityKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPgetConsCopy(SCIP *sourcescip, SCIP *targetscip, SCIP_CONS *sourcecons, SCIP_CONS **targetcons, SCIP_CONSHDLR *sourceconshdlr, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *name, 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_Bool global, SCIP_Bool *valid)
static SCIP_RETCODE createAndAddLinearCons(SCIP *const scip, SCIP_CONSHDLR *const conshdlr, SCIP_VAR **const linvars, int const nlinvars, SCIP_Real *const linvals, SCIP_VAR **const andress, int const nandress, SCIP_Real const *const andvals, SCIP_Bool *const andnegs, SCIP_Real *const lhs, SCIP_Real *const rhs, SCIP_Bool const initial, SCIP_Bool const separate, SCIP_Bool const enforce, SCIP_Bool const check, SCIP_Bool const propagate, SCIP_Bool const local, SCIP_Bool const modifiable, SCIP_Bool const dynamic, SCIP_Bool const removable, SCIP_Bool const stickingatnode, SCIP_CONS **const lincons, SCIP_LINEARCONSTYPE *const linconstype)
static SCIP_RETCODE lockRoundingAndCons(SCIP *const scip, SCIP_CONS *const cons, CONSANDDATA *const consanddata, SCIP_Real const coef, SCIP_Real const lhs, SCIP_Real const rhs)
SCIP_RETCODE SCIPcreateConsSetpack(SCIP *scip, SCIP_CONS **cons, const char *name, 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)
SCIP_Bool SCIPvarIsOriginal(SCIP_VAR *var)
#define SCIPallocBufferArray(scip, ptr, num)
static SCIP_RETCODE chgRhsLinearCons(SCIP *const scip, SCIP_CONS *const cons, SCIP_LINEARCONSTYPE const constype, SCIP_Real const rhs)
SCIP_RETCODE SCIPchgAndConsCheckFlagWhenUpgr(SCIP *scip, SCIP_CONS *cons, SCIP_Bool flag)
static SCIP_RETCODE tryUpgrading(SCIP *const scip, SCIP_CONS *const cons, SCIP_CONSHDLRDATA *const conshdlrdata, int *const ndelconss, int *const naddconss, int *const nfixedvars, int *const nchgcoefs, int *const nchgsides, SCIP_Bool *const cutoff)
static SCIP_RETCODE checkSolution(SCIP *const scip, SCIP_VAR **const vars, int const nvars, SCIP_Bool *const values, SCIP_VAR **const linvars, SCIP_Real *const lincoefs, int const nlinvars, SCIP_Real const constant, SCIP_Real const side, CONSANDDATA **const consanddatas, SCIP_Real *const consanddatacoefs, SCIP_Bool *const consanddatanegs, int const nconsanddatas, int const cnt, int *const xortype)
SCIP_SETPPCTYPE SCIPgetTypeSetppc(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNAndsPseudoboolean(SCIP *const scip, SCIP_CONS *const cons)
SCIP_RETCODE SCIPprintCons(SCIP *scip, SCIP_CONS *cons, FILE *file)
SCIP_RETCODE SCIPchgRhsPseudoboolean(SCIP *const scip, SCIP_CONS *const cons, SCIP_Real const rhs)
int SCIPvarGetNLocksUp(SCIP_VAR *var)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
int SCIPvarCompare(SCIP_VAR *var1, SCIP_VAR *var2)
static SCIP_RETCODE conshdlrdataCreate(SCIP *const scip, SCIP_CONSHDLRDATA **conshdlrdata)
SCIP_Bool SCIPconsIsDeleted(SCIP_CONS *cons)
SCIP_CONS * SCIPgetLinearConsPseudoboolean(SCIP *const scip, SCIP_CONS *const cons)
static SCIP_DECL_HASHKEYEQ(hashKeyEqAndConsDatas)
static SCIP_RETCODE chgRhs(SCIP *const scip, SCIP_CONS *const cons, SCIP_Real rhs)
SCIP_Bool SCIPconsIsChecked(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsInitial(SCIP_CONS *cons)
#define CONSHDLR_PRESOLTIMING
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)
static SCIP_DECL_CONSGETNVARS(consGetNVarsPseudoboolean)
SCIP_RETCODE SCIPfixVar(SCIP *scip, SCIP_VAR *var, SCIP_Real fixedval, SCIP_Bool *infeasible, SCIP_Bool *fixed)
static SCIP_DECL_CONSENFORELAX(consEnforelaxPseudoboolean)
#define BMScopyMemoryArray(ptr, source, num)
SCIP_RETCODE SCIPchgVarBranchPriority(SCIP *scip, SCIP_VAR *var, int branchpriority)
SCIP_RETCODE SCIPlockVarCons(SCIP *scip, SCIP_VAR *var, SCIP_CONS *cons, SCIP_Bool lockdown, SCIP_Bool lockup)
SCIP_RETCODE SCIPsetConshdlrPrint(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPRINT((*consprint)))
Constraint handler for linear constraints in their most general form, .
void * SCIPhashtableRetrieve(SCIP_HASHTABLE *hashtable, void *key)
SCIP_RETCODE SCIPchgRhsLinear(SCIP *scip, SCIP_CONS *cons, SCIP_Real rhs)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
#define DEFAULT_DECOMPOSENORMALPBCONS
SCIP_RETCODE SCIPcreateConsLogicor(SCIP *scip, SCIP_CONS **cons, const char *name, 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)
static SCIP_RETCODE addNewLocks(SCIP *const scip, SCIP_CONS *const cons, CONSANDDATA *const consanddata, SCIP_Real const coef, SCIP_Real const lhs, SCIP_Real const rhs)
SCIP_VAR ** SCIPgetVarsSetppc(SCIP *scip, SCIP_CONS *cons)
void SCIPhashtableFree(SCIP_HASHTABLE **hashtable)
int SCIPgetNVars(SCIP *scip)
int SCIPconsGetNUpgradeLocks(SCIP_CONS *cons)
SCIP_RETCODE SCIPwriteVarsLinearsum(SCIP *scip, FILE *file, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SCIP_Bool type)
static SCIP_DECL_HASHGETKEY(hashGetKeyAndConsDatas)
static SCIP_DECL_CONSGETVARS(consGetVarsPseudoboolean)
SCIP_LINEARCONSTYPE SCIPgetLinearConsTypePseudoboolean(SCIP *const scip, SCIP_CONS *const cons)
SCIP_RETCODE SCIPcreateConsIndicator(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *binvar, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
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)
static SCIP_DECL_CONSFREE(consFreePseudoboolean)
Constraint handler for XOR constraints, .
static SCIP_RETCODE correctConshdlrdata(SCIP *const scip, SCIP_CONSHDLRDATA *const conshdlrdata, int *const ndelconss)
SCIP_RETCODE SCIPwriteVarsList(SCIP *scip, FILE *file, SCIP_VAR **vars, int nvars, SCIP_Bool type, char delimiter)
SCIP_RETCODE SCIPhashmapRemove(SCIP_HASHMAP *hashmap, void *origin)
#define DEFAULT_DECOMPOSEINDICATORPBCONS
int SCIPvarGetNLocksDown(SCIP_VAR *var)
enum SCIP_SetppcType SCIP_SETPPCTYPE
static SCIP_DECL_HASHKEYVAL(hashKeyValAndConsDatas)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisIntegral(SCIP *scip, SCIP_Real val)
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_VAR ** SCIPgetVarsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_CONSDATA * SCIPconsGetData(SCIP_CONS *cons)
SCIP_RETCODE SCIPsetConshdlrInit(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINIT((*consinit)))
static SCIP_RETCODE getLinVarsAndAndRess(SCIP *const scip, SCIP_CONS *const cons, SCIP_VAR **const vars, SCIP_Real *const coefs, int const nvars, SCIP_VAR **const linvars, SCIP_Real *const lincoefs, int *const nlinvars, SCIP_VAR **const andress, SCIP_Real *const andcoefs, SCIP_Bool *const andnegs, int *const nandress)
SCIP_Bool SCIPisConsCompressionEnabled(SCIP *scip)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
static SCIP_RETCODE removeOldLocks(SCIP *const scip, SCIP_CONS *const cons, CONSANDDATA *const consanddata, SCIP_Real const coef, SCIP_Real const lhs, SCIP_Real const rhs)
static SCIP_RETCODE chgLhs(SCIP *const scip, SCIP_CONS *const cons, SCIP_Real lhs)
static SCIP_RETCODE tryUpgradingSetppc(SCIP *const scip, SCIP_CONS *const cons, SCIP_CONSHDLRDATA *const conshdlrdata, int *const ndelconss, int *const naddconss, int *const nfixedvars, int *const nchgcoefs, int *const nchgsides, SCIP_Bool *const cutoff)
SCIP_RETCODE SCIPsetConshdlrPresol(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPRESOL((*conspresol)), int maxprerounds, SCIP_PRESOLTIMING presoltiming)
static SCIP_RETCODE getLinearConsVarsData(SCIP *const scip, SCIP_CONS *const cons, SCIP_LINEARCONSTYPE const constype, SCIP_VAR **const vars, SCIP_Real *const coefs, int *const nvars)
static SCIP_RETCODE correctLocksAndCaptures(SCIP *const scip, SCIP_CONS *const cons, SCIP_CONSHDLRDATA *const conshdlrdata, SCIP_Real const newlhs, SCIP_Real const newrhs, SCIP_VAR **const andress, SCIP_Real *const andcoefs, SCIP_Bool *const andnegs, int const nandress)
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_Bool SCIPisStopped(SCIP *scip)
SCIP_RETCODE SCIPcreateConsBasicPseudoboolean(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR **linvars, int nlinvars, SCIP_Real *linvals, SCIP_VAR ***terms, int nterms, int *ntermvars, SCIP_Real *termvals, SCIP_VAR *indvar, SCIP_Real weight, SCIP_Bool issoftcons, SCIP_VAR *intvar, SCIP_Real lhs, SCIP_Real rhs)
SCIP_RETCODE SCIPsetConshdlrGetNVars(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSGETNVARS((*consgetnvars)))
int SCIPgetNVarsAnd(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPconsIsEnforced(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsSeparated(SCIP_CONS *cons)
void SCIPsortPtrReal(void **ptrarray, SCIP_Real *realarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
void SCIPvarsGetProbvar(SCIP_VAR **vars, int nvars)
int SCIPvarGetIndex(SCIP_VAR *var)
#define SCIPdebugAddSolVal(scip, var, val)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Bool SCIPhashtableExists(SCIP_HASHTABLE *hashtable, void *element)
static SCIP_DECL_CONSDELETE(consDeletePseudoboolean)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
static SCIP_RETCODE inithashmapandtable(SCIP *const scip, SCIP_CONSHDLRDATA **conshdlrdata)
SCIP_Real * SCIPgetValsLinear(SCIP *scip, SCIP_CONS *cons)
constraint handler for pseudoboolean constraints
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
struct SCIP_ConshdlrData SCIP_CONSHDLRDATA
SCIP_RETCODE SCIPchgLhsLinear(SCIP *scip, SCIP_CONS *cons, SCIP_Real lhs)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPvarIsTransformed(SCIP_VAR *var)
void SCIPconsAddUpgradeLocks(SCIP_CONS *cons, int nlocks)
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
#define BMSclearMemoryArray(ptr, num)
static SCIP_RETCODE updateConsanddataUses(SCIP *const scip, SCIP_CONS *const cons, SCIP_CONSHDLRDATA *const conshdlrdata, int *const ndelconss)
#define SCIP_CALL_ABORT(x)
static SCIP_DECL_CONSENFOPS(consEnfopsPseudoboolean)
SCIP_Longint * SCIPgetWeightsKnapsack(SCIP *scip, SCIP_CONS *cons)
#define SCIPcombineTwoInt(a, b)
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
static SCIP_RETCODE createAndAddAnds(SCIP *const scip, SCIP_CONSHDLR *const conshdlr, SCIP_VAR **const *const terms, SCIP_Real *const termcoefs, int const nterms, int const *const ntermvars, SCIP_Bool const initial, SCIP_Bool const enforce, SCIP_Bool const check, SCIP_Bool const local, SCIP_Bool const modifiable, SCIP_Bool const dynamic, SCIP_Bool const stickingatnode, SCIP_CONS **const andconss, SCIP_Real *const andvals, SCIP_Bool *const andnegs, int *const nandconss)
int SCIPgetNVarsLinear(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE conshdlrdataFree(SCIP *const scip, SCIP_CONSHDLRDATA **conshdlrdata)
SCIP_Real SCIPgetLhsLinear(SCIP *scip, SCIP_CONS *cons)
#define CONSHDLR_EAGERFREQ
SCIP_RETCODE SCIPgetNegatedVar(SCIP *scip, SCIP_VAR *var, SCIP_VAR **negvar)
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)
SCIP_Bool SCIPvarIsNegated(SCIP_VAR *var)
#define SCIPreallocBufferArray(scip, ptr, num)
SCIP_Real SCIPgetRhsPseudoboolean(SCIP *const scip, SCIP_CONS *const cons)
SCIP_RETCODE SCIPsetConsInitial(SCIP *scip, SCIP_CONS *cons, SCIP_Bool initial)