48 #define CONSHDLR_NAME "xor" 49 #define CONSHDLR_DESC "constraint handler for xor constraints: r = xor(x1, ..., xn)" 50 #define CONSHDLR_SEPAPRIORITY +850200 51 #define CONSHDLR_ENFOPRIORITY -850200 52 #define CONSHDLR_CHECKPRIORITY -850200 53 #define CONSHDLR_SEPAFREQ 0 54 #define CONSHDLR_PROPFREQ 1 55 #define CONSHDLR_EAGERFREQ 100 57 #define CONSHDLR_MAXPREROUNDS -1 58 #define CONSHDLR_DELAYSEPA FALSE 59 #define CONSHDLR_DELAYPROP FALSE 60 #define CONSHDLR_NEEDSCONS TRUE 62 #define CONSHDLR_PROP_TIMING SCIP_PROPTIMING_BEFORELP 63 #define CONSHDLR_PRESOLTIMING SCIP_PRESOLTIMING_ALWAYS 65 #define EVENTHDLR_NAME "xor" 66 #define EVENTHDLR_DESC "event handler for xor constraints" 68 #define LINCONSUPGD_PRIORITY +600000 70 #define DEFAULT_PRESOLPAIRWISE TRUE 71 #define DEFAULT_ADDEXTENDEDFORM FALSE 72 #define DEFAULT_ADDFLOWEXTENDED FALSE 73 #define DEFAULT_SEPARATEPARITY FALSE 74 #define DEFAULT_GAUSSPROPFREQ 5 75 #define HASHSIZE_XORCONS 500 76 #define DEFAULT_PRESOLUSEHASHING TRUE 77 #define NMINCOMPARISONS 200000 78 #define MINGAINPERNMINCOMPARISONS 1e-06 79 #define MAXXORCONSSSYSTEM 1000 80 #define MAXXORVARSSYSTEM 1000 90 typedef unsigned short Type;
108 unsigned int deleteintvar:1;
109 unsigned int propagated:1;
110 unsigned int sorted:1;
111 unsigned int changed:1;
115 struct SCIP_ConshdlrData
182 assert(scip !=
NULL);
183 assert(conshdlrdata !=
NULL);
184 assert(eventhdlr !=
NULL);
189 (*conshdlrdata)->eventhdlr = eventhdlr;
201 assert(conshdlrdata !=
NULL);
202 assert(*conshdlrdata !=
NULL);
219 assert(consdata !=
NULL);
220 assert(watchedvar1 == -1 || watchedvar1 != watchedvar2);
221 assert(watchedvar1 != -1 || watchedvar2 == -1);
222 assert(watchedvar1 == -1 || (0 <= watchedvar1 && watchedvar1 < consdata->nvars));
223 assert(watchedvar2 == -1 || (0 <= watchedvar2 && watchedvar2 < consdata->nvars));
226 if( watchedvar1 == consdata->watchedvar2 || watchedvar2 == consdata->watchedvar1 )
230 tmp = consdata->watchedvar1;
231 consdata->watchedvar1 = consdata->watchedvar2;
232 consdata->watchedvar2 = tmp;
233 tmp = consdata->filterpos1;
234 consdata->filterpos1 = consdata->filterpos2;
235 consdata->filterpos2 = tmp;
237 assert(watchedvar1 == -1 || watchedvar1 != consdata->watchedvar2);
238 assert(watchedvar2 == -1 || watchedvar2 != consdata->watchedvar1);
241 if( consdata->watchedvar1 != -1 && consdata->watchedvar1 != watchedvar1 )
243 assert(consdata->filterpos1 != -1);
247 if( consdata->watchedvar2 != -1 && consdata->watchedvar2 != watchedvar2 )
249 assert(consdata->filterpos2 != -1);
255 if( watchedvar1 != -1 && watchedvar1 != consdata->watchedvar1 )
260 if( watchedvar2 != -1 && watchedvar2 != consdata->watchedvar2 )
267 consdata->watchedvar1 = watchedvar1;
268 consdata->watchedvar2 = watchedvar2;
281 assert(consdata !=
NULL);
282 assert(consdata->nvars <= consdata->varssize);
284 if( num > consdata->varssize )
290 consdata->varssize = newsize;
292 assert(num <= consdata->varssize);
310 assert(consdata !=
NULL);
311 assert(nvars == 0 || vars !=
NULL);
316 (*consdata)->rhs = rhs;
317 (*consdata)->intvar = intvar;
318 for( r = 0; r <
NROWS; ++r )
319 (*consdata)->rows[r] =
NULL;
320 (*consdata)->nvars = nvars;
321 (*consdata)->varssize = nvars;
322 (*consdata)->watchedvar1 = -1;
323 (*consdata)->watchedvar2 = -1;
324 (*consdata)->filterpos1 = -1;
325 (*consdata)->filterpos2 = -1;
326 (*consdata)->deleteintvar = (intvar ==
NULL);
327 (*consdata)->propagated =
FALSE;
328 (*consdata)->sorted =
FALSE;
329 (*consdata)->changed =
TRUE;
330 (*consdata)->extvars =
NULL;
331 (*consdata)->nextvars = 0;
332 (*consdata)->extvarssize = 0;
339 if( (*consdata)->intvar !=
NULL )
351 assert(conshdlr !=
NULL);
353 assert(conshdlrdata !=
NULL);
355 for( v = (*consdata)->nvars - 1; v >= 0; --v )
363 if( (*consdata)->intvar !=
NULL )
381 assert(consdata !=
NULL);
383 for( r = 0; r <
NROWS; ++r )
385 if( consdata->rows[r] !=
NULL )
402 assert(consdata !=
NULL);
403 assert(*consdata !=
NULL);
413 if ( (*consdata)->nextvars > 0 )
415 assert( (*consdata)->extvars !=
NULL );
416 for (j = 0; j < (*consdata)->extvarssize; ++j)
418 if ( (*consdata)->extvars[j] !=
NULL )
425 (*consdata)->nextvars = 0;
426 (*consdata)->extvarssize = 0;
431 assert((*consdata)->watchedvar1 == -1);
432 assert((*consdata)->watchedvar2 == -1);
439 if( (*consdata)->intvar !=
NULL )
464 assert(consdata !=
NULL);
476 if( consdata->intvar !=
NULL )
503 assert(consdata !=
NULL);
504 assert(consdata->rows[0] ==
NULL);
518 if( consdata->intvar !=
NULL )
524 consdata->intvar = var;
525 consdata->changed =
TRUE;
532 if( consdata->rows[0] !=
NULL )
534 SCIPerrorMessage(
"cannot change intvar of xor constraint after LP relaxation was created\n");
555 assert(consdata !=
NULL);
556 assert(consdata->rows[0] ==
NULL);
570 consdata->vars[consdata->nvars] = var;
572 consdata->sorted = (consdata->nvars == 1);
573 consdata->changed =
TRUE;
589 assert(conshdlr !=
NULL);
591 assert(conshdlrdata !=
NULL);
598 if( consdata->rows[0] !=
NULL )
600 SCIPerrorMessage(
"cannot add coefficients to xor constraint after LP relaxation was created\n");
618 assert(eventhdlr !=
NULL);
621 assert(consdata !=
NULL);
622 assert(0 <= pos && pos < consdata->nvars);
639 if( consdata->watchedvar1 == pos )
643 if( consdata->watchedvar2 == pos )
648 assert(pos != consdata->watchedvar1);
649 assert(pos != consdata->watchedvar2);
652 consdata->vars[pos] = consdata->vars[consdata->nvars-1];
656 if( consdata->watchedvar1 == consdata->nvars )
657 consdata->watchedvar1 = pos;
658 if( consdata->watchedvar2 == consdata->nvars )
659 consdata->watchedvar2 = pos;
661 consdata->propagated =
FALSE;
662 consdata->sorted =
FALSE;
663 consdata->changed =
TRUE;
674 assert(consdata !=
NULL);
676 if( !consdata->sorted )
678 if( consdata->nvars <= 1 )
679 consdata->sorted =
TRUE;
686 if( consdata->watchedvar1 != -1 )
688 var1 = consdata->vars[consdata->watchedvar1];
689 assert(var1 !=
NULL);
690 consdata->watchedvar1 = -1;
691 if( consdata->watchedvar2 != -1 )
693 var2 = consdata->vars[consdata->watchedvar2];
694 assert(var2 !=
NULL);
695 consdata->watchedvar2 = -1;
698 assert(consdata->watchedvar1 == -1);
699 assert(consdata->watchedvar2 == -1);
700 assert(var1 !=
NULL || var2 ==
NULL);
703 SCIPsortPtr((
void**)consdata->vars, SCIPvarCompActiveAndNegated, consdata->nvars);
704 consdata->sorted =
TRUE;
714 for( v = consdata->nvars - 1; v >= 0; --v )
716 if( consdata->vars[v] == var1 )
718 consdata->watchedvar1 = v;
719 if( var2 ==
NULL || consdata->watchedvar2 != -1 )
722 else if( consdata->vars[v] == var2 )
724 assert(consdata->vars[v] !=
NULL);
725 consdata->watchedvar2 = v;
726 if( consdata->watchedvar1 != -1 )
730 assert(consdata->watchedvar1 != -1);
731 assert(consdata->watchedvar2 != -1 || var2 ==
NULL);
732 assert(consdata->watchedvar1 < consdata->nvars);
733 assert(consdata->watchedvar2 < consdata->nvars);
743 for( v = 0; v < consdata->nvars; ++v )
770 scip = (
SCIP*)userptr;
771 assert(scip !=
NULL);
778 if( consdata1->nvars != consdata2->nvars )
784 assert(consdata1->sorted);
785 assert(consdata2->sorted);
787 for( i = 0; i < consdata1->nvars ; ++i )
790 if( consdata1->vars[i] != consdata2->vars[i] )
792 assert(
SCIPvarCompare(consdata1->vars[i], consdata2->vars[i]) == 1 ||
812 assert(consdata !=
NULL);
813 assert(consdata->sorted);
814 assert(consdata->nvars > 0);
817 assert(consdata->vars[0] !=
NULL);
818 assert(consdata->vars[consdata->nvars / 2] !=
NULL);
819 assert(consdata->vars[consdata->nvars - 1] !=
NULL);
851 assert(consdata !=
NULL);
852 assert(consdata->nvars == 0 || consdata->vars !=
NULL);
853 assert(nchgcoefs !=
NULL);
859 while( v < consdata->nvars )
863 var = consdata->vars[v];
876 consdata->rhs = !consdata->rhs;
891 if( negated && consdata->intvar ==
NULL )
896 consdata->rhs = !consdata->rhs;
915 assert(consdata->sorted);
923 v = consdata->nvars-2;
926 if( consdata->vars[v] == consdata->vars[v+1] )
931 newvars[2] = consdata->vars[v];
935 SCIPdebugMsg(scip,
"xor constraint <%s>: deleting pair of equal variables <%s>\n",
940 v =
MIN(v, consdata->nvars-1);
947 if( consdata->intvar !=
NULL )
967 newvars[1] = consdata->intvar;
989 SCIPdebugMsg(scip,
"xor constraint <%s>: deleting pair of negated variables <%s> and <%s>\n",
994 consdata->rhs = !consdata->rhs;
995 v =
MIN(v, consdata->nvars-1);
1002 if( consdata->rhs && consdata->intvar !=
NULL )
1062 newvars[0] = consdata->intvar;
1064 newvars[1] = newvar;
1123 assert( scip !=
NULL );
1124 assert( cons !=
NULL );
1125 assert( naddedconss !=
NULL );
1133 assert( consdata !=
NULL );
1136 if ( consdata->extvars !=
NULL )
1140 if ( consdata->nvars <= 3 )
1144 assert( consdata->extvars ==
NULL );
1145 assert( consdata->nextvars == 0 );
1146 assert( consdata->extvarssize == 0 );
1149 consdata->extvarssize = 4 * (consdata->nvars);
1153 for (i = 0; i < consdata->nvars; ++i)
1171 SCIP_CALL(
SCIPcreateVar(scip, &varnn, name, 0.0, 1.0, 0.0,
SCIP_VARTYPE_IMPLINT,
SCIPconsIsInitial(cons),
SCIPconsIsRemovable(cons),
NULL,
NULL,
NULL,
NULL,
NULL) );
1175 SCIP_CALL(
SCIPcreateVar(scip, &varns, name, 0.0, 1.0, 0.0,
SCIP_VARTYPE_IMPLINT,
SCIPconsIsInitial(cons),
SCIPconsIsRemovable(cons),
NULL,
NULL,
NULL,
NULL,
NULL) );
1184 assert( ! infeasible );
1185 assert( redundant );
1186 assert( aggregated );
1190 if ( i == consdata->nvars-1 )
1192 if ( consdata->rhs )
1196 SCIP_CALL(
SCIPcreateVar(scip, &varns, name, 0.0, 1.0, 0.0,
SCIP_VARTYPE_IMPLINT,
SCIPconsIsInitial(cons),
SCIPconsIsRemovable(cons),
NULL,
NULL,
NULL,
NULL,
NULL) );
1200 SCIP_CALL(
SCIPcreateVar(scip, &varss, name, 0.0, 1.0, 0.0,
SCIP_VARTYPE_IMPLINT,
SCIPconsIsInitial(cons),
SCIPconsIsRemovable(cons),
NULL,
NULL,
NULL,
NULL,
NULL) );
1209 assert( ! infeasible );
1210 assert( redundant );
1211 assert( aggregated );
1217 SCIP_CALL(
SCIPcreateVar(scip, &varnn, name, 0.0, 1.0, 0.0,
SCIP_VARTYPE_IMPLINT,
SCIPconsIsInitial(cons),
SCIPconsIsRemovable(cons),
NULL,
NULL,
NULL,
NULL,
NULL) );
1221 SCIP_CALL(
SCIPcreateVar(scip, &varsn, name, 0.0, 1.0, 0.0,
SCIP_VARTYPE_IMPLINT,
SCIPconsIsInitial(cons),
SCIPconsIsRemovable(cons),
NULL,
NULL,
NULL,
NULL,
NULL) );
1230 assert( ! infeasible );
1231 assert( redundant );
1232 assert( aggregated );
1239 SCIP_CALL(
SCIPcreateVar(scip, &varnn, name, 0.0, 1.0, 0.0,
SCIP_VARTYPE_IMPLINT,
SCIPconsIsInitial(cons),
SCIPconsIsRemovable(cons),
NULL,
NULL,
NULL,
NULL,
NULL) );
1243 SCIP_CALL(
SCIPcreateVar(scip, &varns, name, 0.0, 1.0, 0.0,
SCIP_VARTYPE_IMPLINT,
SCIPconsIsInitial(cons),
SCIPconsIsRemovable(cons),
NULL,
NULL,
NULL,
NULL,
NULL) );
1247 SCIP_CALL(
SCIPcreateVar(scip, &varsn, name, 0.0, 1.0, 0.0,
SCIP_VARTYPE_IMPLINT,
SCIPconsIsInitial(cons),
SCIPconsIsRemovable(cons),
NULL,
NULL,
NULL,
NULL,
NULL) );
1251 SCIP_CALL(
SCIPcreateVar(scip, &varss, name, 0.0, 1.0, 0.0,
SCIP_VARTYPE_IMPLINT,
SCIPconsIsInitial(cons),
SCIPconsIsRemovable(cons),
NULL,
NULL,
NULL,
NULL,
NULL) );
1261 if ( varns !=
NULL )
1266 if ( varsn !=
NULL )
1272 vars[cnt] = consdata->vars[i];
1290 if ( varprevss !=
NULL )
1292 vars[cnt] = varprevss;
1295 if ( varprevns !=
NULL )
1297 vars[cnt] = varprevns;
1302 if ( varss !=
NULL )
1307 if ( varsn !=
NULL )
1328 if ( varprevnn !=
NULL )
1330 vars[cnt] = varprevnn;
1333 if ( varprevsn !=
NULL )
1335 vars[cnt] = varprevsn;
1340 if ( varnn !=
NULL )
1345 if ( varns !=
NULL )
1367 consdata->extvars[4*i] = varnn;
1368 consdata->extvars[4*i + 1] = varns;
1369 consdata->extvars[4*i + 2] = varsn;
1370 consdata->extvars[4*i + 3] = varss;
1372 if ( varnn !=
NULL )
1373 ++(consdata->nextvars);
1374 if ( varns !=
NULL )
1375 ++(consdata->nextvars);
1376 if ( varsn !=
NULL )
1377 ++(consdata->nextvars);
1378 if ( varss !=
NULL )
1379 ++(consdata->nextvars);
1425 assert( scip !=
NULL );
1426 assert( cons !=
NULL );
1427 assert( naddedconss !=
NULL );
1435 assert( consdata !=
NULL );
1438 if ( consdata->extvars !=
NULL )
1442 if ( consdata->nvars <= 3 )
1446 assert( consdata->extvars ==
NULL );
1447 assert( consdata->nextvars == 0 );
1450 consdata->extvarssize = consdata->nvars;
1451 consdata->nextvars = consdata->nvars;
1455 for (i = 0; i < consdata->nvars; ++i)
1466 if ( i == consdata->nvars-1 )
1468 if ( consdata->rhs )
1482 SCIP_CALL(
SCIPcreateVar(scip, &artvar, name, lb, ub, 0.0,
SCIP_VARTYPE_IMPLINT,
SCIPconsIsInitial(cons),
SCIPconsIsRemovable(cons),
NULL,
NULL,
NULL,
NULL,
NULL) );
1491 assert( ! infeasible );
1492 assert( redundant );
1493 assert( aggregated );
1504 vars[2] = consdata->vars[i];
1521 vars[2] = consdata->vars[i];
1538 vars[2] = consdata->vars[i];
1555 vars[2] = consdata->vars[i];
1569 consdata->extvars[i] = artvar;
1600 assert(consdata !=
NULL);
1601 assert(consdata->rows[0] ==
NULL);
1608 if( consdata->intvar ==
NULL )
1613 ub = consdata->nvars/2;
1619 #ifdef SCIP_DEBUG_SOLUTION 1620 if( SCIPdebugIsMainscip(scip) )
1626 for( v = consdata->nvars - 1; v >= 0; --v )
1629 count += (solval > 0.5 ? 1 : 0);
1631 assert((count - consdata->rhs) % 2 == 0);
1632 solval = (
SCIP_Real) ((count - consdata->rhs) / 2);
1644 rhsval = (consdata->rhs ? 1.0 : 0.0);
1650 else if( !consdata->rhs )
1656 for( r = 0; r < 3; ++r )
1663 for( v = 0; v < 3; ++v )
1676 if( consdata->intvar !=
NULL )
1690 for( r = 0; r < 3; ++r )
1697 for( v = 0; v < 3; ++v )
1710 if( consdata->intvar !=
NULL )
1734 assert(consdata !=
NULL);
1735 assert(infeasible !=
NULL);
1736 assert(!(*infeasible));
1738 if( consdata->rows[0] ==
NULL )
1742 assert(consdata->rows[0] !=
NULL);
1743 for( r = 0; r <
NROWS && !(*infeasible); ++r )
1760 assert(consdata !=
NULL);
1762 if( consdata->rows[0] ==
NULL )
1767 for( r = 0; r <
NROWS; ++r )
1788 assert(violated !=
NULL);
1791 assert(consdata !=
NULL);
1812 odd = consdata->rhs;
1814 for( i = 0; i < consdata->nvars; ++i )
1818 odd = (odd != (solval > 0.5));
1831 else if( consdata->intvar !=
NULL )
1841 if( *violated && sol ==
NULL )
1903 assert( separated !=
NULL );
1904 assert( cutoff !=
NULL );
1908 assert(consdata !=
NULL);
1913 if( consdata->rows[0] ==
NULL )
1917 assert(consdata->rows[0] !=
NULL);
1920 for( r = 0; r <
NROWS; ++r )
1936 if ( separateparity && consdata->nvars > 3 )
1948 SCIPdebugMsg(scip,
"separating parity inequalities ...\n");
1951 for (j = 0; j < consdata->nvars; ++j)
1978 if ( (cnt - consdata->rhs) % 2 == 1 )
1984 SCIPdebugMsg(scip,
"found violated parity cut (efficiacy: %f)\n", 1.0 - sum);
1991 for (j = 0; j < consdata->nvars; ++j)
2019 SCIPdebugMsg(scip,
"found violated parity cut (efficiacy: %f, minval: %f)\n", 1.0 - (sum - 1.0 + 2.0 * minval), minval);
2027 for (j = 0; j < consdata->nvars; ++j)
2055 SCIPdebugMsg(scip,
"found violated parity cut (efficiacy: %f, maxval: %f)\n", 1.0 - (sum + 1.0 - 2.0 * maxval), maxval);
2063 for (j = 0; j < consdata->nvars; ++j)
2087 SCIPdebugMsg(scip,
"separated parity inequalites: %d\n", ngen);
2118 assert( A !=
NULL );
2119 assert( b !=
NULL );
2120 assert( p !=
NULL );
2121 assert( s !=
NULL );
2124 for (i = 0; i < m; ++i)
2131 for (i = 0; i < m && i < n; ++i)
2133 assert( s[i] == i );
2146 while ( k < m && A[p[k]][j] == 0 )
2168 assert( A[p[k]][j] != 0 );
2178 assert( A[pi][s[i]] != 0 );
2181 for (k = i+1; k < m; ++k)
2185 if ( A[pk][s[i]] != 0 )
2187 for (j = s[i]; j < n; ++j)
2188 A[pk][j] = A[pk][j] ^ A[pi][j];
2189 b[pk] = b[pk] ^ b[pi];
2194 if ( i % 100 == 99 )
2226 assert( A !=
NULL );
2227 assert( b !=
NULL );
2228 assert( s !=
NULL );
2229 assert( p !=
NULL );
2230 assert( x !=
NULL );
2231 assert( r <= m && r <= n );
2234 for (k = 0; k < n; ++k)
2238 x[s[r-1]] = b[p[r-1]];
2241 for (i = r-2; i >= 0; --i)
2245 assert( i <= s[i] && s[i] <= n );
2249 for (k = i+1; k < r; ++k)
2251 assert( i <= s[k] && s[k] <= n );
2252 if ( A[p[i]][s[k]] != 0 )
2253 val = val ^ x[s[k]];
2296 int nconssactive = 0;
2304 assert( scip !=
NULL );
2305 assert( conss !=
NULL );
2306 assert( result !=
NULL );
2311 SCIPdebugMsg(scip,
"Checking feasibility via the linear equation system over GF2 using Gauss.\n");
2323 for (i = 0; i < nconss; ++i)
2327 xoractive[i] =
FALSE;
2329 assert( conss[i] !=
NULL );
2331 assert( consdata !=
NULL );
2334 for (j = 0; j < consdata->nvars; ++j)
2338 var = consdata->vars[j];
2339 assert( var !=
NULL );
2345 assert( var !=
NULL );
2357 xorvars[nvarsmat++] = var;
2365 xoractive[i] =
TRUE;
2368 #ifdef SCIP_DISABLED_CODE 2375 for (j = 0; j < consdata->nvars; ++j)
2383 if ( ( cnt - consdata->rhs ) % 2 != 0 )
2392 assert( nvarsmat <= nvars );
2393 assert( nconssactive <= nconss );
2397 SCIPdebugMsg(scip,
"Skip checking the xor system over GF2 (%d conss, %d vars).\n", nconssactive, nvarsmat);
2407 for (j = 0; j < nvarsmat; ++j)
2420 for (j = 0; j < nvarsmat; ++j)
2422 assert( 0 <= xoridx[j] && xoridx[j] < nvarsmat );
2423 xorbackidx[xoridx[j]] = j;
2429 for (i = 0; i < nconss; ++i)
2431 if ( ! xoractive[i] )
2434 assert( conss[i] !=
NULL );
2436 assert( consdata !=
NULL );
2437 assert( consdata->nvars > 0 );
2443 b[nconssmat] = (
Type) consdata->rhs;
2444 for (j = 0; j < consdata->nvars; ++j)
2449 var = consdata->vars[j];
2450 assert( var !=
NULL );
2456 assert( var !=
NULL );
2457 b[nconssmat] = ! b[nconssmat];
2474 if(
SCIPisEQ(scip, constant, 1.0) )
2475 b[nconssmat] = ! b[nconssmat];
2483 if(
SCIPisEQ(scip, constant, 1.0) )
2484 b[nconssmat] = ! b[nconssmat];
2487 assert(var !=
NULL);
2503 b[nconssmat] = ! b[nconssmat];
2514 assert( idx < nvarsmat );
2515 assert( 0 <= xorbackidx[idx] && xorbackidx[idx] < nvarsmat );
2516 A[nconssmat][xorbackidx[idx]] = 1;
2522 SCIPdebugMsg(scip,
"Found %d non-fixed variables in %d nonempty xor constraints.\n", nvarsmat, nconssmat);
2523 assert( nconssmat == nconssactive );
2530 SCIPinfoMessage(scip,
NULL,
"Matrix before Gauss (size: %d x %d):\n", nconssmat, nvarsmat);
2531 for (i = 0; i < nconssmat; ++i)
2533 for (j = 0; j < nvarsmat; ++j)
2544 assert( rank <= nconssmat && rank <= nvarsmat );
2552 for (i = 0; i < nconssmat; ++i)
2554 for (j = 0; j < nvarsmat; ++j)
2562 for (i = rank; i < nconssmat; ++i)
2569 if ( i >= nconssmat )
2571 SCIPdebugMsg(scip,
"System feasible with rank %d (nconss=%d)\n", rank, nconssmat);
2574 if( rank == nvarsmat && noaggr )
2588 for (j = 0; j < nvarsmat; ++j)
2594 for( j = 0; j < nvarsmat; ++j )
2603 assert(!infeasible);
2610 assert(!infeasible);
2625 if ( heurtrysol !=
NULL )
2638 for (j = 0; j < nvarsmat; ++j)
2647 for (j = 0; j < nvarsmat; ++j)
2661 for (j = 0; j < nvars; ++j)
2671 for (i = 0; i < nconss; ++i)
2674 assert(consdata !=
NULL);
2676 if ( xoractive[i] && consdata->intvar !=
NULL )
2681 for (j = 0; j < consdata->nvars; ++j)
2687 assert( ! noaggr || nones % 2 == (
int) consdata->rhs );
2688 if ( (
unsigned int) nones != consdata->rhs )
2690 val = (
SCIP_Real) (nones - consdata->rhs)/2;
2705 SCIPdebugMsg(scip,
"Creating solution was successful.\n");
2711 SCIPdebugMsg(scip,
"Creating solution was not successful.\n");
2729 for (i = nconss - 1; i >= 0 ; --i)
2732 assert(consdata !=
NULL);
2734 if ( consdata->nvars == 0 )
2769 assert( cons !=
NULL );
2772 assert(consdata !=
NULL);
2773 vars = consdata->vars;
2774 nvars = consdata->nvars;
2779 assert( infervar ==
NULL || infervar == consdata->intvar );
2782 for (i = 0; i < nvars; ++i)
2791 for (i = 0; i < nvars; ++i)
2808 assert( vars[i] == infervar );
2814 assert( consdata->intvar !=
NULL );
2816 if( infervar != consdata->intvar )
2822 for (i = 0; i < nvars; ++i)
2834 assert( consdata->intvar !=
NULL );
2836 if( infervar != consdata->intvar )
2841 for (i = 0; i < nvars; ++i)
2916 assert(scip !=
NULL);
2917 assert(cons !=
NULL);
2918 assert(eventhdlr !=
NULL);
2919 assert(cutoff !=
NULL);
2920 assert(nfixedvars !=
NULL);
2921 assert(nchgbds !=
NULL);
2928 assert(consdata !=
NULL);
2930 vars = consdata->vars;
2931 nvars = consdata->nvars;
2934 if( consdata->propagated )
2947 watchedvar1 = consdata->watchedvar1;
2948 watchedvar2 = consdata->watchedvar2;
2951 if( watchedvar1 != -1 )
2956 if( watchedvar2 != -1 )
2963 if( watchedvar1 == -1 )
2965 watchedvar1 = watchedvar2;
2968 assert(watchedvar1 != -1 || watchedvar2 == -1);
2971 odd = consdata->rhs;
2974 if( watchedvar2 == -1 )
2976 for( i = 0; i < nvars; ++i )
2985 if( watchedvar1 == -1 )
2987 assert(watchedvar2 == -1);
2990 else if( watchedvar1 != i )
3000 assert(watchedvar1 != -1 || watchedvar2 == -1);
3003 if( watchedvar1 == -1 )
3005 assert(watchedvar2 == -1);
3020 if ( consdata->intvar !=
NULL && !consdata->deleteintvar )
3024 assert( ! *cutoff );
3025 assert( (nfixedones - consdata->rhs) % 2 == 0 );
3027 fixval = (nfixedones - consdata->rhs)/2;
3035 SCIPdebugMsg(scip,
"node infeasible: activity is %d, bounds of integral variable are [%g,%g]\n",
3046 SCIPdebugMsg(scip,
"node infeasible: activity is %d, bounds of integral variable are [%g,%g]\n",
3059 assert( tightened );
3060 assert( ! infeasible );
3066 assert( tightened );
3067 assert( ! infeasible );
3084 if( watchedvar2 == -1 )
3086 assert(watchedvar1 != -1);
3088 SCIPdebugMsg(scip,
"constraint <%s>: only one unfixed variable -> fix <%s> to %u\n",
3092 assert(!infeasible);
3098 if ( consdata->intvar !=
NULL && !consdata->deleteintvar )
3106 assert( (nfixedones - consdata->rhs) % 2 == 0 );
3108 fixval = (nfixedones - consdata->rhs)/2;
3115 SCIPdebugMsg(scip,
"node infeasible: activity is %d, bounds of integral variable are [%g,%g]\n",
3126 SCIPdebugMsg(scip,
"node infeasible: activity is %d, bounds of integral variable are [%g,%g]\n",
3139 assert( tightened );
3140 assert( ! infeasible );
3146 assert( tightened );
3147 assert( ! infeasible );
3162 if ( consdata->intvar !=
NULL && !consdata->deleteintvar )
3169 assert( nfixedones + nfixedzeros < nvars );
3174 nonesmin = 2 * (int)(
SCIPvarGetLbLocal(consdata->intvar) + 0.5) + consdata->rhs;
3175 nonesmax = 2 * (int)(
SCIPvarGetUbLocal(consdata->intvar) + 0.5) + consdata->rhs;
3178 if ( nvars - nfixedzeros < nonesmin )
3180 SCIPdebugMsg(scip,
"constraint <%s>: at most %d variables can take value 1, but there should be at least %d.\n",
SCIPconsGetName(cons), nvars - nfixedones, nonesmin);
3191 if ( nfixedones > nonesmax )
3193 SCIPdebugMsg(scip,
"constraint <%s>: at least %d variables are fixed to 1, but there should be at most %d.\n",
SCIPconsGetName(cons), nfixedones, nonesmax);
3204 newlb = (
SCIP_Real)((nfixedones + 1 - consdata->rhs) / 2);
3205 newub = (
SCIP_Real)((nvars - nfixedzeros - consdata->rhs) / 2);
3213 assert(!infeasible);
3217 nonesmin = 2 * (int)(
SCIPvarGetLbLocal(consdata->intvar) + 0.5) + consdata->rhs;
3226 assert(!infeasible);
3230 nonesmax = 2 * (int)(
SCIPvarGetUbLocal(consdata->intvar) + 0.5) + consdata->rhs;
3233 assert(nvars - nfixedzeros >= nonesmin);
3234 assert(nfixedones <= nonesmax);
3237 if ( nvars - nfixedzeros == nonesmin )
3239 SCIPdebugMsg(scip,
"constraint <%s>: fix %d free variables to 1 to reach lower bound of %d\n",
SCIPconsGetName(cons), nvars - nfixedzeros - nfixedones, nonesmin);
3241 for (i = 0; i < nvars; ++i)
3246 assert( !infeasible );
3247 assert( tightened );
3259 if ( nfixedones == nonesmax )
3261 SCIPdebugMsg(scip,
"constraint <%s>: fix %d free variables to 0 to guarantee upper bound of %d\n",
SCIPconsGetName(cons), nvars - nfixedzeros - nfixedones, nonesmax);
3263 for (i = 0; i < nvars; ++i)
3268 assert(!infeasible);
3284 consdata->propagated =
TRUE;
3302 assert(result !=
NULL);
3304 SCIPdebugMsg(scip,
"resolving fixations according to rule %d\n", (
int) proprule);
3334 assert(scip !=
NULL);
3335 assert(cons !=
NULL);
3336 assert(nfixedvars !=
NULL);
3337 assert(nchgcoefs !=
NULL);
3338 assert(ndelconss !=
NULL);
3339 assert(naddconss !=
NULL);
3340 assert(cutoff !=
NULL);
3347 assert(consdata !=
NULL);
3349 vars = consdata->vars;
3350 nvars = consdata->nvars;
3356 if( !consdata->deleteintvar )
3360 if( !consdata->changed )
3411 if( posnotinclq1 == v )
3417 for( v1 = v+1; v1 < nvars; ++v1 )
3419 if( posnotinclq1 == v1 )
3434 if( posnotinclq1 == -1 )
3442 if( restart || (posnotinclq2 != v && posnotinclq2 != v1) )
3449 posnotinclq1 = posnotinclq2;
3457 assert(vars[v] != vars[v1]);
3470 if( posnotinclq1 == -1 )
3499 SCIPdebugMsg(scip,
"all variables of xor constraints <%s> are in one clique, so fixed all variables to 0\n",
3503 for( v = nvars - 1; v >= 0; --v )
3508 assert(infeasible || fixed);
3512 *cutoff = infeasible;
3532 if( !consdata->rhs )
3540 for( v = 0; v < nvars; ++v )
3542 if( v == posnotinclq1 )
3547 assert(var !=
NULL);
3576 if( consdata->intvar !=
NULL )
3588 *cutoff = infeasible;
3624 assert(conss !=
NULL);
3625 assert(ndelconss !=
NULL);
3628 hashtablesize = nconss;
3632 hashGetKeyXorcons, hashKeyEqXorcons, hashKeyValXorcons, (
void*) scip) );
3635 for( c = 0; c < nconss; ++c )
3651 assert(conshdlrdata !=
NULL);
3659 SCIP_CALL(
applyFixings(scip, cons0, conshdlrdata->eventhdlr, nchgcoefs, naggrvars, naddconss, cutoff) );
3665 assert(consdata0 !=
NULL);
3669 assert(consdata0->sorted);
3683 assert(consdata1 !=
NULL);
3684 assert(consdata0->nvars >= 1 && consdata0->nvars == consdata1->nvars);
3686 assert(consdata0->sorted && consdata1->sorted);
3687 assert(consdata0->vars[0] == consdata1->vars[0]);
3689 if( consdata0->rhs != consdata1->rhs )
3744 assert(conss !=
NULL);
3745 assert(firstchange <= chkind);
3746 assert(cutoff !=
NULL);
3747 assert(nfixedvars !=
NULL);
3748 assert(naggrvars !=
NULL);
3749 assert(ndelconss !=
NULL);
3750 assert(nchgcoefs !=
NULL);
3753 cons0 = conss[chkind];
3758 assert(consdata0 !=
NULL);
3759 assert(consdata0->nvars >= 1);
3764 assert(conshdlrdata !=
NULL);
3772 SCIP_CALL(
applyFixings(scip, cons0, conshdlrdata->eventhdlr, nchgcoefs, naggrvars, naddconss, cutoff) );
3778 assert(consdata0->sorted);
3781 cons0changed = consdata0->changed;
3782 consdata0->changed =
FALSE;
3807 assert(consdata1 !=
NULL);
3809 if( !consdata1->deleteintvar )
3818 SCIP_CALL(
applyFixings(scip, cons1, conshdlrdata->eventhdlr, nchgcoefs, naggrvars, naddconss, cutoff) );
3823 SCIPdebugMsg(scip,
"preprocess xor constraint pair <%s>[chg:%u] and <%s>[chg:%u]\n",
3827 if( !cons0changed && !consdata1->changed )
3831 if( consdata1->nvars == 0 )
3833 if( consdata1->rhs )
3847 else if( consdata1->nvars == 1 )
3851 assert(!infeasible);
3860 SCIP_CALL(
applyFixings(scip, cons0, conshdlrdata->eventhdlr, nchgcoefs, naggrvars, naddconss, cutoff) );
3865 assert(consdata0->sorted);
3869 else if( consdata1->nvars == 2 )
3871 if( !(consdata1->rhs) )
3875 &infeasible, &redundant, &aggregated) );
3881 &infeasible, &redundant, &aggregated) );
3883 assert(!infeasible);
3891 SCIP_CALL(
applyFixings(scip, cons0, conshdlrdata->eventhdlr, nchgcoefs, naggrvars, naddconss, cutoff) );
3897 assert(consdata0->sorted);
3908 assert(consdata0->sorted);
3912 assert(consdata1->sorted);
3920 parity = (consdata0->rhs ^ consdata1->rhs);
3921 cons0hastwoothervars =
FALSE;
3922 cons1hastwoothervars =
FALSE;
3927 while( (v0 < consdata0->nvars || v1 < consdata1->nvars) && !aborted )
3931 assert(v0 <= consdata0->nvars);
3932 assert(v1 <= consdata1->nvars);
3934 if( v0 == consdata0->nvars )
3936 else if( v1 == consdata1->nvars )
3945 assert(v0 < consdata0->nvars);
3946 if( singlevar0 ==
NULL )
3948 singlevar0 = consdata0->vars[v0];
3949 if( cons1hastwoothervars )
3954 cons0hastwoothervars =
TRUE;
3955 if( singlevar1 !=
NULL )
3963 assert(v1 < consdata1->nvars);
3964 if( singlevar1 ==
NULL )
3966 singlevar1 = consdata1->vars[v1];
3967 if( cons0hastwoothervars )
3972 cons1hastwoothervars =
TRUE;
3973 if( singlevar0 !=
NULL )
3981 assert(v0 < consdata0->nvars);
3982 assert(v1 < consdata1->nvars);
3984 if( consdata0->vars[v0] != consdata1->vars[v1] )
4001 if( (cons0hastwoothervars && singlevar1 !=
NULL) || (cons1hastwoothervars && singlevar0 !=
NULL) )
4005 if( singlevar0 ==
NULL && singlevar1 ==
NULL )
4011 SCIPdebugMsg(scip,
"xor constraints <%s> and <%s> are redundant: delete <%s>\n",
4021 if( consdata1->intvar !=
NULL )
4031 if( consdata0->intvar ==
NULL )
4039 &infeasible, &redundant, &aggregated) );
4041 *cutoff = *cutoff || infeasible;
4055 newvars[0] = consdata1->intvar;
4057 newvars[1] = consdata0->intvar;
4078 SCIPdebugMsg(scip,
"xor constraints <%s> and <%s> are contradicting\n",
4085 else if( singlevar1 ==
NULL )
4088 if( !cons0hastwoothervars )
4091 SCIPdebugMsg(scip,
"xor constraints <%s> and <%s> yield sum %u == <%s>\n",
4096 *cutoff = *cutoff || infeasible;
4110 SCIPdebugMsg(scip,
"xor constraint <%s> is superset of <%s> with parity %u\n",
4114 for( v = 0; v < consdata1->nvars; ++v )
4119 SCIP_CALL(
applyFixings(scip, cons0, conshdlrdata->eventhdlr, nchgcoefs, naggrvars, naddconss, cutoff) );
4121 assert(consdata0->nvars >= 2);
4128 assert(consdata0->sorted);
4130 else if( singlevar0 ==
NULL )
4133 if( !cons1hastwoothervars )
4136 SCIPdebugMsg(scip,
"xor constraints <%s> and <%s> yield sum %u == <%s>\n",
4141 assert(infeasible || fixed);
4142 *cutoff = *cutoff || infeasible;
4155 SCIPdebugMsg(scip,
"xor constraint <%s> is subset of <%s> with parity %u\n",
4159 for( v = 0; v < consdata0->nvars; ++v )
4163 SCIP_CALL(
applyFixings(scip, cons1, conshdlrdata->eventhdlr, nchgcoefs, naggrvars, naddconss, cutoff) );
4165 assert(consdata1->nvars >= 2);
4171 assert(consdata1->sorted);
4176 assert(!cons0hastwoothervars);
4177 assert(!cons1hastwoothervars);
4180 SCIPdebugMsg(scip,
"xor constraints <%s> and <%s> yield sum %u == xor(<%s>,<%s>)\n",
4187 &infeasible, &redundant, &aggregated) );
4193 &infeasible, &redundant, &aggregated) );
4197 *cutoff = *cutoff || infeasible;
4208 if( consdata1->intvar !=
NULL )
4210 if( consdata0->intvar ==
NULL )
4218 &infeasible, &redundant, &aggregated) );
4220 *cutoff = *cutoff || infeasible;
4227 if( !consdata0->sorted )
4229 assert(consdata0->sorted);
4238 SCIP_CALL(
applyFixings(scip, cons0, conshdlrdata->eventhdlr, nchgcoefs, naggrvars, naddconss, cutoff) );
4294 if( conshdlr ==
NULL )
4304 SCIP_CALL(
SCIPcreateCons(scip, cons, name, conshdlr, consdata, initial, separate, enforce, check, propagate,
4305 local, modifiable, dynamic, removable, stickingatnode) );
4332 assert( upgdcons !=
NULL );
4341 if( integral && nposcont + nnegcont == 0 && nposbin + nnegbin + nposimplbin + nnegimplbin >= nvars-1 && ncoeffspone + ncoeffsnone == nvars-1 && ncoeffspint + ncoeffsnint == 1 )
4343 assert( ncoeffspfrac + ncoeffsnfrac == 0 );
4356 for( j = nvars - 1; j >= 0; --j )
4360 parityvar = vars[j];
4361 postwo = (vals[j] > 0.0);
4378 assert(xorvars[cnt] !=
NULL);
4381 xorvars[cnt] = vars[j];
4386 if( parityvar !=
NULL )
4388 assert(cnt == nvars - 1);
4405 neednew = (intrhs != 1 && intrhs != 0);
4421 intrhshalfed = intrhs / 2;
4456 SCIPdebugMsg(scip,
"created new variable for aggregation:");
4460 (
SCIP_Real) (postwo ? intrhshalfed : -intrhshalfed), &infeasible, &redundant, &aggregated) );
4461 assert(!infeasible);
4480 assert(intvar !=
NULL);
4494 assert(intvar != parityvar);
4516 assert(scip !=
NULL);
4517 assert(conshdlr !=
NULL);
4536 assert(conshdlrdata !=
NULL);
4553 for( c = 0; c < nconss; ++c )
4570 assert(conshdlrdata !=
NULL);
4576 for( v = (*consdata)->nvars - 1; v >= 0; --v )
4597 assert(sourcedata !=
NULL);
4598 assert(sourcedata->nvars >= 1);
4599 assert(sourcedata->vars !=
NULL);
4602 SCIP_CALL(
consdataCreate(scip, &targetdata, sourcedata->rhs, sourcedata->nvars, sourcedata->vars, sourcedata->intvar) );
4621 assert(infeasible !=
NULL);
4623 *infeasible =
FALSE;
4625 for( i = 0; i < nconss && !(*infeasible); i++ )
4647 assert( conshdlrdata !=
NULL );
4650 for( c = 0; c < nusefulconss; ++c )
4655 else if ( separated )
4678 assert( conshdlrdata !=
NULL );
4681 for( c = 0; c < nusefulconss; ++c )
4686 else if ( separated )
4707 assert( conshdlrdata !=
NULL );
4710 for( i = 0; i < nconss; i++ )
4744 assert( conshdlrdata !=
NULL );
4747 for( i = 0; i < nconss; i++ )
4779 for( i = 0; i < nconss; i++ )
4804 for( i = 0; i < nconss && (*result ==
SCIP_FEASIBLE || completely); i++ )
4818 assert( consdata !=
NULL );
4822 for( v = 0; v < consdata->nvars; ++v )
4828 if( consdata->intvar !=
NULL )
4830 SCIPinfoMessage(scip,
NULL,
";\nviolation: %d operands are set to TRUE but integer variable has value of %g\n",
SCIPgetSolVal(scip, sol, consdata->intvar));
4855 assert(conshdlrdata !=
NULL);
4862 for( c = 0; c < nusefulconss && !cutoff; ++c )
4870 else if( nfixedvars > 0 || nchgbds > 0 )
4881 freq = conshdlrdata->gausspropfreq;
4882 if ( (depth == 0 && freq == 0) || (freq > 0 && depth % freq == 0) )
4902 assert(conshdlr !=
NULL);
4904 assert(conshdlrdata !=
NULL);
4907 for( c = nconss - 1; c >= 0; --c )
4910 assert(consdata !=
NULL);
4912 for( v = consdata->nvars - 1; v >= 0; --v )
4931 assert(conshdlr !=
NULL);
4933 assert(conshdlrdata !=
NULL);
4936 for( c = 0; c < nconss; ++c )
4939 assert(consdata !=
NULL);
4943 for( v = 0; v < consdata->nvars; ++v )
4972 assert(result !=
NULL);
4974 oldnfixedvars = *nfixedvars;
4975 oldnchgbds = *nchgbds;
4976 oldnaggrvars = *naggrvars;
4977 oldndelconss = *ndelconss;
4978 oldnchgcoefs = *nchgcoefs;
4981 assert(conshdlrdata !=
NULL);
4985 firstchange = INT_MAX;
4986 for( c = 0; c < nconss && !cutoff && !
SCIPisStopped(scip); ++c )
4989 assert(cons !=
NULL);
4991 assert(consdata !=
NULL);
4995 consdata->propagated =
FALSE;
4998 if( firstchange == INT_MAX && consdata->changed )
5004 SCIP_CALL(
applyFixings(scip, cons, conshdlrdata->eventhdlr, nchgcoefs, naggrvars, naddconss, &cutoff) );
5014 assert(consdata->nvars >= 2);
5017 if( consdata->nvars == 2 )
5019 SCIPdebugMsg(scip,
"xor constraint <%s> has only two unfixed variables, rhs=%u\n",
5022 assert(consdata->vars !=
NULL);
5028 if( !consdata->rhs )
5034 &cutoff, &redundant, &aggregated) );
5042 &cutoff, &redundant, &aggregated) );
5072 assert(consdata->deleteintvar || (consdata->rhs &&
SCIPvarGetLbGlobal(consdata->intvar) < 0.5));
5095 if( firstchange < nconss && conshdlrdata->presolusehashing )
5100 if( conshdlrdata->presolpairwise )
5104 npaircomparisons = 0;
5105 lastndelconss = *ndelconss;
5107 for( c = firstchange; c < nconss && !cutoff && !
SCIPisStopped(scip); ++c )
5114 &cutoff, nfixedvars, naggrvars, ndelconss, naddconss, nchgcoefs) );
5120 lastndelconss = *ndelconss;
5121 npaircomparisons = 0;
5131 else if( *nfixedvars > oldnfixedvars || *nchgbds > oldnchgbds || *naggrvars > oldnaggrvars
5132 || *ndelconss > oldndelconss || *nchgcoefs > oldnchgcoefs )
5142 int naddedconss = 0;
5145 assert(cons !=
NULL);
5147 assert(consdata !=
NULL);
5149 if ( consdata->extvars !=
NULL )
5152 if ( conshdlrdata->addflowextended )
5160 (*naddconss) += naddedconss;
5186 assert(consdata !=
NULL);
5189 for( i = 0; i < consdata->nvars; ++i )
5195 if( consdata->intvar !=
NULL )
5208 assert( scip !=
NULL );
5209 assert( conshdlr !=
NULL );
5210 assert( cons !=
NULL );
5226 const char* consname;
5230 assert(scip !=
NULL);
5231 assert(sourcescip !=
NULL);
5232 assert(sourcecons !=
NULL);
5237 assert(sourceconsdata !=
NULL);
5240 sourcevars = sourceconsdata->vars;
5241 nvars = sourceconsdata->nvars;
5242 intvar = sourceconsdata->intvar;
5243 targetintvar =
NULL;
5252 if( intvar !=
NULL )
5255 assert(!(*valid) || targetintvar !=
NULL);
5265 targetintvar, initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable,
5276 for( v = 0; v < nvars && *valid; ++v )
5279 assert(!(*valid) || targetvars[v] !=
NULL);
5283 if( *valid && intvar !=
NULL )
5286 assert(!(*valid) || targetintvar !=
NULL);
5297 targetintvar, initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable,
5318 SCIPdebugMsg(scip,
"parse <%s> as xor constraint\n", str);
5334 if( varssize < requiredsize )
5337 varssize = requiredsize;
5345 assert(varssize >= requiredsize);
5347 SCIPdebugMsg(scip,
"successfully parsed %d variables\n", nvars);
5352 while( *str !=
'=' && *str !=
'\0' )
5375 while( *str ==
' ' || *str ==
'\t' )
5382 while( *str !=
'=' && *str !=
'\0' )
5394 while( *str ==
' ' || *str ==
'\t' )
5400 if( intvar ==
NULL )
5409 while( *str !=
')' && *str !=
'\0' )
5413 if( intvar !=
NULL )
5417 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) );
5423 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) );
5450 assert(consdata !=
NULL);
5452 if ( consdata->intvar !=
NULL )
5455 if ( varssize < consdata->nvars + nintvar + consdata->nextvars )
5461 if ( consdata->intvar !=
NULL )
5462 vars[consdata->nvars] = consdata->intvar;
5464 if ( consdata->nextvars > 0 )
5466 assert( consdata->extvars !=
NULL );
5467 cnt = consdata->nvars + nintvar;
5468 for (j = 0; j < consdata->extvarssize; ++j)
5470 if ( consdata->extvars[j] !=
NULL )
5471 vars[cnt++] = consdata->extvars[j];
5473 assert( cnt == consdata->nvars + nintvar + consdata->nextvars );
5488 assert(cons !=
NULL);
5491 assert(consdata !=
NULL);
5493 if( consdata->intvar ==
NULL )
5494 (*nvars) = consdata->nvars + consdata->nextvars;
5496 (*nvars) = consdata->nvars + 1 + consdata->nextvars;
5512 assert(eventhdlr !=
NULL);
5513 assert(eventdata !=
NULL);
5514 assert(event !=
NULL);
5517 assert(consdata !=
NULL);
5525 consdata->sorted =
FALSE;
5528 consdata->propagated =
FALSE;
5549 eventExecXor,
NULL) );
5557 consEnfolpXor, consEnfopsXor, consCheckXor, consLockXor,
5559 assert(conshdlr !=
NULL);
5590 "constraints/xor/presolpairwise",
5591 "should pairwise constraint comparison be performed in presolving?",
5595 "constraints/xor/presolusehashing",
5596 "should hash table be used for detecting redundant constraints in advance?",
5600 "constraints/xor/addextendedform",
5601 "should the extended formulation be added in presolving?",
5605 "constraints/xor/addflowextended",
5606 "should the extended flow formulation be added (nonsymmetric formulation otherwise)?",
5610 "constraints/xor/separateparity",
5611 "should parity inequalities be separated?",
5615 "constraints/xor/gausspropfreq",
5616 "frequency for applying the Gauss propagator",
5663 if( conshdlr ==
NULL )
5673 SCIP_CALL(
SCIPcreateCons(scip, cons, name, conshdlr, consdata, initial, separate, enforce, check, propagate,
5674 local, modifiable, dynamic, removable, stickingatnode) );
5715 assert(consdata !=
NULL);
5717 return consdata->nvars;
5736 assert(consdata !=
NULL);
5738 return consdata->vars;
5757 assert(consdata !=
NULL);
5759 return consdata->intvar;
5777 assert(consdata !=
NULL);
5779 return consdata->rhs;
enum SCIP_Result SCIP_RESULT
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
SCIP_RETCODE SCIPaddVarsToRowSameCoef(SCIP *scip, SCIP_ROW *row, int nvars, SCIP_VAR **vars, SCIP_Real val)
void SCIPconshdlrSetData(SCIP_CONSHDLR *conshdlr, SCIP_CONSHDLRDATA *conshdlrdata)
static SCIP_RETCODE consdataPrint(SCIP *scip, SCIP_CONSDATA *consdata, FILE *file, SCIP_Bool endline)
SCIP_RETCODE SCIPincConsAge(SCIP *scip, SCIP_CONS *cons)
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
static SCIP_RETCODE createRelaxation(SCIP *scip, SCIP_CONS *cons)
static SCIP_DECL_EVENTEXEC(eventExecXor)
SCIP_RETCODE SCIPsetConshdlrDelete(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSDELETE((*consdelete)))
SCIP_Bool SCIPinRepropagation(SCIP *scip)
static int computeRowEcholonGF2(SCIP *scip, int m, int n, int *p, int *s, Type **A, Type *b)
static SCIP_DECL_CONSCOPY(consCopyXor)
static SCIP_DECL_CONSFREE(consFreeXor)
#define MAXXORCONSSSYSTEM
SCIP_Bool SCIPvarsHaveCommonClique(SCIP_VAR *var1, SCIP_Bool value1, SCIP_VAR *var2, SCIP_Bool value2, SCIP_Bool regardimplics)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
primal heuristic that tries a given solution
SCIP_RETCODE SCIPtightenVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened)
SCIP_RETCODE SCIPcacheRowExtensions(SCIP *scip, SCIP_ROW *row)
SCIP_Real SCIPgetVarUbAtIndex(SCIP *scip, SCIP_VAR *var, SCIP_BDCHGIDX *bdchgidx, SCIP_Bool after)
static SCIP_DECL_CONSINITLP(consInitlpXor)
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)
#define SCIP_EVENTTYPE_VARFIXED
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_CONSINITPRE(consInitpreXor)
SCIP_Real SCIPgetVarLbAtIndex(SCIP *scip, SCIP_VAR *var, SCIP_BDCHGIDX *bdchgidx, SCIP_Bool after)
static SCIP_RETCODE propagateCons(SCIP *scip, SCIP_CONS *cons, SCIP_EVENTHDLR *eventhdlr, SCIP_Bool *cutoff, int *nfixedvars, int *nchgbds)
SCIP_RETCODE SCIPhashtableInsert(SCIP_HASHTABLE *hashtable, void *element)
SCIP_RETCODE SCIPcatchVarEvent(SCIP *scip, SCIP_VAR *var, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
SCIP_RETCODE SCIPflushRowExtensions(SCIP *scip, SCIP_ROW *row)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_RETCODE SCIPsetConshdlrGetVars(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSGETVARS((*consgetvars)))
SCIP_Bool SCIPvarIsInitial(SCIP_VAR *var)
static SCIP_DECL_CONSSEPASOL(consSepasolXor)
SCIP_RETCODE SCIPsetConshdlrEnforelax(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSENFORELAX((*consenforelax)))
SCIP_RETCODE SCIPresetConsAge(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPdelCons(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE analyzeConflict(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *infervar, PROPRULE proprule)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
SCIP_RETCODE SCIPaddVarToRow(SCIP *scip, SCIP_ROW *row, SCIP_VAR *var, SCIP_Real val)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
SCIP_RETCODE SCIPaddConflictBinvar(SCIP *scip, SCIP_VAR *var)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_RETCODE unlockRounding(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
SCIP_RETCODE SCIPincludeEventhdlrBasic(SCIP *scip, SCIP_EVENTHDLR **eventhdlrptr, const char *name, const char *desc, SCIP_DECL_EVENTEXEC((*eventexec)), SCIP_EVENTHDLRDATA *eventhdlrdata)
SCIP_RETCODE SCIPgetTransformedVar(SCIP *scip, SCIP_VAR *var, SCIP_VAR **transvar)
SCIP_RETCODE SCIPupdateConsFlags(SCIP *scip, SCIP_CONS *cons0, SCIP_CONS *cons1)
SCIP_RETCODE SCIPparseVarName(SCIP *scip, const char *str, SCIP_VAR **var, char **endptr)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
SCIP_RETCODE SCIPsetConshdlrInitpre(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINITPRE((*consinitpre)))
SCIP_Bool SCIPisFeasNegative(SCIP *scip, SCIP_Real val)
static SCIP_DECL_CONSPROP(consPropXor)
#define DEFAULT_PRESOLUSEHASHING
static SCIP_RETCODE conshdlrdataFree(SCIP *scip, SCIP_CONSHDLRDATA **conshdlrdata)
int SCIPconsGetPos(SCIP_CONS *cons)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
SCIP_RETCODE SCIPincludeConshdlrBasic(SCIP *scip, SCIP_CONSHDLR **conshdlrptr, const char *name, const char *desc, int enfopriority, int chckpriority, int eagerfreq, SCIP_Bool needscons, SCIP_DECL_CONSENFOLP((*consenfolp)), SCIP_DECL_CONSENFOPS((*consenfops)), SCIP_DECL_CONSCHECK((*conscheck)), SCIP_DECL_CONSLOCK((*conslock)), SCIP_CONSHDLRDATA *conshdlrdata)
SCIP_Real SCIPinfinity(SCIP *scip)
int SCIPsnprintf(char *t, int len, const char *s,...)
enum SCIP_Retcode SCIP_RETCODE
static SCIP_DECL_CONSPRESOL(consPresolXor)
SCIP_RETCODE SCIPaddConflictUb(SCIP *scip, SCIP_VAR *var, SCIP_BDCHGIDX *bdchgidx)
static void solveRowEcholonGF2(int m, int n, int r, int *p, int *s, Type **A, Type *b, Type *x)
SCIP_RETCODE SCIPaddVarLocks(SCIP *scip, SCIP_VAR *var, int nlocksdown, int nlocksup)
SCIP_Bool SCIPconsIsStickingAtNode(SCIP_CONS *cons)
#define SCIP_PRESOLTIMING_EXHAUSTIVE
SCIP_RETCODE SCIPincludeConshdlrXor(SCIP *scip)
static SCIP_DECL_CONSENFOLP(consEnfolpXor)
#define DEFAULT_ADDFLOWEXTENDED
#define CONSHDLR_CHECKPRIORITY
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)
#define MINGAINPERNMINCOMPARISONS
SCIP_Real SCIPvarGetAggrScalar(SCIP_VAR *var)
SCIP_Bool SCIPconsIsTransformed(SCIP_CONS *cons)
SCIP_RETCODE SCIPinitConflictAnalysis(SCIP *scip, SCIP_CONFTYPE conftype, SCIP_Bool iscutoffinvolved)
SCIP_RETCODE SCIPtightenVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened)
#define SCIPfreeBlockMemory(scip, ptr)
static SCIP_DECL_CONSSEPALP(consSepalpXor)
SCIP_RETCODE SCIPsetConshdlrSepa(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSSEPALP((*conssepalp)), SCIP_DECL_CONSSEPASOL((*conssepasol)), int sepafreq, int sepapriority, SCIP_Bool delaysepa)
SCIP_RETCODE SCIPheurPassSolAddSol(SCIP *scip, SCIP_HEUR *heur, SCIP_SOL *sol)
static SCIP_RETCODE consdataFree(SCIP *scip, SCIP_CONSDATA **consdata, SCIP_EVENTHDLR *eventhdlr)
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define CONSHDLR_SEPAPRIORITY
#define CONSHDLR_PROP_TIMING
#define SCIPfreeBufferArray(scip, ptr)
SCIP_Bool SCIPvarIsRemovable(SCIP_VAR *var)
Constraint handler for the set partitioning / packing / covering constraints .
#define SCIPallocBlockMemory(scip, ptr)
#define SCIPdebugPrintCons(x, y, z)
SCIP_Bool SCIPisTransformed(SCIP *scip)
static SCIP_RETCODE addRelaxation(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *infeasible)
SCIP_VAR * SCIPvarGetNegationVar(SCIP_VAR *var)
SCIP_Bool SCIPconsIsRemovable(SCIP_CONS *cons)
static SCIP_DECL_CONSTRANS(consTransXor)
#define SCIP_EVENTTYPE_BOUNDCHANGED
SCIP_RETCODE SCIPsetConshdlrInitlp(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINITLP((*consinitlp)))
static SCIP_DECL_CONSLOCK(consLockXor)
SCIP_RETCODE SCIPaddIntParam(SCIP *scip, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPgetTransformedVars(SCIP *scip, int nvars, SCIP_VAR **vars, SCIP_VAR **transvars)
SCIP_RETCODE SCIPsetConshdlrParse(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPARSE((*consparse)))
static SCIP_DECL_CONSENFOPS(consEnfopsXor)
SCIP_Bool SCIPconsIsActive(SCIP_CONS *cons)
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)
SCIP_RETCODE SCIPaddConflictLb(SCIP *scip, SCIP_VAR *var, SCIP_BDCHGIDX *bdchgidx)
static SCIP_RETCODE applyFixings(SCIP *scip, SCIP_CONS *cons, SCIP_EVENTHDLR *eventhdlr, int *nchgcoefs, int *naggrvars, int *naddconss, SCIP_Bool *cutoff)
SCIP_Real SCIPcomputeVarLbLocal(SCIP *scip, SCIP_VAR *var)
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_VAR * SCIPvarGetNegatedVar(SCIP_VAR *var)
SCIP_Bool SCIProwIsInLP(SCIP_ROW *row)
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
SCIP_Bool SCIPisConflictAnalysisApplicable(SCIP *scip)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
SCIP_VAR * SCIPvarGetProbvar(SCIP_VAR *var)
SCIP_RETCODE SCIPcreateConsBasicXor(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_Bool rhs, int nvars, SCIP_VAR **vars)
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
static SCIP_RETCODE detectRedundantConstraints(SCIP *scip, BMS_BLKMEM *blkmem, SCIP_CONS **conss, int nconss, int *firstchange, int *nchgcoefs, int *naggrvars, int *ndelconss, int *naddconss, SCIP_Bool *cutoff)
SCIP_RETCODE SCIPparseVarsList(SCIP *scip, const char *str, SCIP_VAR **vars, int *nvars, int varssize, int *requiredsize, char **endptr, char delimiter, SCIP_Bool *success)
SCIP_Bool SCIPisPresolveFinished(SCIP *scip)
#define CONSHDLR_ENFOPRIORITY
static SCIP_DECL_CONSDELETE(consDeleteXor)
#define SCIP_PRESOLTIMING_MEDIUM
static SCIP_DECL_CONSPRINT(consPrintXor)
SCIP_RETCODE SCIPsetConshdlrCopy(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), SCIP_DECL_CONSCOPY((*conscopy)))
SCIP_HEUR * SCIPfindHeur(SCIP *scip, const char *name)
static SCIP_DECL_CONSEXITPRE(consExitpreXor)
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
#define DEFAULT_SEPARATEPARITY
int SCIPvarCompareActiveAndNegated(SCIP_VAR *var1, SCIP_VAR *var2)
SCIP_RETCODE SCIPdelConsLocal(SCIP *scip, SCIP_CONS *cons)
#define CONSHDLR_MAXPREROUNDS
static SCIP_DECL_CONSGETVARS(consGetVarsXor)
SCIP_Bool SCIPisEfficacious(SCIP *scip, SCIP_Real efficacy)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
SCIP_RETCODE SCIPunlockVarCons(SCIP *scip, SCIP_VAR *var, SCIP_CONS *cons, SCIP_Bool lockdown, SCIP_Bool lockup)
const char * SCIPconsGetName(SCIP_CONS *cons)
SCIP_Real SCIPvarGetAggrConstant(SCIP_VAR *var)
SCIP_Bool SCIPconsIsPropagated(SCIP_CONS *cons)
struct SCIP_EventData SCIP_EVENTDATA
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)
SCIP_CONSHDLRDATA * SCIPconshdlrGetData(SCIP_CONSHDLR *conshdlr)
#define CONSHDLR_NEEDSCONS
void SCIPsortPtr(void **ptrarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
#define SCIPhashTwo(a, b)
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define DEFAULT_GAUSSPROPFREQ
SCIP_Real SCIPcomputeVarUbLocal(SCIP *scip, SCIP_VAR *var)
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPanalyzeConflictCons(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success)
SCIP_Bool SCIPconsIsLocal(SCIP_CONS *cons)
SCIP_Real SCIPgetRowLPActivity(SCIP *scip, SCIP_ROW *row)
SCIP_RETCODE SCIPsetConshdlrResprop(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSRESPROP((*consresprop)))
#define SCIPdebugGetSolVal(scip, var, val)
SCIP_RETCODE SCIPaddCut(SCIP *scip, SCIP_SOL *sol, SCIP_ROW *cut, SCIP_Bool forcecut, SCIP_Bool *infeasible)
struct SCIP_ConsData SCIP_CONSDATA
static SCIP_DECL_CONSPARSE(consParseXor)
static void consdataSort(SCIP_CONSDATA *consdata)
#define CONSHDLR_DELAYSEPA
static SCIP_RETCODE consdataFreeRows(SCIP *scip, SCIP_CONSDATA *consdata)
static SCIP_DECL_CONSGETNVARS(consGetNVarsXor)
static SCIP_DECL_CONSRESPROP(consRespropXor)
#define SCIPallocBufferArray(scip, ptr, num)
SCIP_RETCODE SCIPsetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real val)
public data structures and miscellaneous methods
#define CONSHDLR_PROPFREQ
#define DEFAULT_ADDEXTENDEDFORM
SCIP_VAR * SCIPeventGetVar(SCIP_EVENT *event)
static SCIP_RETCODE consdataSwitchWatchedvars(SCIP *scip, SCIP_CONSDATA *consdata, SCIP_EVENTHDLR *eventhdlr, int watchedvar1, int watchedvar2)
SCIP_RETCODE SCIPcheckSol(SCIP *scip, SCIP_SOL *sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *feasible)
#define LINCONSUPGD_PRIORITY
SCIP_EVENTTYPE SCIPeventGetType(SCIP_EVENT *event)
#define CONSHDLR_SEPAFREQ
static SCIP_RETCODE conshdlrdataCreate(SCIP *scip, SCIP_CONSHDLRDATA **conshdlrdata, SCIP_EVENTHDLR *eventhdlr)
SCIP_RETCODE SCIPcreateEmptyRowCons(SCIP *scip, SCIP_ROW **row, SCIP_CONSHDLR *conshdlr, const char *name, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool removable)
int SCIPgetDepth(SCIP *scip)
static SCIP_RETCODE preprocessConstraintPairs(SCIP *scip, SCIP_CONS **conss, int firstchange, int chkind, SCIP_Bool *cutoff, int *nfixedvars, int *naggrvars, int *ndelconss, int *naddconss, int *nchgcoefs)
SCIP_RETCODE SCIPprintCons(SCIP *scip, SCIP_CONS *cons, FILE *file)
int SCIPvarGetNLocksUp(SCIP_VAR *var)
SCIP_Bool SCIPstrToRealValue(const char *str, SCIP_Real *value, char **endptr)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
int SCIPvarCompare(SCIP_VAR *var1, SCIP_VAR *var2)
static SCIP_RETCODE setIntvar(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
static SCIP_RETCODE addConflictBounds(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *infervar, SCIP_BDCHGIDX *bdchgidx, PROPRULE proprule)
static SCIP_RETCODE addExtendedAsymmetricFormulation(SCIP *scip, SCIP_CONS *cons, int *naddedconss)
SCIP_Bool SCIPconsIsDeleted(SCIP_CONS *cons)
SCIP_RETCODE SCIPfreeSol(SCIP *scip, SCIP_SOL **sol)
SCIP_Bool SCIPconsIsChecked(SCIP_CONS *cons)
static SCIP_DECL_HASHKEYVAL(hashKeyValXorcons)
SCIP_Bool SCIPconsIsInitial(SCIP_CONS *cons)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
SCIP_RETCODE SCIPdropVarEvent(SCIP *scip, SCIP_VAR *var, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
SCIP_VAR * SCIPvarGetAggrVar(SCIP_VAR *var)
#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)
SCIP_RETCODE SCIPfixVar(SCIP *scip, SCIP_VAR *var, SCIP_Real fixedval, SCIP_Bool *infeasible, SCIP_Bool *fixed)
#define BMScopyMemoryArray(ptr, source, num)
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_Bool SCIPgetRhsXor(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE checkSystemGF2(SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_SOL *currentsol, SCIP_RESULT *result)
SCIP_RETCODE SCIPinferVarLbCons(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_CONS *infercons, int inferinfo, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened)
#define SCIP_MAXTREEDEPTH
SCIP_Bool SCIPinProbing(SCIP *scip)
static SCIP_RETCODE consdataCreate(SCIP *scip, SCIP_CONSDATA **consdata, SCIP_Bool rhs, int nvars, SCIP_VAR **vars, SCIP_VAR *intvar)
void SCIPhashtableFree(SCIP_HASHTABLE **hashtable)
SCIP_RETCODE SCIPincludeLinconsUpgrade(SCIP *scip, SCIP_DECL_LINCONSUPGD((*linconsupgd)), int priority, const char *conshdlrname)
int SCIPgetNVars(SCIP *scip)
SCIP_VAR ** SCIPgetVarsXor(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE separateCons(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool separateparity, SCIP_Bool *separated, SCIP_Bool *cutoff)
SCIP_RETCODE SCIPcreateConsLinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
SCIP_RETCODE SCIPsetConshdlrExitpre(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSEXITPRE((*consexitpre)))
Constraint handler for XOR constraints, .
int SCIPgetNVarsXor(SCIP *scip, SCIP_CONS *cons)
#define CONSHDLR_EAGERFREQ
SCIP_RETCODE SCIPreleaseRow(SCIP *scip, SCIP_ROW **row)
SCIP_RETCODE SCIPwriteVarsList(SCIP *scip, FILE *file, SCIP_VAR **vars, int nvars, SCIP_Bool type, char delimiter)
int SCIPvarGetNLocksDown(SCIP_VAR *var)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_DECL_CONSEXITSOL(consExitsolXor)
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_CONSDATA * SCIPconsGetData(SCIP_CONS *cons)
SCIP_RETCODE SCIPinferVarUbCons(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound, SCIP_CONS *infercons, int inferinfo, SCIP_Bool force, SCIP_Bool *infeasible, SCIP_Bool *tightened)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
static SCIP_RETCODE lockRounding(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
SCIP_RETCODE SCIPsetConshdlrPresol(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPRESOL((*conspresol)), int maxprerounds, SCIP_PRESOLTIMING presoltiming)
SCIP_VAR ** SCIPgetVars(SCIP *scip)
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
static SCIP_RETCODE addExtendedFlowFormulation(SCIP *scip, SCIP_CONS *cons, int *naddedconss)
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)
static SCIP_DECL_CONSCHECK(consCheckXor)
SCIP_RETCODE SCIPcaptureVar(SCIP *scip, SCIP_VAR *var)
SCIP_Bool SCIPconsIsModifiable(SCIP_CONS *cons)
static SCIP_RETCODE createConsXorIntvar(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_Bool rhs, int nvars, SCIP_VAR **vars, SCIP_VAR *intvar, 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 SCIPisStopped(SCIP *scip)
SCIP_RETCODE SCIPsetConshdlrGetNVars(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSGETNVARS((*consgetnvars)))
static SCIP_RETCODE resolvePropagation(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *infervar, PROPRULE proprule, SCIP_BDCHGIDX *bdchgidx, SCIP_RESULT *result)
static SCIP_RETCODE checkCons(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool checklprows, SCIP_Bool *violated)
static SCIP_DECL_HASHKEYEQ(hashKeyEqXorcons)
SCIP_Bool SCIPconsIsEnforced(SCIP_CONS *cons)
SCIP_Bool SCIPdoNotAggr(SCIP *scip)
SCIP_Bool SCIPconsIsSeparated(SCIP_CONS *cons)
SCIP_RETCODE SCIPprintRow(SCIP *scip, SCIP_ROW *row, FILE *file)
#define CONSHDLR_DELAYPROP
int SCIPvarGetIndex(SCIP_VAR *var)
SCIP_Real SCIPgetRowSolFeasibility(SCIP *scip, SCIP_ROW *row, SCIP_SOL *sol)
#define SCIPdebugAddSolVal(scip, var, val)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
static SCIP_Bool allRowsInLP(SCIP_CONSDATA *consdata)
static SCIP_DECL_CONSENFORELAX(consEnforelaxXor)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
enum SCIP_Vartype SCIP_VARTYPE
struct SCIP_ConshdlrData SCIP_CONSHDLRDATA
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
static SCIP_RETCODE delCoefPos(SCIP *scip, SCIP_CONS *cons, SCIP_EVENTHDLR *eventhdlr, int pos)
static SCIP_DECL_CONSHDLRCOPY(conshdlrCopyXor)
SCIP_Bool SCIPvarIsTransformed(SCIP_VAR *var)
static SCIP_RETCODE addCoef(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
static SCIP_DECL_HASHGETKEY(hashGetKeyXorcons)
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
#define BMSclearMemoryArray(ptr, num)
static SCIP_RETCODE consdataEnsureVarsSize(SCIP *scip, SCIP_CONSDATA *consdata, int num)
struct BMS_BlkMem BMS_BLKMEM
#define DEFAULT_PRESOLPAIRWISE
SCIP_RETCODE SCIPsetConshdlrExitsol(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSEXITSOL((*consexitsol)))
#define SCIPcombineTwoInt(a, b)
SCIP_RETCODE SCIPwriteVarName(SCIP *scip, FILE *file, SCIP_VAR *var, SCIP_Bool type)
void SCIPsortRealIntPtr(SCIP_Real *realarray, int *intarray, void **ptrarray, int len)
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
SCIP_RETCODE SCIPinferBinvarCons(SCIP *scip, SCIP_VAR *var, SCIP_Bool fixedval, SCIP_CONS *infercons, int inferinfo, SCIP_Bool *infeasible, SCIP_Bool *tightened)
SCIP_VAR * SCIPgetIntVarXor(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPfloor(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPprintVar(SCIP *scip, SCIP_VAR *var, FILE *file)
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)
static SCIP_RETCODE cliquePresolve(SCIP *scip, SCIP_CONS *cons, int *nfixedvars, int *nchgcoefs, int *ndelconss, int *naddconss, SCIP_Bool *cutoff)
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)
SCIP_Bool SCIPvarIsNegated(SCIP_VAR *var)
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
#define SCIPreallocBufferArray(scip, ptr, num)
SCIP_RETCODE SCIPsetConshdlrProp(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPROP((*consprop)), int propfreq, SCIP_Bool delayprop, SCIP_PROPTIMING proptiming)
static SCIP_DECL_LINCONSUPGD(linconsUpgdXor)
SCIP_RETCODE SCIPprintSol(SCIP *scip, SCIP_SOL *sol, FILE *file, SCIP_Bool printzeros)