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 )
963 NULL, NULL, NULL, NULL, 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 )
1020 NULL, NULL, NULL, NULL, 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 WITH_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 )
1745 if( consdata->rows[r] != NULL && !
SCIProwIsInLP(consdata->rows[r]) )
1760 assert(consdata != NULL);
1762 if( consdata->rows[0] == NULL )
1767 for( r = 0; r <
NROWS; ++r )
1769 if( consdata->rows[r] != NULL && !
SCIProwIsInLP(consdata->rows[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 )
1846 else if ( *violated && sol != NULL )
1906 assert( separated != NULL );
1907 assert( cutoff != NULL );
1911 assert(consdata != NULL);
1916 if( consdata->rows[0] == NULL )
1920 assert(consdata->rows[0] != NULL);
1923 for( r = 0; r <
NROWS; ++r )
1925 if( consdata->rows[r] != NULL && !
SCIProwIsInLP(consdata->rows[r]) )
1939 if ( separateparity && consdata->nvars > 3 )
1951 SCIPdebugMsg(scip,
"separating parity inequalities ...\n");
1954 for (j = 0; j < consdata->nvars; ++j)
1981 if ( (cnt - consdata->rhs) % 2 == 1 )
1987 SCIPdebugMsg(scip,
"found violated parity cut (efficiacy: %f)\n", 1.0 - sum);
1994 for (j = 0; j < consdata->nvars; ++j)
2022 SCIPdebugMsg(scip,
"found violated parity cut (efficiacy: %f, minval: %f)\n", 1.0 - (sum - 1.0 + 2.0 * minval), minval);
2030 for (j = 0; j < consdata->nvars; ++j)
2058 SCIPdebugMsg(scip,
"found violated parity cut (efficiacy: %f, maxval: %f)\n", 1.0 - (sum + 1.0 - 2.0 * maxval), maxval);
2066 for (j = 0; j < consdata->nvars; ++j)
2090 SCIPdebugMsg(scip,
"separated parity inequalites: %d\n", ngen);
2121 assert( A != NULL );
2122 assert( b != NULL );
2123 assert( p != NULL );
2124 assert( s != NULL );
2127 for (i = 0; i < m; ++i)
2134 for (i = 0; i < m && i < n; ++i)
2136 assert( s[i] == i );
2149 while ( k < m && A[p[k]][j] == 0 )
2171 assert( A[p[k]][j] != 0 );
2181 assert( A[pi][s[i]] != 0 );
2184 for (k = i+1; k < m; ++k)
2188 if ( A[pk][s[i]] != 0 )
2190 for (j = s[i]; j < n; ++j)
2191 A[pk][j] = A[pk][j] ^ A[pi][j];
2192 b[pk] = b[pk] ^ b[pi];
2197 if ( i % 100 == 99 )
2229 assert( A != NULL );
2230 assert( b != NULL );
2231 assert( s != NULL );
2232 assert( p != NULL );
2233 assert( x != NULL );
2234 assert( r <= m && r <= n );
2237 for (k = 0; k < n; ++k)
2241 x[s[r-1]] = b[p[r-1]];
2244 for (i = r-2; i >= 0; --i)
2248 assert( i <= s[i] && s[i] <= n );
2252 for (k = i+1; k < r; ++k)
2254 assert( i <= s[k] && s[k] <= n );
2255 if ( A[p[i]][s[k]] != 0 )
2256 val = val ^ x[s[k]];
2299 int nconssactive = 0;
2307 assert( scip != NULL );
2308 assert( conss != NULL );
2309 assert( result != NULL );
2314 SCIPdebugMsg(scip,
"Checking feasibility via the linear equation system over GF2 using Gauss.\n");
2326 for (i = 0; i < nconss; ++i)
2330 xoractive[i] =
FALSE;
2332 assert( conss[i] != NULL );
2334 assert( consdata != NULL );
2337 for (j = 0; j < consdata->nvars; ++j)
2341 var = consdata->vars[j];
2342 assert( var != NULL );
2348 assert( var != NULL );
2360 xorvars[nvarsmat++] = var;
2368 xoractive[i] =
TRUE;
2371 #ifdef SCIP_DISABLED_CODE 2378 for (j = 0; j < consdata->nvars; ++j)
2386 if ( ( cnt - consdata->rhs ) % 2 != 0 )
2395 assert( nvarsmat <= nvars );
2396 assert( nconssactive <= nconss );
2400 SCIPdebugMsg(scip,
"Skip checking the xor system over GF2 (%d conss, %d vars).\n", nconssactive, nvarsmat);
2410 for (j = 0; j < nvarsmat; ++j)
2423 for (j = 0; j < nvarsmat; ++j)
2425 assert( 0 <= xoridx[j] && xoridx[j] < nvarsmat );
2426 xorbackidx[xoridx[j]] = j;
2432 for (i = 0; i < nconss; ++i)
2434 if ( ! xoractive[i] )
2437 assert( conss[i] != NULL );
2439 assert( consdata != NULL );
2440 assert( consdata->nvars > 0 );
2446 b[nconssmat] = (
Type) consdata->rhs;
2447 for (j = 0; j < consdata->nvars; ++j)
2452 var = consdata->vars[j];
2453 assert( var != NULL );
2459 assert( var != NULL );
2460 b[nconssmat] = ! b[nconssmat];
2477 if(
SCIPisEQ(scip, constant, 1.0) )
2478 b[nconssmat] = ! b[nconssmat];
2486 if(
SCIPisEQ(scip, constant, 1.0) )
2487 b[nconssmat] = ! b[nconssmat];
2490 assert(var != NULL);
2506 b[nconssmat] = ! b[nconssmat];
2517 assert( idx < nvarsmat );
2518 assert( 0 <= xorbackidx[idx] && xorbackidx[idx] < nvarsmat );
2519 A[nconssmat][xorbackidx[idx]] = 1;
2525 SCIPdebugMsg(scip,
"Found %d non-fixed variables in %d nonempty xor constraints.\n", nvarsmat, nconssmat);
2526 assert( nconssmat == nconssactive );
2533 SCIPinfoMessage(scip, NULL,
"Matrix before Gauss (size: %d x %d):\n", nconssmat, nvarsmat);
2534 for (i = 0; i < nconssmat; ++i)
2536 for (j = 0; j < nvarsmat; ++j)
2547 assert( rank <= nconssmat && rank <= nvarsmat );
2554 SCIPinfoMessage(scip, NULL,
"Matrix after Gauss (rank: %d):\n", rank);
2555 for (i = 0; i < nconssmat; ++i)
2557 for (j = 0; j < nvarsmat; ++j)
2565 for (i = rank; i < nconssmat; ++i)
2572 if ( i >= nconssmat )
2574 SCIPdebugMsg(scip,
"System feasible with rank %d (nconss=%d)\n", rank, nconssmat);
2577 if( rank == nvarsmat && noaggr )
2591 for (j = 0; j < nvarsmat; ++j)
2597 for( j = 0; j < nvarsmat; ++j )
2606 assert(!infeasible);
2613 assert(!infeasible);
2628 if ( heurtrysol != NULL )
2641 for (j = 0; j < nvarsmat; ++j)
2650 for (j = 0; j < nvarsmat; ++j)
2664 for (j = 0; j < nvars; ++j)
2674 for (i = 0; i < nconss; ++i)
2677 assert(consdata != NULL);
2679 if ( xoractive[i] && consdata->intvar != NULL )
2684 for (j = 0; j < consdata->nvars; ++j)
2690 assert( ! noaggr || nones % 2 == (
int) consdata->rhs );
2691 if ( (
unsigned int) nones != consdata->rhs )
2693 val = (
SCIP_Real) (nones - consdata->rhs)/2;
2708 SCIPdebugMsg(scip,
"Creating solution was successful.\n");
2714 SCIPdebugMsg(scip,
"Creating solution was not successful.\n");
2732 for (i = nconss - 1; i >= 0 ; --i)
2735 assert(consdata != NULL);
2737 if ( consdata->nvars == 0 )
2772 assert( cons != NULL );
2775 assert(consdata != NULL);
2776 vars = consdata->vars;
2777 nvars = consdata->nvars;
2782 assert( infervar == NULL || infervar == consdata->intvar );
2785 for (i = 0; i < nvars; ++i)
2794 for (i = 0; i < nvars; ++i)
2811 assert( vars[i] == infervar );
2817 assert( consdata->intvar != NULL );
2819 if( infervar != consdata->intvar )
2825 for (i = 0; i < nvars; ++i)
2837 assert( consdata->intvar != NULL );
2839 if( infervar != consdata->intvar )
2844 for (i = 0; i < nvars; ++i)
2919 assert(scip != NULL);
2920 assert(cons != NULL);
2921 assert(eventhdlr != NULL);
2922 assert(cutoff != NULL);
2923 assert(nfixedvars != NULL);
2924 assert(nchgbds != NULL);
2931 assert(consdata != NULL);
2933 vars = consdata->vars;
2934 nvars = consdata->nvars;
2937 if( consdata->propagated )
2950 watchedvar1 = consdata->watchedvar1;
2951 watchedvar2 = consdata->watchedvar2;
2954 if( watchedvar1 != -1 )
2959 if( watchedvar2 != -1 )
2966 if( watchedvar1 == -1 )
2968 watchedvar1 = watchedvar2;
2971 assert(watchedvar1 != -1 || watchedvar2 == -1);
2974 odd = consdata->rhs;
2977 if( watchedvar2 == -1 )
2979 for( i = 0; i < nvars; ++i )
2988 if( watchedvar1 == -1 )
2990 assert(watchedvar2 == -1);
2993 else if( watchedvar1 != i )
3003 assert(watchedvar1 != -1 || watchedvar2 == -1);
3006 if( watchedvar1 == -1 )
3008 assert(watchedvar2 == -1);
3023 if ( consdata->intvar != NULL && !consdata->deleteintvar )
3027 assert( ! *cutoff );
3028 assert( (nfixedones - consdata->rhs) % 2 == 0 );
3030 fixval = (nfixedones - consdata->rhs)/2;
3038 SCIPdebugMsg(scip,
"node infeasible: activity is %d, bounds of integral variable are [%g,%g]\n",
3049 SCIPdebugMsg(scip,
"node infeasible: activity is %d, bounds of integral variable are [%g,%g]\n",
3062 assert( tightened );
3063 assert( ! infeasible );
3069 assert( tightened );
3070 assert( ! infeasible );
3087 if( watchedvar2 == -1 )
3089 assert(watchedvar1 != -1);
3091 SCIPdebugMsg(scip,
"constraint <%s>: only one unfixed variable -> fix <%s> to %u\n",
3095 assert(!infeasible);
3101 if ( consdata->intvar != NULL && !consdata->deleteintvar )
3109 assert( (nfixedones - consdata->rhs) % 2 == 0 );
3111 fixval = (nfixedones - consdata->rhs)/2;
3118 SCIPdebugMsg(scip,
"node infeasible: activity is %d, bounds of integral variable are [%g,%g]\n",
3129 SCIPdebugMsg(scip,
"node infeasible: activity is %d, bounds of integral variable are [%g,%g]\n",
3142 assert( tightened );
3143 assert( ! infeasible );
3149 assert( tightened );
3150 assert( ! infeasible );
3165 if ( consdata->intvar != NULL && !consdata->deleteintvar )
3172 assert( nfixedones + nfixedzeros < nvars );
3177 nonesmin = 2 * (int)(
SCIPvarGetLbLocal(consdata->intvar) + 0.5) + consdata->rhs;
3178 nonesmax = 2 * (int)(
SCIPvarGetUbLocal(consdata->intvar) + 0.5) + consdata->rhs;
3181 if ( nvars - nfixedzeros < nonesmin )
3183 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);
3194 if ( nfixedones > nonesmax )
3196 SCIPdebugMsg(scip,
"constraint <%s>: at least %d variables are fixed to 1, but there should be at most %d.\n",
SCIPconsGetName(cons), nfixedones, nonesmax);
3207 newlb = (
SCIP_Real)((nfixedones + 1 - consdata->rhs) / 2);
3208 newub = (
SCIP_Real)((nvars - nfixedzeros - consdata->rhs) / 2);
3216 assert(!infeasible);
3220 nonesmin = 2 * (int)(
SCIPvarGetLbLocal(consdata->intvar) + 0.5) + consdata->rhs;
3229 assert(!infeasible);
3233 nonesmax = 2 * (int)(
SCIPvarGetUbLocal(consdata->intvar) + 0.5) + consdata->rhs;
3236 assert(nvars - nfixedzeros >= nonesmin);
3237 assert(nfixedones <= nonesmax);
3240 if ( nvars - nfixedzeros == nonesmin )
3242 SCIPdebugMsg(scip,
"constraint <%s>: fix %d free variables to 1 to reach lower bound of %d\n",
SCIPconsGetName(cons), nvars - nfixedzeros - nfixedones, nonesmin);
3244 for (i = 0; i < nvars; ++i)
3249 assert( !infeasible );
3250 assert( tightened );
3262 if ( nfixedones == nonesmax )
3264 SCIPdebugMsg(scip,
"constraint <%s>: fix %d free variables to 0 to guarantee upper bound of %d\n",
SCIPconsGetName(cons), nvars - nfixedzeros - nfixedones, nonesmax);
3266 for (i = 0; i < nvars; ++i)
3271 assert(!infeasible);
3287 consdata->propagated =
TRUE;
3305 assert(result != NULL);
3307 SCIPdebugMsg(scip,
"resolving fixations according to rule %d\n", (
int) proprule);
3337 assert(scip != NULL);
3338 assert(cons != NULL);
3339 assert(nfixedvars != NULL);
3340 assert(nchgcoefs != NULL);
3341 assert(ndelconss != NULL);
3342 assert(naddconss != NULL);
3343 assert(cutoff != NULL);
3350 assert(consdata != NULL);
3352 vars = consdata->vars;
3353 nvars = consdata->nvars;
3359 if( !consdata->deleteintvar )
3363 if( !consdata->changed )
3414 if( posnotinclq1 == v )
3420 for( v1 = v+1; v1 < nvars; ++v1 )
3422 if( posnotinclq1 == v1 )
3437 if( posnotinclq1 == -1 )
3445 if( restart || (posnotinclq2 != v && posnotinclq2 != v1) )
3452 posnotinclq1 = posnotinclq2;
3460 assert(vars[v] != vars[v1]);
3473 if( posnotinclq1 == -1 )
3502 SCIPdebugMsg(scip,
"all variables of xor constraints <%s> are in one clique, so fixed all variables to 0\n",
3506 for( v = nvars - 1; v >= 0; --v )
3511 assert(infeasible || fixed);
3515 *cutoff = infeasible;
3535 if( !consdata->rhs )
3543 for( v = 0; v < nvars; ++v )
3545 if( v == posnotinclq1 )
3550 assert(var != NULL);
3579 if( consdata->intvar != NULL )
3591 *cutoff = infeasible;
3627 assert(conss != NULL);
3628 assert(ndelconss != NULL);
3631 hashtablesize = nconss;
3635 hashGetKeyXorcons, hashKeyEqXorcons, hashKeyValXorcons, (
void*) scip) );
3638 for( c = 0; c < nconss; ++c )
3654 assert(conshdlrdata != NULL);
3662 SCIP_CALL(
applyFixings(scip, cons0, conshdlrdata->eventhdlr, nchgcoefs, naggrvars, naddconss, cutoff) );
3668 assert(consdata0 != NULL);
3672 assert(consdata0->sorted);
3686 assert(consdata1 != NULL);
3687 assert(consdata0->nvars >= 1 && consdata0->nvars == consdata1->nvars);
3689 assert(consdata0->sorted && consdata1->sorted);
3690 assert(consdata0->vars[0] == consdata1->vars[0]);
3692 if( consdata0->rhs != consdata1->rhs )
3747 assert(conss != NULL);
3748 assert(firstchange <= chkind);
3749 assert(cutoff != NULL);
3750 assert(nfixedvars != NULL);
3751 assert(naggrvars != NULL);
3752 assert(ndelconss != NULL);
3753 assert(nchgcoefs != NULL);
3756 cons0 = conss[chkind];
3761 assert(consdata0 != NULL);
3762 assert(consdata0->nvars >= 1);
3767 assert(conshdlrdata != NULL);
3775 SCIP_CALL(
applyFixings(scip, cons0, conshdlrdata->eventhdlr, nchgcoefs, naggrvars, naddconss, cutoff) );
3781 assert(consdata0->sorted);
3784 cons0changed = consdata0->changed;
3785 consdata0->changed =
FALSE;
3810 assert(consdata1 != NULL);
3812 if( !consdata1->deleteintvar )
3821 SCIP_CALL(
applyFixings(scip, cons1, conshdlrdata->eventhdlr, nchgcoefs, naggrvars, naddconss, cutoff) );
3826 SCIPdebugMsg(scip,
"preprocess xor constraint pair <%s>[chg:%u] and <%s>[chg:%u]\n",
3830 if( !cons0changed && !consdata1->changed )
3834 if( consdata1->nvars == 0 )
3836 if( consdata1->rhs )
3850 else if( consdata1->nvars == 1 )
3854 assert(!infeasible);
3863 SCIP_CALL(
applyFixings(scip, cons0, conshdlrdata->eventhdlr, nchgcoefs, naggrvars, naddconss, cutoff) );
3868 assert(consdata0->sorted);
3872 else if( consdata1->nvars == 2 )
3874 if( !(consdata1->rhs) )
3878 &infeasible, &redundant, &aggregated) );
3884 &infeasible, &redundant, &aggregated) );
3886 assert(!infeasible);
3894 SCIP_CALL(
applyFixings(scip, cons0, conshdlrdata->eventhdlr, nchgcoefs, naggrvars, naddconss, cutoff) );
3900 assert(consdata0->sorted);
3911 assert(consdata0->sorted);
3915 assert(consdata1->sorted);
3923 parity = (consdata0->rhs ^ consdata1->rhs);
3924 cons0hastwoothervars =
FALSE;
3925 cons1hastwoothervars =
FALSE;
3930 while( (v0 < consdata0->nvars || v1 < consdata1->nvars) && !aborted )
3934 assert(v0 <= consdata0->nvars);
3935 assert(v1 <= consdata1->nvars);
3937 if( v0 == consdata0->nvars )
3939 else if( v1 == consdata1->nvars )
3948 assert(v0 < consdata0->nvars);
3949 if( singlevar0 == NULL )
3951 singlevar0 = consdata0->vars[v0];
3952 if( cons1hastwoothervars )
3957 cons0hastwoothervars =
TRUE;
3958 if( singlevar1 != NULL )
3966 assert(v1 < consdata1->nvars);
3967 if( singlevar1 == NULL )
3969 singlevar1 = consdata1->vars[v1];
3970 if( cons0hastwoothervars )
3975 cons1hastwoothervars =
TRUE;
3976 if( singlevar0 != NULL )
3984 assert(v0 < consdata0->nvars);
3985 assert(v1 < consdata1->nvars);
3987 if( consdata0->vars[v0] != consdata1->vars[v1] )
4004 if( (cons0hastwoothervars && singlevar1 != NULL) || (cons1hastwoothervars && singlevar0 != NULL) )
4008 if( singlevar0 == NULL && singlevar1 == NULL )
4014 SCIPdebugMsg(scip,
"xor constraints <%s> and <%s> are redundant: delete <%s>\n",
4024 if( consdata1->intvar != NULL )
4034 if( consdata0->intvar == NULL )
4042 &infeasible, &redundant, &aggregated) );
4044 *cutoff = *cutoff || infeasible;
4058 newvars[0] = consdata1->intvar;
4060 newvars[1] = consdata0->intvar;
4081 SCIPdebugMsg(scip,
"xor constraints <%s> and <%s> are contradicting\n",
4088 else if( singlevar1 == NULL )
4091 if( !cons0hastwoothervars )
4094 SCIPdebugMsg(scip,
"xor constraints <%s> and <%s> yield sum %u == <%s>\n",
4099 *cutoff = *cutoff || infeasible;
4113 SCIPdebugMsg(scip,
"xor constraint <%s> is superset of <%s> with parity %u\n",
4117 for( v = 0; v < consdata1->nvars; ++v )
4122 SCIP_CALL(
applyFixings(scip, cons0, conshdlrdata->eventhdlr, nchgcoefs, naggrvars, naddconss, cutoff) );
4124 assert(consdata0->nvars >= 2);
4131 assert(consdata0->sorted);
4133 else if( singlevar0 == NULL )
4136 if( !cons1hastwoothervars )
4139 SCIPdebugMsg(scip,
"xor constraints <%s> and <%s> yield sum %u == <%s>\n",
4144 assert(infeasible || fixed);
4145 *cutoff = *cutoff || infeasible;
4158 SCIPdebugMsg(scip,
"xor constraint <%s> is subset of <%s> with parity %u\n",
4162 for( v = 0; v < consdata0->nvars; ++v )
4166 SCIP_CALL(
applyFixings(scip, cons1, conshdlrdata->eventhdlr, nchgcoefs, naggrvars, naddconss, cutoff) );
4168 assert(consdata1->nvars >= 2);
4174 assert(consdata1->sorted);
4179 assert(!cons0hastwoothervars);
4180 assert(!cons1hastwoothervars);
4183 SCIPdebugMsg(scip,
"xor constraints <%s> and <%s> yield sum %u == xor(<%s>,<%s>)\n",
4190 &infeasible, &redundant, &aggregated) );
4196 &infeasible, &redundant, &aggregated) );
4200 *cutoff = *cutoff || infeasible;
4211 if( consdata1->intvar != NULL )
4213 if( consdata0->intvar == NULL )
4221 &infeasible, &redundant, &aggregated) );
4223 *cutoff = *cutoff || infeasible;
4230 if( !consdata0->sorted )
4232 assert(consdata0->sorted);
4241 SCIP_CALL(
applyFixings(scip, cons0, conshdlrdata->eventhdlr, nchgcoefs, naggrvars, naddconss, cutoff) );
4297 if( conshdlr == NULL )
4307 SCIP_CALL(
SCIPcreateCons(scip, cons, name, conshdlr, consdata, initial, separate, enforce, check, propagate,
4308 local, modifiable, dynamic, removable, stickingatnode) );
4335 assert( upgdcons != NULL );
4344 if( integral && nposcont + nnegcont == 0 && nposbin + nnegbin + nposimplbin + nnegimplbin >= nvars-1 && ncoeffspone + ncoeffsnone == nvars-1 && ncoeffspint + ncoeffsnint == 1 )
4346 assert( ncoeffspfrac + ncoeffsnfrac == 0 );
4359 for( j = nvars - 1; j >= 0; --j )
4363 parityvar = vars[j];
4364 postwo = (vals[j] > 0.0);
4381 assert(xorvars[cnt] != NULL);
4384 xorvars[cnt] = vars[j];
4389 if( parityvar != NULL )
4391 assert(cnt == nvars - 1);
4408 neednew = (intrhs != 1 && intrhs != 0);
4424 intrhshalfed = intrhs / 2;
4459 SCIPdebugMsg(scip,
"created new variable for aggregation:");
4463 (
SCIP_Real) (postwo ? intrhshalfed : -intrhshalfed), &infeasible, &redundant, &aggregated) );
4464 assert(!infeasible);
4483 assert(intvar != NULL);
4497 assert(intvar != parityvar);
4519 assert(scip != NULL);
4520 assert(conshdlr != NULL);
4539 assert(conshdlrdata != NULL);
4556 for( c = 0; c < nconss; ++c )
4573 assert(conshdlrdata != NULL);
4579 for( v = (*consdata)->nvars - 1; v >= 0; --v )
4600 assert(sourcedata != NULL);
4601 assert(sourcedata->nvars >= 1);
4602 assert(sourcedata->vars != NULL);
4605 SCIP_CALL(
consdataCreate(scip, &targetdata, sourcedata->rhs, sourcedata->nvars, sourcedata->vars, sourcedata->intvar) );
4624 assert(infeasible != NULL);
4626 *infeasible =
FALSE;
4628 for( i = 0; i < nconss && !(*infeasible); i++ )
4650 assert( conshdlrdata != NULL );
4653 for( c = 0; c < nusefulconss; ++c )
4658 else if ( separated )
4681 assert( conshdlrdata != NULL );
4684 for( c = 0; c < nusefulconss; ++c )
4689 else if ( separated )
4710 assert( conshdlrdata != NULL );
4713 for( i = 0; i < nconss; i++ )
4747 assert( conshdlrdata != NULL );
4750 for( i = 0; i < nconss; i++ )
4782 for( i = 0; i < nconss; i++ )
4807 for( i = 0; i < nconss && (*result ==
SCIP_FEASIBLE || completely); i++ )
4821 assert( consdata != NULL );
4825 for( v = 0; v < consdata->nvars; ++v )
4831 if( consdata->intvar != NULL )
4833 SCIPinfoMessage(scip, NULL,
";\nviolation: %d operands are set to TRUE but integer variable has value of %g\n",
SCIPgetSolVal(scip, sol, consdata->intvar));
4837 SCIPinfoMessage(scip, NULL,
";\nviolation: %d operands are set to TRUE\n", sum );
4858 assert(conshdlrdata != NULL);
4865 for( c = 0; c < nusefulconss && !cutoff; ++c )
4873 else if( nfixedvars > 0 || nchgbds > 0 )
4884 freq = conshdlrdata->gausspropfreq;
4885 if ( (depth == 0 && freq == 0) || (freq > 0 && depth % freq == 0) )
4905 assert(conshdlr != NULL);
4907 assert(conshdlrdata != NULL);
4910 for( c = nconss - 1; c >= 0; --c )
4913 assert(consdata != NULL);
4915 for( v = consdata->nvars - 1; v >= 0; --v )
4934 assert(conshdlr != NULL);
4936 assert(conshdlrdata != NULL);
4939 for( c = 0; c < nconss; ++c )
4942 assert(consdata != NULL);
4946 for( v = 0; v < consdata->nvars; ++v )
4975 assert(result != NULL);
4977 oldnfixedvars = *nfixedvars;
4978 oldnchgbds = *nchgbds;
4979 oldnaggrvars = *naggrvars;
4980 oldndelconss = *ndelconss;
4981 oldnchgcoefs = *nchgcoefs;
4984 assert(conshdlrdata != NULL);
4988 firstchange = INT_MAX;
4989 for( c = 0; c < nconss && !cutoff && !
SCIPisStopped(scip); ++c )
4992 assert(cons != NULL);
4994 assert(consdata != NULL);
4998 consdata->propagated =
FALSE;
5001 if( firstchange == INT_MAX && consdata->changed )
5007 SCIP_CALL(
applyFixings(scip, cons, conshdlrdata->eventhdlr, nchgcoefs, naggrvars, naddconss, &cutoff) );
5017 assert(consdata->nvars >= 2);
5020 if( consdata->nvars == 2 )
5022 SCIPdebugMsg(scip,
"xor constraint <%s> has only two unfixed variables, rhs=%u\n",
5025 assert(consdata->vars != NULL);
5031 if( !consdata->rhs )
5037 &cutoff, &redundant, &aggregated) );
5045 &cutoff, &redundant, &aggregated) );
5075 assert(consdata->deleteintvar || (consdata->rhs &&
SCIPvarGetLbGlobal(consdata->intvar) < 0.5));
5098 if( firstchange < nconss && conshdlrdata->presolusehashing )
5103 if( conshdlrdata->presolpairwise )
5107 npaircomparisons = 0;
5108 lastndelconss = *ndelconss;
5110 for( c = firstchange; c < nconss && !cutoff && !
SCIPisStopped(scip); ++c )
5117 &cutoff, nfixedvars, naggrvars, ndelconss, naddconss, nchgcoefs) );
5123 lastndelconss = *ndelconss;
5124 npaircomparisons = 0;
5134 else if( *nfixedvars > oldnfixedvars || *nchgbds > oldnchgbds || *naggrvars > oldnaggrvars
5135 || *ndelconss > oldndelconss || *nchgcoefs > oldnchgcoefs )
5145 int naddedconss = 0;
5148 assert(cons != NULL);
5150 assert(consdata != NULL);
5152 if ( consdata->extvars != NULL )
5155 if ( conshdlrdata->addflowextended )
5163 (*naddconss) += naddedconss;
5189 assert(consdata != NULL);
5192 for( i = 0; i < consdata->nvars; ++i )
5198 if( consdata->intvar != NULL )
5211 assert( scip != NULL );
5212 assert( conshdlr != NULL );
5213 assert( cons != NULL );
5229 const char* consname;
5233 assert(scip != NULL);
5234 assert(sourcescip != NULL);
5235 assert(sourcecons != NULL);
5240 assert(sourceconsdata != NULL);
5243 sourcevars = sourceconsdata->vars;
5244 nvars = sourceconsdata->nvars;
5245 intvar = sourceconsdata->intvar;
5246 targetintvar = NULL;
5255 if( intvar != NULL )
5258 assert(!(*valid) || targetintvar != NULL);
5268 targetintvar, initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable,
5279 for( v = 0; v < nvars && *valid; ++v )
5282 assert(!(*valid) || targetvars[v] != NULL);
5286 if( *valid && intvar != NULL )
5289 assert(!(*valid) || targetintvar != NULL);
5300 targetintvar, initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable,
5321 SCIPdebugMsg(scip,
"parse <%s> as xor constraint\n", str);
5337 if( varssize < requiredsize )
5340 varssize = requiredsize;
5348 assert(varssize >= requiredsize);
5350 SCIPdebugMsg(scip,
"successfully parsed %d variables\n", nvars);
5355 while( *str !=
'=' && *str !=
'\0' )
5378 while( *str ==
' ' || *str ==
'\t' )
5385 while( *str !=
'=' && *str !=
'\0' )
5397 while( *str ==
' ' || *str ==
'\t' )
5403 if( intvar == NULL )
5412 while( *str !=
')' && *str !=
'\0' )
5416 if( intvar != NULL )
5420 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) );
5426 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) );
5453 assert(consdata != NULL);
5455 if ( consdata->intvar != NULL )
5458 if ( varssize < consdata->nvars + nintvar + consdata->nextvars )
5464 if ( consdata->intvar != NULL )
5465 vars[consdata->nvars] = consdata->intvar;
5467 if ( consdata->nextvars > 0 )
5469 assert( consdata->extvars != NULL );
5470 cnt = consdata->nvars + nintvar;
5471 for (j = 0; j < consdata->extvarssize; ++j)
5473 if ( consdata->extvars[j] != NULL )
5474 vars[cnt++] = consdata->extvars[j];
5476 assert( cnt == consdata->nvars + nintvar + consdata->nextvars );
5491 assert(cons != NULL);
5494 assert(consdata != NULL);
5496 if( consdata->intvar == NULL )
5497 (*nvars) = consdata->nvars + consdata->nextvars;
5499 (*nvars) = consdata->nvars + 1 + consdata->nextvars;
5515 assert(eventhdlr != NULL);
5516 assert(eventdata != NULL);
5517 assert(event != NULL);
5520 assert(consdata != NULL);
5528 consdata->sorted =
FALSE;
5531 consdata->propagated =
FALSE;
5552 eventExecXor, NULL) );
5560 consEnfolpXor, consEnfopsXor, consCheckXor, consLockXor,
5562 assert(conshdlr != NULL);
5593 "constraints/xor/presolpairwise",
5594 "should pairwise constraint comparison be performed in presolving?",
5598 "constraints/xor/presolusehashing",
5599 "should hash table be used for detecting redundant constraints in advance?",
5603 "constraints/xor/addextendedform",
5604 "should the extended formulation be added in presolving?",
5608 "constraints/xor/addflowextended",
5609 "should the extended flow formulation be added (nonsymmetric formulation otherwise)?",
5613 "constraints/xor/separateparity",
5614 "should parity inequalities be separated?",
5618 "constraints/xor/gausspropfreq",
5619 "frequency for applying the Gauss propagator",
5666 if( conshdlr == NULL )
5676 SCIP_CALL(
SCIPcreateCons(scip, cons, name, conshdlr, consdata, initial, separate, enforce, check, propagate,
5677 local, modifiable, dynamic, removable, stickingatnode) );
5718 assert(consdata != NULL);
5720 return consdata->nvars;
5739 assert(consdata != NULL);
5741 return consdata->vars;
5760 assert(consdata != NULL);
5762 return consdata->intvar;
5780 assert(consdata != NULL);
5782 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 SCIPaddRow(SCIP *scip, SCIP_ROW *row, SCIP_Bool forcecut, SCIP_Bool *infeasible)
SCIP_RETCODE SCIPsetConshdlrResprop(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSRESPROP((*consresprop)))
#define SCIPdebugGetSolVal(scip, var, val)
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)
void SCIPupdateSolConsViolation(SCIP *scip, SCIP_SOL *sol, SCIP_Real absviol, SCIP_Real relviol)
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)