73#include "scip/cons_eqknapsack.h"
77#define CONSHDLR_NAME "pseudoboolean"
78#define CONSHDLR_DESC "constraint handler dealing with pseudo Boolean constraints"
79#define CONSHDLR_ENFOPRIORITY -1000000
80#define CONSHDLR_CHECKPRIORITY -5000000
81#define CONSHDLR_EAGERFREQ 100
83#define CONSHDLR_MAXPREROUNDS -1
84#define CONSHDLR_NEEDSCONS TRUE
86#define CONSHDLR_PRESOLTIMING SCIP_PRESOLTIMING_MEDIUM
88#define DEFAULT_DECOMPOSENORMALPBCONS FALSE
89#define DEFAULT_DECOMPOSEINDICATORPBCONS TRUE
91#define DEFAULT_SEPARATENONLINEAR TRUE
92#define DEFAULT_PROPAGATENONLINEAR TRUE
93#define DEFAULT_REMOVABLENONLINEAR TRUE
94#define USEINDICATOR TRUE
95#define NONLINCONSUPGD_PRIORITY 60000
98#undef NONLINCONSUPGD_PRIORITY
103#define HASHSIZE_PSEUDOBOOLEANNONLINEARTERMS 500
202 unsigned int issoftcons:1;
203 unsigned int changed:1;
204 unsigned int propagated:1;
205 unsigned int presolved:1;
206 unsigned int cliquesadded:1;
207 unsigned int upgradetried:1;
211struct SCIP_ConshdlrData
215 int nallconsanddatas;
217 int sallconsanddatas;
225 SCIP_Bool decomposenormalpbcons;
226 SCIP_Bool decomposeindicatorpbcons;
248 if( varind1 < varind2 )
250 else if( varind1 > varind2 )
252 else if( varind1 != -1 )
258 return SCIPvarComp(elem1, elem2);
283 consand1 = consanddata1->
cons;
284 consand2 = consanddata2->
cons;
342 for( v = cdata1->
nvars - 1; v > 0; --v )
345 for( v = cdata2->
nvars - 1; v > 0; --v )
358 for( v = cdata1->
nvars - 1; v >= 0; --v )
364 if( cdata1->
vars[v] != cdata2->
vars[v] )
394 for( v = cdata->
nvars - 1; v > 0; --v )
402 assert(minidx >= 0 && minidx <= maxidx);
416 if( ((*conshdlrdata)->inithashmapandtable) )
430 hashGetKeyAndConsDatas, hashKeyEqAndConsDatas, hashKeyValAndConsDatas, (
void*)
scip) );
436 (*conshdlrdata)->inithashmapandtable =
TRUE;
453 (*conshdlrdata)->allconsanddatas =
NULL;
454 (*conshdlrdata)->nallconsanddatas = 0;
455 (*conshdlrdata)->sallconsanddatas = 10;
460 (*conshdlrdata)->inithashmapandtable =
FALSE;
461 (*conshdlrdata)->hashtable =
NULL;
462 (*conshdlrdata)->hashtablesize = 0;
463 (*conshdlrdata)->hashmap =
NULL;
464 (*conshdlrdata)->hashmapsize = 0;
467 (*conshdlrdata)->nlinconss = 0;
470 (*conshdlrdata)->noriguses = 0;
486 assert((*conshdlrdata)->nallconsanddatas == 0);
489 if( (*conshdlrdata)->inithashmapandtable )
492 (*conshdlrdata)->hashmapsize = 0;
494 (*conshdlrdata)->hashtablesize = 0;
501 (*conshdlrdata)->inithashmapandtable =
FALSE;
506 (*conshdlrdata)->allconsanddatas =
NULL;
507 (*conshdlrdata)->nallconsanddatas = 0;
508 (*conshdlrdata)->sallconsanddatas = 0;
544 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
545 *
nvars = SCIPgetNVarsEQKnapsack(
scip, cons);
607 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
608 *lhs = SCIPgetCapacityEQKnapsack(
scip, cons);
628 SCIP_Real*
const coefs,
654 for( v = 0; v < *
nvars; ++v )
656 vars[v] = linvars[v];
657 coefs[v] = lincoefs[v];
662 for( v = 0; v < *
nvars; ++v )
663 vars[v] = linvars[v];
675 for( v = 0; v < *
nvars; ++v )
677 vars[v] = linvars[v];
683 for( v = 0; v < *
nvars; ++v )
684 vars[v] = linvars[v];
690 SCIP_Longint* weights;
700 for( v = 0; v < *
nvars; ++v )
702 vars[v] = linvars[v];
708 for( v = 0; v < *
nvars; ++v )
709 vars[v] = linvars[v];
721 for( v = 0; v < *
nvars; ++v )
723 vars[v] = linvars[v];
729 for( v = 0; v < *
nvars; ++v )
730 vars[v] = linvars[v];
735 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
737 SCIP_Longint* weights;
739 *
nvars = SCIPgetNVarsEQKnapsack(
scip, cons);
740 linvars = SCIPgetVarsEQKnapsack(
scip, cons);
745 weights = SCIPgetWeightsEQKnapsack(
scip, cons);
747 for( v = 0; v < *
nvars; ++v )
749 vars[v] = linvars[v];
755 for( v = 0; v < *
nvars; ++v )
756 vars[v] = linvars[v];
777 SCIP_Real*
const coefs,
780 SCIP_Real*
const lincoefs,
784 SCIP_Real*
const andcoefs,
786 SCIP_Bool*
const andnegs,
804 if( nlinvars !=
NULL )
806 if( nandress !=
NULL )
816 for( v = 0; v <
nvars; ++v )
818 SCIP_Bool hashmapentryexists;
828 hashmapentryexists =
SCIPhashmapExists(conshdlrdata->hashmap, (
void*)(hashmapvar));
831 hashmapvar =
vars[v];
836 if( hashmapentryexists )
845 if( hashmapentryexists )
853 if( !hashmapentryexists && linvars !=
NULL && nlinvars !=
NULL )
855 linvars[*nlinvars] =
vars[v];
856 if( lincoefs !=
NULL )
859 lincoefs[*nlinvars] = coefs[v];
863 else if( hashmapentryexists && nandress !=
NULL )
865 if( andress !=
NULL )
867 andress[*nandress] = hashmapvar;
869 if( andcoefs !=
NULL )
873 andcoefs[*nandress] = coefs[v];
874 andnegs[*nandress] = (
vars[v] != hashmapvar);
885#ifdef CHECK_CONSISTENCY
904 SCIP_Bool* alreadyfound;
925 assert(consdata->nconsanddatas > 0);
926 assert(consdata->nconsanddatas <= consdata->sconsanddatas);
938 assert(
nvars == consdata->nlinvars + consdata->nconsanddatas);
956 andress, andcoefs, andnegs, &nandress) );
957 assert(nlinvars == consdata->nlinvars);
958 assert(nandress == consdata->nconsanddatas);
960 for( v = nandress - 1; v >= 0; --v )
962 SCIP_VAR* andresultant = andress[v];
965 for(
c = consdata->nconsanddatas - 1;
c >= 0; --
c )
968 if( consdata->consanddatas[
c]->cons !=
NULL )
973 if( res == andresultant && consdata->andnegs[
c] == andnegs[v] && consdata->andcoefs[
c] == andcoefs[v] )
980 alreadyfound[
c] =
TRUE;
989 for(
c = consdata->nconsanddatas - 1;
c >= 0; --
c )
1005#define checkConsConsistency(scip, cons)
1030 tmpvars = consanddata->
vars;
1031 ntmpvars = consanddata->
nvars;
1034 for( v = ntmpvars - 1; v >= 0; --v )
1044 tmpvars = consanddata->
newvars;
1048 for( v = ntmpvars - 1; v >= 0; --v )
1059 if( !origdata || consanddata->
nvars == 0 )
1064 consanddata->
nuses = 0;
1065 consanddata->
nvars = 0;
1066 consanddata->
svars = 0;
1081 if( consanddata->
nvars > 0 )
1092 if( conshdlrdata->inithashmapandtable )
1124 if( conshdlrdata->inithashmapandtable )
1151 SCIP_Real*
const andcoefs,
1152 SCIP_Bool*
const andnegs,
1153 int const nandconss,
1155 SCIP_Real
const weight,
1156 SCIP_Bool
const issoftcons,
1163 SCIP_Bool transforming
1166 SCIP_Bool transformed;
1173 assert(nandconss == 0 || (andconss !=
NULL && andcoefs !=
NULL));
1191 SCIPerrorMessage(
"left hand side of pseudo boolean constraint greater than right hand side\n");
1202 (*consdata)->issoftcons = issoftcons;
1205 (*consdata)->weight = weight;
1211 (*consdata)->indvar = indvar;
1214 (*consdata)->indvar =
NULL;
1217 if( intvar !=
NULL )
1224 (*consdata)->intvar = intvar;
1227 (*consdata)->intvar =
NULL;
1230 (*consdata)->lincons = lincons;
1231 (*consdata)->linconstype = linconstype;
1243 if( transforming || transformed )
1253 (*consdata)->nlinvars =
nvars - nandconss;
1264 if( andnegs !=
NULL )
1272 (*consdata)->nconsanddatas = nandconss;
1273 (*consdata)->sconsanddatas = nandconss;
1283 for(
c = nandconss - 1;
c >= 0; --
c )
1292 assert((*consdata)->consanddatas[
c]->origcons == andconss[
c] || (*consdata)->consanddatas[
c]->cons == andconss[
c]);
1297 if( (*consdata)->consanddatas[
c]->origcons !=
NULL && (*consdata)->consanddatas[
c]->cons ==
NULL )
1307 assert((*consdata)->consanddatas[
c]->cons !=
NULL);
1308 assert((*consdata)->consanddatas[
c]->newvars ==
NULL);
1309 assert((*consdata)->consanddatas[
c]->isoriginal);
1311 (*consdata)->consanddatas[
c]->istransformed =
TRUE;
1313 vars = (*consdata)->consanddatas[
c]->vars;
1314 ncvars = (*consdata)->consanddatas[
c]->nvars;
1324 for( v = ncvars - 1; v >= 0; --v )
1329 else if( (*consdata)->consanddatas[
c]->cons !=
NULL )
1330 assert((*consdata)->consanddatas[
c]->istransformed);
1332 ++((*consdata)->consanddatas[
c]->nuses);
1334 else if( transformed )
1336 assert((*consdata)->consanddatas[
c]->cons == andconss[
c]);
1338 assert((*consdata)->consanddatas[
c]->istransformed);
1343 SCIPsortPtrPtrRealBool((
void**)andress, (
void**)((*consdata)->consanddatas), (*consdata)->andcoefs, (*consdata)->andnegs, resvarComp, nandconss);
1350 (*consdata)->consanddatas =
NULL;
1351 (*consdata)->andcoefs =
NULL;
1352 (*consdata)->andnegs =
NULL;
1353 (*consdata)->nconsanddatas = 0;
1354 (*consdata)->sconsanddatas = 0;
1358 (*consdata)->lhs = lhs;
1359 (*consdata)->rhs = rhs;
1361 (*consdata)->changed =
TRUE;
1362 (*consdata)->propagated =
FALSE;
1363 (*consdata)->presolved =
FALSE;
1364 (*consdata)->cliquesadded =
FALSE;
1365 (*consdata)->upgradetried =
TRUE;
1374 conshdlrdata->noriguses += (*consdata)->nconsanddatas;
1396 assert((*consdata)->nconsanddatas == 0 || (*consdata)->consanddatas !=
NULL);
1400 if( (*consdata)->lincons !=
NULL )
1405 nconsanddatas = (*consdata)->nconsanddatas;
1406 consanddatas = (*consdata)->consanddatas;
1409 for(
c = nconsanddatas - 1;
c >= 0; --
c )
1411 assert((consanddatas[
c]->origcons ==
NULL) == (consanddatas[
c]->noriguses == 0));
1412 assert((consanddatas[
c]->cons ==
NULL) == (consanddatas[
c]->nuses == 0));
1413 assert(consanddatas[
c]->nuses >= 0);
1414 assert(consanddatas[
c]->noriguses >= 0);
1418 if( !isorig && consanddatas[
c]->cons !=
NULL )
1422 --(consanddatas[
c]->
nuses);
1425 if( consanddatas[
c]->nuses == 0 )
1427 if( conshdlrdata->inithashmapandtable )
1433 if( consanddatas[
c]->origcons ==
NULL )
1445 if( consanddatas[
c]->origcons ==
NULL )
1449 assert(conshdlrdata->nallconsanddatas > 0);
1451 for( d = conshdlrdata->nallconsanddatas - 1; d >= 0; --d )
1453 if( conshdlrdata->allconsanddatas[d] == consanddatas[
c] )
1455 --conshdlrdata->nallconsanddatas;
1459 conshdlrdata->allconsanddatas[d] = conshdlrdata->allconsanddatas[conshdlrdata->nallconsanddatas];
1469 else if( isorig && consanddatas[
c]->origcons !=
NULL )
1472 assert(consanddatas[
c]->nuses == 0);
1473 assert(consanddatas[
c]->nnewvars == 0);
1474 assert(consanddatas[
c]->snewvars == 0);
1480 if( consanddatas[
c]->noriguses == 0 )
1484 if( conshdlrdata->inithashmapandtable )
1499 assert(consanddatas[
c]->svars > 0);
1503 consanddatas[
c]->
nvars = 0;
1504 consanddatas[
c]->
svars = 0;
1509 assert(consanddatas[
c]->svars == 0);
1516 assert(conshdlrdata->nallconsanddatas > 0);
1517 for( d = conshdlrdata->nallconsanddatas - 1; d >= 0; --d )
1519 if( conshdlrdata->allconsanddatas[d] == consanddatas[
c] )
1521 --conshdlrdata->nallconsanddatas;
1525 conshdlrdata->allconsanddatas[d] = conshdlrdata->allconsanddatas[conshdlrdata->nallconsanddatas];
1536 assert(!consanddatas[
c]->istransformed);
1541 if( consanddatas[
c]->nuses == 0 && consanddatas[
c]->istransformed )
1546 else if( consanddatas[
c]->nuses == 0 )
1552 assert(consanddatas[
c]->nnewvars == 0);
1553 assert(consanddatas[
c]->snewvars == 0);
1556 tmpvars = consanddatas[
c]->
vars;
1557 ntmpvars = consanddatas[
c]->
nvars;
1560 for( v = ntmpvars - 1; v >= 0; --v )
1569 if( !consanddatas[
c]->istransformed && consanddatas[
c]->noriguses > 0 )
1572 assert(consanddatas[
c]->nuses == 0);
1573 assert(consanddatas[
c]->nnewvars == 0);
1574 assert(consanddatas[
c]->snewvars == 0);
1577 assert(consanddatas[
c]->svars > 0);
1580 assert(consanddatas[
c]->isoriginal);
1586 if( conshdlrdata->inithashmapandtable )
1635 SCIP_Real
const coef,
1636 SCIP_Real
const lhs,
1680 for( v =
nvars - 1; v >= 0; --v )
1687 for( v =
nvars - 1; v >= 0; --v )
1704 SCIP_Real
const coef,
1705 SCIP_Real
const lhs,
1743 for( v =
nvars - 1; v >= 0; --v )
1750 for( v =
nvars - 1; v >= 0; --v )
1789#ifdef WITHEQKNAPSACK
1798 assert(consdata->nconsanddatas >= 0);
1820 assert(consdata->nlinvars + consdata->nconsanddatas ==
nvars);
1836 for( v = 0; v <
nvars; ++v )
1878 if( consanddata !=
NULL )
1885 andcons = consanddata->
cons;
1903 if( consanddata !=
NULL && nandvars == 0 )
1912 else if( coefs[v] == 1.0 )
1917 else if( coefs[v] == -1.0 )
1925 if( consanddata ==
NULL )
1972 SCIP_Bool
const initial,
1974 SCIP_Bool
const enforce,
1977 SCIP_Bool
const check,
1980 SCIP_Bool
const local,
1983 SCIP_Bool
const modifiable,
1986 SCIP_Bool
const dynamic,
1989 SCIP_Bool
const stickingatnode,
2002 SCIP_Bool removable;
2003 SCIP_Bool transformed;
2039 if( tmpdata !=
NULL )
2047 *andcons = tmpdata->
cons;
2093#ifdef WITH_DEBUG_SOLUTION
2094 if( SCIPdebugIsMainscip(
scip) )
2097 SCIP_Real debugsolval;
2100 for( v =
nvars - 1; v >= 0; --v )
2108 val = ((val < 0.5) ? 0.0 : 1.0);
2113 SCIPerrorMessage(
"computed solution value %g for resultant <%s> violates debug solution value %g\n", val,
SCIPvarGetName(resultant), debugsolval);
2135 local, modifiable, dynamic, removable, stickingatnode) );
2147 if( conshdlrdata->nallconsanddatas == conshdlrdata->sallconsanddatas )
2153 conshdlrdata->allconsanddatas[conshdlrdata->nallconsanddatas] = newdata;
2154 ++(conshdlrdata->nallconsanddatas);
2160 newdata->
cons = newcons;
2167 for( v = newdata->
nvars - 1; v >= 0; --v )
2242 if( consdata->nconsanddatas == consdata->sconsanddatas )
2252 ++(consdata->nconsanddatas);
2255 switch( consdata->linconstype )
2278#ifdef WITHEQKNAPSACK
2279 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
2283 SCIP_CALL( SCIPaddCoefEQKnapsack(
scip, consdata->lincons, res, (SCIP_Longint) val) );
2296 consdata->changed =
TRUE;
2297 consdata->propagated =
FALSE;
2298 consdata->presolved =
FALSE;
2299 consdata->cliquesadded =
FALSE;
2300 consdata->upgradetried =
FALSE;
2322 SCIPerrorMessage(
"changing left hand side only allowed on standard lienar constraint \n");
2324#ifdef WITHEQKNAPSACK
2325 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
2353 SCIPerrorMessage(
"changing left hand side only allowed on standard lienar constraint \n");
2355#ifdef WITHEQKNAPSACK
2356 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
2380 SCIP_Real* lincoefs;
2383 SCIP_Real* andcoefs;
2428 SCIP_CALL(
getLinVarsAndAndRess(
scip, cons,
vars, coefs,
nvars, linvars, lincoefs, &nlinvars, andress, andcoefs, andnegs, &nandress) );
2429 assert(consdata->nconsanddatas == nandress);
2445 for(
c = consdata->nconsanddatas - 1;
c >= 0; --
c )
2450 consanddata = consdata->consanddatas[
c];
2453 andcons = consanddata->
cons;
2458 val = andnegs[
c] ? -andcoefs[
c] : andcoefs[
c];
2463 for( v = nandvars - 1; v >= 0; --v )
2470 for( v = nandvars - 1; v >= 0; --v )
2480 for(
c = consdata->nconsanddatas - 1;
c >= 0; --
c )
2485 consanddata = consdata->consanddatas[
c];
2488 andcons = consanddata->
cons;
2493 val = andnegs[
c] ? -andcoefs[
c] : andcoefs[
c];
2498 for( v = nandvars - 1; v >= 0; --v )
2505 for( v = nandvars - 1; v >= 0; --v )
2517 consdata->propagated =
FALSE;
2522 consdata->lhs = lhs;
2523 consdata->presolved =
FALSE;
2524 consdata->changed =
TRUE;
2551 SCIP_Real* lincoefs;
2554 SCIP_Real* andcoefs;
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];
2624 andcons = consanddata->
cons;
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];
2659 andcons = consanddata->
cons;
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;
2715 SCIP_Real*
const termcoefs,
2717 int const*
const ntermvars,
2718 SCIP_Bool
const initial,
2720 SCIP_Bool
const enforce,
2723 SCIP_Bool
const check,
2726 SCIP_Bool
const local,
2729 SCIP_Bool
const modifiable,
2732 SCIP_Bool
const dynamic,
2735 SCIP_Bool
const stickingatnode,
2740 SCIP_Real*
const andvals,
2741 SCIP_Bool*
const andnegs,
2760 for( t = 0; t <
nterms; ++t )
2765 initial, enforce, check, local, modifiable, dynamic, stickingatnode,
2766 &(andconss[*nandconss])) );
2768 andvals[*nandconss] = termcoefs[t];
2769 andnegs[*nandconss] =
FALSE;
2784 SCIP_Real*
const linvals,
2787 SCIP_Real
const*
const andvals,
2788 SCIP_Bool*
const andnegs,
2789 SCIP_Real*
const lhs,
2790 SCIP_Real*
const rhs,
2791 SCIP_Bool
const initial,
2793 SCIP_Bool
const separate,
2795 SCIP_Bool
const enforce,
2798 SCIP_Bool
const check,
2803 SCIP_Bool
const local,
2806 SCIP_Bool
const modifiable,
2809 SCIP_Bool
const dynamic,
2812 SCIP_Bool
const removable,
2815 SCIP_Bool
const stickingatnode,
2844 assert(nlinvars > 0 || nandress > 0);
2854 ++(conshdlrdata->nlinconss);
2870 nvars = nlinvars + nandress;
2873 for( v = nlinvars - 1; v >= 0; --v )
2903 for( v = nandress - 1; v >= 0; --v )
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
2965 for( v = 0; v < nlinvars; ++v )
2967 if( mult * linvals[v] > 0.0 )
2968 transvars[v] = linvars[v];
2977 for( v = 0; v < nandress; ++v )
2979 if( mult * andvals[v] > 0.0 )
2980 transvars[nlinvars + v] = andress[v];
2992 initial, separate, enforce, check,
propagate, local, modifiable, dynamic, removable, stickingatnode) );
3021 if( upgrconshdlr !=
NULL && !created && ncoeffspone + ncoeffsnone ==
nvars )
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];
3049 for( v = 0; v < nandress; ++v )
3051 if( mult * andvals[v] > 0.0 )
3052 transvars[nlinvars + v] = andress[v];
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];
3099 for( v = 0; v < nandress; ++v )
3101 if( mult * andvals[v] > 0.0 )
3102 transvars[nlinvars + v] = andress[v];
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];
3160 for( v = 0; v < nandress; ++v )
3162 if( mult * andvals[v] > 0.0 )
3163 transvars[nlinvars + v] = andress[v];
3175 initial, separate, enforce, check,
propagate, local, modifiable, dynamic, removable, stickingatnode) );
3198 SCIP_Longint* weights;
3199 SCIP_Longint capacity;
3200 SCIP_Longint weight;
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;
3242 for( v = 0; v < nandress; ++v )
3248 transvars[nlinvars + v] = andress[v];
3249 weights[nlinvars + v] = weight;
3255 weights[nlinvars + v] = -weight;
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) )
3287 SCIP_Longint* weights;
3288 SCIP_Longint capacity;
3289 SCIP_Longint weight;
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;
3330 for( v = 0; v < nandress; ++v )
3336 transvars[nlinvars + v] = andress[v];
3337 weights[nlinvars + v] = weight;
3343 weights[nlinvars + v] = -weight;
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;
3373 initial, separate, enforce, check,
propagate, local, modifiable, dynamic, removable, stickingatnode) );
3378 for( v = 0; v < nandress; ++v )
3409 SCIP_Bool*
const violated,
3410 SCIP_Bool
const printreason
3466 assert(consdata->nlinvars + consdata->nconsanddatas ==
nvars);
3478 for( v = 0; v <
nvars; ++v )
3489 if( consanddata !=
NULL )
3500 if( consanddata ==
NULL )
3511 if( andcons ==
NULL )
3512 andcons = consanddata->
cons;
3522 for(
i = 0;
i < nandvars; ++
i )
3526 solval = 1.0 - solval;
3530 activity += coefs[v] * solval;
3533 SCIPdebugMsg(
scip,
"lhs = %g, activity = %g, rhs = %g\n", lhs, activity, rhs);
3536 lhsviol = lhs - activity;
3537 rhsviol = activity - rhs;
3539 if(lhsviol > rhsviol)
3598 SCIP_Bool*
const violated
3618 for(
c = conshdlrdata->nallconsanddatas - 1;
c >= 0; --
c )
3621 SCIP_Real minsolval;
3622 SCIP_Real sumsolval;
3625 if( !conshdlrdata->allconsanddatas[
c]->istransformed )
3628 andcons = conshdlrdata->allconsanddatas[
c]->cons;
3631 if( andcons ==
NULL )
3642 for( v =
nvars - 1; v >= 0; --v )
3646 if( solval < minsolval )
3649 sumsolval += solval;
3656 viol =
MAX3(0.0, solval - minsolval, sumsolval - (
nvars - 1.0 + solval));
3681 SCIP*
const targetscip,
3683 SCIP*
const sourcescip,
3690 SCIP_Bool
const initial,
3691 SCIP_Bool
const separate,
3692 SCIP_Bool
const enforce,
3693 SCIP_Bool
const check,
3695 SCIP_Bool
const local,
3696 SCIP_Bool
const modifiable,
3697 SCIP_Bool
const dynamic,
3698 SCIP_Bool
const removable,
3699 SCIP_Bool
const stickingatnode,
3701 SCIP_Bool
const global,
3702 SCIP_Bool*
const valid
3721 sourcelincons = sourceconsdata->lincons;
3730 SCIP_Real* targetandcoefs;
3731 int ntargetandconss;
3734 targetlinconstype = sourceconsdata->linconstype;
3736 switch( targetlinconstype )
3754#ifdef WITHEQKNAPSACK
3755 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
3766 if( conshdlrlinear ==
NULL )
3772 targetlincons =
NULL;
3792 targetandconss =
NULL;
3793 targetandcoefs =
NULL;
3794 ntargetandconss = 0;
3800 int nsourceandconss;
3803 SCIP_Real* targetlincoefs;
3809 nsourceandconss = sourceconsdata->nconsanddatas;
3824 targetlinvars, targetlincoefs, &ntargetlinvars) );
3831 SCIPvarIsHashkeyEq, SCIPvarGetHashkeyVal,
NULL) );
3833 for(
c = 0 ;
c < ntargetlinvars; ++
c )
3842 for(
c = 0 ;
c < nsourceandconss; ++
c )
3849 consanddata = sourceconsdata->consanddatas[
c];
3866 targetandconss[ntargetandconss] =
NULL;
3878 targetandcoefs[ntargetandconss] = sourceconsdata->andcoefs[
c];
3884 assert(ntargetandconss <= ntargetlinvars);
3889 SCIP_Real targetrhs;
3890 SCIP_Real targetlhs;
3894 const char* consname;
3897 assert(sourceconsdata->issoftcons == (sourceconsdata->indvar !=
NULL));
3898 indvar = sourceconsdata->indvar;
3899 intvar = sourceconsdata->intvar;
3902 if( indvar !=
NULL )
3932 targetlincons, targetlinconstype, targetandconss, targetandcoefs, ntargetandconss,
3933 indvar, sourceconsdata->weight, sourceconsdata->issoftcons, intvar, targetlhs, targetrhs,
3934 initial, separate, enforce, check,
propagate, local, modifiable, dynamic, removable, stickingatnode) );
3944 if( targetlincons !=
NULL )
3950 if( targetandconss !=
NULL )
3954 assert(ntargetandconss <= sourceconsdata->nconsanddatas);
3956 for(
c = 0 ;
c < ntargetandconss; ++
c )
3958 if( targetandconss[
c] !=
NULL )
3989 allconsanddatas = conshdlrdata->allconsanddatas;
3991 assert(conshdlrdata->nallconsanddatas > 0);
3992 assert(conshdlrdata->nallconsanddatas <= conshdlrdata->sallconsanddatas);
3994 for(
c = conshdlrdata->nallconsanddatas - 1;
c >= 0; --
c )
4003 consanddata = allconsanddatas[
c];
4008 if( consanddata->
nuses == 0 )
4026 cons = consanddata->
cons;
4049 for( v =
nvars - 1; v > 0; --v )
4052 for( v = nnewvars - 1; v > 0; --v )
4057 if(
nvars == nnewvars )
4064 for( v =
nvars - 1; v >= 0; --v )
4066 if(
vars[v] != newvars[v] )
4078 if( nnewvars > consanddata->
snewvars )
4088 for( v = consanddata->
nnewvars - 1; v >= 0; --v )
4106 SCIP_Real
const coef,
4107 SCIP_Real
const lhs,
4134 SCIP_Real
const coef,
4135 SCIP_Real
const lhs,
4161 SCIP_Real
const newlhs,
4162 SCIP_Real
const newrhs,
4164 SCIP_Real*
const andcoefs,
4165 SCIP_Bool*
const andnegs,
4170 int nnewconsanddatas;
4171 int snewconsanddatas;
4172 SCIP_Real* newandcoefs;
4173 SCIP_Real* oldandcoefs;
4174 SCIP_Bool* newandnegs;
4175 SCIP_Bool* oldandnegs;
4196 SCIPsortPtrRealBool((
void**)(consdata->consanddatas), consdata->andcoefs, consdata->andnegs, resvarCompWithInactive, consdata->nconsanddatas);
4201 consanddatas = consdata->consanddatas;
4202 oldandcoefs = consdata->andcoefs;
4203 oldandnegs = consdata->andnegs;
4204 nconsanddatas = consdata->nconsanddatas;
4205 assert(nconsanddatas == 0 || (consanddatas !=
NULL && oldandcoefs !=
NULL));
4207 snewconsanddatas = nconsanddatas + nandress;
4214 nnewconsanddatas = 0;
4217 for(
c = 0, c1 = 0;
c < nconsanddatas && c1 < nandress; )
4226 if( !consanddatas[
c]->istransformed )
4229 consdata->changed =
TRUE;
4230 consdata->upgradetried =
FALSE;
4234 andcons = consanddatas[
c]->
cons;
4237 if( andcons ==
NULL )
4240 consdata->changed =
TRUE;
4241 consdata->upgradetried =
FALSE;
4248 oldandnegs[
c] ? -oldandcoefs[
c] : oldandcoefs[
c], consdata->lhs, consdata->rhs) );
4250 consdata->changed =
TRUE;
4251 consdata->upgradetried =
FALSE;
4270 assert(consanddatas[
c]->nuses > 0);
4271 --(consanddatas[
c]->
nuses);
4275 consdata->lhs, consdata->rhs) );
4277 consdata->changed =
TRUE;
4278 consdata->upgradetried =
FALSE;
4279 consdata->propagated =
FALSE;
4280 consdata->presolved =
FALSE;
4287 newandcoefs[nnewconsanddatas] = andcoefs[c1];
4288 newandnegs[nnewconsanddatas] = andnegs[c1];
4289 ++(newconsanddatas[nnewconsanddatas]->
nuses);
4293 -newandcoefs[nnewconsanddatas] : newandcoefs[nnewconsanddatas], newlhs, newrhs) );
4295 consdata->changed =
TRUE;
4296 consdata->upgradetried =
FALSE;
4297 consdata->cliquesadded =
FALSE;
4298 consdata->propagated =
FALSE;
4299 consdata->presolved =
FALSE;
4305 SCIP_Bool coefsignchanged;
4306 SCIP_Bool lhschanged;
4307 SCIP_Bool rhschanged;
4314 newconsanddatas[nnewconsanddatas] = consanddatas[
c];
4316 newandcoefs[nnewconsanddatas] = andcoefs[c1];
4317 newandnegs[nnewconsanddatas] = andnegs[c1];
4319 if( ((oldandnegs[
c] == andnegs[c1]) && !
SCIPisEQ(
scip, oldandcoefs[
c], newandcoefs[c1]))
4320 || ((oldandnegs[
c] != newandnegs[c1]) && !
SCIPisEQ(
scip, oldandcoefs[
c], -newandcoefs[c1])) )
4321 consdata->upgradetried =
FALSE;
4323 coefsignchanged = (oldandnegs[
c] == andnegs[c1]) &&
4324 ((oldandcoefs[
c] < 0 && andcoefs[c1] > 0) || (oldandcoefs[
c] > 0 && andcoefs[c1] < 0));
4325 coefsignchanged = coefsignchanged || ((oldandnegs[
c] != andnegs[c1]) &&
4326 ((oldandcoefs[
c] < 0 && andcoefs[c1] < 0) || (oldandcoefs[
c] > 0 && andcoefs[c1] > 0)));
4328 || (consdata->lhs < 0 && newlhs > 0) || (consdata->lhs > 0 && newlhs < 0);
4330 || (consdata->rhs < 0 && newrhs > 0) || (consdata->rhs > 0 && newrhs < 0);
4333 if( coefsignchanged || lhschanged || rhschanged || newconsanddatas[nnewconsanddatas]->nnewvars > 0)
4337 -oldandcoefs[
c] : oldandcoefs[
c], consdata->lhs, consdata->rhs) );
4339 -newandcoefs[nnewconsanddatas] : newandcoefs[nnewconsanddatas], newlhs, newrhs) );
4341 consdata->changed =
TRUE;
4342 consdata->upgradetried =
FALSE;
4343 consdata->cliquesadded =
FALSE;
4344 consdata->propagated =
FALSE;
4345 consdata->presolved =
FALSE;
4355 if(
c < nconsanddatas )
4359 for( ;
c < nconsanddatas; ++
c )
4367 andcons = consanddatas[
c]->
cons;
4369 if( andcons !=
NULL )
4376 if( andcons ==
NULL )
4378 consdata->changed =
TRUE;
4379 consdata->upgradetried =
FALSE;
4383 assert(consanddatas[
c]->nuses > 0);
4384 --(consanddatas[
c]->
nuses);
4388 consdata->lhs, consdata->rhs) );
4389 consdata->changed =
TRUE;
4390 consdata->upgradetried =
FALSE;
4391 consdata->propagated =
FALSE;
4392 consdata->presolved =
FALSE;
4395 else if( c1 < nandress )
4397 for( ; c1 < nandress; ++c1 )
4405 newandcoefs[nnewconsanddatas] = andcoefs[c1];
4406 newandnegs[nnewconsanddatas] = andnegs[c1];
4407 ++(newconsanddatas[nnewconsanddatas]->
nuses);
4411 -newandcoefs[nnewconsanddatas] : newandcoefs[nnewconsanddatas], newlhs, newrhs) );
4414 consdata->changed =
TRUE;
4415 consdata->upgradetried =
FALSE;
4416 consdata->cliquesadded =
FALSE;
4417 consdata->propagated =
FALSE;
4418 consdata->presolved =
FALSE;
4421 assert(
c == nconsanddatas && c1 == nandress);
4430 consdata->upgradetried =
FALSE;
4431 consdata->lhs = newlhs;
4432 consdata->rhs = newrhs;
4435 consdata->consanddatas = newconsanddatas;
4436 consdata->andcoefs = newandcoefs;
4437 consdata->andnegs = newandnegs;
4438 consdata->nconsanddatas = nnewconsanddatas;
4439 consdata->sconsanddatas = snewconsanddatas;
4441 oldnvars = consdata->nlinvars;
4444 consdata->nlinvars -= nnewconsanddatas;
4446 if( oldnvars != consdata->nlinvars )
4448 consdata->changed =
TRUE;
4449 consdata->upgradetried =
FALSE;
4450 consdata->cliquesadded =
FALSE;
4451 consdata->propagated =
FALSE;
4452 consdata->presolved =
FALSE;
4456 consanddatas = consdata->consanddatas;
4457 nconsanddatas = consdata->nconsanddatas;
4458 assert(nconsanddatas == 0 || consanddatas !=
NULL);
4461 for(
c = nconsanddatas - 1;
c > 0; --
c )
4488 int*
const naggrvars,
4517 assert(consdata->nconsanddatas > 0);
4520 if( consdata->cliquesadded )
4523 consdata->cliquesadded =
TRUE;
4532 assert(consdata->nconsanddatas > 0);
4533 assert(consdata->nconsanddatas <= consdata->sconsanddatas);
4537 assert(
nvars == consdata->nlinvars + consdata->nconsanddatas);
4552 assert(nandress == consdata->nconsanddatas);
4556 for(
c = nandress - 1;
c >= 0; --
c )
4562 consanddata = consdata->consanddatas[
c];
4570 andvars = consanddata->
newvars;
4575 andvars = consanddata->
vars;
4576 nandvars = consanddata->
nvars;
4579 for( v1 = nandvars - 1; v1 >= 0; --v1 )
4582 SCIP_Bool values[2];
4597 for( v2 = nlinvars - 1; v2 >= 0; --v2 )
4627 if( values[0] != values[1] && var1 == var2 )
4633 clqvars[0] = andres;
4644 *nchgbds += nchgbdslocal;
4676 clqvars[0] = andres;
4687 *nchgbds += nchgbdslocal;
4707 for(
c = nandress - 1;
c > 0; --
c )
4716 consanddata1 = consdata->consanddatas[
c];
4718 consanddata2 = consdata->consanddatas[
c - 1];
4727 andvars1 = consanddata1->
newvars;
4728 nandvars1 = consanddata1->
nnewvars;
4732 andvars1 = consanddata1->
vars;
4733 nandvars1 = consanddata1->
nvars;
4739 andvars2 = consanddata2->
newvars;
4740 nandvars2 = consanddata2->
nnewvars;
4744 andvars2 = consanddata2->
vars;
4745 nandvars2 = consanddata2->
nvars;
4749 for( v1 = nandvars1 - 1; v1 >= 0; --v1 )
4752 SCIP_Bool values[2];
4754 var1 = andvars1[v1];
4767 for( v2 = nandvars2 - 1; v2 >= 0; --v2 )
4771 var2 = andvars2[v2];
4797 if( values[0] != values[1] && var1 == var2 )
4803 clqvars[0] = andres;
4804 clqvars[1] = andres2;
4813 *nchgbds += nchgbdslocal;
4846 clqvars[0] = andres;
4857 *nchgbds += nchgbdslocal;
4914 if( consdata->propagated )
4918 consdata->propagated =
TRUE;
4941 consanddatas = consdata->consanddatas;
4942 nconsanddatas = consdata->nconsanddatas;
4943 assert(nconsanddatas == 0 || consanddatas !=
NULL);
4949 for(
c = nconsanddatas - 1;
c >= 0; --
c )
4955 if( !consanddatas[
c]->istransformed )
4958 andcons = consanddatas[
c]->
cons;
4979 SCIP_Real* activescalars;
4980 SCIP_Real activeconstant;
4989 allconsanddatas = conshdlrdata->allconsanddatas;
4991 assert(conshdlrdata->nallconsanddatas >= 1);
4992 assert(conshdlrdata->nallconsanddatas <= conshdlrdata->sallconsanddatas);
4994 if( nfixedvars >= 1 &&
nvars >= 1 )
5002 activescalars =
NULL;
5005 for(
c = conshdlrdata->nallconsanddatas - 1;
c >= 0; --
c )
5012 consanddata = allconsanddatas[
c];
5030 if( consanddata->
nvars == 0 )
5047 consanddata->
nuses = 0;
5062 if( consanddata->
nuses == 0 )
5064 SCIP_Bool looseorcolumn;
5093 SCIP_Bool del =
TRUE;
5099 for(
w = 0;
w < nfixedvars && del; ++
w )
5108 activevars[0] = fixedvars[
w];
5109 activescalars[0] = 1.0;
5110 activeconstant = 0.0;
5113 &activeconstant, &requiredsize,
TRUE) );
5116 for(
i = 0;
i < nactivevars && del; ++
i )
5120 if( activevars[
i] == resvar )
5134 if( !looseorcolumn )
5159 cons = consanddata->
cons;
5174 consanddata->
nuses = 0;
5192 tmpvars = consanddata->
vars;
5194 for( v = consanddata->
nvars - 1; v >= 0; --v )
5202 tmpvars = consanddata->
vars;
5203 stmpvars = consanddata->
svars;
5207 consanddata->
newvars = tmpvars;
5213 if( activevars !=
NULL )
5249 consanddatas = consdata->consanddatas;
5250 nconsanddatas = consdata->nconsanddatas;
5251 assert(nconsanddatas > 0 && consanddatas !=
NULL);
5255 for(
c = nconsanddatas - 1;
c >= 0; --
c )
5259 consanddata = consanddatas[
c];
5269 for(
c = nconsanddatas - 1;
c >= 0; --
c )
5273 consanddata = consanddatas[
c];
5275 assert(consanddatas[
c]->istransformed);
5279 if( consanddata->
nuses > 0 )
5280 --(consanddata->
nuses);
5283 if( consanddata->
nuses == 0 )
5287 SCIP_Bool looseorcolumn;
5318 if( !looseorcolumn )
5342 consdata->nconsanddatas = 0;
5361 SCIP_Bool*
const values,
5365 SCIP_Real*
const lincoefs,
5367 SCIP_Real
const constant,
5368 SCIP_Real
const side,
5370 SCIP_Real*
const consanddatacoefs,
5371 SCIP_Bool*
const consanddatanegs,
5372 int const nconsanddatas,
5399 assert(nconsanddatas > 0);
5400 assert(*xortype >= -1 && *xortype <= 1);
5403 SCIPsortPtr((
void**)linvars, SCIPvarCompActiveAndNegated, nlinvars);
5407 for( v = nlinvars - 1; v >= 0; --v )
5412 value += lincoefs[v];
5427 for(
c = nconsanddatas - 1;
c >= 0; --
c )
5429 SCIP_Bool val =
TRUE;
5431 consanddata = consanddatas[
c];
5438 termvars = consanddata->
newvars;
5443 termvars = consanddata->
vars;
5444 ntermvars = consanddata->
nvars;
5452 SCIPsortPtrBool((
void**)repvars, negated, SCIPvarCompActiveAndNegated, ntermvars);
5454 for( v = ntermvars - 1; v >= 0; --v )
5463 if( (negated[v] && values[pos]) || (!negated[v] && !values[pos]) )
5479 if( val != consanddatanegs[
c] )
5480 value += consanddatacoefs[
c];
5486 if( *xortype == -1 )
5494 else if( *xortype == 1 && cnt % 2 == 0 )
5496 else if( *xortype == 0 && cnt % 2 == 1 )
5502 if( *xortype == -1 )
5510 else if( *xortype == 1 && cnt % 2 == 1 )
5512 else if( *xortype == 0 && cnt % 2 == 0 )
5533 int*
const ndelconss,
5534 int*
const naddconss,
5535 int*
const nfixedvars,
5536 int*
const nchgcoefs,
5537 int*
const nchgsides,
5546 SCIP_Real* allcoefs;
5549 SCIP_Real* lincoefs;
5551 SCIP_Real* andcoefs;
5585 consanddatas = consdata->consanddatas;
5586 andcoefs = consdata->andcoefs;
5587 andnegs = consdata->andnegs;
5588 nconsanddatas = consdata->nconsanddatas;
5589 assert(nconsanddatas > 0 && consanddatas !=
NULL);
5601 lincons = consdata->lincons;
5605 assert(nallvars - nconsanddatas == consdata->nlinvars);
5606 nlinvars = consdata->nlinvars;
5628 assert(nlinvars == consdata->nlinvars);
5629 assert(nandress == nallvars-nlinvars);
5640 firstnlinvars = nlinvars;
5643 SCIPsortPtr((
void**)linvars, SCIPvarCompActiveAndNegated, nlinvars);
5645 for(
c = nconsanddatas - 1;
c >= 0; --
c )
5647 consanddata = consanddatas[
c];
5673 oldnlinvars = nlinvars;
5676 for( v =
nvars - 1, v1 = nlinvars - 1; v >= 0 && v1 >= 0; )
5696 linvars[nlinvars] =
var;
5718 for( ; v >= 0; --v )
5733 linvars[nlinvars] =
var;
5742 if( nlinvars > oldnlinvars )
5745 SCIPsortPtr((
void**)linvars, SCIPvarCompActiveAndNegated, nlinvars);
5753 for( v = (1 << nlinvars) - 1; v >= 0; --v )
5756 for( v1 = nlinvars - 1; v1 >= 0; --v1 )
5769 consdata->lhs, consanddatas, andcoefs, andnegs, nconsanddatas, cnt, &xortype) );
5776 assert(xortype >= -1 && xortype <= 1);
5824 int*
const ndelconss,
5825 int*
const naddconss,
5826 int*
const nfixedvars,
5827 int*
const nchgcoefs,
5828 int*
const nchgsides,
5856 consanddatas = consdata->consanddatas;
5857 nconsanddatas = consdata->nconsanddatas;
5858 assert(nconsanddatas > 0 && consanddatas !=
NULL);
5866 if( nconsanddatas == 1 )
5870 SCIP_Real* allcoefs;
5873 SCIP_Real* lincoefs;
5886 if( consdata->nlinvars == 0 )
5898 lincons = consdata->lincons;
5900 consanddata = consanddatas[0];
5929 assert(nallvars == consdata->nlinvars + 1);
5931 nlinvars = consdata->nlinvars;
5946 assert(nlinvars == consdata->nlinvars);
5949 for( v = 0; v < nlinvars; ++v )
5955 for( v = 0; v <
nvars; ++v )
5987 c = nconsanddatas - 1;
5988 assert(consanddatas[
c]->istransformed);
5991 if( consanddatas[
c]->nnewvars > 0 )
5999 neqvars = consanddatas[
c]->
nvars;
6009 for( v = neqvars - 1; v > 0; --v )
6013 for( --
c ;
c >= 0; --
c )
6020 consanddata = consanddatas[
c];
6022 assert(consanddatas[
c]->istransformed);
6039 for( v =
nvars - 1; v > 0; --v )
6044 if(
nvars < nminvars )
6047 else if(
nvars > nmaxvars )
6050 assert(nminvars <= nmaxvars);
6053 for( v = 0, v2 = 0; v < neqvars && v2 <
nvars; )
6064 if( index1 < index2 )
6066 else if( index1 > index2 )
6070 assert(index1 == index2);
6073 if( nneweqvars < v )
6074 eqvars[nneweqvars] = eqvars[v];
6080 neqvars = nneweqvars;
6085 if( nminvars > neqvars + 1 )
6127 if( neqvars > 0 && consdata->nlinvars == 0 )
6129 SCIP_Bool infeasible;
6133 for( v = 0; v < neqvars; ++v )
6150 if( nminvars == neqvars )
6162 if( neqvars > 0 && nminvars == nmaxvars && nminvars == neqvars + 1 )
6173 lincons = consdata->lincons;
6185 for(
c = nconsanddatas - 1;
c >= 0; --
c )
6191 consanddata = consanddatas[
c];
6193 assert(consanddatas[
c]->istransformed);
6208 for( v = 0, v2 = 0; v < neqvars && v2 <
nvars; )
6219 assert(index1 >= index2);
6221 if( index1 > index2 )
6228 assert(index1 == index2);
6238 for( ; v2 <
nvars; ++v2)
6250 if( consdata->nlinvars > 0 )
6256 SCIP_Real* lincoefs;
6260 for( v = 0; v < neqvars; ++v )
6267 assert(
nvars == consdata->nlinvars + consdata->nconsanddatas);
6281 for( v = 0; v <
nvars; ++v )
6287 assert(nlinvars == consdata->nlinvars);
6290 for( v = 0; v < nlinvars; ++v )
6336 int*
const ndelconss,
6337 int*
const naddconss,
6338 int*
const nfixedvars,
6339 int*
const nchgcoefs,
6340 int*
const nchgsides,
6369 consanddatas = consdata->consanddatas;
6370 nconsanddatas = consdata->nconsanddatas;
6371 assert(nconsanddatas > 0 && consanddatas !=
NULL);
6393 if( nconsanddatas == 1 )
6396 if( consdata->nlinvars == 0 )
6425 if( consdata->nlinvars > 0 )
6430 assert(consdata->nlinvars == 0 && nconsanddatas > 1);
6432 c = nconsanddatas - 1;
6433 assert(consanddatas[
c]->istransformed);
6436 if( consanddatas[
c]->nnewvars > 0 )
6444 neqvars = consanddatas[
c]->
nvars;
6454 for( v = neqvars - 1; v > 0; --v )
6458 for( --
c ;
c >= 0; --
c )
6465 consanddata = consanddatas[
c];
6467 assert(consanddatas[
c]->istransformed);
6484 for( v =
nvars - 1; v > 0; --v )
6489 if(
nvars < nminvars )
6492 else if(
nvars > nmaxvars )
6495 assert(nminvars <= nmaxvars);
6498 for( v = 0, v2 = 0; v < neqvars && v2 <
nvars; )
6509 if( index1 < index2 )
6511 else if( index1 > index2 )
6515 assert(index1 == index2);
6518 if( nneweqvars < v )
6519 eqvars[nneweqvars] = eqvars[v];
6525 neqvars = nneweqvars;
6567 if( neqvars > 0 && ((nminvars == nmaxvars && nminvars == neqvars + 1) || (nminvars == neqvars) || (type ==
SCIP_SETPPCTYPE_PARTITIONING)) )
6574 SCIP_Bool infeasible;
6576 SCIP_Bool createcons;
6577 SCIP_Bool deletecons;
6597 if( neqvars == nminvars )
6600 createcons = (
SCIPisLE(
scip, lhs, rhs) && ((nminvars == nmaxvars && nminvars == neqvars + 1) || (nminvars == neqvars)));
6605 lincons = consdata->lincons;
6623 for(
c = nconsanddatas - 1;
c >= 0; --
c )
6629 consanddata = consanddatas[
c];
6631 assert(consanddatas[
c]->istransformed);
6647 if( deletecons && neqvars + 1 <
nvars )
6666 for( v = 0, v2 = 0; v < neqvars && v2 <
nvars; )
6677 assert(index1 >= index2);
6679 if( index1 > index2 )
6686 else if( deletecons )
6703 assert(index1 == index2);
6714 for( ; v2 <
nvars; ++v2)
6720 else if( deletecons )
6741 for( v = 0; v < neqvars; ++v )
6812 int*
const ndelconss,
6813 int*
const naddconss,
6814 int*
const nfixedvars,
6815 int*
const nchgcoefs,
6816 int*
const nchgsides,
6841 consanddatas = consdata->consanddatas;
6842 assert(consdata->nconsanddatas == 0 || consanddatas !=
NULL);
6846 if( consdata->nconsanddatas == 0 )
6862 assert(consdata->nlinvars + consdata->nconsanddatas ==
nvars);
6864 switch( consdata->linconstype )
6881#ifdef WITHEQKNAPSACK
6882 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
6899 consdata->upgradetried =
TRUE;
6910 int*
const ndelconss,
6911 int*
const naggrvars,
6947 consanddatas = consdata->consanddatas;
6948 nconsanddatas = consdata->nconsanddatas;
6949 assert(nconsanddatas == 0 || consanddatas !=
NULL);
6958 if( nconsanddatas < 2 || nconsanddatas > 3 )
6964 assert(consdata->nlinvars + nconsanddatas ==
nvars);
6967 if( consdata->nlinvars != 1 )
6971 if( consanddatas[0]->nnewvars > 0 )
6976 if( consanddatas[1]->nnewvars > 0 )
6978 if(
nvars != consanddatas[1]->nnewvars )
6996 if( consanddatas[nconsanddatas - 1]->nnewvars > 0 )
6999 vars = consanddatas[nconsanddatas - 1]->
vars;
7007 for( v = 1; v <
nvars; ++v )
7032 for( v =
nvars - 1; v >= 0; --v )
7043 ++(varcount[negated[v]][v]);
7046 for(
c = nconsanddatas - 2;
c >= 0; --
c )
7051 if( consanddatas[nconsanddatas - 1]->nnewvars > 0 )
7065 for( v = 1; v <
nvars; ++v )
7090 for( v =
nvars - 1; v >= 0; --v )
7104 ++(varcount[negated[v]][pos]);
7117 for(
i = 1;
i >= 0; --
i )
7119 for( v =
nvars - 1; v >= 0; --v )
7123 if( varcount[
i][v] == 0 )
7125 else if( varcount[
i][v] == 1 )
7127 else if( varcount[
i][v] == 2 )
7135 if( othercount == 0 )
7140 if( nconsanddatas == 2 && twocount ==
nvars - 1 && onecount == 2 && zerocount == 1 )
7143 SCIP_Real* conscoefs;
7155 assert(nconsvars == consdata->nlinvars + nconsanddatas);
7160 for( v = 0; v < nconsvars; ++v )
7179 SCIP_Bool redundant;
7180 SCIP_Bool infeasible;
7181 SCIP_Bool aggregated;
7187 for(
i = 1;
i >= 0; --
i )
7189 for( v =
nvars - 1; v >= 0; --v )
7192 if( varcount[
i][v] == 2 )
7248 else if(
nvars == 2 && nconsanddatas == 3 && twocount == 2 && onecount == 2 && zerocount == 0)
7251 SCIP_Real* conscoefs;
7267 assert(nconsvars == consdata->nlinvars + nconsanddatas);
7272 for( v = 0; v < nconsvars; ++v )
7286 newandvars[0] =
NULL;
7287 newandvars[1] =
NULL;
7291 for(
i = 1;
i >= 0; --
i )
7293 for( v =
nvars - 1; v >= 0; --v )
7296 if( varcount[
i][v] == 1 )
7298 if( newandvars[0] ==
NULL )
7364 SCIP_Real* tmpvals =
NULL;
7366 SCIP_Real constant = 0.0;
7409 if( consdata->intvar !=
NULL )
7411 vars[0] = consdata->intvar;
7435 for(
i = 0;
i < tmpnvars; ++
i )
7436 vals[
i] = tmpvals[
i];
7441 for(
i = 0;
i < tmpnvars; ++
i )
7447 for(
i = 0;
i < tmpnvars; ++
i )
7453 for(
i = 0;
i < tmpnvars; ++
i )
7464 for(
i = 0;
i < tmpnvars; ++
i )
7477 for(
c = 0;
c < consdata->nconsanddatas; ++
c )
7484 tmpnvars = consdata->consanddatas[
c]->nvars;
7485 for(
i = 0;
i < tmpnvars; ++
i )
7486 vars[
i] = consdata->consanddatas[
c]->vars[
i];
7487 for(
i = 0;
i < tmpnvars; ++
i )
7509#ifdef NONLINCONSUPGD_PRIORITY
7515 SCIP_EXPRGRAPH* exprgraph;
7516 SCIP_EXPRGRAPHNODE* node;
7526 SCIP_Real* termvals;
7535 node = SCIPgetExprgraphNodeNonlinear(
scip, cons);
7541 switch( SCIPexprgraphGetNodeOperator(node) )
7543 case SCIP_EXPR_VARIDX:
7544 case SCIP_EXPR_CONST:
7545 case SCIP_EXPR_PLUS:
7546 case SCIP_EXPR_MINUS:
7548 case SCIP_EXPR_LINEAR:
7554 case SCIP_EXPR_SQUARE:
7555 case SCIP_EXPR_SQRT:
7556 case SCIP_EXPR_REALPOWER:
7557 case SCIP_EXPR_INTPOWER:
7558 case SCIP_EXPR_SIGNPOWER:
7569 case SCIP_EXPR_SIGN:
7570 case SCIP_EXPR_PRODUCT:
7571 case SCIP_EXPR_USER:
7575 case SCIP_EXPR_QUADRATIC:
7578 case SCIP_EXPR_POLYNOMIAL:
7582 case SCIP_EXPR_PARAM:
7583 case SCIP_EXPR_LAST:
7593 for(
i = 0;
i < SCIPgetNLinearVarsNonlinear(
scip, cons); ++
i )
7595 var = SCIPgetLinearVarsNonlinear(
scip, cons)[
i];
7601#ifdef SCIP_DISABLED_CODE
7603 if( objvar ==
NULL && SCIPgetLinearCoefsNonlinear(
scip, cons)[
i] == -1.0 &&
7620 for(
i = 0;
i < SCIPexprgraphGetNodeNChildren(node); ++
i )
7622 SCIP_EXPRGRAPHNODE* child;
7624 child = SCIPexprgraphGetNodeChildren(node)[
i];
7626 if( SCIPexprgraphGetNodeOperator(child) != SCIP_EXPR_VARIDX )
7628 SCIPdebugMsg(
scip,
"not pseudoboolean because child %d is not a variable\n",
i);
7632 var = (
SCIP_VAR*)SCIPexprgraphGetNodeVar(exprgraph, child);
7643 if( upgdconsssize < 1 )
7653 lhs -= SCIPexprgraphGetNodePolynomialConstant(node);
7655 rhs -= SCIPexprgraphGetNodePolynomialConstant(node);
7658 if( objvar !=
NULL )
7662 for(
i = 0;
i < SCIPgetNLinearVarsNonlinear(
scip, cons); ++
i )
7664 var = SCIPgetLinearVarsNonlinear(
scip, cons)[
i];
7666 linvars[nlinvars++] =
var;
7670 nlinvars = SCIPgetNLinearVarsNonlinear(
scip, cons);
7673 nterms = SCIPexprgraphGetNodePolynomialNMonomials(node);
7680 SCIP_EXPRDATA_MONOMIAL* monomial;
7682 monomial = SCIPexprgraphGetNodePolynomialMonomials(node)[
i];
7685 ntermvars[
i] = SCIPexprGetMonomialNFactors(monomial);
7688 for( j = 0; j < SCIPexprGetMonomialNFactors(monomial); ++j )
7690 terms[
i][j] = (
SCIP_VAR*)SCIPexprgraphGetNodeVar(exprgraph, SCIPexprgraphGetNodeChildren(node)[SCIPexprGetMonomialChildIndices(monomial)[j]]);
7691 assert(SCIPexprGetMonomialExponents(monomial)[j] > 0.0);
7694 termvals[
i] = SCIPexprGetMonomialCoef(monomial);
7699 objvar !=
NULL ? linvars : SCIPgetLinearVarsNonlinear(
scip, cons), nlinvars, SCIPgetLinearCoefsNonlinear(
scip, cons),
7771 for(
c = conshdlrdata->nallconsanddatas - 1;
c >= 0; --
c )
7781 assert(conshdlrdata->allconsanddatas[
c]->newvars ==
NULL);
7783 vars = conshdlrdata->allconsanddatas[
c]->vars;
7784 nvars = conshdlrdata->allconsanddatas[
c]->nvars;
7788 for( v =
nvars - 1; v > 0; --v )
7796 andcons = conshdlrdata->allconsanddatas[
c]->cons;
7807 SCIPconsGetName(conshdlrdata->allconsanddatas[
c]->cons), (
void*)(conshdlrdata->allconsanddatas[
c]),
7808 (
void*)(conshdlrdata->allconsanddatas[
c]->cons));
7829 if( conshdlrdata->decomposeindicatorpbcons || conshdlrdata->decomposenormalpbcons )
7831 for(
c = 0;
c < nconss; ++
c )
7860 if( consdata->issoftcons && conshdlrdata->decomposeindicatorpbcons )
7867 SCIP_Bool updateandconss;
7869#if USEINDICATOR == FALSE
7879 assert(consdata->weight != 0);
7895 updateandconss =
FALSE;
7897#if USEINDICATOR == FALSE
7902 for( v =
nvars - 1; v >= 0; --v )
7936 updateandconss =
TRUE;
7948 ub = lhs - maxact - 1;
7979 if( !updateandconss )
7995 lb = rhs - minact + 1;
8030 updateandconss =
TRUE;
8043 for( v =
nvars - 1; v >= 0; --v )
8053 if( !updateandconss )
8071 else if( !consdata->issoftcons && conshdlrdata->decomposenormalpbcons )
8082 if( consdata->intvar !=
NULL )
8127 for(
c = (*consdata)->nconsanddatas - 1;
c >= 0; --
c )
8129 assert((*consdata)->consanddatas[
c]->nuses == 0);
8130 assert((*consdata)->consanddatas[
c]->cons ==
NULL);
8131 assert((*consdata)->consanddatas[
c]->noriguses == 0 || ((*consdata)->consanddatas[
c]->origcons !=
NULL &&
SCIPconsIsOriginal((*consdata)->consanddatas[
c]->origcons)));
8134 conshdlrdata->noriguses -= (*consdata)->nconsanddatas;
8136 assert(conshdlrdata->noriguses >= 0);
8163 assert(sourcedata->nconsanddatas == 0 || sourcedata->consanddatas !=
NULL);
8169 for(
c = sourcedata->nconsanddatas - 1;
c >= 0; --
c )
8172 andconss[
c] = sourcedata->consanddatas[
c]->origcons;
8179 andconss, sourcedata->andcoefs, sourcedata->andnegs, sourcedata->nconsanddatas, sourcedata->indvar, sourcedata->weight,
8180 sourcedata->issoftcons, sourcedata->intvar, sourcedata->lhs, sourcedata->rhs,
SCIPconsIsChecked(sourcecons),
8297 if( consdata->issoftcons )
8330 int firstupgradetry;
8346 oldnfixedvars = *nfixedvars;
8347 oldnaggrvars = *naggrvars;
8348 oldnchgbds = *nchgbds;
8349 oldndelconss = *ndelconss;
8350 oldnupgdconss = *nupgdconss;
8351 oldnchgcoefs = *nchgcoefs;
8352 oldnchgsides = *nchgsides;
8360 firstchange = INT_MAX;
8361 firstupgradetry = INT_MAX;
8372 SCIP_Real* lincoefs;
8375 SCIP_Real* andcoefs;
8424 andress, andcoefs, andnegs, &nandress) );
8437 if( firstchange == INT_MAX && consdata->changed )
8450 if( consdata->changed )
8463 if( firstupgradetry == INT_MAX && !consdata->upgradetried )
8464 firstupgradetry =
c;
8469 consdata->presolved =
TRUE;
8487 consdata->changed =
FALSE;
8506 else if( *nfixedvars > oldnfixedvars || *naggrvars > oldnaggrvars || *nchgbds > oldnchgbds || *ndelconss > oldndelconss
8507 || *nupgdconss > oldnupgdconss || *nchgcoefs > oldnchgcoefs || *nchgsides > oldnchgsides )
8536 lhs = consdata->lhs;
8537 rhs = consdata->rhs;
8545 SCIPdebugMsg(
scip,
"%socking constraint <%s> by [%d;%d].\n", (nlocksneg < 0) || (nlockspos < 0) ?
"Unl" :
"L",
SCIPconsGetName(cons), nlocksneg, nlockspos);
8548 for(
c = consdata->nconsanddatas - 1;
c >= 0; --
c )
8557 consanddata = consdata->consanddatas[
c];
8563 andcons = consanddata->
cons;
8565 if( andcons ==
NULL )
8574 consanddata->
nvars = 0;
8575 consanddata->
svars = 0;
8585 andvars = consanddata->
newvars;
8590 andvars = consanddata->
vars;
8591 nandvars = consanddata->
nvars;
8598 val = consdata->andnegs[
c] ? -consdata->andcoefs[
c] : consdata->andcoefs[
c];
8605 for( v = nandvars - 1; v >= 0; --v )
8615 for( v = nandvars - 1; v >= 0; --v )
8632 for( v = nandvars - 1; v >= 0; --v )
8642 for( v = nandvars - 1; v >= 0; --v )
8678 const char* consname;
8690 initial, separate, enforce, check,
propagate, local, modifiable, dynamic, removable, stickingatnode, global,
8710 SCIP_Bool transformed;
8748 assert(nlinconsvars >= 0);
8751 if( nlinconsvars == 0 )
8758 else if( varssize < nlinconsvars )
8776 assert(nlinconsvars == nlinvars + nandress);
8798 for(
r = nandress - 1;
r >= 0; --
r )
8810 andcons = consanddata->
cons;
8817 if( varssize <=
nvars )
8836 if( varssize <
nvars + noperands )
8876 SCIP_Bool transformed;
8909 assert(nlinconsvars >= 0);
8912 if( nlinconsvars == 0 )
8930 assert(nlinconsvars == nlinvars + nandress);
8946 for(
r = nandress - 1;
r >= 0; --
r )
8958 andcons = consanddata->
cons;
9021 consEnfolpPseudoboolean, consEnfopsPseudoboolean, consCheckPseudoboolean, consLockPseudoboolean,
9044 "decompose all normal pseudo boolean constraint into a \"linear\" constraint and \"and\" constraints",
9048 "decompose all indicator pseudo boolean constraint into a \"linear\" constraint and \"and\" constraints",
9051 "constraints/" CONSHDLR_NAME "/nlcseparate",
"should the nonlinear constraints be separated during LP processing?",
9054 "constraints/" CONSHDLR_NAME "/nlcpropagate",
"should the nonlinear constraints be propagated during node processing?",
9057 "constraints/" CONSHDLR_NAME "/nlcremovable",
"should the nonlinear constraints be removable?",
9060#ifdef NONLINCONSUPGD_PRIORITY
9079 SCIP_Real* andcoefs,
9083 SCIP_Bool issoftcons,
9101 SCIP_Bool modifiable,
9107 SCIP_Bool removable,
9109 SCIP_Bool stickingatnode
9121 SCIP_Bool memisinvalid;
9122 SCIP_Bool transformed;
9130 assert(nandconss == 0 || (andconss !=
NULL && andcoefs !=
NULL));
9133 if( intvar !=
NULL )
9136 SCIPerrorMessage(
"intvar currently not supported by pseudo boolean constraint handler\n");
9142 if( conshdlr ==
NULL )
9157 assert(conshdlrdata->allconsanddatas !=
NULL);
9158 assert(conshdlrdata->nallconsanddatas <= conshdlrdata->sallconsanddatas);
9160 memisinvalid =
TRUE;
9166 for(
c = nandconss - 1;
c >= 0; --
c )
9221 newdata->
cons = andconss[
c];
9224 for( v = newdata->
nvars - 1; v >= 0; --v )
9240 if( tmpdata ==
NULL || (tmpdata->
cons != andconss[
c] && tmpdata->
origcons != andconss[
c]))
9244 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");
9248 if( conshdlrdata->nallconsanddatas == conshdlrdata->sallconsanddatas )
9253 conshdlrdata->allconsanddatas[conshdlrdata->nallconsanddatas] = newdata;
9254 ++(conshdlrdata->nallconsanddatas);
9260 memisinvalid =
TRUE;
9276 newdata->noriguses = 1;
9286 memisinvalid =
FALSE;
9330 indvar, weight, issoftcons, intvar, lhs, rhs, check,
FALSE) );
9334 SCIP_CALL(
SCIPcreateCons(
scip, cons, name, conshdlr, consdata, initial, separate, enforce, check,
propagate,
9335 local, modifiable, dynamic, removable, stickingatnode) );
9359 SCIP_Real* termvals,
9362 SCIP_Bool issoftcons,
9380 SCIP_Bool modifiable,
9386 SCIP_Bool removable,
9388 SCIP_Bool stickingatnode
9398 SCIP_Real* andcoefs;
9411 if( intvar !=
NULL )
9414 SCIPerrorMessage(
"intvar currently not supported by pseudo boolean constraint handler\n");
9420 if( conshdlr ==
NULL )
9426#if USEINDICATOR == TRUE
9427 if( issoftcons && modifiable )
9429 SCIPerrorMessage(
"Indicator constraint handler can't work with modifiable constraints\n");
9450 initial, enforce, check, local, modifiable, dynamic, stickingatnode,
9451 andconss, andcoefs, andnegs, &nandconss) );
9455 for(
c = nandconss - 1;
c >= 0; --
c )
9474 &lhs, &rhs, initial, separate, enforce,
FALSE,
propagate, local, modifiable, dynamic, removable,
9475 stickingatnode, &lincons, &linconstype) );
9482 indvar, weight, issoftcons, intvar, lhs, rhs, check,
FALSE) );
9492 SCIP_CALL(
SCIPcreateCons(
scip, cons, name, conshdlr, consdata, initial, separate, enforce, check,
propagate,
9493 local, modifiable, dynamic, removable, stickingatnode) );
9515 SCIP_Real* termvals,
9518 SCIP_Bool issoftcons,
9527 terms,
nterms, ntermvars, termvals, indvar, weight, issoftcons, intvar, lhs, rhs,
9566 switch( consdata->linconstype )
9589#ifdef WITHEQKNAPSACK
9590 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
9594 SCIP_CALL( SCIPaddCoefEQKnapsack(
scip, consdata->lincons,
var, (SCIP_Longint) val) );
9603 consdata->propagated =
FALSE;
9604 consdata->presolved =
FALSE;
9605 consdata->cliquesadded =
FALSE;
9662 return consdata->indvar;
9686 return consdata->lincons;
9710 return consdata->linconstype;
9736 return consdata->nlinvars;
9744 SCIP_Real*
const lincoefs,
9772 if( *nlinvars < consdata->nlinvars )
9774 *nlinvars = consdata->nlinvars;
9789 SCIP_CALL(
getLinVarsAndAndRess(
scip, cons,
vars, coefs,
nvars, linvars, lincoefs, nlinvars,
NULL,
NULL,
NULL,
NULL) );
9804 SCIP_Real*
const andcoefs,
9831 if( *nandconss < consdata->nconsanddatas )
9833 *nandconss = consdata->nconsanddatas;
9837 *nandconss = consdata->nconsanddatas;
9838 assert(*nandconss == 0 || consdata->consanddatas !=
NULL);
9842 for(
c = *nandconss - 1;
c >= 0; --
c )
9845 assert(consdata->consanddatas[
c]->istransformed ? (consdata->consanddatas[
c]->cons !=
NULL) :
TRUE);
9846 assert(consdata->consanddatas[
c]->isoriginal ? (consdata->consanddatas[
c]->origcons !=
NULL) :
TRUE);
9847 assert(consdata->consanddatas[
c]->cons !=
NULL || consdata->consanddatas[
c]->origcons !=
NULL);
9848 assert(isorig ? consdata->consanddatas[
c]->origcons !=
NULL : consdata->consanddatas[
c]->cons !=
NULL);
9850 andconss[
c] = (isorig ? consdata->consanddatas[
c]->origcons : consdata->consanddatas[
c]->cons);
9853 andcoefs[
c] = consdata->andcoefs[
c];
9882 return consdata->nconsanddatas;
9914 switch( consdata->linconstype )
9922#ifdef WITHEQKNAPSACK
9923 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
9925 SCIPerrorMessage(
"changing left hand side only allowed on standard linear constraint \n");
9962 switch( consdata->linconstype )
9970#ifdef WITHEQKNAPSACK
9971 case SCIP_LINEARCONSTYPE_EQKNAPSACK:
9973 SCIPerrorMessage(
"changing right hand side only allowed on standard linear constraint \n");
10006 return consdata->lhs;
10031 return consdata->rhs;
Constraint handler for AND constraints, .
constraint handler for indicator constraints
Constraint handler for knapsack constraints of the form , x binary and .
Constraint handler for linear constraints in their most general form, .
Constraint handler for logicor constraints (equivalent to set covering, but algorithms are suited fo...
constraint handler for nonlinear constraints specified by algebraic expressions
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)
#define CONSHDLR_NEEDSCONS
static SCIP_RETCODE checkAndConss(SCIP *const scip, SCIP_CONSHDLR *const conshdlr, SCIP_SOL *const sol, SCIP_Bool *const violated)
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)
#define HASHSIZE_PSEUDOBOOLEANNONLINEARTERMS
static SCIP_RETCODE conshdlrdataCreate(SCIP *const scip, SCIP_CONSHDLRDATA **conshdlrdata)
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)
#define CONSHDLR_CHECKPRIORITY
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)
static SCIP_RETCODE getLinearConsNVars(SCIP *const scip, SCIP_CONS *const cons, SCIP_LINEARCONSTYPE const constype, int *const nvars)
static SCIP_RETCODE checkLocksAndRes(SCIP *const scip, SCIP_VAR *res)
static SCIP_RETCODE propagateCons(SCIP *const scip, SCIP_CONS *const cons, SCIP_Bool *const cutoff, int *const ndelconss)
static SCIP_RETCODE getLinearConsSides(SCIP *const scip, SCIP_CONS *const cons, SCIP_LINEARCONSTYPE const constype, SCIP_Real *const lhs, SCIP_Real *const rhs)
#define DEFAULT_DECOMPOSEINDICATORPBCONS
static SCIP_RETCODE conshdlrdataFree(SCIP *const scip, SCIP_CONSHDLRDATA **conshdlrdata)
static SCIP_RETCODE chgRhsLinearCons(SCIP *const scip, SCIP_CONS *const cons, SCIP_LINEARCONSTYPE const constype, SCIP_Real const rhs)
#define CONSHDLR_MAXPREROUNDS
static SCIP_RETCODE computeConsAndDataChanges(SCIP *const scip, SCIP_CONSHDLRDATA *const conshdlrdata)
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)
#define checkConsConsistency(scip, cons)
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)
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)
static SCIP_RETCODE addCoefTerm(SCIP *const scip, SCIP_CONS *const cons, SCIP_VAR **const vars, int const nvars, SCIP_Real const val)
static SCIP_RETCODE addSymmetryInformation(SCIP *scip, SYM_SYMTYPE symtype, SCIP_CONS *cons, SYM_GRAPH *graph, SCIP_Bool *success)
#define DEFAULT_PROPAGATENONLINEAR
static SCIP_RETCODE inithashmapandtable(SCIP *const scip, SCIP_CONSHDLRDATA **conshdlrdata)
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)
static SCIP_RETCODE consdataPrint(SCIP *const scip, SCIP_CONS *const cons, FILE *const file)
#define NONLINCONSUPGD_PRIORITY
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)
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 transformToOrig(SCIP *const scip, CONSANDDATA *consanddata, SCIP_CONSHDLRDATA *conshdlrdata)
static SCIP_RETCODE addCliques(SCIP *const scip, SCIP_CONS *const cons, SCIP_Bool *const cutoff, int *const naggrvars, int *const nchgbds)
static SCIP_RETCODE chgLhs(SCIP *const scip, SCIP_CONS *const cons, SCIP_Real lhs)
#define DEFAULT_REMOVABLENONLINEAR
static SCIP_RETCODE updateConsanddataUses(SCIP *const scip, SCIP_CONS *const cons, SCIP_CONSHDLRDATA *const conshdlrdata, int *const ndelconss)
#define DEFAULT_SEPARATENONLINEAR
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)
#define CONSHDLR_PRESOLTIMING
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)
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)
#define CONSHDLR_EAGERFREQ
static SCIP_RETCODE chgLhsLinearCons(SCIP *const scip, SCIP_CONS *const cons, SCIP_LINEARCONSTYPE const constype, SCIP_Real const lhs)
#define CONSHDLR_ENFOPRIORITY
#define DEFAULT_DECOMPOSENORMALPBCONS
static SCIP_RETCODE correctConshdlrdata(SCIP *const scip, SCIP_CONSHDLRDATA *const conshdlrdata, int *const ndelconss)
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)
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)
static SCIP_RETCODE checkOrigPbCons(SCIP *const scip, SCIP_CONS *const cons, SCIP_SOL *const sol, SCIP_Bool *const violated, SCIP_Bool const printreason)
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)
static SCIP_RETCODE chgRhs(SCIP *const scip, SCIP_CONS *const cons, SCIP_Real rhs)
static SCIP_RETCODE updateAndConss(SCIP *const scip, SCIP_CONS *const cons)
static SCIP_RETCODE consdataFree(SCIP *const scip, SCIP_CONSDATA **consdata, SCIP_Bool isorig, SCIP_CONSHDLRDATA *conshdlrdata)
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 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)
constraint handler for pseudoboolean constraints
#define ARTIFICIALVARNAMEPREFIX
Constraint handler for the set partitioning / packing / covering constraints .
Constraint handler for XOR constraints, .
#define SCIPdebugGetSolVal(scip, var, val)
#define SCIPdebugAddSolVal(scip, var, val)
#define SCIP_CALL_ABORT(x)
SCIP_RETCODE SCIPchgLhsPseudoboolean(SCIP *const scip, SCIP_CONS *const cons, SCIP_Real const lhs)
int SCIPgetNVarsKnapsack(SCIP *scip, SCIP_CONS *cons)
#define SCIP_DECL_NONLINCONSUPGD(x)
int SCIPgetNVarsLogicor(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetRhsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPchgRhsLinear(SCIP *scip, SCIP_CONS *cons, SCIP_Real rhs)
SCIP_LINEARCONSTYPE SCIPgetLinearConsTypePseudoboolean(SCIP *const scip, SCIP_CONS *const cons)
SCIP_RETCODE SCIPaddCoefPseudoboolean(SCIP *const scip, SCIP_CONS *const cons, SCIP_VAR *const var, SCIP_Real const val)
SCIP_RETCODE SCIPaddCoefLinear(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real val)
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)
SCIP_RETCODE SCIPaddCoefKnapsack(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Longint weight)
SCIP_Real SCIPgetLhsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPchgAndConsCheckFlagWhenUpgr(SCIP *scip, SCIP_CONS *cons, SCIP_Bool flag)
int SCIPgetNVarsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR * SCIPgetResultantAnd(SCIP *scip, SCIP_CONS *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)
int SCIPgetNAndsPseudoboolean(SCIP *const scip, SCIP_CONS *const cons)
int SCIPgetNLinVarsWithoutAndPseudoboolean(SCIP *const scip, SCIP_CONS *const cons)
int SCIPgetNVarsAnd(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPgetLinDatasWithoutAndPseudoboolean(SCIP *const scip, SCIP_CONS *const cons, SCIP_VAR **const linvars, SCIP_Real *const lincoefs, int *const nlinvars)
SCIP_Real * SCIPgetValsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPchgAndConsRemovableFlagWhenUpgr(SCIP *scip, SCIP_CONS *cons, SCIP_Bool flag)
SCIP_Real SCIPgetLhsPseudoboolean(SCIP *const scip, SCIP_CONS *const cons)
int SCIPgetNVarsSetppc(SCIP *scip, SCIP_CONS *cons)
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_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_VAR * SCIPgetIndVarPseudoboolean(SCIP *const scip, SCIP_CONS *const cons)
SCIP_VAR ** SCIPgetVarsSetppc(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPsortAndCons(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPisAndConsSorted(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetRhsNonlinear(SCIP_CONS *cons)
SCIP_RETCODE SCIPaddTermPseudoboolean(SCIP *const scip, SCIP_CONS *const cons, SCIP_VAR **const vars, int const nvars, SCIP_Real const val)
SCIP_RETCODE SCIPchgRhsPseudoboolean(SCIP *const scip, SCIP_CONS *const cons, SCIP_Real const rhs)
SCIP_RETCODE SCIPaddCoefSetppc(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
enum SCIP_SetppcType SCIP_SETPPCTYPE
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_Longint * SCIPgetWeightsKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_Longint SCIPgetCapacityKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_SETPPCTYPE SCIPgetTypeSetppc(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateConsLinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
SCIP_RETCODE 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_VAR ** SCIPgetVarsLogicor(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsAnd(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsKnapsack(SCIP *scip, SCIP_CONS *cons)
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)
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)
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 SCIPgetAndDatasPseudoboolean(SCIP *const scip, SCIP_CONS *const cons, SCIP_CONS **const andconss, SCIP_Real *const andcoefs, int *const nandconss)
SCIP_CONS * SCIPgetLinearConsPseudoboolean(SCIP *const scip, SCIP_CONS *const cons)
enum SCIP_LinearConsType SCIP_LINEARCONSTYPE
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)
SCIP_RETCODE SCIPchgLhsLinear(SCIP *scip, SCIP_CONS *cons, SCIP_Real lhs)
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_Real SCIPgetLhsNonlinear(SCIP_CONS *cons)
SCIP_Real SCIPgetRhsPseudoboolean(SCIP *const scip, SCIP_CONS *const cons)
SCIP_RETCODE SCIPaddCoefLogicor(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
@ SCIP_LINEARCONSTYPE_LINEAR
@ SCIP_LINEARCONSTYPE_INVALIDCONS
@ SCIP_LINEARCONSTYPE_LOGICOR
@ SCIP_LINEARCONSTYPE_KNAPSACK
@ SCIP_LINEARCONSTYPE_SETPPC
@ SCIP_SETPPCTYPE_PARTITIONING
@ SCIP_SETPPCTYPE_COVERING
@ SCIP_SETPPCTYPE_PACKING
SCIP_RETCODE SCIPincludeConshdlrPseudoboolean(SCIP *scip)
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)
SCIP_Bool SCIPisConsCompressionEnabled(SCIP *scip)
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_Bool SCIPisTransformed(SCIP *scip)
SCIP_Bool SCIPisStopped(SCIP *scip)
SCIP_STAGE SCIPgetStage(SCIP *scip)
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
int SCIPgetNVars(SCIP *scip)
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPdelCons(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNFixedVars(SCIP *scip)
SCIP_VAR ** SCIPgetFixedVars(SCIP *scip)
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
SCIP_RETCODE SCIPhashmapRemove(SCIP_HASHMAP *hashmap, void *origin)
void SCIPhashtableFree(SCIP_HASHTABLE **hashtable)
SCIP_Bool SCIPhashtableExists(SCIP_HASHTABLE *hashtable, void *element)
#define SCIPhashFour(a, b, c, d)
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)
void * SCIPhashtableRetrieve(SCIP_HASHTABLE *hashtable, void *key)
SCIP_RETCODE SCIPhashtableRemove(SCIP_HASHTABLE *hashtable, void *element)
SCIP_RETCODE SCIPhashtableInsert(SCIP_HASHTABLE *hashtable, void *element)
SCIP_RETCODE SCIPdelConsLocal(SCIP *scip, SCIP_CONS *cons)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
SCIP_Real SCIPrelDiff(SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
void SCIPconshdlrSetData(SCIP_CONSHDLR *conshdlr, SCIP_CONSHDLRDATA *conshdlrdata)
SCIP_RETCODE SCIPsetConshdlrFree(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
SCIP_RETCODE SCIPsetConshdlrPresol(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPRESOL((*conspresol)), int maxprerounds, SCIP_PRESOLTIMING presoltiming)
SCIP_RETCODE SCIPsetConshdlrInitpre(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
SCIP_RETCODE SCIPsetConshdlrEnforelax(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
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_RETCODE SCIPsetConshdlrGetVars(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
SCIP_RETCODE SCIPsetConshdlrPrint(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
SCIP_RETCODE SCIPsetConshdlrGetSignedPermsymGraph(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPsetConshdlrCopy(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)),)
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
SCIP_RETCODE SCIPsetConshdlrInit(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
SCIP_RETCODE SCIPsetConshdlrGetPermsymGraph(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
SCIP_RETCODE SCIPsetConshdlrDelete(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
SCIP_CONSHDLRDATA * SCIPconshdlrGetData(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPsetConshdlrTrans(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
SCIP_RETCODE SCIPsetConshdlrGetNVars(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
SCIP_CONSDATA * SCIPconsGetData(SCIP_CONS *cons)
void SCIPconsAddUpgradeLocks(SCIP_CONS *cons, int nlocks)
SCIP_Bool SCIPconsIsDynamic(SCIP_CONS *cons)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsInitial(SCIP_CONS *cons)
SCIP_RETCODE SCIPprintCons(SCIP *scip, SCIP_CONS *cons, FILE *file)
int SCIPconsGetNUpgradeLocks(SCIP_CONS *cons)
SCIP_RETCODE SCIPsetConsSeparated(SCIP *scip, SCIP_CONS *cons, SCIP_Bool separate)
SCIP_Bool SCIPconsIsOriginal(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsChecked(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsDeleted(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsTransformed(SCIP_CONS *cons)
SCIP_RETCODE SCIPsetConsInitial(SCIP *scip, SCIP_CONS *cons, SCIP_Bool initial)
SCIP_Bool SCIPconsIsLockedType(SCIP_CONS *cons, SCIP_LOCKTYPE locktype)
SCIP_Bool SCIPconsIsEnforced(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsActive(SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateCons(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_CONSHDLR *conshdlr, SCIP_CONSDATA *consdata, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
SCIP_Bool SCIPconsIsPropagated(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsLocal(SCIP_CONS *cons)
const char * SCIPconsGetName(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsLocked(SCIP_CONS *cons)
SCIP_RETCODE SCIPresetConsAge(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPconsIsModifiable(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsAdded(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsStickingAtNode(SCIP_CONS *cons)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
SCIP_RETCODE SCIPtransformCons(SCIP *scip, SCIP_CONS *cons, SCIP_CONS **transcons)
SCIP_RETCODE SCIPsetConsChecked(SCIP *scip, SCIP_CONS *cons, SCIP_Bool check)
SCIP_Bool SCIPconsIsSeparated(SCIP_CONS *cons)
SCIP_RETCODE SCIPcaptureCons(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPincConsAge(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPconsIsRemovable(SCIP_CONS *cons)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
#define SCIPensureBlockMemoryArray(scip, ptr, arraysizeptr, minsize)
#define SCIPallocClearBlockMemoryArray(scip, ptr, num)
#define SCIPallocClearBufferArray(scip, ptr, num)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPduplicateBufferArray(scip, ptr, source, num)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
#define SCIPfreeBlockMemory(scip, ptr)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
#define SCIPfreeBufferArrayNull(scip, ptr)
#define SCIPallocBlockMemory(scip, ptr)
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
void SCIPupdateSolConsViolation(SCIP *scip, SCIP_SOL *sol, SCIP_Real absviol, SCIP_Real relviol)
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
SCIP_RETCODE SCIPaddSymgraphEdge(SCIP *scip, SYM_GRAPH *graph, int first, int second, SCIP_Bool hasval, SCIP_Real val)
SCIP_RETCODE SCIPaddSymgraphOpnode(SCIP *scip, SYM_GRAPH *graph, int op, int *nodeidx)
SCIP_RETCODE SCIPgetSymActiveVariables(SCIP *scip, SYM_SYMTYPE symtype, SCIP_VAR ***vars, SCIP_Real **scalars, int *nvars, SCIP_Real *constant, SCIP_Bool transformed)
SCIP_RETCODE SCIPaddSymgraphConsnode(SCIP *scip, SYM_GRAPH *graph, SCIP_CONS *cons, SCIP_Real lhs, SCIP_Real rhs, int *nodeidx)
SCIP_RETCODE SCIPaddSymgraphVarAggregation(SCIP *scip, SYM_GRAPH *graph, int rootidx, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SCIP_Real constant)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisIntegral(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasZero(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPfeasFloor(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasPositive(SCIP *scip, SCIP_Real val)
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 SCIPlockVarCons(SCIP *scip, SCIP_VAR *var, SCIP_CONS *cons, SCIP_Bool lockdown, SCIP_Bool lockup)
SCIP_RETCODE SCIPremoveVarFromGlobalStructures(SCIP *scip, SCIP_VAR *var)
SCIP_VAR * SCIPvarGetNegatedVar(SCIP_VAR *var)
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
SCIP_RETCODE SCIPaddClique(SCIP *scip, SCIP_VAR **vars, SCIP_Bool *values, int nvars, SCIP_Bool isequation, SCIP_Bool *infeasible, int *nbdchgs)
SCIP_RETCODE SCIPgetTransformedVars(SCIP *scip, int nvars, SCIP_VAR **vars, SCIP_VAR **transvars)
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
int SCIPvarGetNLocksUpType(SCIP_VAR *var, SCIP_LOCKTYPE locktype)
SCIP_RETCODE SCIPgetBinvarRepresentatives(SCIP *scip, int nvars, SCIP_VAR **vars, SCIP_VAR **repvars, SCIP_Bool *negated)
SCIP_Bool SCIPvarIsTransformed(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_Real SCIPvarGetObj(SCIP_VAR *var)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
int SCIPvarGetIndex(SCIP_VAR *var)
SCIP_RETCODE SCIPaddVarLocksType(SCIP *scip, SCIP_VAR *var, SCIP_LOCKTYPE locktype, int nlocksdown, int nlocksup)
SCIP_RETCODE SCIPchgVarBranchPriority(SCIP *scip, SCIP_VAR *var, int branchpriority)
SCIP_RETCODE SCIPunlockVarCons(SCIP *scip, SCIP_VAR *var, SCIP_CONS *cons, SCIP_Bool lockdown, SCIP_Bool lockup)
int SCIPvarGetProbindex(SCIP_VAR *var)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
SCIP_Bool SCIPvarIsTransformedOrigvar(SCIP_VAR *var)
SCIP_RETCODE SCIPgetNegatedVar(SCIP *scip, SCIP_VAR *var, SCIP_VAR **negvar)
SCIP_Bool SCIPvarIsNegated(SCIP_VAR *var)
SCIP_VAR * SCIPvarGetNegationVar(SCIP_VAR *var)
SCIP_RETCODE SCIPcreateVar(SCIP *scip, SCIP_VAR **var, const char *name, SCIP_Real lb, SCIP_Real ub, SCIP_Real obj, SCIP_VARTYPE vartype, SCIP_Bool initial, SCIP_Bool removable, SCIP_DECL_VARDELORIG((*vardelorig)), SCIP_DECL_VARTRANS((*vartrans)), SCIP_DECL_VARDELTRANS((*vardeltrans)), SCIP_DECL_VARCOPY((*varcopy)), SCIP_VARDATA *vardata)
SCIP_Bool SCIPvarIsOriginal(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_RETCODE SCIPfixVar(SCIP *scip, SCIP_VAR *var, SCIP_Real fixedval, SCIP_Bool *infeasible, SCIP_Bool *fixed)
int SCIPvarCompare(SCIP_VAR *var1, SCIP_VAR *var2)
SCIP_RETCODE SCIPwriteVarName(SCIP *scip, FILE *file, SCIP_VAR *var, SCIP_Bool type)
SCIP_RETCODE SCIPgetBinvarRepresentative(SCIP *scip, SCIP_VAR *var, SCIP_VAR **repvar, SCIP_Bool *negated)
SCIP_RETCODE SCIPwriteVarsList(SCIP *scip, FILE *file, SCIP_VAR **vars, int nvars, SCIP_Bool type, char delimiter)
SCIP_Bool SCIPvarsHaveCommonClique(SCIP_VAR *var1, SCIP_Bool value1, SCIP_VAR *var2, SCIP_Bool value2, SCIP_Bool regardimplics)
int SCIPvarGetNLocksDownType(SCIP_VAR *var, SCIP_LOCKTYPE locktype)
SCIP_RETCODE SCIPgetTransformedVar(SCIP *scip, SCIP_VAR *var, SCIP_VAR **transvar)
SCIP_RETCODE SCIPcaptureVar(SCIP *scip, SCIP_VAR *var)
SCIP_Bool SCIPsortedvecFindPtr(void **ptrarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), void *val, int len, int *pos)
void SCIPsortPtr(void **ptrarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
void SCIPsortPtrBool(void **ptrarray, SCIP_Bool *boolarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
void SCIPsortPtrRealBool(void **ptrarray, SCIP_Real *realarray, SCIP_Bool *boolarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
void SCIPsortPtrPtrRealBool(void **ptrarray1, void **ptrarray2, SCIP_Real *realarray, SCIP_Bool *boolarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
int SCIPsnprintf(char *t, int len, const char *s,...)
assert(minobj< SCIPgetCutoffbound(scip))
static SCIP_Bool propagate
static volatile int nterms
memory allocation routines
#define BMScopyMemoryArray(ptr, source, num)
#define BMSclearMemoryArray(ptr, num)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
public methods for managing constraints
public methods for message output
#define SCIPdebugPrintCons(x, y, z)
public data structures and miscellaneous methods
methods for sorting joint arrays of various types
public methods for problem variables
public methods for constraint handler plugins and constraints
public methods for problem copies
public methods for memory management
public methods for message handling
public methods for numerical tolerances
public methods for SCIP parameter handling
public methods for global and local (sub)problems
public methods for solutions
public methods for SCIP variables
unsigned int istransformed
methods for dealing with symmetry detection graphs
#define SCIP_DECL_CONSGETSIGNEDPERMSYMGRAPH(x)
#define SCIP_DECL_CONSGETPERMSYMGRAPH(x)
#define SCIP_DECL_CONSENFOLP(x)
#define SCIP_DECL_CONSINITPRE(x)
#define SCIP_DECL_CONSDELETE(x)
#define SCIP_DECL_CONSGETVARS(x)
#define SCIP_DECL_CONSPRINT(x)
struct SCIP_ConshdlrData SCIP_CONSHDLRDATA
#define SCIP_DECL_CONSENFORELAX(x)
#define SCIP_DECL_CONSGETNVARS(x)
#define SCIP_DECL_CONSENFOPS(x)
#define SCIP_DECL_CONSTRANS(x)
#define SCIP_DECL_CONSPRESOL(x)
#define SCIP_DECL_CONSLOCK(x)
#define SCIP_DECL_CONSCOPY(x)
#define SCIP_DECL_CONSINIT(x)
struct SCIP_ConsData SCIP_CONSDATA
#define SCIP_DECL_CONSCHECK(x)
#define SCIP_DECL_CONSHDLRCOPY(x)
#define SCIP_DECL_CONSFREE(x)
#define SCIP_DECL_SORTPTRCOMP(x)
#define SCIP_DECL_HASHKEYEQ(x)
#define SCIP_DECL_HASHGETKEY(x)
#define SCIP_DECL_HASHKEYVAL(x)
enum SCIP_Retcode SCIP_RETCODE
@ SCIP_STAGE_TRANSFORMING
enum SYM_Symtype SYM_SYMTYPE
@ SYM_CONSOPTYPE_PB_LINEAR
@ SCIP_VARSTATUS_AGGREGATED
enum SCIP_Varstatus SCIP_VARSTATUS