125#define READER_NAME "opbreader"
126#define READER_DESC "file reader for pseudo-Boolean problem in opb format"
127#define READER_EXTENSION "opb"
129#define GENCONSNAMES TRUE
130#define INDICATORVARNAME "indicatorvar"
131#define INDICATORSLACKVARNAME "indslack"
132#define TOPCOSTCONSNAME "topcostcons"
137#define OPB_MAX_LINELEN 65536
138#define OPB_MAX_PUSHEDTOKENS 2
139#define OPB_INIT_COEFSSIZE 8192
140#define OPB_MAX_INTSIZE -1
145struct SCIP_ReaderData
191#if GENCONSNAMES == TRUE
214 SCIPerrorMessage(
"Syntax error in line %d: %s found <%s>\n", opbinput->linenumber, msg, opbinput->token);
215 if( opbinput->linebuf[opbinput->linebufsize - 1] ==
'\n' )
224 opbinput->haserror =
TRUE;
235 return opbinput->haserror;
295 if( isdigit((
unsigned char)
c) )
297 else if( (*exptype ==
OPB_EXP_NONE) && !(*hasdot) && (
c ==
'.') )
302 else if( !firstchar && (*exptype ==
OPB_EXP_NONE) && (
c ==
'e' ||
c ==
'E') )
304 if( nextc ==
'+' || nextc ==
'-' )
309 else if( isdigit((
unsigned char)nextc) )
338 opbinput->linepos = 0;
339 opbinput->linebuf[opbinput->linebufsize - 2] =
'\0';
341 if(
SCIPfgets(opbinput->linebuf, opbinput->linebufsize, opbinput->file) ==
NULL )
344 opbinput->linenumber++;
347 while( opbinput->linebuf[opbinput->linebufsize - 2] !=
'\0' )
354 opbinput->linebuf[newsize-2] =
'\0';
355 if (
SCIPfgets(opbinput->linebuf + opbinput->linebufsize - 1, newsize - opbinput->linebufsize + 1, opbinput->file) ==
NULL )
357 opbinput->linebufsize = newsize;
360 opbinput->linebuf[opbinput->linebufsize - 1] =
'\0';
368 if( commentstart !=
NULL )
370 *commentstart =
'\0';
371 *(commentstart+1) =
'\0';
391 *pointer1 = *pointer2;
408 assert(opbinput->linepos < opbinput->linebufsize);
411 if( opbinput->npushedtokens > 0 )
413 swapPointers(&opbinput->token, &opbinput->pushedtokens[opbinput->npushedtokens-1]);
414 opbinput->npushedtokens--;
415 SCIPdebugMsg(
scip,
"(line %d) read token again: '%s'\n", opbinput->linenumber, opbinput->token);
420 buf = opbinput->linebuf;
423 if( buf[opbinput->linepos] ==
'\0' )
430 assert(opbinput->linepos == 0);
432 buf = opbinput->linebuf;
437 assert(opbinput->linepos < opbinput->linebufsize);
443 if(
isValueChar(buf[opbinput->linepos], buf[opbinput->linepos+1],
TRUE, &hasdot, &exptype) )
451 opbinput->token[tokenlen] = buf[opbinput->linepos];
455 while(
isValueChar(buf[opbinput->linepos], buf[opbinput->linepos+1],
FALSE, &hasdot, &exptype) );
464 opbinput->token[tokenlen] = buf[opbinput->linepos];
467 if( tokenlen == 1 &&
isTokenChar(opbinput->token[0]) )
477 && (opbinput->token[tokenlen-1] ==
'<' || opbinput->token[tokenlen-1] ==
'>' || opbinput->token[tokenlen-1] ==
'=')
478 && buf[opbinput->linepos] ==
'=' )
482 else if( opbinput->token[tokenlen-1] ==
'=' && (buf[opbinput->linepos] ==
'<' || buf[opbinput->linepos] ==
'>') )
484 opbinput->token[tokenlen-1] = buf[opbinput->linepos];
489 opbinput->token[tokenlen] =
'\0';
491 SCIPdebugMsg(
scip,
"(line %d) read token: '%s'\n", opbinput->linenumber, opbinput->token);
505 swapPointers(&opbinput->pushedtokens[opbinput->npushedtokens], &opbinput->token);
506 opbinput->npushedtokens++;
518 swapPointers(&opbinput->pushedtokens[opbinput->npushedtokens], &opbinput->tokenbuf);
519 opbinput->npushedtokens++;
541 if( *(opbinput->token) ==
';')
556 assert(*sign == +1 || *sign == -1);
558 if( strlen(opbinput->token) == 1 )
560 assert(opbinput->token[1] ==
'\0');
562 if( *opbinput->token ==
'+' )
564 else if( *opbinput->token ==
'-' )
595 val = strtod(opbinput->token, &endptr);
596 if( endptr != opbinput->token && *endptr ==
'\0' )
599 if( strlen(opbinput->token) > 18 )
600 opbinput->nproblemcoeffs++;
617 if( strcmp(opbinput->token,
"<") == 0 )
623 else if( strcmp(opbinput->token,
">") == 0 )
629 else if( strcmp(opbinput->token,
"=") == 0 )
649 if( strcmp(opbinput->token,
"[") == 0 )
665 if( strcmp(opbinput->token,
"]") == 0 )
685 initial = !dynamiccols;
686 removable = dynamiccols;
729 name = opbinput->token;
733 while(!isdigit((
unsigned char) *name ) && !
isTokenChar(*name) && !opbinput->haserror )
759 if( *
nvars == *varssize )
769 opbinput->haserror =
TRUE;
771 name = opbinput->token;
798 int*
const ntermcoefs,
841 *isNonlinear =
FALSE;
855 if( strcmp(opbinput->token,
":") == 0 )
861 SCIPdebugMsg(
scip,
"(line %d) read constraint name: '%s'\n", opbinput->linenumber, name);
866 syntaxError(
scip, opbinput,
"Soft top cost line needs to be the first non-comment line, and without any objective function.\n");
873 SCIPdebugMsg(
scip,
"(line %d) constraint has no name\n", opbinput->linenumber);
887 opbinput->eof =
TRUE;
909 haveweightstart =
FALSE;
910 haveweightend =
FALSE;
931 if(
isSign(opbinput, &coefsign) )
933 SCIPdebugMsg(
scip,
"(line %d) read coefficient sign: %+d\n", opbinput->linenumber, coefsign);
942 if( (*nlincoefs > 0 || *ntermcoefs > 0 || ntmpcoefs > 0) && !havesign )
948 SCIPdebugMsg(
scip,
"(line %d) read coefficient value: %g with sign %+d\n", opbinput->linenumber, coef, coefsign);
957 if( strcmp(name,
"soft") == 0 )
961 tmpcoefs[ntmpcoefs] = coefsign * coef;
973 SCIPwarningMessage(
scip,
"Found in line %d a soft constraint, without having read a starting top-cost line.\n", opbinput->linenumber);
975 haveweightstart =
TRUE;
981 *weight = coefsign * coef;
982 SCIPdebugMsg(
scip,
"(line %d) found soft constraint weight: %g\n", opbinput->linenumber, *weight);
987 haveweightend =
TRUE;
995 if( haveweightstart != haveweightend )
1002 if( strcmp(name,
"soft") == 0 )
1014 *isNonlinear =
TRUE;
1016 SCIPdebugMsg(
scip,
"(line %d) found linear term: %+g", opbinput->linenumber, coefsign * coef);
1020 for( v = 0; v < ntmpvars; ++v )
1029 assert(*ntermcoefs <= *termcoefssize);
1031 if( *ntermcoefs >= *termcoefssize )
1039 *termcoefssize = newsize;
1041 assert(*ntermcoefs < *termcoefssize);
1047 (*ntermvars)[*ntermcoefs] = ntmpvars;
1050 for( --ntmpvars; ntmpvars >= 0; --ntmpvars )
1052 (*terms)[*ntermcoefs][ntmpvars] = tmpvars[ntmpvars];
1055 (*termcoefs)[*ntermcoefs] = coefsign * coef;
1060 SCIPwarningMessage(
scip,
"coefficient %g in line %d not integral.\n", (*termcoefs)[*ntermcoefs], opbinput->linenumber);
1080 assert(*nlincoefs <= *lincoefssize);
1082 if( *nlincoefs >= *lincoefssize )
1089 *lincoefssize = newsize;
1091 assert(*nlincoefs < *lincoefssize);
1094 (*linvars)[*nlincoefs] = tmpvars[0];
1095 (*lincoefs)[*nlincoefs] = coefsign * coef;
1100 SCIPwarningMessage(
scip,
"coefficient %g in line %d not integral.\n", (*lincoefs)[*nlincoefs], opbinput->linenumber);
1116 if( !opbinput->haserror )
1127 assert(*nlincoefs == 0 && *ntermcoefs == 0);
1130 (*lincoefs)[*nlincoefs] = tmpcoefs[0];
1160 int*
const ntermvars,
1161 int const ntermcoefs
1168 assert(ntermcoefs == 0 || (terms !=
NULL && ntermvars !=
NULL && termcoefs !=
NULL));
1178 if( opbinput->intsize >= 0 && opbinput->intsize <= CHAR_BIT * (
int)
sizeof(
unsigned long long) )
1183 unsigned long long presum;
1184 unsigned long long intsum = (
unsigned long long)summand;
1186 for( v = 0; v < ncoefs; ++v )
1188 summand = scale * coefs[v];
1192 intsum += (
unsigned long long)summand;
1196 for( v = 0; v < ntermcoefs; ++v )
1198 summand = scale * termcoefs[v];
1202 intsum += (
unsigned long long)summand;
1206 intsum >>= opbinput->intsize;
1211 if( strcmp(sense,
"max" ) == 0 )
1215 if( ntermcoefs > 0 )
1219 SCIPerrorMessage(
"Non-linear objectives are not supported in exact solving mode.\n");
1228 for( t = 0; t < ntermcoefs; ++t )
1235 nvars = ntermvars[t];
1248#ifdef WITH_DEBUG_SOLUTION
1249 if( SCIPdebugIsMainscip(
scip) )
1253 for( v =
nvars - 1; v >= 0; --v )
1279 for( v = 0; v < ncoefs; ++v )
1340 int* nNonlinearConss
1388 SCIP_CALL(
readCoefficients(
scip, opbinput, name, &linvars, &lincoefs, &nlincoefs, &lincoefssize, &terms, &termcoefs, &ntermvars, &termcoefssize,
1389 &ntermcoefs, &newsection, &isNonlinear, &issoftcons, &weight) );
1391 if(
hasError(opbinput) || opbinput->eof )
1395 if( strcmp(name,
"min") == 0 || strcmp(name,
"max") == 0 )
1399 syntaxError(
scip, opbinput,
"Cannot have an objective function when having soft constraints.\n");
1404 SCIP_CALL_TERMINATE( retcode,
setObjective(
scip, opbinput, name,
objscale, linvars, lincoefs, nlincoefs, terms, termcoefs, ntermvars, ntermcoefs), TERMINATE );
1406 else if( strcmp(name,
"soft") == 0 )
1409 opbinput->wbo =
TRUE;
1410 if( nlincoefs == 0 )
1416 opbinput->topcost = lincoefs[0];
1418 SCIPdebugMsg(
scip,
"Weighted Boolean Optimization problem has topcost of %g\n", opbinput->topcost);
1420 else if( nlincoefs > 0 )
1431 if( !
isSense(opbinput, &sense) )
1433 syntaxError(
scip, opbinput,
"expected constraint sense '=' or '>='.");
1444 if(
isSign(opbinput, &sidesign) )
1457 sidevalue *= sidesign;
1490 if( opbinput->intsize >= 0 && opbinput->intsize <= CHAR_BIT * (
int)
sizeof(
unsigned long long) )
1494 unsigned long long presum;
1495 unsigned long long intsum = (
unsigned long long)summand;
1497 for( t = 0; t < nlincoefs; ++t )
1502 intsum += (
unsigned long long)summand;
1506 for( t = 0; t < ntermcoefs; ++t )
1511 intsum += (
unsigned long long)summand;
1515 intsum >>= opbinput->intsize;
1525 initial = initialconss;
1533 removable = dynamicrows;
1539 ++(opbinput->nindvars);
1548 if( ntermcoefs > 0 || issoftcons )
1552 SCIPerrorMessage(
"Non-linear constraints are not supported in exact solving mode.\n");
1556#if GENCONSNAMES == TRUE
1558 ++(opbinput->consnumber);
1563 ntermvars, termcoefs, indvar, weight, issoftcons, lhs, rhs, initial,
separate, enforce, check,
propagate,
1564 local, modifiable, dynamic, removable,
FALSE);
1570#if GENCONSNAMES == TRUE
1572 ++(opbinput->consnumber);
1592 for(
int i = 0;
i < nlincoefs; ++
i )
1606 SCIPdebugMsg(
scip,
"(line %d) created constraint: ", opbinput->linenumber);
1611 ++(*nNonlinearConss);
1616 for( t = ntermcoefs - 1; t >= 0; --t )
1650 opbinput->linebuf[opbinput->linebufsize - 2] =
'\0';
1651 opbinput->intsize = -1;
1653 while(
SCIPfgets(opbinput->linebuf, opbinput->linebufsize, opbinput->file) !=
NULL )
1659 while( opbinput->linebuf[opbinput->linebufsize - 2] !=
'\0' )
1666 opbinput->linebuf[newsize-2] =
'\0';
1667 if (
SCIPfgets(opbinput->linebuf + opbinput->linebufsize - 1, newsize - opbinput->linebufsize + 1, opbinput->file) ==
NULL )
1669 opbinput->linebufsize = newsize;
1671 opbinput->linebuf[opbinput->linebufsize - 1] =
'\0';
1674 commentstart = strpbrk(opbinput->linebuf,
commentchars);
1677 if( commentstart ==
NULL )
1680#ifdef SCIP_DISABLED_CODE
1682 str = strstr(opbinput->linebuf,
"#product= ");
1688 str += strlen(
"#product= ");
1699 if( pos !=
NULL && strcmp(pos,
"sizeproduct=") == 0 )
1711 str = strstr(opbinput->linebuf,
"intsize= ");
1717 str += strlen(
"intsize= ");
1723 opbinput->intsize = atoi(pos);
1724 SCIPdebugMsg(
scip,
"number of bits required to represent sum of the absolute values of all integers appearing in a constraint or objective function = %d\n", opbinput->intsize);
1729 str = strstr(opbinput->linebuf,
"Obj. scale : ");
1732 str += strlen(
"Obj. scale : ");
1737 str = strstr(opbinput->linebuf,
"Obj. offset : ");
1740 str += strlen(
"Obj. offset : ");
1741 *objoffset = atof(str);
1745 *commentstart =
'\0';
1757 const char* filename
1764 int nNonlinearConss;
1772 opbinput->file =
SCIPfopen(filename,
"r");
1773 if( opbinput->file ==
NULL )
1787 if( readerdata->maxintsize >= 0 && opbinput->intsize > readerdata->maxintsize )
1795 SCIP_CALL_TERMINATE( retcode,
SCIPcreateProb(
scip, filename,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL), TERMINATE2 );
1799 opbinput->objsense = (
SCIP_OBJSENSE)(-1 * (
int)(opbinput->objsense));
1806 nNonlinearConss = 0;
1836 topcostvars[ntopcostvars] =
vars[
i];
1846 -
SCIPinfinity(
scip), topcostrhs,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE), TERMINATE1 );
1859 for(
int j = 0; j < ntopcostvars; ++j )
1862 topcostsrat, lhs, rhs,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE);
1909 for( v =
nvars - 1; v >= 0; --v )
1922 for( v =
nvars - 1; v >= 0; --v )
1934 SCIPdebugMsg(
scip,
"A variable couldn't retransformed to an original variable.\n");
1945 SCIPdebugMsg(
scip,
"A variable couldn't retransformed to an original variable or a negated variable of an original variable (scalar = %g, constant = %g).\n", scalar, constant);
1981 if( requiredsize > *varssize )
1985 *varssize = requiredsize;
1992 for( v = 0; v < *
nvars; ++v )
2030 if( requiredsize > *varssize )
2034 *varssize = requiredsize;
2041 for( v = 0; v < *
nvars; ++v )
2083 if( conshdlr !=
NULL )
2087 int* shouldnotbeinand;
2097 *existandconshdlr =
TRUE;
2112 for(
c = norigconss - 1;
c >= 0; --
c )
2119 andconss[nandconss] = origconss[
c];
2132 *nresvars = nandconss;
2145 for(
c = nandconss - 1;
c >= 0; --
c )
2163 SCIPsortPtrPtrInt((
void**)(*resvars), (
void**)(*andvars), (*nandvars), SCIPvarComp, (*nresvars));
2174 for(
r = *nresvars - 1;
r >= 0; --
r )
2177 shouldnotbeinand[ncontainedands] =
r;
2182 while( v < (*nandvars)[
r] )
2200 for(
a = ncontainedands - 1;
a >= 0; --
a )
2201 if( shouldnotbeinand[
a] == pos )
2220 shouldnotbeinand[ncontainedands] = pos;
2226 (*nandvars)[
r] = (*nandvars)[
r] + (*nandvars)[pos] - 1;
2230 for(
a = (*nandvars)[pos] - 1;
a >= 0; --
a )
2231 (*andvars)[
r][(*nandvars)[
r] -
a - 1] = (*andvars)[pos][
a];
2251 *existandconshdlr =
FALSE;
2268 linebuffer[0] =
'\0';
2286 if( (*linecnt) > 0 )
2288 linebuffer[(*linecnt)] =
'\0';
2302 const char* extension
2314 (void) strncat(linebuffer, extension,
OPB_MAX_LINELEN - (
unsigned int)(*linecnt));
2315 (*linecnt) += (int) strlen(extension);
2328 int const*
const nandvars,
2336 char const*
const multisymbol,
2364 for( v = 0; v <
nvars; ++v )
2388 const char* conshdlrname;
2393 if( topcostcons !=
NULL )
2400 if( strcmp(conshdlrname,
"linear") == 0 )
2405 else if( strcmp(conshdlrname,
"knapsack") == 0 )
2410 else if( strcmp(conshdlrname,
"setppc") == 0 )
2414 else if( strcmp(conshdlrname,
"exactlinear") == 0 )
2435 if( conshdlr !=
NULL )
2445 for(
c = 0;
c < nconss; ++
c )
2451 topcostcons = conss[
c];
2458 for(
w = 0;
w < nconsvars; ++
w )
2461 topcostfound =
TRUE;
2465 topcostfound =
FALSE;
2484 if( conshdlr !=
NULL )
2494 for(
c = 0;
c < nconss; ++
c )
2500 topcostcons = conss[
c];
2507 for(
w = 0;
w < nconsvars; ++
w )
2510 topcostfound =
TRUE;
2514 topcostfound =
FALSE;
2533 if( conshdlr !=
NULL )
2543 for(
c = 0;
c < nconss; ++
c )
2549 topcostcons = conss[
c];
2556 for(
w = 0;
w < nconsvars; ++
w )
2559 topcostfound =
TRUE;
2563 topcostfound =
FALSE;
2581 if( conshdlr !=
NULL )
2593 for(
c = 0;
c < nconss; ++
c )
2599 topcostcons = conss[
c];
2606 for(
w = 0;
w < nconsvars; ++
w )
2609 topcostfound =
TRUE;
2613 topcostfound =
FALSE;
2648 assert(mult * 10 > mult);
2702 for(
c = nresvars - 1;
c > 0; --
c )
2707 for( v = 0; v <
nvars; ++v )
2733 assert(pos >= 0 && nandvars[pos] > 0 && andvars[pos] !=
NULL);
2734 assert(andvars[pos][nandvars[pos] - 1] !=
NULL);
2744 for(
a = nandvars[pos] - 2;
a >= 0; --
a )
2773 const char*
const type,
2781 const int*
const nandvars,
2784 const char*
const multisymbol
2798 assert(strcmp(type,
"=") == 0 || strcmp(type,
">=") == 0);
2810 for( v = 0; v <
nvars; ++v )
2814 if(
ABS(*mult) >
ABS(*mult * 10) )
2816 SCIPerrorMessage(
"failed to scale fractional coefficients to integrality because the required multiplier is too large\n");
2825 if(
ABS(*mult) >
ABS(*mult * 10) )
2827 SCIPerrorMessage(
"failed to scale fractional coefficients to integrality because the required multiplier is too large\n");
2834 if(
ABS(*mult) != 1 )
2842 for( v = nresvars - 1; v > 0; --v )
2859 for( v = 0; v <
nvars; ++v )
2862 val = vals[v] * (*mult);
2873 assert(nandvars[pos] >= 1);
2875 assert(andvars[pos][nandvars[pos] - 1] !=
NULL);
2896 for(
a = nandvars[pos] - 2;
a >= 0; --
a )
2925 val = lhs * (*mult);
2954 const int*
const nandvars,
2957 const char*
const multisymbol
2989 for( v = 0; v <
nvars; ++v )
2990 activevals[v] = 1.0;
2994 activeconstant = 0.0;
3005 rhs -= activeconstant;
3007 retcode =
printNLRow(
scip, file,
"=", activevars, activevals,
nvars, rhs, resvars, nresvars, andvars, nandvars,
3008 weight, &mult, multisymbol);
3015 lhs -= activeconstant;
3017 retcode =
printNLRow(
scip, file,
">=", activevars, activevals,
nvars, lhs, resvars, nresvars, andvars, nandvars,
3018 weight, &mult, multisymbol);
3024 rhs -= activeconstant;
3026 retcode =
printNLRow(
scip, file,
">=", activevars, activevals,
nvars, rhs, resvars, nresvars, andvars, nandvars,
3027 weight, &mult, multisymbol);
3050 const char* multisymbol
3063 assert(strcmp(type,
"=") == 0 || strcmp(type,
">=") == 0);
3077 for( v = 0; v <
nvars; ++v )
3081 if(
ABS(*mult) >
ABS(*mult * 10) )
3083 SCIPerrorMessage(
"failed to scale fractional coefficients to integrality because the required multiplier is too large\n");
3092 if(
ABS(*mult) >
ABS(*mult * 10) )
3094 SCIPerrorMessage(
"failed to scale fractional coefficients to integrality because the required multiplier is too large\n");
3101 if(
ABS(*mult) != 1 )
3120 for( v = 0; v <
nvars; ++v )
3123 val = vals[v] * (*mult);
3144 val = lhs * (*mult);
3172 const char* multisymbol
3185 assert(strcmp(type,
"=") == 0 || strcmp(type,
">=") == 0);
3222 for( v = 0; v <
nvars; ++v )
3276 const char* multisymbol
3295 activeconstant = 0.0;
3307 for( v = 0; v <
nvars; ++v )
3308 activevals[v] = 1.0;
3323 rhs -= activeconstant;
3325 retcode =
printRow(
scip, file,
"=", activevars, activevals,
nvars, rhs, weight, &mult, multisymbol);
3334 lhs -= activeconstant;
3336 retcode =
printRow(
scip, file,
">=", activevars, activevals,
nvars, lhs, weight, &mult, multisymbol);
3342 rhs -= activeconstant;
3344 retcode =
printRow(
scip, file,
">=", activevars, activevals,
nvars, rhs, weight, &mult, multisymbol);
3367 const char* multisymbol
3406 for( v = 0; v <
nvars; ++v )
3424 retcode =
printRowExact(
scip, file,
"=", activevars, activevals,
nvars, activeside, weight, mult, multisymbol);
3435 retcode =
printRowExact(
scip, file,
">=", activevars, activevals,
nvars, activeside, weight, mult, multisymbol);
3443 retcode =
printRowExact(
scip, file,
">=", activevars, activevals,
nvars, activeside, weight, mult, multisymbol);
3447 if( activevals !=
NULL )
3464 int* nindicatorconss
3468 const char* conshdlrname;
3478 *nindicatorconss = 0;
3481 for(
c = 0;
c < nconss; ++
c )
3492 if( strcmp(conshdlrname,
"and") == 0 )
3495 if( strcmp(conshdlrname,
"pseudoboolean") == 0 )
3498 ++(*nindicatorconss);
3503 if( strcmp(conshdlrname,
"indicator") == 0 )
3505 ++(*nindicatorconss);
3577 int const*
const nandvars,
3578 char const*
const multisymbol,
3585 const char* conshdlrname;
3616 if( conshdlr !=
NULL )
3633 for(
c = 0;
c < nindconss; ++
c )
3648 if( conshdlr !=
NULL )
3664 for(
c = 0;
c < npbconss; ++
c )
3686 for(
c = 0;
c < nconss; ++
c )
3693 if( strcmp(conshdlrname,
"pseudoboolean") == 0 )
3695 if( !pbhashmapcreated )
3699 pbhashmapcreated =
TRUE;
3708 else if( strcmp(conshdlrname,
"indicator") == 0 )
3710 if( !indhashmapcreated )
3714 indhashmapcreated =
TRUE;
3744 if( linconssofindicatorsmap !=
NULL )
3748 if( artcons !=
NULL )
3752 if( weightexact !=
NULL )
3757 if( linconssofpbsmap !=
NULL )
3761 if( artcons !=
NULL )
3765 if( indvar !=
NULL )
3769 if( weightexact !=
NULL )
3777 isweightzero = (weight == 0LL);
3801 topcostfound =
TRUE;
3807 if( strcmp(conshdlrname,
"linear") == 0 )
3814 weight, transformed, multisymbol);
3823 else if( strcmp(conshdlrname,
"setppc") == 0 )
3834 andvars, nandvars, weight, transformed, multisymbol);
3839 consvars,
NULL, nconsvars, 1.0, 1.0, weight, transformed, multisymbol);
3847 weight, transformed, multisymbol);
3860 weight, transformed, multisymbol);
3870 else if( strcmp(conshdlrname,
"logicor") == 0 )
3876 resvars, nresvars, andvars, nandvars, weight, transformed, multisymbol);
3885 else if( strcmp(conshdlrname,
"knapsack") == 0 )
3895 for( v = 0; v < nconsvars; ++v )
3902 weight, transformed, multisymbol);
3912 else if( strcmp(conshdlrname,
"varbound") == 0 )
3937 else if( strcmp(conshdlrname,
"exactlinear") == 0 )
3952 else if( strcmp(conshdlrname,
"indicator") == 0 )
4005 for( v = 0; v < nconsvars; ++v )
4009 if( consvars[v] == slackvar )
4011 assert(nonbinarypos == -1);
4027 if( nonbinarypos == -1 )
4049 assert(0 <= nonbinarypos && nonbinarypos < nconsvars);
4053 consvars[nonbinarypos] = consvars[nconsvars];
4054 consvals[nonbinarypos] = consvals[nconsvars];
4060 resvars, nresvars, andvars, nandvars,
4061 weight, transformed, multisymbol);
4067 weight, transformed, multisymbol);
4076 SCIPwarningMessage(
scip,
"indicator constraint <%s> will not be printed because the indicator variable has no objective value(= weight of this soft constraint)\n",
SCIPconsGetName(cons) );
4082 else if( strcmp(conshdlrname,
"and") == 0 )
4087 assert(existandconshdlr);
4089 else if( strcmp(conshdlrname,
"pseudoboolean") == 0 )
4109 SCIPerrorMessage(
"Cannot print constraint %s with non-integral coefficient or sides in opb-format\n",
4115 if( linconssofpbsmap !=
NULL )
4117 if( linconssofindicatorsmap !=
NULL )
4119 if( weightexact !=
NULL )
4133 char const*
const multisymbol,
4151 for( v = 0; v <
nvars; ++v )
4172 assert(lb > -0.5 && ub < 1.5);
4177 if( lb > 0.5 || ub < 0.5 )
4207 int const*
const nandvars,
4209 char const*
const multisymbol,
4231 for(
r = nresvars - 1;
r >= 0; --
r )
4239 resvar = resvars[
r];
4254 if( lb > 0.5 || ub < 0.5 )
4271 for( v = nandvars[
r] - 1; v >= 0; --v )
4288 if( lb > 0.5 || ub < 0.5 )
4305 for(
r = nresvars - 1;
r >= 0; --
r )
4308 resvar = resvars[
r];
4324 for( v = nandvars[
r] - 1; v >= 0; --v )
4340 else if( rhslhs == 1 )
4350 for( v = nandvars[
r] - 1; v >= 0; --v )
4376 firstprinted =
FALSE;
4381 for( v = nandvars[
r] - 1; v >= 0; --v )
4391 firstprinted =
TRUE;
4418 assert(pos >= 0 && nandvars[pos] > 0 && andvars[pos] !=
NULL);
4419 assert(andvars[pos][nandvars[pos] - 1] !=
NULL);
4428 for(
a = nandvars[pos] - 2;
a >= 0; --
a )
4485 int const*
const nandvars,
4496 int nindicatorconss;
4518 SCIPvarGetHashkey, SCIPvarIsHashkeyEq, SCIPvarGetHashkeyVal,
NULL) );
4522 objsense, objoffset,
objscale, objoffsetexact, objscaleexact, multisymbol, existands, transformed) );
4525 retcode =
writeOpbConstraints(
scip, file, conss, nconss,
vars,
nvars, resvars, nresvars, andvars, nandvars,
4526 multisymbol, existandconshdlr, existands, transformed);
4528 if( existands && (retcode ==
SCIP_OKAY) )
4554 const char* filename,
4569 opbinput.file =
NULL;
4571 opbinput.linebuf[0] =
'\0';
4574 opbinput.token[0] =
'\0';
4576 opbinput.tokenbuf[0] =
'\0';
4582 opbinput.npushedtokens = 0;
4583 opbinput.linenumber = 1;
4584 opbinput.linepos = 0;
4586 opbinput.eof =
FALSE;
4587 opbinput.haserror =
FALSE;
4588 opbinput.nproblemcoeffs = 0;
4589 opbinput.wbo =
FALSE;
4591 opbinput.nindvars = 0;
4592#if GENCONSNAMES == TRUE
4593 opbinput.consnumber = 0;
4613 if( opbinput.nproblemcoeffs > 0 )
4615 SCIPwarningMessage(
scip,
"there might be <%d> coefficients or weight out of range!\n", opbinput.nproblemcoeffs);
4619 if( opbinput.haserror )
4666 int nintegralvars =
nvars - ncontvars;
4672 ispseudoboolean = (ncontvars <= nindicatorconss);
4673 for( v = nbinvars; v < nintegralvars && ispseudoboolean; ++v )
4677 ispseudoboolean =
FALSE;
4680 if( ispseudoboolean )
4693 for( v =
nvars - 1; v >= 0; --v )
4705 retcode =
writeOpb(
scip, file, name, transformed, objsense, objoffset,
objscale, objoffsetexact, objscaleexact,
4706 vars,
nvars, conss, nconss, resvars, nresvars, andvars, nandvars, existandconshdlr, existands,
result);
4717 for( v =
nvars - 1; v >= 0; --v )
4744 for( v = nfixedvars - 1; v >= 0; --v )
4773 for( v =
nvars - 1; v >= 0; --v )
4784 retcode =
writeOpb(
scip, file, name, transformed, objsense, objoffset,
objscale, objoffsetexact, objscaleexact,
4785 vars,
nvars, conss, nconss, resvars, nresvars, andvars, nandvars, existandconshdlr, existands,
result);
4796 for( v = nresvars - 1; v >= 0; --v )
4874 SCIPerrorMessage(
"OPB reader cannot yet write problems in exact solving mode\n");
4879 vars,
nvars, nbinvars, nintvars, nimplvars, ncontvars, fixedvars, nfixedvars, conss, nconss, genericnames,
result) );
4913 "reading/" READER_NAME "/dynamicconss",
"should model constraints be subject to aging?",
4916 "reading/" READER_NAME "/multisymbol",
"use '*' between coefficients and variables by writing to problem?",
4919 "bits required to represent the sum of absolute values of all integers that appear in a constraint or "
4920 "objective function) or -1 for unlimited",
Constraint handler for AND constraints, .
Constraint handler for linear constraints in their most general form, .
constraint handler for indicator constraints
Constraint handler for knapsack constraints of the form , x binary and .
Constraint handler for linear constraints in their most general form, .
Constraint handler for logicor constraints (equivalent to set covering, but algorithms are suited fo...
constraint handler for pseudoboolean constraints
#define ARTIFICIALVARNAMEPREFIX
Constraint handler for the set partitioning / packing / covering constraints .
Constraint handler for variable bound constraints .
#define SCIPdebugGetSolVal(scip, var, val)
#define SCIPdebugAddSolVal(scip, var, val)
#define SCIP_CALL_ABORT(x)
#define SCIP_CALL_TERMINATE(retcode, x, TERM)
#define SCIP_LONGINT_FORMAT
SCIP_FILE * SCIPfopen(const char *path, const char *mode)
int SCIPfeof(SCIP_FILE *stream)
int SCIPfclose(SCIP_FILE *fp)
char * SCIPfgets(char *s, int size, SCIP_FILE *stream)
int SCIPgetNVarsKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetVbdcoefVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_RATIONAL * SCIPgetLhsExactLinear(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsLogicor(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetRhsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RATIONAL * SCIPgetRhsExactLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateConsExactLinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_RATIONAL **vals, SCIP_RATIONAL *lhs, SCIP_RATIONAL *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_VAR ** SCIPgetVarsExactLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateConsAnd(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *resvar, int nvars, SCIP_VAR **vars, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
SCIP_Real SCIPgetLhsLinear(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR * SCIPgetResultantAnd(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsAnd(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsExactLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Real * SCIPgetValsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR * SCIPgetVbdvarVarbound(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsSetppc(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR * SCIPgetIndVarPseudoboolean(SCIP *const scip, SCIP_CONS *const cons)
SCIP_RETCODE SCIPcreateConsPseudoboolean(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR **linvars, int nlinvars, SCIP_Real *linvals, SCIP_VAR ***terms, int nterms, int *ntermvars, SCIP_Real *termvals, SCIP_VAR *indvar, SCIP_Real weight, SCIP_Bool issoftcons, SCIP_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_VAR ** SCIPgetVarsSetppc(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR * SCIPgetBinaryVarIndicator(SCIP_CONS *cons)
SCIP_VAR * SCIPgetVarVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_Longint * SCIPgetWeightsKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR * SCIPgetSlackVarIndicator(SCIP_CONS *cons)
SCIP_Longint SCIPgetCapacityKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetLhsVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_SETPPCTYPE SCIPgetTypeSetppc(SCIP *scip, SCIP_CONS *cons)
SCIP_CONS * SCIPgetLinearConsIndicator(SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateConsLinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
SCIP_VAR ** SCIPgetVarsLogicor(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetRhsVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsAnd(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_CONS * SCIPgetLinearConsPseudoboolean(SCIP *const scip, SCIP_CONS *const cons)
SCIP_RATIONAL ** SCIPgetValsExactLinear(SCIP *scip, SCIP_CONS *cons)
@ SCIP_SETPPCTYPE_PARTITIONING
@ SCIP_SETPPCTYPE_COVERING
@ SCIP_SETPPCTYPE_PACKING
SCIP_RETCODE SCIPreadOpb(SCIP *scip, SCIP_READER *reader, const char *filename, SCIP_RESULT *result)
SCIP_RETCODE SCIPwriteOpb(SCIP *scip, FILE *file, const char *name, SCIP_Bool transformed, SCIP_OBJSENSE objsense, SCIP_Real objoffset, SCIP_Real objscale, SCIP_RATIONAL *objoffsetexact, SCIP_RATIONAL *objscaleexact, SCIP_VAR **vars, int nvars, int nbinvars, int nintvars, int nimplvars, int ncontvars, SCIP_VAR **fixedvars, int nfixedvars, SCIP_CONS **conss, int nconss, SCIP_Bool genericnames, SCIP_RESULT *result)
SCIP_RETCODE SCIPincludeReaderOpb(SCIP *scip)
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
int SCIPgetNOrigConss(SCIP *scip)
SCIP_Real SCIPgetOrigObjoffset(SCIP *scip)
int SCIPgetNVars(SCIP *scip)
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNConss(SCIP *scip)
SCIP_VAR ** SCIPgetVars(SCIP *scip)
SCIP_RETCODE SCIPprintTransProblem(SCIP *scip, FILE *file, const char *extension, SCIP_Bool genericnames)
SCIP_RETCODE SCIPprintOrigProblem(SCIP *scip, FILE *file, const char *extension, SCIP_Bool genericnames)
SCIP_RETCODE SCIPsetObjsense(SCIP *scip, SCIP_OBJSENSE objsense)
SCIP_RETCODE SCIPaddOrigObjoffset(SCIP *scip, SCIP_Real addval)
SCIP_CONS ** SCIPgetOrigConss(SCIP *scip)
SCIP_RETCODE SCIPcreateProb(SCIP *scip, const char *name, SCIP_DECL_PROBDELORIG((*probdelorig)), SCIP_DECL_PROBTRANS((*probtrans)), SCIP_DECL_PROBDELTRANS((*probdeltrans)), SCIP_DECL_PROBINITSOL((*probinitsol)), SCIP_DECL_PROBEXITSOL((*probexitsol)), SCIP_DECL_PROBCOPY((*probcopy)), SCIP_PROBDATA *probdata)
SCIP_VAR * SCIPfindVar(SCIP *scip, const char *name)
SCIP_CONS * SCIPfindCons(SCIP *scip, const char *name)
SCIP_RETCODE SCIPaddOrigObjoffsetExact(SCIP *scip, SCIP_RATIONAL *addval)
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
void SCIPhashtableFree(SCIP_HASHTABLE **hashtable)
SCIP_Bool SCIPhashtableExists(SCIP_HASHTABLE *hashtable, void *element)
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_RETCODE SCIPhashtableInsert(SCIP_HASHTABLE *hashtable, void *element)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
#define SCIPdebugMsgPrint
SCIP_MESSAGEHDLR * SCIPgetMessagehdlr(SCIP *scip)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
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 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)
int SCIPconshdlrGetNConss(SCIP_CONSHDLR *conshdlr)
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
SCIP_RETCODE SCIPprintCons(SCIP *scip, SCIP_CONS *cons, FILE *file)
SCIP_Bool SCIPconsIsTransformed(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsEnabled(SCIP_CONS *cons)
const char * SCIPconsGetName(SCIP_CONS *cons)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
SCIP_Bool SCIPisExact(SCIP *scip)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
#define SCIPreallocMemoryArray(scip, ptr, newnum)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
#define SCIPallocMemoryArray(scip, ptr, num)
BMS_BUFMEM * SCIPbuffer(SCIP *scip)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPreallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPduplicateMemoryArray(scip, ptr, source, num)
#define SCIPfreeMemoryArray(scip, ptr)
#define SCIPduplicateBufferArray(scip, ptr, source, num)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
#define SCIPfreeBlockMemory(scip, ptr)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
#define SCIPfreeBufferArrayNull(scip, ptr)
#define SCIPallocBlockMemory(scip, ptr)
void SCIPrationalMult(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
void SCIPrationalAdd(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
int SCIPrationalToString(SCIP_RATIONAL *rational, char *str, int strlen)
void SCIPrationalSetReal(SCIP_RATIONAL *res, SCIP_Real real)
void SCIPrationalFreeBuffer(BMS_BUFMEM *bufmem, SCIP_RATIONAL **rational)
void SCIPrationalDiff(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
SCIP_RETCODE SCIPrationalCopyBufferArray(BMS_BUFMEM *mem, SCIP_RATIONAL ***result, SCIP_RATIONAL **src, int len)
SCIP_RETCODE SCIPrationalCreateBuffer(BMS_BUFMEM *bufmem, SCIP_RATIONAL **rational)
SCIP_Bool SCIPrationalIsZero(SCIP_RATIONAL *rational)
void SCIPrationalSetRational(SCIP_RATIONAL *res, SCIP_RATIONAL *src)
void SCIPrationalMessage(SCIP_MESSAGEHDLR *msg, FILE *file, SCIP_RATIONAL *rational)
void SCIPrationalSetNegInfinity(SCIP_RATIONAL *res)
SCIP_Bool SCIPrationalIsNegative(SCIP_RATIONAL *rational)
SCIP_Bool SCIPrationalIsInfinity(SCIP_RATIONAL *rational)
SCIP_RETCODE SCIPrationalCreateBufferArray(BMS_BUFMEM *mem, SCIP_RATIONAL ***rational, int size)
SCIP_Bool SCIPrationalIsNegInfinity(SCIP_RATIONAL *rational)
void SCIPrationalDivReal(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_Real op2)
SCIP_Bool SCIPrationalIsEQ(SCIP_RATIONAL *rat1, SCIP_RATIONAL *rat2)
SCIP_RETCODE SCIPrationalReallocBufferArray(BMS_BUFMEM *mem, SCIP_RATIONAL ***result, int oldlen, int newlen)
void SCIPrationalMultReal(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_Real op2)
void SCIPrationalFreeBufferArray(BMS_BUFMEM *mem, SCIP_RATIONAL ***ratbufarray, int size)
SCIP_RETCODE SCIPsetReaderCopy(SCIP *scip, SCIP_READER *reader,)
SCIP_RETCODE SCIPincludeReaderBasic(SCIP *scip, SCIP_READER **readerptr, const char *name, const char *desc, const char *extension, SCIP_READERDATA *readerdata)
SCIP_READERDATA * SCIPreaderGetData(SCIP_READER *reader)
SCIP_RETCODE SCIPsetReaderWrite(SCIP *scip, SCIP_READER *reader,)
SCIP_RETCODE SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader,)
const char * SCIPreaderGetName(SCIP_READER *reader)
SCIP_RETCODE SCIPsetReaderFree(SCIP *scip, SCIP_READER *reader,)
void SCIPreaderMarkExact(SCIP_READER *reader)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisIntegral(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasZero(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPround(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPceil(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
SCIP_VAR * SCIPvarGetNegatedVar(SCIP_VAR *var)
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbOriginal(SCIP_VAR *var)
SCIP_RETCODE SCIPaddVarExactData(SCIP *scip, SCIP_VAR *var, SCIP_RATIONAL *lb, SCIP_RATIONAL *ub, SCIP_RATIONAL *obj)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
SCIP_RETCODE SCIPvarGetOrigvarSumExact(SCIP_VAR **var, SCIP_RATIONAL *scalar, SCIP_RATIONAL *constant)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
int SCIPvarGetIndex(SCIP_VAR *var)
SCIP_RETCODE SCIPcreateVarImpl(SCIP *scip, SCIP_VAR **var, const char *name, SCIP_Real lb, SCIP_Real ub, SCIP_Real obj, SCIP_VARTYPE vartype, SCIP_IMPLINTTYPE impltype, 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)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbOriginal(SCIP_VAR *var)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
SCIP_RETCODE SCIPgetProbvarLinearSumExact(SCIP *scip, SCIP_VAR **vars, SCIP_RATIONAL **scalars, int *nvars, int varssize, SCIP_RATIONAL *constant, int *requiredsize, SCIP_Bool mergemultiples)
SCIP_RETCODE SCIPgetProbvarLinearSum(SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, int varssize, SCIP_Real *constant, int *requiredsize)
SCIP_RETCODE SCIPgetNegatedVar(SCIP *scip, SCIP_VAR *var, SCIP_VAR **negvar)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
SCIP_Bool SCIPvarIsNegated(SCIP_VAR *var)
SCIP_VAR * SCIPvarGetNegationVar(SCIP_VAR *var)
SCIP_RETCODE SCIPcreateVar(SCIP *scip, SCIP_VAR **var, const char *name, SCIP_Real lb, SCIP_Real ub, SCIP_Real obj, SCIP_VARTYPE vartype, SCIP_Bool initial, SCIP_Bool removable, SCIP_DECL_VARDELORIG((*vardelorig)), SCIP_DECL_VARTRANS((*vartrans)), SCIP_DECL_VARDELTRANS((*vardeltrans)), SCIP_DECL_VARCOPY((*varcopy)), SCIP_VARDATA *vardata)
SCIP_RETCODE SCIPprintVar(SCIP *scip, SCIP_VAR *var, FILE *file)
SCIP_RETCODE SCIPchgVarObjExact(SCIP *scip, SCIP_VAR *var, SCIP_RATIONAL *newobj)
SCIP_RETCODE SCIPchgVarObj(SCIP *scip, SCIP_VAR *var, SCIP_Real newobj)
SCIP_RETCODE SCIPgetBinvarRepresentative(SCIP *scip, SCIP_VAR *var, SCIP_VAR **repvar, SCIP_Bool *negated)
SCIP_RATIONAL * SCIPvarGetObjExact(SCIP_VAR *var)
SCIP_RETCODE SCIPaddVarObj(SCIP *scip, SCIP_VAR *var, SCIP_Real addobj)
SCIP_Bool SCIPsortedvecFindPtr(void **ptrarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), void *val, int len, int *pos)
void SCIPsortPtrPtrInt(void **ptrarray1, void **ptrarray2, int *intarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
int SCIPstrcasecmp(const char *s1, const char *s2)
int SCIPsnprintf(char *t, int len, const char *s,...)
void SCIPprintSysError(const char *message)
int SCIPmemccpy(char *dest, const char *src, char stop, unsigned int cnt)
assert(minobj< SCIPgetCutoffbound(scip))
static SCIP_Bool propagate
static const SCIP_Real scalars[]
memory allocation routines
SCIP_RATIONAL * SCIPconsGetRhsExact(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success)
SCIP_Real SCIPconsGetLhs(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success)
SCIP_RATIONAL * SCIPconsGetLhsExact(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success)
SCIP_Real SCIPconsGetRhs(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success)
public methods for managing constraints
wrapper functions to map file i/o to standard or zlib file i/o
struct SCIP_File SCIP_FILE
public methods for message output
#define SCIPdebugPrintCons(x, y, z)
public data structures and miscellaneous methods
methods for sorting joint arrays of various types
public methods for input file readers
public methods for problem variables
wrapper for rational number arithmetic
static SCIP_Bool hasError(LPINPUT *lpinput)
static const char commentchars[]
static SCIP_Bool isTokenChar(char c)
static const char delimchars[]
static SCIP_RETCODE writeOpbRelevantAnds(SCIP *const scip, FILE *const file, SCIP_VAR **const resvars, int const nresvars, SCIP_VAR **const *const andvars, int const *const nandvars, SCIP_HASHTABLE *const printedfixing, char const *const multisymbol, SCIP_Bool const transformed)
static SCIP_RETCODE setObjective(SCIP *const scip, OPBINPUT *const opbinput, const char *sense, SCIP_Real const scale, SCIP_VAR **const linvars, SCIP_Real *const coefs, int const ncoefs, SCIP_VAR ***const terms, SCIP_Real *const termcoefs, int *const ntermvars, int const ntermcoefs)
static SCIP_RETCODE writeOpb(SCIP *scip, FILE *file, const char *name, SCIP_Bool transformed, SCIP_OBJSENSE objsense, SCIP_Real objoffset, SCIP_Real objscale, SCIP_RATIONAL *objoffsetexact, SCIP_RATIONAL *objscaleexact, SCIP_VAR **vars, int nvars, SCIP_CONS **conss, int nconss, SCIP_VAR **const resvars, int const nresvars, SCIP_VAR **const *const andvars, int const *const nandvars, SCIP_Bool const existandconshdlr, SCIP_Bool const existands, SCIP_RESULT *result)
static SCIP_RETCODE printRow(SCIP *scip, FILE *file, const char *type, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SCIP_Real lhs, SCIP_Longint weight, SCIP_Longint *mult, const char *multisymbol)
static void clearBuffer(char *linebuffer, int *linecnt)
static SCIP_Bool isSign(OPBINPUT *opbinput, int *sign)
static SCIP_RETCODE getBinVarsRepresentatives(SCIP *const scip, SCIP_VAR **const vars, int const nvars, SCIP_Bool const transformed)
static SCIP_Bool getNextToken(SCIP *scip, OPBINPUT *opbinput)
static SCIP_Bool isValueChar(char c, char nextc, SCIP_Bool firstchar, SCIP_Bool *hasdot, OPBEXPTYPE *exptype)
static SCIP_RETCODE getVariableOrTerm(SCIP *scip, OPBINPUT *opbinput, SCIP_VAR ***vars, int *nvars, int *varssize)
static SCIP_RETCODE writeOpbFixedVars(SCIP *const scip, FILE *const file, SCIP_VAR **vars, int nvars, SCIP_HASHTABLE *const printedfixing, char const *const multisymbol, SCIP_Bool const transformed)
static void swapTokenBuffer(OPBINPUT *opbinput)
static SCIP_RETCODE printRowExact(SCIP *scip, FILE *file, const char *type, SCIP_VAR **vars, SCIP_RATIONAL **vals, int nvars, SCIP_RATIONAL *lhs, SCIP_RATIONAL *weight, SCIP_RATIONAL *mult, const char *multisymbol)
static SCIP_RETCODE writeOpbObjective(SCIP *const scip, FILE *const file, SCIP_VAR **const vars, int const nvars, SCIP_VAR **const resvars, int const nresvars, SCIP_VAR **const *const andvars, int const *const nandvars, SCIP_OBJSENSE const objsense, SCIP_Real const objoffset, SCIP_Real const objscale, SCIP_RATIONAL *const objoffsetexact, SCIP_RATIONAL *const objscaleexact, char const *const multisymbol, SCIP_Bool const existands, SCIP_Bool const transformed)
static SCIP_RETCODE getCommentLineData(SCIP *scip, OPBINPUT *opbinput, SCIP_Real *objscale, SCIP_Real *objoffset)
static SCIP_RETCODE printLinearCons(SCIP *scip, FILE *file, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SCIP_Real lhs, SCIP_Real rhs, SCIP_Longint weight, SCIP_Bool transformed, const char *multisymbol)
static void writeBuffer(SCIP *scip, FILE *file, char *linebuffer, int *linecnt)
static void pushToken(OPBINPUT *opbinput)
static SCIP_RETCODE readOPBFile(SCIP *scip, SCIP_READER *reader, OPBINPUT *opbinput, const char *filename)
static SCIP_RETCODE computeAndConstraintInfos(SCIP *const scip, SCIP_Bool const transformed, SCIP_VAR ***resvars, int *nresvars, SCIP_VAR ****andvars, int **nandvars, SCIP_Bool *const existandconshdlr, SCIP_Bool *const existands)
static SCIP_RETCODE printNonLinearCons(SCIP *const scip, FILE *const file, SCIP_VAR **const vars, SCIP_Real *const vals, int nvars, SCIP_Real lhs, SCIP_Real rhs, SCIP_VAR **const resvars, int nresvars, SCIP_VAR **const *const andvars, const int *const nandvars, SCIP_Longint weight, SCIP_Bool transformed, const char *const multisymbol)
static SCIP_RETCODE printNLRow(SCIP *const scip, FILE *const file, const char *const type, SCIP_VAR **const vars, SCIP_Real *const vals, int nvars, SCIP_Real lhs, SCIP_VAR **const resvars, int nresvars, SCIP_VAR **const *const andvars, const int *const nandvars, SCIP_Longint weight, SCIP_Longint *const mult, const char *const multisymbol)
static SCIP_RETCODE writeOpbConstraints(SCIP *const scip, FILE *const file, SCIP_CONS **const conss, int const nconss, SCIP_VAR **const vars, int const nvars, SCIP_VAR **const resvars, int const nresvars, SCIP_VAR **const *const andvars, int const *const nandvars, char const *const multisymbol, SCIP_Bool const existandconshdlr, SCIP_Bool const existands, SCIP_Bool const transformed)
static void determineTotalNumberLinearConss(SCIP *const scip, SCIP_CONS **const conss, int const nconss, int *nlinearconss, int *nindicatorconss)
static SCIP_Bool isStartingSoftConstraintWeight(SCIP *scip, OPBINPUT *opbinput)
#define OPB_MAX_PUSHEDTOKENS
static void appendBuffer(SCIP *scip, FILE *file, char *linebuffer, int *linecnt, const char *extension)
static SCIP_Bool getNextLine(SCIP *scip, OPBINPUT *opbinput)
static SCIP_RETCODE printLinearConsExact(SCIP *scip, FILE *file, SCIP_VAR **vars, SCIP_RATIONAL **vals, int nvars, SCIP_RATIONAL *lhs, SCIP_RATIONAL *rhs, SCIP_RATIONAL *weight, SCIP_Bool transformed, const char *multisymbol)
static SCIP_Bool isEndLine(OPBINPUT *opbinput)
#define OPB_INIT_COEFSSIZE
static SCIP_RETCODE createVariable(SCIP *scip, SCIP_VAR **var, char *name)
static void syntaxError(SCIP *scip, OPBINPUT *opbinput, const char *msg)
static SCIP_RETCODE readConstraints(SCIP *scip, OPBINPUT *opbinput, SCIP_Real objscale, int *nNonlinearConss)
static SCIP_Bool isValue(SCIP *scip, OPBINPUT *opbinput, SCIP_Real *value)
static SCIP_Bool isDelimChar(char c)
static void swapPointers(char **pointer1, char **pointer2)
static SCIP_Bool hasError(OPBINPUT *opbinput)
static void pushBufferToken(OPBINPUT *opbinput)
static SCIP_Bool isSense(OPBINPUT *opbinput, OPBSENSE *sense)
static SCIP_RETCODE getActiveVariablesExact(SCIP *scip, SCIP_VAR ***vars, SCIP_RATIONAL ***scalars, int *nvars, int *varssize, SCIP_RATIONAL *constant, SCIP_Bool transformed)
enum OpbExpType OPBEXPTYPE
static SCIP_RETCODE readCoefficients(SCIP *const scip, OPBINPUT *const opbinput, char *const name, SCIP_VAR ***linvars, SCIP_Real **lincoefs, int *const nlincoefs, int *lincoefssize, SCIP_VAR ****terms, SCIP_Real **termcoefs, int **ntermvars, int *termcoefssize, int *const ntermcoefs, SCIP_Bool *const newsection, SCIP_Bool *const isNonlinear, SCIP_Bool *const issoftcons, SCIP_Real *const weight)
#define INDICATORSLACKVARNAME
static SCIP_RETCODE getActiveVariables(SCIP *scip, SCIP_VAR ***vars, SCIP_Real **scalars, int *nvars, int *varssize, SCIP_Real *constant, SCIP_Bool transformed)
static SCIP_Bool isEndingSoftConstraintWeight(SCIP *scip, OPBINPUT *opbinput)
static SCIP_Bool isTokenChar(char c)
pseudo-Boolean file reader (opb format)
public methods for constraint handler plugins and constraints
public methods for exact solving
public methods for memory management
public methods for message handling
public methods for numerical tolerances
public methods for SCIP parameter handling
public methods for global and local (sub)problems
public methods for reader plugins
public methods for querying solving statistics
public methods for SCIP variables
static SCIP_RETCODE separate(SCIP *scip, SCIP_SEPA *sepa, SCIP_SOL *sol, SCIP_RESULT *result)
Main separation function.
struct SCIP_Cons SCIP_CONS
struct SCIP_Conshdlr SCIP_CONSHDLR
struct SCIP_HashMap SCIP_HASHMAP
struct SCIP_HashTable SCIP_HASHTABLE
enum SCIP_Objsense SCIP_OBJSENSE
struct SCIP_Rational SCIP_RATIONAL
#define SCIP_DECL_READERWRITE(x)
struct SCIP_ReaderData SCIP_READERDATA
struct SCIP_Reader SCIP_READER
#define SCIP_DECL_READERREAD(x)
#define SCIP_DECL_READERCOPY(x)
#define SCIP_DECL_READERFREE(x)
enum SCIP_Result SCIP_RESULT
enum SCIP_Retcode SCIP_RETCODE
@ SCIP_IMPLINTTYPE_STRONG
@ SCIP_VARTYPE_CONTINUOUS
@ SCIP_VARSTATUS_ORIGINAL
@ SCIP_VARSTATUS_MULTAGGR
@ SCIP_VARSTATUS_AGGREGATED