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;
234 assert(consanddata1->
cons != NULL);
235 assert(consanddata2->
cons != NULL);
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);
301 assert(cdata1->
vars != NULL);
302 assert(cdata1->
nvars > 1);
303 assert(cdata2->
vars != NULL);
304 assert(cdata2->
nvars > 1);
308 for( v = cdata1->
nvars - 1; v > 0; --v )
311 for( v = cdata2->
nvars - 1; v > 0; --v )
320 if( cdata1->
cons != NULL && cdata2->
cons != NULL && cdata1->
cons != cdata2->
cons )
324 for( v = cdata1->
nvars - 1; v >= 0; --v )
326 assert(cdata1->
vars[v] != NULL);
327 assert(cdata2->
vars[v] != NULL);
330 if( cdata1->
vars[v] != cdata2->
vars[v] )
353 assert(cdata != NULL);
354 assert(cdata->
vars != 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);
493 assert(
nvars != 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);
605 assert(
nvars != 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 )
837 assert(consanddata->
cons != NULL);
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 && nandress != NULL )
877 if( andcoefs != NULL )
879 assert(andnegs != NULL);
884 SCIPsortPtr((
void**)andress, SCIPvarComp, *nandress);
892 #ifdef CHECK_CONSISTENCY 918 assert(scip != NULL);
919 assert(cons != NULL);
925 assert(consdata != NULL);
928 assert(consdata->lincons != NULL);
931 assert(consdata->consanddatas != NULL);
932 assert(consdata->nconsanddatas > 0);
933 assert(consdata->nconsanddatas <= consdata->sconsanddatas);
939 assert(
SCIPisLE(scip, newlhs, newrhs));
940 assert(
SCIPisEQ(scip, newrhs, consdata->rhs) ||
SCIPisEQ(scip, newrhs, -consdata->lhs));
941 assert(
SCIPisEQ(scip, newlhs, consdata->lhs) ||
SCIPisEQ(scip, newlhs, -consdata->rhs));
945 assert(nvars == consdata->nlinvars + consdata->nconsanddatas);
959 assert(nvars == 0 || (coefs != NULL));
963 andress, andcoefs, andnegs, &nandress) );
964 assert(nlinvars == consdata->nlinvars);
965 assert(nandress == consdata->nconsanddatas);
967 for( v = nandress - 1; v >= 0; --v )
969 SCIP_VAR* andresultant = andress[v];
972 for( c = consdata->nconsanddatas - 1; c >= 0; --c )
974 assert(consdata->consanddatas[c] != NULL);
975 if( consdata->consanddatas[c]->cons != NULL )
980 if( res == andresultant && consdata->andnegs[c] == andnegs[v] && consdata->andcoefs[c] == andcoefs[v] )
984 assert(!alreadyfound[c]);
987 alreadyfound[c] =
TRUE;
996 for( c = consdata->nconsanddatas - 1; c >= 0; --c )
998 assert(alreadyfound[c]);
1012 #define checkConsConsistency(scip, cons) 1031 assert(scip != NULL);
1032 assert(consanddata != NULL);
1033 assert(conshdlrdata != NULL);
1037 tmpvars = consanddata->
vars;
1038 ntmpvars = consanddata->
nvars;
1041 for( v = ntmpvars - 1; v >= 0; --v )
1043 assert(tmpvars[v] != NULL);
1051 tmpvars = consanddata->
newvars;
1055 for( v = ntmpvars - 1; v >= 0; --v )
1057 assert(tmpvars[v] != NULL);
1066 if( !origdata || consanddata->
nvars == 0 )
1071 consanddata->
nuses = 0;
1072 consanddata->
nvars = 0;
1073 consanddata->
svars = 0;
1080 assert(consanddata->
origcons != NULL);
1088 if( consanddata->
nvars > 0 )
1099 if( conshdlrdata->inithashmapandtable )
1101 assert(conshdlrdata->hashmap != NULL);
1102 assert(conshdlrdata->hashtable != NULL);
1111 assert(consanddata->
origcons == NULL);
1115 assert(consanddata->
nuses == 0);
1116 assert(consanddata->
nnewvars == 0);
1117 assert(consanddata->
snewvars == 0);
1118 assert(consanddata->
newvars == NULL);
1124 assert(consanddata->
origcons != NULL);
1125 assert(consanddata->
nvars > 0);
1126 assert(consanddata->
svars > 0);
1127 assert(consanddata->
vars != NULL);
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 )
1418 assert((consanddatas[c]->
origcons == NULL) == (consanddatas[c]->
noriguses == 0));
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);
1440 if( consanddatas[c]->
origcons == NULL )
1452 if( consanddatas[c]->
origcons == 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];
1476 else if( isorig && consanddatas[c]->
origcons != NULL )
1479 assert(consanddatas[c]->
nuses == 0);
1480 assert(consanddatas[c]->
nnewvars == 0);
1481 assert(consanddatas[c]->
snewvars == 0);
1482 assert(consanddatas[c]->
newvars == NULL);
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);
1520 assert(consanddatas[c]->
origcons == NULL);
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);
1561 assert(consanddatas[c]->
newvars == NULL);
1563 tmpvars = consanddatas[c]->
vars;
1564 ntmpvars = consanddatas[c]->
nvars;
1567 for( v = ntmpvars - 1; v >= 0; --v )
1569 assert(tmpvars[v] != NULL);
1578 assert(consanddatas[c]->
origcons != NULL);
1579 assert(consanddatas[c]->
nuses == 0);
1580 assert(consanddatas[c]->
nnewvars == 0);
1581 assert(consanddatas[c]->
snewvars == 0);
1582 assert(consanddatas[c]->
newvars == NULL);
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;
1675 assert(
nvars == 0 || (vars != NULL && res != NULL));
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;
1733 if( consanddata->
cons != NULL )
1737 assert(
nvars == 0 || vars != NULL);
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);
1836 assert(
nvars == 0 || (coefs != NULL));
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);
2025 newdata->
cons = NULL;
2035 if( tmpdata != NULL )
2042 assert(tmpdata->
cons != NULL);
2043 *andcons = tmpdata->
cons;
2045 assert(tmpdata->
nuses > 0);
2058 assert(*andcons != NULL);
2062 assert(res != NULL);
2077 TRUE,
TRUE, NULL, NULL, NULL, NULL, NULL) );
2089 #ifdef WITH_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);
2216 assert(
nvars == 0 || vars != 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));
2420 assert(
nvars == 0 || (coefs != NULL));
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));
2593 assert(
nvars == 0 || (coefs != NULL));
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);
3442 assert(scip != NULL);
3443 assert(cons != NULL);
3445 assert(violated != NULL);
3453 assert(consdata != NULL);
3454 assert(consdata->lincons != NULL);
3477 assert(
nvars == 0 || (coefs != NULL));
3482 assert(consdata->nlinvars + consdata->nconsanddatas ==
nvars);
3487 assert(conshdlr != NULL);
3489 assert(conshdlrdata != NULL);
3490 assert(conshdlrdata->hashmap != NULL);
3499 for( v = 0; v <
nvars; ++v )
3504 assert(vars[v] != NULL);
3514 hashmapvar = vars[v];
3517 assert(hashmapvar != NULL);
3525 linvars[nlinvars] = vars[v];
3526 lincoefs[nlinvars] = coefs[v];
3532 andress[nandress] = hashmapvar;
3539 andcoefs[nandress] = -coefs[v];
3542 andcoefs[nandress] = coefs[v];
3546 assert(nandress == consdata->nconsanddatas);
3550 SCIPdebugMsg(scip,
"nlinvars = %d, nandress = %d\n", nlinvars, nandress);
3551 SCIPdebugMsg(scip,
"linear activity = %g\n", activity);
3554 for( c = consdata->nconsanddatas - 1; c >= 0; --c )
3561 andcons = consdata->consanddatas[c]->origcons;
3566 if( andcons == NULL )
3568 andcons = consdata->consanddatas[c]->cons;
3570 assert(andcons != NULL);
3577 assert(nandvars == 0 || (andvars != NULL && res != NULL));
3578 assert(res == andress[c]);
3583 for( v = nandvars - 1; v >= 0; --v )
3589 activity += andvalue * andcoefs[c];
3591 SCIPdebugMsg(scip,
"lhs = %g, overall activity = %g, rhs = %g\n", lhs, activity, rhs);
3594 lhsviol = lhs - activity;
3595 rhsviol = activity - rhs;
3597 if(lhsviol > rhsviol)
3619 SCIPinfoMessage(scip, NULL,
"violation: left hand side is violated by %.15g\n", lhs - activity);
3635 SCIPinfoMessage(scip, NULL,
"violation: right hand side is violated by %.15g\n", activity - rhs);
3672 assert(scip != NULL);
3673 assert(conshdlr != NULL);
3674 assert(violated != NULL);
3677 assert(conshdlrdata != NULL);
3681 for( c = conshdlrdata->nallconsanddatas - 1; c >= 0; --c )
3683 if( !conshdlrdata->allconsanddatas[c]->istransformed )
3686 andcons = conshdlrdata->allconsanddatas[c]->cons;
3689 if( andcons == NULL )
3695 assert(
nvars == 0 || (vars != NULL && res != NULL));
3699 for( v =
nvars - 1; v >= 0; --v )
3718 else if( sol == NULL )
3732 SCIP*
const sourcescip,
3757 assert(targetscip != NULL);
3758 assert(targetcons != NULL);
3759 assert(sourcescip != NULL);
3760 assert(sourcecons != NULL);
3762 assert(valid != NULL);
3767 assert(sourceconsdata != NULL);
3770 sourcelincons = sourceconsdata->lincons;
3771 assert(sourcelincons != NULL);
3780 int ntargetandconss;
3783 targetlinconstype = sourceconsdata->linconstype;
3785 switch( targetlinconstype )
3789 assert(conshdlrlinear != NULL);
3793 assert(conshdlrlinear != NULL);
3797 assert(conshdlrlinear != NULL);
3801 assert(conshdlrlinear != NULL);
3803 #ifdef WITHEQKNAPSACK 3804 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
3806 assert(conshdlrlinear != NULL);
3815 if( conshdlrlinear == NULL )
3821 targetlincons = NULL;
3831 assert(targetlincons != NULL);
3841 targetandconss = NULL;
3842 targetandcoefs = NULL;
3843 ntargetandconss = 0;
3849 int nsourceandconss;
3856 assert(conshdlrand != NULL);
3858 nsourceandconss = sourceconsdata->nconsanddatas;
3873 targetlinvars, targetlincoefs, &ntargetlinvars) );
3880 SCIPvarIsHashkeyEq, SCIPvarGetHashkeyVal, NULL) );
3882 for( c = 0 ; c < ntargetlinvars; ++c )
3891 for( c = 0 ; c < nsourceandconss; ++c )
3898 consanddata = sourceconsdata->consanddatas[c];
3899 assert(consanddata != NULL);
3901 oldcons = consanddata->
cons;
3902 assert(oldcons != NULL);
3905 assert(targetandresultant != NULL);
3915 targetandconss[ntargetandconss] = NULL;
3927 targetandcoefs[ntargetandconss] = sourceconsdata->andcoefs[c];
3933 assert(ntargetandconss <= ntargetlinvars);
3937 if( ntargetandconss == 0 )
3950 const char* consname;
3953 assert(sourceconsdata->issoftcons == (sourceconsdata->indvar != NULL));
3954 indvar = sourceconsdata->indvar;
3955 intvar = sourceconsdata->intvar;
3958 if( indvar != NULL )
3962 assert(!(*valid) || indvar != NULL);
3965 if( intvar != NULL && *valid )
3968 assert(!(*valid) || intvar != NULL);
3983 targetlincons, targetlinconstype, targetandconss, targetandcoefs, ntargetandconss,
3984 indvar, sourceconsdata->weight, sourceconsdata->issoftcons, intvar, targetlhs, targetrhs,
3985 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) );
3993 if( targetlincons != NULL )
3999 if( targetandconss != NULL )
4003 assert(ntargetandconss <= sourceconsdata->nconsanddatas);
4005 for( c = 0 ; c < ntargetandconss; ++c )
4007 if( targetandconss[c] != NULL )
4035 assert(scip != NULL);
4036 assert(conshdlrdata != NULL);
4038 allconsanddatas = conshdlrdata->allconsanddatas;
4039 assert(allconsanddatas != NULL);
4040 assert(conshdlrdata->nallconsanddatas > 0);
4041 assert(conshdlrdata->nallconsanddatas <= conshdlrdata->sallconsanddatas);
4043 for( c = conshdlrdata->nallconsanddatas - 1; c >= 0; --c )
4052 consanddata = allconsanddatas[c];
4057 if( consanddata->
nuses == 0 )
4060 vars = consanddata->
vars;
4061 nvars = consanddata->
nvars;
4062 assert(nvars == 0 || vars != NULL);
4069 if( consanddata->
cons != NULL )
4075 cons = consanddata->
cons;
4076 assert(cons != NULL);
4098 for( v = nvars - 1; v > 0; --v )
4101 for( v = nnewvars - 1; v > 0; --v )
4106 if( nvars == nnewvars )
4113 for( v = nvars - 1; v >= 0; --v )
4115 if( vars[v] != newvars[v] )
4127 if( nnewvars > consanddata->
snewvars )
4137 for( v = consanddata->
nnewvars - 1; v >= 0; --v )
4140 assert(consanddata->
newvars[v] != NULL);
4160 assert(scip != NULL);
4161 assert(cons != NULL);
4162 assert(consanddata != NULL);
4171 assert(consanddata->
cons != NULL);
4188 assert(scip != NULL);
4189 assert(cons != NULL);
4190 assert(consanddata != NULL);
4199 assert(consanddata->
cons != NULL);
4219 int nnewconsanddatas;
4220 int snewconsanddatas;
4232 assert(scip != NULL);
4233 assert(cons != NULL);
4234 assert(conshdlrdata != NULL);
4235 assert(conshdlrdata->hashmap != NULL);
4236 assert(nandress == 0 || (andress != NULL && andcoefs != NULL));
4239 assert(
SCIPisLE(scip, newlhs, newrhs));
4242 assert(consdata != NULL);
4245 SCIPsortPtrRealBool((
void**)(consdata->consanddatas), consdata->andcoefs, consdata->andnegs, resvarCompWithInactive, consdata->nconsanddatas);
4247 consanddatas = consdata->consanddatas;
4248 oldandcoefs = consdata->andcoefs;
4249 oldandnegs = consdata->andnegs;
4250 nconsanddatas = consdata->nconsanddatas;
4251 assert(nconsanddatas == 0 || (consanddatas != NULL && oldandcoefs != NULL));
4255 for( c = nandress - 1; c > 0; --c )
4263 for( c = nconsanddatas - 1; c > 0; --c )
4268 assert(consanddatas[c] != NULL);
4274 assert(consanddatas[c - 1] != NULL);
4279 assert(!
SCIPisZero(scip, oldandcoefs[c - 1]));
4284 assert(consanddatas[c]->cons != NULL);
4286 assert(res1 != NULL);
4287 assert(consanddatas[c - 1]->cons != NULL);
4289 assert(res2 != NULL);
4295 snewconsanddatas = nconsanddatas + nandress;
4302 nnewconsanddatas = 0;
4305 for( c = 0, c1 = 0; c < nconsanddatas && c1 < nandress; )
4311 assert(consanddatas[c] != NULL);
4317 consdata->changed =
TRUE;
4318 consdata->upgradetried =
FALSE;
4322 andcons = consanddatas[c]->
cons;
4323 assert(andcons != NULL);
4325 if( andcons == NULL )
4328 consdata->changed =
TRUE;
4329 consdata->upgradetried =
FALSE;
4336 oldandnegs[c] ? -oldandcoefs[c] : oldandcoefs[c], consdata->lhs, consdata->rhs) );
4338 consdata->changed =
TRUE;
4339 consdata->upgradetried =
FALSE;
4342 assert(andcons != NULL);
4346 assert(res1 != NULL);
4351 assert(res2 != NULL);
4357 assert(consanddatas[c]->
nuses > 0);
4358 --(consanddatas[c]->
nuses);
4362 consdata->lhs, consdata->rhs) );
4364 consdata->changed =
TRUE;
4365 consdata->upgradetried =
FALSE;
4366 consdata->propagated =
FALSE;
4367 consdata->presolved =
FALSE;
4373 newandcoefs[nnewconsanddatas] = andcoefs[c1];
4374 newandnegs[nnewconsanddatas] = andnegs[c1];
4375 ++(newconsanddatas[nnewconsanddatas]->
nuses);
4378 SCIP_CALL(
addNewLocks(scip, cons, newconsanddatas[nnewconsanddatas], newandnegs[nnewconsanddatas] ?
4379 -newandcoefs[nnewconsanddatas] : newandcoefs[nnewconsanddatas], newlhs, newrhs) );
4381 consdata->changed =
TRUE;
4382 consdata->upgradetried =
FALSE;
4383 consdata->cliquesadded =
FALSE;
4384 consdata->propagated =
FALSE;
4385 consdata->presolved =
FALSE;
4398 newconsanddatas[nnewconsanddatas] = consanddatas[c];
4400 newandcoefs[nnewconsanddatas] = andcoefs[c1];
4401 newandnegs[nnewconsanddatas] = andnegs[c1];
4403 if( ((oldandnegs[c] == andnegs[c1]) && !
SCIPisEQ(scip, oldandcoefs[c], newandcoefs[c1]))
4404 || ((oldandnegs[c] != newandnegs[c1]) && !
SCIPisEQ(scip, oldandcoefs[c], -newandcoefs[c1])) )
4405 consdata->upgradetried =
FALSE;
4407 coefsignchanged = (oldandnegs[c] == andnegs[c1]) &&
4408 ((oldandcoefs[c] < 0 && andcoefs[c1] > 0) || (oldandcoefs[c] > 0 && andcoefs[c1] < 0));
4409 coefsignchanged = coefsignchanged || ((oldandnegs[c] != andnegs[c1]) &&
4410 ((oldandcoefs[c] < 0 && andcoefs[c1] < 0) || (oldandcoefs[c] > 0 && andcoefs[c1] > 0)));
4412 || (consdata->lhs < 0 && newlhs > 0) || (consdata->lhs > 0 && newlhs < 0);
4414 || (consdata->rhs < 0 && newrhs > 0) || (consdata->rhs > 0 && newrhs < 0);
4417 if( coefsignchanged || lhschanged || rhschanged || newconsanddatas[nnewconsanddatas]->
nnewvars > 0)
4421 -oldandcoefs[c] : oldandcoefs[c], consdata->lhs, consdata->rhs) );
4422 SCIP_CALL(
addNewLocks(scip, cons, newconsanddatas[nnewconsanddatas], newandnegs[nnewconsanddatas] ?
4423 -newandcoefs[nnewconsanddatas] : newandcoefs[nnewconsanddatas], newlhs, newrhs) );
4425 consdata->changed =
TRUE;
4426 consdata->upgradetried =
FALSE;
4427 consdata->cliquesadded =
FALSE;
4428 consdata->propagated =
FALSE;
4429 consdata->presolved =
FALSE;
4439 if( c < nconsanddatas )
4441 assert(c1 == nandress);
4443 for( ; c < nconsanddatas; ++c )
4449 assert(consanddatas[c] != NULL);
4451 andcons = consanddatas[c]->
cons;
4453 if( andcons != NULL )
4456 assert(res1 != NULL);
4460 if( andcons == NULL )
4462 consdata->changed =
TRUE;
4463 consdata->upgradetried =
FALSE;
4467 assert(consanddatas[c]->
nuses > 0);
4468 --(consanddatas[c]->
nuses);
4472 consdata->lhs, consdata->rhs) );
4473 consdata->changed =
TRUE;
4474 consdata->upgradetried =
FALSE;
4475 consdata->propagated =
FALSE;
4476 consdata->presolved =
FALSE;
4479 else if( c1 < nandress )
4481 for( ; c1 < nandress; ++c1 )
4486 assert(res2 != NULL);
4489 newandcoefs[nnewconsanddatas] = andcoefs[c1];
4490 newandnegs[nnewconsanddatas] = andnegs[c1];
4491 ++(newconsanddatas[nnewconsanddatas]->
nuses);
4494 SCIP_CALL(
addNewLocks(scip, cons, newconsanddatas[nnewconsanddatas], newandnegs[nnewconsanddatas] ?
4495 -newandcoefs[nnewconsanddatas] : newandcoefs[nnewconsanddatas], newlhs, newrhs) );
4498 consdata->changed =
TRUE;
4499 consdata->upgradetried =
FALSE;
4500 consdata->cliquesadded =
FALSE;
4501 consdata->propagated =
FALSE;
4502 consdata->presolved =
FALSE;
4505 assert(c == nconsanddatas && c1 == nandress);
4512 if( !
SCIPisEQ(scip, consdata->lhs, newlhs) || !
SCIPisEQ(scip, consdata->rhs, newrhs) )
4514 consdata->upgradetried =
FALSE;
4515 consdata->lhs = newlhs;
4516 consdata->rhs = newrhs;
4519 consdata->consanddatas = newconsanddatas;
4520 consdata->andcoefs = newandcoefs;
4521 consdata->andnegs = newandnegs;
4522 consdata->nconsanddatas = nnewconsanddatas;
4523 consdata->sconsanddatas = snewconsanddatas;
4525 oldnvars = consdata->nlinvars;
4528 consdata->nlinvars -= nnewconsanddatas;
4530 if( oldnvars != consdata->nlinvars )
4532 consdata->changed =
TRUE;
4533 consdata->upgradetried =
FALSE;
4534 consdata->cliquesadded =
FALSE;
4535 consdata->propagated =
FALSE;
4536 consdata->presolved =
FALSE;
4542 SCIPsortPtrRealBool((
void**)(consdata->consanddatas), consdata->andcoefs, consdata->andnegs, resvarCompWithInactive, consdata->nconsanddatas);
4545 consanddatas = consdata->consanddatas;
4546 nconsanddatas = consdata->nconsanddatas;
4547 assert(nconsanddatas == 0 || consanddatas != NULL);
4550 for( c = nconsanddatas - 1; c > 0; --c )
4555 assert(consanddatas[c] != NULL);
4556 assert(consanddatas[c]->cons != NULL);
4558 assert(res1 != NULL);
4559 assert(consanddatas[c - 1] != NULL);
4560 assert(consanddatas[c - 1]->cons != NULL);
4562 assert(res2 != NULL);
4577 int*
const naggrvars,
4594 assert(scip != NULL);
4595 assert(cons != NULL);
4596 assert(cutoff != NULL);
4597 assert(naggrvars != NULL);
4598 assert(nchgbds != NULL);
4604 assert(consdata != NULL);
4606 assert(consdata->nconsanddatas > 0);
4609 if( consdata->cliquesadded )
4612 consdata->cliquesadded =
TRUE;
4617 assert(consdata->lincons != NULL);
4620 assert(consdata->consanddatas != NULL);
4621 assert(consdata->nconsanddatas > 0);
4622 assert(consdata->nconsanddatas <= consdata->sconsanddatas);
4626 assert(
nvars == consdata->nlinvars + consdata->nconsanddatas);
4641 NULL, NULL, NULL, &nandress) );
4643 assert(nandress == consdata->nconsanddatas);
4644 assert(consdata->consanddatas != NULL);
4647 for( c = nandress - 1; c >= 0; --c )
4653 consanddata = consdata->consanddatas[c];
4654 assert(consanddata != NULL);
4661 andvars = consanddata->
newvars;
4666 andvars = consanddata->
vars;
4667 nandvars = consanddata->
nvars;
4670 for( v1 = nandvars - 1; v1 >= 0; --v1 )
4688 for( v2 = nlinvars - 1; v2 >= 0; --v2 )
4718 if( values[0] != values[1] && var1 == var2 )
4724 clqvars[0] = andres;
4726 assert(clqvars[1] != NULL);
4735 *nchgbds += nchgbdslocal;
4767 clqvars[0] = andres;
4769 assert(clqvars[1] != NULL);
4778 *nchgbds += nchgbdslocal;
4798 for( c = nandress - 1; c > 0; --c )
4807 consanddata1 = consdata->consanddatas[c];
4808 assert(consanddata1 != NULL);
4809 consanddata2 = consdata->consanddatas[c - 1];
4810 assert(consanddata2 != NULL);
4818 andvars1 = consanddata1->
newvars;
4819 nandvars1 = consanddata1->
nnewvars;
4823 andvars1 = consanddata1->
vars;
4824 nandvars1 = consanddata1->
nvars;
4830 andvars2 = consanddata2->
newvars;
4831 nandvars2 = consanddata2->
nnewvars;
4835 andvars2 = consanddata2->
vars;
4836 nandvars2 = consanddata2->
nvars;
4840 for( v1 = nandvars1 - 1; v1 >= 0; --v1 )
4845 var1 = andvars1[v1];
4858 for( v2 = nandvars2 - 1; v2 >= 0; --v2 )
4862 var2 = andvars2[v2];
4888 if( values[0] != values[1] && var1 == var2 )
4894 clqvars[0] = andres;
4895 clqvars[1] = andres2;
4904 *nchgbds += nchgbdslocal;
4937 clqvars[0] = andres;
4939 assert(clqvars[1] != NULL);
4948 *nchgbds += nchgbdslocal;
4986 assert(scip != NULL);
4987 assert(cons != NULL);
4988 assert(cutoff != NULL);
4989 assert(ndelconss != NULL);
4994 assert(consdata != NULL);
4995 assert(consdata->lincons != NULL);
5005 if( consdata->propagated )
5009 consdata->propagated =
TRUE;
5026 assert(scip != NULL);
5027 assert(cons != NULL);
5030 assert(consdata != NULL);
5032 consanddatas = consdata->consanddatas;
5033 nconsanddatas = consdata->nconsanddatas;
5034 assert(nconsanddatas == 0 || consanddatas != NULL);
5040 for( c = nconsanddatas - 1; c >= 0; --c )
5044 assert(consanddatas[c] != NULL);
5049 andcons = consanddatas[c]->
cons;
5050 assert(andcons != NULL);
5070 assert(scip != NULL);
5071 assert(conshdlrdata != NULL);
5072 assert(ndelconss != NULL);
5074 allconsanddatas = conshdlrdata->allconsanddatas;
5075 assert(allconsanddatas != NULL);
5076 assert(conshdlrdata->nallconsanddatas > 0);
5077 assert(conshdlrdata->nallconsanddatas <= conshdlrdata->sallconsanddatas);
5079 for( c = conshdlrdata->nallconsanddatas - 1; c >= 0; --c )
5086 consanddata = allconsanddatas[c];
5088 assert(consanddata->
nvars == 0 || (consanddata->
vars != NULL && consanddata->
svars > 0));
5093 assert(consanddata->
vars == NULL || consanddata->
origcons != NULL);
5094 assert(consanddata->
nvars == 0 || consanddata->
origcons != NULL);
5095 assert(consanddata->
svars == 0 || consanddata->
origcons != NULL);
5096 assert(consanddata->
newvars == NULL);
5097 assert(consanddata->
nnewvars == 0);
5098 assert(consanddata->
snewvars == 0);
5104 if( consanddata->
nvars == 0 )
5109 assert(consanddata->
nnewvars == 0);
5110 assert(consanddata->
nuses > 0);
5111 assert(resvar != NULL);
5121 consanddata->
nuses = 0;
5124 if( consanddata->
origcons == NULL )
5136 if( consanddata->
nuses == 0 )
5141 if( consanddata->
cons == NULL )
5145 assert(consanddata->
vars == NULL || consanddata->
origcons != NULL);
5146 assert(consanddata->
nvars == 0 || consanddata->
origcons != NULL);
5147 assert(consanddata->
svars == 0 || consanddata->
origcons != NULL);
5148 assert(consanddata->
newvars == NULL);
5149 assert(consanddata->
nnewvars == 0);
5150 assert(consanddata->
snewvars == 0);
5170 if( nfixedvars > 0 )
5191 for( w = nfixedvars - 1; w >= 0; --w )
5195 if( activevars == NULL )
5200 assert(activevars != NULL);
5201 assert(activescalars != NULL);
5203 activevars[0] = fixedvars[w];
5204 activescalars[0] = 1.0;
5205 activeconstant = 0.0;
5209 &activeconstant, &requiredsize,
TRUE) );
5212 if( nactivevars == 0 )
5215 fixedvars[w] = fixedvars[nfixedvars];
5219 fixedvars[w] = activevars[0];
5221 if( nactivevars > 1 )
5226 for( i = 1; i < nactivevars; ++i )
5229 fixedvars[nfixedvars] = activevars[i];
5239 if( activevars != NULL )
5245 SCIPsortPtr((
void**)fixedvars, SCIPvarComp, nfixedvars);
5263 if( !looseorcolumn )
5274 if( consanddata->
origcons == NULL )
5288 cons = consanddata->
cons;
5289 assert(cons != NULL);
5296 assert(consanddata->
nuses > 0);
5297 assert(resvar != NULL);
5303 consanddata->
nuses = 0;
5306 if( consanddata->
origcons == NULL )
5321 tmpvars = consanddata->
vars;
5323 for( v = consanddata->
nvars - 1; v >= 0; --v )
5326 assert(tmpvars[v] != NULL);
5331 tmpvars = consanddata->
vars;
5332 stmpvars = consanddata->
svars;
5336 consanddata->
newvars = tmpvars;
5361 assert(scip != NULL);
5362 assert(cons != NULL);
5363 assert(conshdlrdata != NULL);
5364 assert(ndelconss != NULL);
5370 assert(consdata != NULL);
5372 consanddatas = consdata->consanddatas;
5373 nconsanddatas = consdata->nconsanddatas;
5374 assert(nconsanddatas > 0 && consanddatas != NULL);
5377 if( nconsanddatas > 0 )
5379 assert(consdata->andcoefs != NULL);
5381 for( c = nconsanddatas - 1; c >= 0; --c )
5385 consanddata = consanddatas[c];
5386 assert(consanddata != NULL);
5396 for( c = nconsanddatas - 1; c >= 0; --c )
5400 consanddata = consanddatas[c];
5401 assert(consanddata != NULL);
5404 assert(consanddata->
nuses > 0);
5406 if( consanddata->
nuses > 0 )
5407 --(consanddata->
nuses);
5410 if( consanddata->
nuses == 0 )
5419 assert(resvar != NULL);
5435 if( nfixedvars > 0 )
5452 for( w = nfixedvars - 1; w >= 0; --w )
5455 foundmultiaggrvar =
TRUE;
5460 SCIPsortPtr((
void**)fixedvars, SCIPvarComp, nfixedvars);
5462 if( foundmultiaggrvar )
5504 if( !looseorcolumn )
5515 if( consanddata->
origcons == NULL )
5528 consdata->nconsanddatas = 0;
5558 int const nconsanddatas,
5575 assert(scip != NULL);
5576 assert(vars != NULL);
5578 assert(values != NULL);
5579 assert(linvars != NULL || nlinvars == 0);
5580 assert(lincoefs != NULL || nlinvars == 0);
5581 assert(nvars >= nlinvars);
5583 assert(consanddatas != NULL);
5584 assert(consanddatacoefs != NULL);
5585 assert(nconsanddatas > 0);
5586 assert(*xortype >= -1 && *xortype <= 1);
5589 SCIPsortPtr((
void**)linvars, SCIPvarCompActiveAndNegated, nlinvars);
5590 SCIPsortPtr((
void**)vars, SCIPvarCompActiveAndNegated, nvars);
5593 for( v = nlinvars - 1; v >= 0; --v )
5598 value += lincoefs[v];
5613 for( c = nconsanddatas - 1; c >= 0; --c )
5617 consanddata = consanddatas[c];
5618 assert(consanddata != NULL);
5624 termvars = consanddata->
newvars;
5629 termvars = consanddata->
vars;
5630 ntermvars = consanddata->
nvars;
5632 assert(ntermvars > 0 && termvars != NULL);
5638 SCIPsortPtrBool((
void**)repvars, negated, SCIPvarCompActiveAndNegated, ntermvars);
5640 for( v = ntermvars - 1; v >= 0; --v )
5649 if( (negated[v] && values[pos]) || (!negated[v] && !values[pos]) )
5665 if( val != consanddatanegs[c] )
5666 value += consanddatacoefs[c];
5672 if( *xortype == -1 )
5680 else if( *xortype == 1 && cnt % 2 == 0 )
5682 else if( *xortype == 0 && cnt % 2 == 1 )
5688 if( *xortype == -1 )
5696 else if( *xortype == 1 && cnt % 2 == 1 )
5698 else if( *xortype == 0 && cnt % 2 == 0 )
5719 int*
const ndelconss,
5720 int*
const naddconss,
5721 int*
const nfixedvars,
5722 int*
const nchgcoefs,
5723 int*
const nchgsides,
5758 assert(scip != NULL);
5759 assert(cons != NULL);
5760 assert(conshdlrdata != NULL);
5761 assert(ndelconss != NULL);
5762 assert(nfixedvars != NULL);
5763 assert(nchgcoefs != NULL);
5764 assert(nchgsides != NULL);
5765 assert(cutoff != NULL);
5769 assert(consdata != NULL);
5771 consanddatas = consdata->consanddatas;
5772 andcoefs = consdata->andcoefs;
5773 andnegs = consdata->andnegs;
5774 nconsanddatas = consdata->nconsanddatas;
5775 assert(nconsanddatas > 0 && consanddatas != NULL);
5777 assert(consdata->lincons != NULL);
5781 if( !
SCIPisEQ(scip, consdata->lhs, consdata->rhs) || (!
SCIPisEQ(scip, consdata->lhs, 1.0) && !
SCIPisZero(scip, consdata->lhs)) )
5784 assert(consanddatas[0] != NULL);
5785 assert(consanddatas[0]->cons != NULL);
5787 lincons = consdata->lincons;
5791 assert(nallvars - nconsanddatas == consdata->nlinvars);
5792 nlinvars = consdata->nlinvars;
5809 assert(nallvars > 0);
5813 NULL, NULL, NULL, &nandress) );
5814 assert(nlinvars == consdata->nlinvars);
5815 assert(nandress == nallvars-nlinvars);
5826 firstnlinvars = nlinvars;
5829 SCIPsortPtr((
void**)linvars, SCIPvarCompActiveAndNegated, nlinvars);
5831 for( c = nconsanddatas - 1; c >= 0; --c )
5833 consanddata = consanddatas[c];
5834 assert(consanddata != NULL);
5845 vars = consanddata->
vars;
5848 assert(
nvars > 0 && vars != NULL);
5859 oldnlinvars = nlinvars;
5862 for( v =
nvars - 1, v1 = nlinvars - 1; v >= 0 && v1 >= 0; )
5882 linvars[nlinvars] = var;
5904 for( ; v >= 0; --v )
5919 linvars[nlinvars] = var;
5928 if( nlinvars > oldnlinvars )
5931 SCIPsortPtr((
void**)linvars, SCIPvarCompActiveAndNegated, nlinvars);
5939 for( v = (1 << nlinvars) - 1; v >= 0; --v )
5942 for( v1 = nlinvars - 1; v1 >= 0; --v1 )
5952 assert(cnt <= nlinvars);
5954 SCIP_CALL(
checkSolution(scip, linvars, nlinvars, values, activelinvars, lincoefs, firstnlinvars, constant,
5955 consdata->lhs, consanddatas, andcoefs, andnegs, nconsanddatas, cnt, &xortype) );
5962 assert(xortype >= -1 && xortype <= 1);
5976 SCIPdebugMsg(scip,
"created upgraded XOR constraint:\n");
6010 int*
const ndelconss,
6011 int*
const naddconss,
6012 int*
const nfixedvars,
6013 int*
const nchgcoefs,
6014 int*
const nchgsides,
6029 assert(scip != NULL);
6030 assert(cons != NULL);
6031 assert(conshdlrdata != NULL);
6032 assert(ndelconss != NULL);
6033 assert(nfixedvars != NULL);
6034 assert(nchgcoefs != NULL);
6035 assert(nchgsides != NULL);
6036 assert(cutoff != NULL);
6040 assert(consdata != NULL);
6042 consanddatas = consdata->consanddatas;
6043 nconsanddatas = consdata->nconsanddatas;
6044 assert(nconsanddatas > 0 && consanddatas != NULL);
6046 assert(consdata->lincons != NULL);
6049 assert(consanddatas[0] != NULL);
6050 assert(consanddatas[0]->cons != NULL);
6052 if( nconsanddatas == 1 )
6072 if( consdata->nlinvars == 0 )
6084 lincons = consdata->lincons;
6086 consanddata = consanddatas[0];
6087 assert(consanddata != NULL);
6098 vars = consanddata->
vars;
6099 nvars = consanddata->
nvars;
6101 assert(nvars > 0 && vars != NULL);
6115 assert(nallvars == consdata->nlinvars + 1);
6117 nlinvars = consdata->nlinvars;
6127 assert(allcoefs != NULL);
6131 NULL, NULL, NULL, NULL) );
6132 assert(nlinvars == consdata->nlinvars);
6135 for( v = 0; v < nlinvars; ++v )
6141 for( v = 0; v <
nvars; ++v )
6149 SCIPdebugMsg(scip,
"created upgraded linear constraint:\n");
6173 c = nconsanddatas - 1;
6177 if( consanddatas[c]->
nnewvars > 0 )
6179 neqvars = consanddatas[c]->
nnewvars;
6185 neqvars = consanddatas[c]->
nvars;
6191 assert(neqvars > 0 && eqvars != NULL);
6195 for( v = neqvars - 1; v > 0; --v )
6199 for( --c ; c >= 0; --c )
6206 consanddata = consanddatas[c];
6207 assert(consanddata != NULL);
6218 vars = consanddata->
vars;
6219 nvars = consanddata->
nvars;
6221 assert(nvars > 0 && vars != NULL);
6225 for( v = nvars - 1; v > 0; --v )
6230 if( nvars < nminvars )
6233 else if( nvars > nmaxvars )
6235 assert(nminvars > 0);
6236 assert(nminvars <= nmaxvars);
6239 for( v = 0, v2 = 0; v < neqvars && v2 <
nvars; )
6244 assert(eqvars[v] != NULL);
6245 assert(vars[v2] != NULL);
6250 if( index1 < index2 )
6252 else if( index1 > index2 )
6256 assert(index1 == index2);
6257 assert(nneweqvars <= v);
6259 if( nneweqvars < v )
6260 eqvars[nneweqvars] = eqvars[v];
6266 neqvars = nneweqvars;
6271 if( nminvars > neqvars + 1 )
6313 if( neqvars > 0 && consdata->nlinvars == 0 )
6319 for( v = 0; v < neqvars; ++v )
6336 if( nminvars == neqvars )
6348 if( neqvars > 0 && nminvars == nmaxvars && nminvars == neqvars + 1 )
6359 lincons = consdata->lincons;
6371 for( c = nconsanddatas - 1; c >= 0; --c )
6377 consanddata = consanddatas[c];
6378 assert(consanddata != NULL);
6389 vars = consanddata->
vars;
6390 nvars = consanddata->
nvars;
6392 assert(nvars > 0 && vars != NULL);
6394 for( v = 0, v2 = 0; v < neqvars && v2 <
nvars; )
6399 assert(eqvars[v] != NULL);
6400 assert(vars[v2] != NULL);
6405 assert(index1 >= index2);
6407 if( index1 > index2 )
6414 assert(index1 == index2);
6423 assert(v == neqvars);
6424 for( ; v2 <
nvars; ++v2)
6429 assert(v == neqvars && v2 == nvars);
6436 if( consdata->nlinvars > 0 )
6446 for( v = 0; v < neqvars; ++v )
6453 assert(nvars == consdata->nlinvars + consdata->nconsanddatas);
6463 assert(nvars == 0 || (coefs != NULL));
6467 for( v = 0; v <
nvars; ++v )
6468 assert(
SCIPisEQ(scip, coefs[v], 1.0));
6472 NULL, NULL, NULL, NULL) );
6473 assert(nlinvars == consdata->nlinvars);
6476 for( v = 0; v < nlinvars; ++v )
6494 SCIPdebugMsg(scip,
"created upgraded linear constraint:\n");
6522 int*
const ndelconss,
6523 int*
const naddconss,
6524 int*
const nfixedvars,
6525 int*
const nchgcoefs,
6526 int*
const nchgsides,
6542 assert(scip != NULL);
6543 assert(cons != NULL);
6544 assert(conshdlrdata != NULL);
6545 assert(ndelconss != NULL);
6546 assert(nfixedvars != NULL);
6547 assert(nchgcoefs != NULL);
6548 assert(nchgsides != NULL);
6549 assert(cutoff != NULL);
6553 assert(consdata != NULL);
6555 consanddatas = consdata->consanddatas;
6556 nconsanddatas = consdata->nconsanddatas;
6557 assert(nconsanddatas > 0 && consanddatas != NULL);
6559 assert(consdata->lincons != NULL);
6576 assert(consanddatas[0] != NULL);
6577 assert(consanddatas[0]->cons != NULL);
6579 if( nconsanddatas == 1 )
6582 if( consdata->nlinvars == 0 )
6611 if( consdata->nlinvars > 0 )
6616 assert(consdata->nlinvars == 0 && nconsanddatas > 1);
6618 c = nconsanddatas - 1;
6622 if( consanddatas[c]->
nnewvars > 0 )
6624 neqvars = consanddatas[c]->
nnewvars;
6630 neqvars = consanddatas[c]->
nvars;
6636 assert(neqvars > 0 && eqvars != NULL);
6640 for( v = neqvars - 1; v > 0; --v )
6644 for( --c ; c >= 0; --c )
6651 consanddata = consanddatas[c];
6652 assert(consanddata != NULL);
6663 vars = consanddata->
vars;
6664 nvars = consanddata->
nvars;
6666 assert(nvars > 0 && vars != NULL);
6670 for( v = nvars - 1; v > 0; --v )
6675 if( nvars < nminvars )
6678 else if( nvars > nmaxvars )
6680 assert(nminvars > 0);
6681 assert(nminvars <= nmaxvars);
6684 for( v = 0, v2 = 0; v < neqvars && v2 <
nvars; )
6689 assert(eqvars[v] != NULL);
6690 assert(vars[v2] != NULL);
6695 if( index1 < index2 )
6697 else if( index1 > index2 )
6701 assert(index1 == index2);
6702 assert(nneweqvars <= v);
6704 if( nneweqvars < v )
6705 eqvars[nneweqvars] = eqvars[v];
6711 neqvars = nneweqvars;
6753 if( neqvars > 0 && ((nminvars == nmaxvars && nminvars == neqvars + 1) || (nminvars == neqvars) || (type ==
SCIP_SETPPCTYPE_PARTITIONING)) )
6783 if( neqvars == nminvars )
6786 createcons = (
SCIPisLE(scip, lhs, rhs) && ((nminvars == nmaxvars && nminvars == neqvars + 1) || (nminvars == neqvars)));
6791 lincons = consdata->lincons;
6809 for( c = nconsanddatas - 1; c >= 0; --c )
6815 consanddata = consanddatas[c];
6816 assert(consanddata != NULL);
6827 vars = consanddata->
vars;
6828 nvars = consanddata->
nvars;
6830 assert(nvars > 0 && vars != NULL);
6833 if( deletecons && neqvars + 1 < nvars )
6852 for( v = 0, v2 = 0; v < neqvars && v2 <
nvars; )
6857 assert(eqvars[v] != NULL);
6858 assert(vars[v2] != NULL);
6863 assert(index1 >= index2);
6865 if( index1 > index2 )
6869 assert(newcons != NULL);
6872 else if( deletecons )
6889 assert(index1 == index2);
6899 assert(v == neqvars);
6900 for( ; v2 <
nvars; ++v2)
6906 else if( deletecons )
6921 assert(v == neqvars && v2 == nvars);
6927 for( v = 0; v < neqvars; ++v )
6953 assert(newcons != NULL);
6963 SCIPdebugMsg(scip,
"created upgraded linear constraint:\n");
6972 assert(!deletecons);
6998 int*
const ndelconss,
6999 int*
const naddconss,
7000 int*
const nfixedvars,
7001 int*
const nchgcoefs,
7002 int*
const nchgsides,
7012 assert(scip != NULL);
7013 assert(cons != NULL);
7014 assert(conshdlrdata != NULL);
7015 assert(ndelconss != NULL);
7016 assert(nfixedvars != NULL);
7017 assert(nchgcoefs != NULL);
7018 assert(nchgsides != NULL);
7019 assert(cutoff != NULL);
7023 assert(consdata != NULL);
7024 assert(consdata->lincons != NULL);
7027 consanddatas = consdata->consanddatas;
7028 assert(consdata->nconsanddatas == 0 || consanddatas != NULL);
7032 if( consdata->nconsanddatas == 0 )
7048 assert(consdata->nlinvars + consdata->nconsanddatas ==
nvars);
7050 switch( consdata->linconstype )
7053 SCIP_CALL(
tryUpgradingXor(scip, cons, conshdlrdata, ndelconss, naddconss, nfixedvars, nchgcoefs, nchgsides, cutoff) );
7064 SCIP_CALL(
tryUpgradingXor(scip, cons, conshdlrdata, ndelconss, naddconss, nfixedvars, nchgcoefs, nchgsides, cutoff) );
7067 #ifdef WITHEQKNAPSACK 7068 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
7069 SCIP_CALL(
tryUpgradingXor(scip, cons, conshdlrdata, ndelconss, naddconss, nfixedvars, nchgcoefs, nchgsides, cutoff) );
7085 consdata->upgradetried =
TRUE;
7096 int*
const ndelconss,
7097 int*
const naggrvars,
7118 assert(scip != NULL);
7119 assert(cons != NULL);
7120 assert(conshdlrdata != NULL);
7121 assert(ndelconss != NULL);
7122 assert(naggrvars != NULL);
7123 assert(cutoff != NULL);
7130 assert(consdata != NULL);
7131 assert(consdata->lincons != NULL);
7133 consanddatas = consdata->consanddatas;
7134 nconsanddatas = consdata->nconsanddatas;
7135 assert(nconsanddatas == 0 || consanddatas != NULL);
7141 assert(
SCIPisEQ(scip, consdata->rhs, consdata->lhs));
7142 assert(
SCIPisEQ(scip, consdata->rhs, 1.0));
7144 if( nconsanddatas < 2 || nconsanddatas > 3 )
7150 assert(consdata->nlinvars + nconsanddatas ==
nvars);
7153 if( consdata->nlinvars != 1 )
7157 if( consanddatas[0]->
nnewvars > 0 )
7162 if( consanddatas[1]->
nnewvars > 0 )
7182 if( consanddatas[nconsanddatas - 1]->
nnewvars > 0 )
7183 vars = consanddatas[nconsanddatas - 1]->
newvars;
7185 vars = consanddatas[nconsanddatas - 1]->
vars;
7193 for( v = 1; v <
nvars; ++v )
7213 assert(var1 != var2);
7218 for( v =
nvars - 1; v >= 0; --v )
7229 ++(varcount[negated[v]][v]);
7232 for( c = nconsanddatas - 2; c >= 0; --c )
7237 if( consanddatas[nconsanddatas - 1]->
nnewvars > 0 )
7238 vars = consanddatas[c]->
newvars;
7240 vars = consanddatas[c]->
vars;
7251 for( v = 1; v <
nvars; ++v )
7271 assert(var1 != var2);
7276 for( v = nvars - 1; v >= 0; --v )
7286 if(
SCIPsortedvecFindPtr((
void**)allvars, SCIPvarCompActiveAndNegated, repvars[v], nvars, &pos) )
7288 assert(pos >= 0 && pos < nvars);
7290 ++(varcount[negated[v]][pos]);
7303 for( i = 1; i >= 0; --i )
7305 for( v =
nvars - 1; v >= 0; --v )
7309 if( varcount[i][v] == 0 )
7311 else if( varcount[i][v] == 1 )
7313 else if( varcount[i][v] == 2 )
7321 if( othercount == 0 )
7326 if( nconsanddatas == 2 && twocount ==
nvars - 1 && onecount == 2 && zerocount == 1 )
7341 assert(nconsvars == consdata->nlinvars + nconsanddatas);
7342 assert(conscoefs != NULL);
7346 for( v = 0; v < nconsvars; ++v )
7347 assert(
SCIPisEQ(scip, conscoefs[v], 1.0));
7353 NULL, NULL, NULL, NULL) );
7354 assert(nlinvars == 1);
7355 assert(linvar != NULL);
7373 for( i = 1; i >= 0; --i )
7375 for( v =
nvars - 1; v >= 0; --v )
7378 if( varcount[i][v] == 2 )
7390 assert(var != NULL);
7434 else if(
nvars == 2 && nconsanddatas == 3 && twocount == 2 && onecount == 2 && zerocount == 0)
7453 assert(nconsvars == consdata->nlinvars + nconsanddatas);
7454 assert(conscoefs != NULL);
7458 for( v = 0; v < nconsvars; ++v )
7459 assert(
SCIPisEQ(scip, conscoefs[v], 1.0));
7465 NULL, NULL, NULL, NULL) );
7466 assert(nlinvars == 1);
7467 assert(linvar != NULL);
7472 newandvars[0] = NULL;
7473 newandvars[1] = NULL;
7477 for( i = 1; i >= 0; --i )
7479 for( v =
nvars - 1; v >= 0; --v )
7482 if( varcount[i][v] == 1 )
7484 if( newandvars[0] == NULL )
7488 assert(newandvars[1] == NULL);
7500 assert(newandvars[0] != NULL && newandvars[1] != NULL);
7545 assert(scip != NULL);
7546 assert(conshdlr != NULL);
7563 assert(scip != NULL);
7564 assert(conshdlr != NULL);
7569 assert(conshdlrdata != NULL);
7586 assert(scip != NULL);
7587 assert(conshdlr != NULL);
7591 assert(conshdlrdata != NULL);
7594 for( c = conshdlrdata->nallconsanddatas - 1; c >= 0; --c )
7603 assert(conshdlrdata->allconsanddatas[c] != NULL);
7604 assert(conshdlrdata->allconsanddatas[c]->newvars == NULL);
7606 vars = conshdlrdata->allconsanddatas[c]->vars;
7607 nvars = conshdlrdata->allconsanddatas[c]->nvars;
7608 assert(vars != NULL || nvars == 0);
7611 for( v = nvars - 1; v > 0; --v )
7619 andcons = conshdlrdata->allconsanddatas[c]->cons;
7620 assert(andcons != NULL);
7630 SCIPconsGetName(conshdlrdata->allconsanddatas[c]->cons), (
void*)(conshdlrdata->allconsanddatas[c]),
7631 (
void*)(conshdlrdata->allconsanddatas[c]->cons));
7644 assert(scip != NULL);
7645 assert(conshdlr != NULL);
7649 assert(conshdlrdata != NULL);
7652 if( conshdlrdata->decomposeindicatorpbcons || conshdlrdata->decomposenormalpbcons )
7654 for( c = 0; c < nconss; ++c )
7663 assert(cons != NULL);
7670 assert(consdata != NULL);
7681 assert(nvars == 0 || (coefs != NULL));
7683 if( consdata->issoftcons && conshdlrdata->decomposeindicatorpbcons )
7692 #if USEINDICATOR == FALSE 7702 assert(consdata->weight != 0);
7703 assert(consdata->indvar != NULL);
7706 assert(consdata->intvar == NULL);
7710 assert(negindvar != NULL);
7718 updateandconss =
FALSE;
7720 #if USEINDICATOR == FALSE 7725 for( v = nvars - 1; v >= 0; --v )
7759 updateandconss =
TRUE;
7771 ub = lhs - maxact - 1;
7802 if( !updateandconss )
7818 lb = rhs - minact + 1;
7853 updateandconss =
TRUE;
7866 for( v = nvars - 1; v >= 0; --v )
7876 if( !updateandconss )
7894 else if( !consdata->issoftcons && conshdlrdata->decomposenormalpbcons )
7905 if( consdata->intvar != NULL )
7931 assert(scip != NULL);
7932 assert(conshdlr != NULL);
7933 assert(cons != NULL);
7934 assert(consdata != NULL);
7935 assert(*consdata != NULL);
7939 assert(conshdlrdata != NULL);
7950 for( c = (*consdata)->nconsanddatas - 1; c >= 0; --c )
7952 assert((*consdata)->consanddatas[c]->nuses == 0);
7953 assert((*consdata)->consanddatas[c]->cons == NULL);
7954 assert((*consdata)->consanddatas[c]->noriguses == 0 || ((*consdata)->consanddatas[c]->origcons != NULL &&
SCIPconsIsOriginal((*consdata)->consanddatas[c]->origcons)));
7957 conshdlrdata->noriguses -= (*consdata)->nconsanddatas;
7959 assert(conshdlrdata->noriguses >= 0);
7976 assert(scip != NULL);
7977 assert(conshdlr != NULL);
7980 assert(sourcecons != NULL);
7981 assert(targetcons != NULL);
7984 assert(sourcedata != NULL);
7986 assert(sourcedata->nconsanddatas == 0 || sourcedata->consanddatas != NULL);
7992 for( c = sourcedata->nconsanddatas - 1; c >= 0; --c )
7994 assert(sourcedata->consanddatas[c] != NULL);
7995 andconss[c] = sourcedata->consanddatas[c]->origcons;
7996 assert(andconss[c] != NULL);
8002 andconss, sourcedata->andcoefs, sourcedata->andnegs, sourcedata->nconsanddatas, sourcedata->indvar, sourcedata->weight,
8003 sourcedata->issoftcons, sourcedata->intvar, sourcedata->lhs, sourcedata->rhs,
SCIPconsIsChecked(sourcecons),
8025 assert(scip != NULL);
8026 assert(conshdlr != NULL);
8028 assert(result != NULL);
8050 assert(scip != NULL);
8051 assert(conshdlr != NULL);
8053 assert(result != NULL);
8075 assert(scip != NULL);
8076 assert(conshdlr != NULL);
8078 assert(result != NULL);
8101 assert(scip != NULL);
8102 assert(conshdlr != NULL);
8103 assert(sol != NULL);
8105 assert(result != NULL);
8115 for( c = nconss - 1; c >= 0 && (*result ==
SCIP_FEASIBLE || completely); --c )
8118 assert(consdata != NULL);
8120 if( consdata->issoftcons )
8122 assert(consdata->indvar != NULL);
8153 int firstupgradetry;
8163 assert(scip != NULL);
8164 assert(conshdlr != NULL);
8166 assert(result != NULL);
8169 oldnfixedvars = *nfixedvars;
8170 oldnaggrvars = *naggrvars;
8171 oldnchgbds = *nchgbds;
8172 oldndelconss = *ndelconss;
8173 oldnupgdconss = *nupgdconss;
8174 oldnchgcoefs = *nchgcoefs;
8175 oldnchgsides = *nchgsides;
8183 firstchange = INT_MAX;
8184 firstupgradetry = INT_MAX;
8187 for( c = 0; c < nconss && !cutoff && !
SCIPisStopped(scip); ++c )
8205 assert(cons != NULL);
8209 assert(consdata != NULL);
8210 assert(consdata->lincons != NULL);
8227 assert(
SCIPisLE(scip, newlhs, newrhs));
8243 assert(nvars == 0 || (coefs != NULL));
8250 andress, andcoefs, andnegs, &nandress) );
8263 if( firstchange == INT_MAX && consdata->changed )
8276 if( consdata->changed )
8279 SCIP_CALL(
tryUpgrading(scip, cons, conshdlrdata, ndelconss, naddconss, nfixedvars, nchgcoefs, nchgsides, &cutoff) );
8289 if( firstupgradetry == INT_MAX && !consdata->upgradetried )
8290 firstupgradetry = c;
8295 consdata->presolved =
TRUE;
8313 consdata->changed =
FALSE;
8332 else if( *nfixedvars > oldnfixedvars || *naggrvars > oldnaggrvars || *nchgbds > oldnchgbds || *ndelconss > oldndelconss
8333 || *nupgdconss > oldnupgdconss || *nchgcoefs > oldnchgcoefs || *nchgsides > oldnchgsides )
8353 assert(scip != NULL);
8354 assert(cons != NULL);
8355 assert(conshdlr != NULL);
8359 assert(consdata != NULL);
8361 lhs = consdata->lhs;
8362 rhs = consdata->rhs;
8370 SCIPdebugMsg(scip,
"%socking constraint <%s> by [%d;%d].\n", (nlocksneg < 0) || (nlockspos < 0) ?
"Unl" :
"L",
SCIPconsGetName(cons), nlocksneg, nlockspos);
8373 for( c = consdata->nconsanddatas - 1; c >= 0; --c )
8382 consanddata = consdata->consanddatas[c];
8383 assert( consanddata != NULL );
8388 andcons = consanddata->
cons;
8390 if( andcons == NULL )
8393 assert(consanddata->
nnewvars == 0);
8394 assert(consanddata->
nvars == 0);
8399 consanddata->
nvars = 0;
8400 consanddata->
svars = 0;
8407 assert(andcons != NULL);
8410 andvars = consanddata->
newvars;
8415 andvars = consanddata->
vars;
8416 nandvars = consanddata->
nvars;
8421 assert(nandvars == 0 || andvars != NULL);
8422 assert(andres != NULL);
8423 val = consdata->andnegs[c] ? -consdata->andcoefs[c] : consdata->andcoefs[c];
8430 for( v = nandvars - 1; v >= 0; --v )
8440 for( v = nandvars - 1; v >= 0; --v )
8457 for( v = nandvars - 1; v >= 0; --v )
8467 for( v = nandvars - 1; v >= 0; --v )
8489 assert(scip != NULL);
8490 assert(conshdlr != NULL);
8492 assert(cons != NULL);
8503 const char* consname;
8505 assert(scip != NULL);
8506 assert(sourcescip != NULL);
8507 assert(sourcecons != NULL);
8515 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode, global,
8517 assert(cons != NULL || *valid ==
FALSE);
8539 assert(scip != NULL);
8540 assert(conshdlr != NULL);
8541 assert(cons != NULL);
8542 assert(vars != NULL);
8543 assert(varssize >= 0);
8544 assert(success != NULL);
8560 assert(consdata != NULL);
8561 assert(consdata->lincons != NULL);
8573 assert(nlinconsvars >= 0);
8576 if( nlinconsvars == 0 )
8583 else if( varssize < nlinconsvars )
8603 andress, NULL, NULL, &nandress) );
8604 assert(nlinconsvars == nlinvars + nandress);
8610 assert(linvars != NULL);
8617 assert(andress != NULL);
8621 assert(conshdlrdata != NULL);
8622 assert(conshdlrdata->hashmap != NULL);
8626 for( r = nandress - 1; r >= 0; --r )
8630 assert(andress[r] != NULL);
8634 assert(consanddata != NULL);
8638 andcons = consanddata->
cons;
8642 assert(andcons != NULL);
8645 if( varssize <= nvars )
8653 vars[
nvars] = andress[r];
8661 assert(noperands >= 0);
8664 if( varssize < nvars + noperands )
8707 assert(scip != NULL);
8708 assert(conshdlr != NULL);
8709 assert(cons != NULL);
8710 assert(
nvars != NULL);
8711 assert(success != NULL);
8724 assert(consdata != NULL);
8725 assert(consdata->lincons != NULL);
8737 assert(nlinconsvars >= 0);
8740 if( nlinconsvars == 0 )
8760 andress, NULL, NULL, &nandress) );
8761 assert(nlinconsvars == nlinvars + nandress);
8768 assert(andress != NULL);
8772 assert(conshdlrdata != NULL);
8773 assert(conshdlrdata->hashmap != NULL);
8777 for( r = nandress - 1; r >= 0; --r )
8781 assert(andress[r] != NULL);
8785 assert(consanddata != NULL);
8789 andcons = consanddata->
cons;
8793 assert(andcons != NULL);
8834 consEnfolpPseudoboolean, consEnfopsPseudoboolean, consCheckPseudoboolean, consLockPseudoboolean,
8836 assert(conshdlr != NULL);
8855 "decompose all normal pseudo boolean constraint into a \"linear\" constraint and \"and\" constraints",
8859 "decompose all indicator pseudo boolean constraint into a \"linear\" constraint and \"and\" constraints",
8862 "constraints/" CONSHDLR_NAME "/nlcseparate",
"should the nonlinear constraints be separated during LP processing?",
8865 "constraints/" CONSHDLR_NAME "/nlcpropagate",
"should the nonlinear constraints be propagated during node processing?",
8868 "constraints/" CONSHDLR_NAME "/nlcremovable",
"should the nonlinear constraints be removable?",
8929 assert(scip != NULL);
8930 assert(cons != NULL);
8931 assert(lincons != NULL);
8933 assert(andconss != NULL);
8934 assert(andcoefs != NULL);
8935 assert(nandconss >= 1);
8936 assert(issoftcons == (indvar != NULL));
8940 if( conshdlr == NULL )
8948 assert(conshdlrdata != NULL);
8953 assert(conshdlrdata->hashmap != NULL);
8954 assert(conshdlrdata->hashtable != NULL);
8955 assert(conshdlrdata->allconsanddatas != NULL);
8956 assert(conshdlrdata->nallconsanddatas <= conshdlrdata->sallconsanddatas);
8958 memisinvalid =
TRUE;
8964 for( c = nandconss - 1; c >= 0; --c )
8966 assert(andconss[c] != NULL);
8970 assert(vars != NULL &&
nvars > 0);
8971 assert(res != NULL);
8991 newdata->
cons = NULL;
8996 assert(newdata != NULL);
9011 assert(newdata->
vars != NULL && newdata->
nvars > 0);
9018 assert(transformed);
9019 newdata->
cons = andconss[c];
9022 for( v = newdata->
nvars - 1; v >= 0; --v )
9030 assert(!transformed);
9036 assert(tmpdata == NULL || tmpdata->
cons != NULL || tmpdata->
origcons != NULL);
9038 if( tmpdata == NULL || (tmpdata->
cons != andconss[c] && tmpdata->
origcons != andconss[c]))
9040 if( tmpdata != NULL && (tmpdata->
cons != NULL || tmpdata->
origcons != NULL) )
9042 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");
9046 if( conshdlrdata->nallconsanddatas == conshdlrdata->sallconsanddatas )
9051 conshdlrdata->allconsanddatas[conshdlrdata->nallconsanddatas] = newdata;
9052 ++(conshdlrdata->nallconsanddatas);
9058 memisinvalid =
TRUE;
9074 newdata->noriguses = 1;
9084 memisinvalid =
FALSE;
9088 assert(tmpdata->
nuses > 0);
9105 assert(newdata != NULL);
9127 SCIP_CALL(
consdataCreate(scip, conshdlr, &consdata, lincons, linconstype, andconss, andcoefs, NULL, nandconss,
9128 indvar, weight, issoftcons, intvar, lhs, rhs, check,
FALSE) );
9129 assert(consdata != NULL);
9132 SCIP_CALL(
SCIPcreateCons(scip, cons, name, conshdlr, consdata, initial, separate, enforce, check, propagate,
9133 local, modifiable, dynamic, removable, stickingatnode) );
9201 assert(scip != NULL);
9202 assert(cons != NULL);
9203 assert(nlinvars == 0 || (linvars != NULL && linvals != NULL));
9204 assert(nterms == 0 || (terms != NULL && termvals != NULL && ntermvars != NULL));
9205 assert(issoftcons == (indvar != NULL));
9209 if( conshdlr == NULL )
9215 #if USEINDICATOR == TRUE 9216 if( issoftcons && modifiable )
9218 SCIPerrorMessage(
"Indicator constraint handler can't work with modifiable constraints\n");
9225 assert(conshdlrdata != NULL);
9239 initial, enforce, check, local, modifiable, dynamic, stickingatnode,
9240 andconss, andcoefs, andnegs, &nandconss) );
9241 assert(nterms >= nandconss);
9244 for( c = nandconss - 1; c >= 0; --c )
9246 assert(andconss[c] != NULL);
9263 &lhs, &rhs, initial, separate, enforce,
FALSE, propagate, local, modifiable, dynamic, removable,
9264 stickingatnode, &lincons, &linconstype) );
9265 assert(lincons != NULL);
9270 SCIP_CALL(
consdataCreate(scip, conshdlr, &consdata, lincons, linconstype, andconss, andcoefs, andnegs, nandconss,
9271 indvar, weight, issoftcons, intvar, lhs, rhs, check,
FALSE) );
9272 assert(consdata != NULL);
9281 SCIP_CALL(
SCIPcreateCons(scip, cons, name, conshdlr, consdata, initial, separate, enforce, check, propagate,
9282 local, modifiable, dynamic, removable, stickingatnode) );
9314 terms, nterms, ntermvars, termvals, indvar, weight, issoftcons, intvar, lhs, rhs,
9336 assert(scip != NULL);
9337 assert(cons != NULL);
9338 assert(var != NULL);
9351 assert(consdata != NULL);
9353 switch( consdata->linconstype )
9376 #ifdef WITHEQKNAPSACK 9377 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
9390 consdata->propagated =
FALSE;
9391 consdata->presolved =
FALSE;
9392 consdata->cliquesadded =
FALSE;
9412 assert(scip != NULL);
9413 assert(cons != NULL);
9414 assert(
nvars == 0 || vars != NULL);
9436 assert(scip != NULL);
9437 assert(cons != NULL);
9447 assert(consdata != NULL);
9449 return consdata->indvar;
9460 assert(scip != NULL);
9461 assert(cons != NULL);
9471 assert(consdata != NULL);
9473 return consdata->lincons;
9484 assert(scip != NULL);
9485 assert(cons != NULL);
9495 assert(consdata != NULL);
9497 return consdata->linconstype;
9508 assert(scip != NULL);
9509 assert(cons != NULL);
9521 assert(consdata != NULL);
9523 return consdata->nlinvars;
9541 assert(scip != NULL);
9542 assert(cons != NULL);
9543 assert(nlinvars != NULL);
9544 assert(*nlinvars == 0 || linvars != NULL);
9545 assert(*nlinvars == 0 || lincoefs != NULL);
9555 assert(consdata != NULL);
9559 if( *nlinvars < consdata->nlinvars )
9561 *nlinvars = consdata->nlinvars;
9576 SCIP_CALL(
getLinVarsAndAndRess(scip, cons, vars, coefs,
nvars, linvars, lincoefs, nlinvars, NULL, NULL, NULL, NULL) );
9600 assert(scip != NULL);
9601 assert(cons != NULL);
9602 assert(nandconss != NULL);
9603 assert(*nandconss == 0 || andconss != NULL);
9604 assert(*nandconss == 0 || andcoefs != NULL);
9614 assert(consdata != NULL);
9618 if( *nandconss < consdata->nconsanddatas )
9620 *nandconss = consdata->nconsanddatas;
9624 *nandconss = consdata->nconsanddatas;
9625 assert(*nandconss == 0 || consdata->consanddatas != NULL);
9629 for( c = *nandconss - 1; c >= 0; --c )
9631 assert(consdata->consanddatas[c] != NULL);
9632 assert(consdata->consanddatas[c]->istransformed ? (consdata->consanddatas[c]->cons != NULL) :
TRUE);
9633 assert(consdata->consanddatas[c]->isoriginal ? (consdata->consanddatas[c]->origcons != NULL) : TRUE);
9634 assert(consdata->consanddatas[c]->cons != NULL || consdata->consanddatas[c]->origcons != NULL);
9635 assert(isorig ? consdata->consanddatas[c]->origcons != NULL : consdata->consanddatas[c]->cons != NULL);
9637 andconss[c] = (isorig ? consdata->consanddatas[c]->origcons : consdata->consanddatas[c]->cons);
9638 assert(andconss[c] != NULL);
9640 andcoefs[c] = consdata->andcoefs[c];
9654 assert(scip != NULL);
9655 assert(cons != NULL);
9667 assert(consdata != NULL);
9669 return consdata->nconsanddatas;
9687 assert(scip != NULL);
9688 assert(cons != NULL);
9699 assert(consdata != NULL);
9701 switch( consdata->linconstype )
9709 #ifdef WITHEQKNAPSACK 9710 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
9712 SCIPerrorMessage(
"changing left hand side only allowed on standard linear constraint \n");
9747 assert(consdata != NULL);
9749 switch( consdata->linconstype )
9757 #ifdef WITHEQKNAPSACK 9758 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
9760 SCIPerrorMessage(
"changing right hand side only allowed on standard linear constraint \n");
9789 assert(consdata != NULL);
9791 return consdata->lhs;
9812 assert(consdata != NULL);
9814 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_Real SCIPrelDiff(SCIP_Real val1, SCIP_Real val2)
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)
void SCIPupdateSolConsViolation(SCIP *scip, SCIP_SOL *sol, SCIP_Real absviol, SCIP_Real relviol)
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)