122#define READER_NAME "opbreader"
123#define READER_DESC "file reader for pseudo-Boolean problem in opb format"
124#define READER_EXTENSION "opb"
126#define GENCONSNAMES TRUE
127#define LINEAROBJECTIVE TRUE
132#define INDICATORVARNAME "indicatorvar"
133#define INDICATORSLACKVARNAME "indslack"
134#define TOPCOSTCONSNAME "topcostcons"
139#define OPB_MAX_LINELEN 65536
140#define OPB_MAX_PUSHEDTOKENS 2
141#define OPB_INIT_COEFSSIZE 8192
180#if GENCONSNAMES == TRUE
203 SCIPerrorMessage(
"Syntax error in line %d: %s found <%s>\n", opbinput->linenumber, msg, opbinput->token);
204 if( opbinput->linebuf[opbinput->linebufsize - 1] ==
'\n' )
213 opbinput->haserror =
TRUE;
224 return opbinput->haserror;
284 if( isdigit((
unsigned char)
c) )
286 else if( (*exptype ==
OPB_EXP_NONE) && !(*hasdot) && (
c ==
'.') )
291 else if( !firstchar && (*exptype ==
OPB_EXP_NONE) && (
c ==
'e' ||
c ==
'E') )
293 if( nextc ==
'+' || nextc ==
'-' )
298 else if( isdigit((
unsigned char)nextc) )
327 opbinput->linepos = 0;
328 opbinput->linebuf[opbinput->linebufsize - 2] =
'\0';
330 if(
SCIPfgets(opbinput->linebuf, opbinput->linebufsize, opbinput->file) ==
NULL )
333 opbinput->linenumber++;
336 while( opbinput->linebuf[opbinput->linebufsize - 2] !=
'\0' )
343 opbinput->linebuf[newsize-2] =
'\0';
344 if (
SCIPfgets(opbinput->linebuf + opbinput->linebufsize - 1, newsize - opbinput->linebufsize + 1, opbinput->file) ==
NULL )
346 opbinput->linebufsize = newsize;
349 opbinput->linebuf[opbinput->linebufsize - 1] =
'\0';
357 if( commentstart !=
NULL )
359 *commentstart =
'\0';
360 *(commentstart+1) =
'\0';
380 *pointer1 = *pointer2;
397 assert(opbinput->linepos < opbinput->linebufsize);
400 if( opbinput->npushedtokens > 0 )
402 swapPointers(&opbinput->token, &opbinput->pushedtokens[opbinput->npushedtokens-1]);
403 opbinput->npushedtokens--;
404 SCIPdebugMsg(
scip,
"(line %d) read token again: '%s'\n", opbinput->linenumber, opbinput->token);
409 buf = opbinput->linebuf;
412 if( buf[opbinput->linepos] ==
'\0' )
419 assert(opbinput->linepos == 0);
421 buf = opbinput->linebuf;
426 assert(opbinput->linepos < opbinput->linebufsize);
432 if(
isValueChar(buf[opbinput->linepos], buf[opbinput->linepos+1],
TRUE, &hasdot, &exptype) )
440 opbinput->token[tokenlen] = buf[opbinput->linepos];
444 while(
isValueChar(buf[opbinput->linepos], buf[opbinput->linepos+1],
FALSE, &hasdot, &exptype) );
453 opbinput->token[tokenlen] = buf[opbinput->linepos];
456 if( tokenlen == 1 &&
isTokenChar(opbinput->token[0]) )
466 && (opbinput->token[tokenlen-1] ==
'<' || opbinput->token[tokenlen-1] ==
'>' || opbinput->token[tokenlen-1] ==
'=')
467 && buf[opbinput->linepos] ==
'=' )
471 else if( opbinput->token[tokenlen-1] ==
'=' && (buf[opbinput->linepos] ==
'<' || buf[opbinput->linepos] ==
'>') )
473 opbinput->token[tokenlen-1] = buf[opbinput->linepos];
478 opbinput->token[tokenlen] =
'\0';
480 SCIPdebugMsg(
scip,
"(line %d) read token: '%s'\n", opbinput->linenumber, opbinput->token);
494 swapPointers(&opbinput->pushedtokens[opbinput->npushedtokens], &opbinput->token);
495 opbinput->npushedtokens++;
507 swapPointers(&opbinput->pushedtokens[opbinput->npushedtokens], &opbinput->tokenbuf);
508 opbinput->npushedtokens++;
530 if( *(opbinput->token) ==
';')
545 assert(*sign == +1 || *sign == -1);
547 if( strlen(opbinput->token) == 1 )
549 assert(opbinput->token[1] ==
'\0');
551 if( *opbinput->token ==
'+' )
553 else if( *opbinput->token ==
'-' )
584 val = strtod(opbinput->token, &endptr);
585 if( endptr != opbinput->token && *endptr ==
'\0' )
588 if( strlen(opbinput->token) > 18 )
589 opbinput->nproblemcoeffs++;
606 if( strcmp(opbinput->token,
"<") == 0 )
612 else if( strcmp(opbinput->token,
">") == 0 )
618 else if( strcmp(opbinput->token,
"=") == 0 )
638 if( strcmp(opbinput->token,
"[") == 0 )
654 if( strcmp(opbinput->token,
"]") == 0 )
669 SCIP_Bool dynamiccols;
674 initial = !dynamiccols;
675 removable = dynamiccols;
714 name = opbinput->token;
718 while(!isdigit((
unsigned char) *name ) && !
isTokenChar(*name) && !opbinput->haserror )
744 if( *
nvars == *varssize )
754 opbinput->haserror =
TRUE;
756 name = opbinput->token;
776 SCIP_Real** lincoefs,
780 SCIP_Real** termcoefs,
783 int*
const ntermcoefs,
784 SCIP_Bool*
const newsection,
785 SCIP_Bool*
const isNonlinear,
786 SCIP_Bool*
const issoftcons,
787 SCIP_Real*
const weight
794 SCIP_Bool haveweightstart;
795 SCIP_Bool haveweightend;
826 *isNonlinear =
FALSE;
840 if( strcmp(opbinput->token,
":") == 0 )
846 SCIPdebugMsg(
scip,
"(line %d) read constraint name: '%s'\n", opbinput->linenumber, name);
851 syntaxError(
scip, opbinput,
"Soft top cost line needs to be the first non-comment line, and without any objective function.\n");
858 SCIPdebugMsg(
scip,
"(line %d) constraint has no name\n", opbinput->linenumber);
872 opbinput->eof =
TRUE;
894 haveweightstart =
FALSE;
895 haveweightend =
FALSE;
916 if(
isSign(opbinput, &coefsign) )
918 SCIPdebugMsg(
scip,
"(line %d) read coefficient sign: %+d\n", opbinput->linenumber, coefsign);
927 if( (*nlincoefs > 0 || *ntermcoefs > 0 || ntmpcoefs > 0) && !havesign )
933 SCIPdebugMsg(
scip,
"(line %d) read coefficient value: %g with sign %+d\n", opbinput->linenumber, coef, coefsign);
942 if( strcmp(name,
"soft") == 0 )
946 tmpcoefs[ntmpcoefs] = coefsign * coef;
958 SCIPwarningMessage(
scip,
"Found in line %d a soft constraint, without having read a starting top-cost line.\n", opbinput->linenumber);
960 haveweightstart =
TRUE;
966 *weight = coefsign * coef;
967 SCIPdebugMsg(
scip,
"(line %d) found soft constraint weight: %g\n", opbinput->linenumber, *weight);
972 haveweightend =
TRUE;
980 if( haveweightstart != haveweightend )
987 if( strcmp(name,
"soft") == 0 )
1001 SCIPdebugMsg(
scip,
"(line %d) found linear term: %+g", opbinput->linenumber, coefsign * coef);
1005 for( v = 0; v < ntmpvars; ++v )
1014 assert(*ntermcoefs <= *termcoefssize);
1016 if( *ntermcoefs >= *termcoefssize )
1024 *termcoefssize = newsize;
1026 assert(*ntermcoefs < *termcoefssize);
1032 (*ntermvars)[*ntermcoefs] = ntmpvars;
1035 for( --ntmpvars; ntmpvars >= 0; --ntmpvars )
1037 (*terms)[*ntermcoefs][ntmpvars] = tmpvars[ntmpvars];
1040 (*termcoefs)[*ntermcoefs] = coefsign * coef;
1045 SCIPwarningMessage(
scip,
"coefficient %g in line %d not integral.\n", (*termcoefs)[*ntermcoefs], opbinput->linenumber);
1065 assert(*nlincoefs <= *lincoefssize);
1067 if( *nlincoefs >= *lincoefssize )
1074 *lincoefssize = newsize;
1076 assert(*nlincoefs < *lincoefssize);
1079 (*linvars)[*nlincoefs] = tmpvars[0];
1080 (*lincoefs)[*nlincoefs] = coefsign * coef;
1085 SCIPwarningMessage(
scip,
"coefficient %g in line %d not integral.\n", (*lincoefs)[*nlincoefs], opbinput->linenumber);
1101 if( !opbinput->haserror )
1112 assert(*nlincoefs == 0 && *ntermcoefs == 0);
1115 (*lincoefs)[*nlincoefs] = tmpcoefs[0];
1139 SCIP_Real
const scale,
1141 SCIP_Real*
const coefs,
1144 SCIP_Real*
const termcoefs,
1145 int*
const ntermvars,
1146 int const ntermcoefs
1153 assert(ntermcoefs == 0 || (terms !=
NULL && ntermvars !=
NULL && termcoefs !=
NULL));
1161 if( strcmp(sense,
"max" ) == 0 )
1170 if( ntermcoefs > 0 )
1172#if (LINEAROBJECTIVE == TRUE)
1180 for( t = 0; t < ntermcoefs; ++t )
1187 nvars = ntermvars[t];
1205#ifdef WITH_DEBUG_SOLUTION
1206 if( SCIPdebugIsMainscip(
scip) )
1208 SCIP_Real val = 0.0;
1210 for( v =
nvars - 1; v >= 0; --v )
1243 for( v = 0; v < ntermcoefs; ++v )
1245 if( termcoefs[v] < 0 )
1251 for( v = 0; v < ncoefs; ++v )
1273#ifdef WITH_DEBUG_SOLUTION
1274 if( SCIPdebugIsMainscip(
scip) )
1276 SCIP_Real artval = 0.0;
1279 for( t = 0; t < ntermcoefs; ++t )
1282 nvars = ntermvars[t];
1286 for( v =
nvars - 1; v >= 0; --v )
1295 artval += (((val < 0.5) ? 0.0 : 1.0) * termcoefs[t]);
1320 for( v = 0; v < ncoefs; ++v )
1348 int* nNonlinearConss
1354 SCIP_Real* lincoefs;
1358 SCIP_Real* termcoefs;
1364 SCIP_Real sidevalue;
1367 SCIP_Bool newsection;
1368 SCIP_Bool initialconss;
1369 SCIP_Bool dynamicconss;
1370 SCIP_Bool dynamicrows;
1377 SCIP_Bool modifiable;
1379 SCIP_Bool removable;
1380 SCIP_Bool isNonlinear;
1382 SCIP_Bool issoftcons;
1396 SCIP_CALL(
readCoefficients(
scip, opbinput, name, &linvars, &lincoefs, &nlincoefs, &lincoefssize, &terms, &termcoefs, &ntermvars, &termcoefssize,
1397 &ntermcoefs, &newsection, &isNonlinear, &issoftcons, &weight) );
1399 if(
hasError(opbinput) || opbinput->eof )
1403 if( strcmp(name,
"min") == 0 || strcmp(name,
"max") == 0 )
1407 syntaxError(
scip, opbinput,
"Cannot have an objective function when having soft constraints.\n");
1412 SCIP_CALL(
setObjective(
scip, opbinput, name,
objscale, linvars, lincoefs, nlincoefs, terms, termcoefs, ntermvars, ntermcoefs) );
1414 else if( strcmp(name,
"soft") == 0 )
1417 opbinput->wbo =
TRUE;
1418 if( nlincoefs == 0 )
1424 opbinput->topcost = lincoefs[0];
1426 SCIPdebugMsg(
scip,
"Weighted Boolean Optimization problem has topcost of %g\n", opbinput->topcost);
1428 else if( nlincoefs > 0 )
1439 if( !
isSense(opbinput, &sense) )
1441 syntaxError(
scip, opbinput,
"expected constraint sense '=' or '>='.");
1452 if(
isSign(opbinput, &sidesign) )
1465 sidevalue *= sidesign;
1500 initial = initialconss;
1508 removable = dynamicrows;
1514 ++(opbinput->nindvars);
1523 if( ntermcoefs > 0 || issoftcons )
1525#if GENCONSNAMES == TRUE
1527 ++(opbinput->consnumber);
1532 ntermvars, termcoefs, indvar, weight, issoftcons,
NULL, lhs, rhs,
1533 initial, separate, enforce, check,
propagate, local, modifiable, dynamic, removable,
FALSE);
1539#if GENCONSNAMES == TRUE
1541 ++(opbinput->consnumber);
1546 initial, separate, enforce, check,
propagate, local, modifiable, dynamic, removable,
FALSE);
1552 SCIPdebugMsg(
scip,
"(line %d) created constraint: ", opbinput->linenumber);
1557 ++(*nNonlinearConss);
1562 for( t = ntermcoefs - 1; t >= 0; --t )
1585 SCIP_Real* objoffset
1599 commentstart =
NULL;
1603 opbinput->linebuf[opbinput->linebufsize - 2] =
'\0';
1607 if(
SCIPfgets(opbinput->linebuf, opbinput->linebufsize, opbinput->file) ==
NULL )
1614 while( opbinput->linebuf[opbinput->linebufsize - 2] !=
'\0' )
1621 opbinput->linebuf[newsize-2] =
'\0';
1622 if (
SCIPfgets(opbinput->linebuf + opbinput->linebufsize - 1, newsize - opbinput->linebufsize + 1, opbinput->file) ==
NULL )
1624 opbinput->linebufsize = newsize;
1626 opbinput->linebuf[opbinput->linebufsize - 1] =
'\0';
1634 if( commentstart !=
NULL )
1637 nproducts = strstr(opbinput->linebuf,
"#product= ");
1638 if( nproducts !=
NULL )
1643 nproducts += strlen(
"#product= ");
1654 if( pos !=
NULL && strcmp(pos,
"sizeproduct=") == 0 )
1667 str = strstr(opbinput->linebuf,
"Obj. scale : ");
1670 str += strlen(
"Obj. scale : ");
1676 str = strstr(opbinput->linebuf,
"Obj. offset : ");
1679 str += strlen(
"Obj. offset : ");
1680 *objoffset = atof(str);
1685 *commentstart =
'\0';
1691 while(commentstart !=
NULL && !stop);
1701 const char* filename
1705 SCIP_Real objoffset;
1706 int nNonlinearConss;
1713 opbinput->file =
SCIPfopen(filename,
"r");
1714 if( opbinput->file ==
NULL )
1733 opbinput->objsense = (
SCIP_OBJSENSE)(-1 * (
int)(opbinput->objsense));
1740 nNonlinearConss = 0;
1751 SCIP_Real* topcosts;
1755 SCIP_Longint topcostrhs;
1769 topcostvars[ntopcostvars] =
vars[
i];
1780 (SCIP_Real) topcostrhs,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE) );
1806 SCIP_Bool
const transformed
1818 for( v =
nvars - 1; v >= 0; --v )
1831 for( v =
nvars - 1; v >= 0; --v )
1843 SCIPdebugMsg(
scip,
"A variable couldn't retransformed to an original variable.\n");
1854 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);
1871 SCIP_Real* constant,
1872 SCIP_Bool transformed
1888 if( requiredsize > *
nvars )
1898 for( v = 0; v < *
nvars; ++v )
1913 SCIP_Bool
const transformed,
1918 SCIP_Bool*
const existandconshdlr,
1919 SCIP_Bool*
const existands
1939 if( conshdlr !=
NULL )
1943 int* shouldnotbeinand;
1953 *existandconshdlr =
TRUE;
1968 for(
c = norigconss - 1;
c >= 0; --
c )
1975 andconss[nandconss] = origconss[
c];
1988 *nresvars = nandconss;
2001 for(
c = nandconss - 1;
c >= 0; --
c )
2019 SCIPsortPtrPtrInt((
void**)(*resvars), (
void**)(*andvars), (*nandvars), SCIPvarComp, (*nresvars));
2030 for(
r = *nresvars - 1;
r >= 0; --
r )
2033 shouldnotbeinand[ncontainedands] =
r;
2038 while( v < (*nandvars)[
r] )
2056 for(
a = ncontainedands - 1;
a >= 0; --
a )
2057 if( shouldnotbeinand[
a] == pos )
2076 shouldnotbeinand[ncontainedands] = pos;
2082 (*nandvars)[
r] = (*nandvars)[
r] + (*nandvars)[pos] - 1;
2086 for(
a = (*nandvars)[pos] - 1;
a >= 0; --
a )
2087 (*andvars)[
r][(*nandvars)[
r] -
a - 1] = (*andvars)[pos][
a];
2107 *existandconshdlr =
FALSE;
2124 linebuffer[0] =
'\0';
2142 if( (*linecnt) > 0 )
2144 linebuffer[(*linecnt)] =
'\0';
2158 const char* extension
2170 (void) strncat(linebuffer, extension,
OPB_MAX_LINELEN - (
unsigned int)(*linecnt));
2171 (*linecnt) += (int) strlen(extension);
2184 int const*
const nandvars,
2188 SCIP_Real
const objoffset,
2189 char const*
const multisymbol,
2190 SCIP_Bool
const existands,
2191 SCIP_Bool
const transformed
2198 SCIP_Bool objective;
2217 for( v = 0; v <
nvars; ++v )
2246 if( topcostcons !=
NULL )
2273 if( conshdlr !=
NULL )
2284 for(
c = 0;
c < nconss; ++
c )
2289 SCIP_Bool topcostfound;
2299 topcostfound =
FALSE;
2301 for(
w = 0;
w < nlinvars; ++
w )
2304 topcostfound =
TRUE;
2308 topcostfound =
FALSE;
2328 if( conshdlr !=
NULL )
2339 for(
c = 0;
c < nconss; ++
c )
2344 SCIP_Bool topcostfound;
2354 topcostfound =
FALSE;
2356 for(
w = 0;
w < ntopvars; ++
w )
2359 topcostfound =
TRUE;
2363 topcostfound =
FALSE;
2385 if( conshdlr !=
NULL )
2396 for(
c = 0;
c < nconss; ++
c )
2401 SCIP_Bool topcostfound;
2411 topcostfound =
FALSE;
2413 for(
w = 0;
w < ntopvars; ++
w )
2416 topcostfound =
TRUE;
2420 topcostfound =
FALSE;
2453 assert(mult * 10 > mult);
2480 for(
c = nresvars - 1;
c > 0; --
c )
2485 for( v = 0; v <
nvars; ++v )
2511 assert(pos >= 0 && nandvars[pos] > 0 && andvars[pos] !=
NULL);
2512 assert(andvars[pos][nandvars[pos] - 1] !=
NULL);
2518 (SCIP_Longint) (
SCIPvarGetObj(
var) * mult), multisymbol, negated ?
"~" :
"",
2522 for(
a = nandvars[pos] - 2;
a >= 0; --
a )
2551 char const*
const type,
2553 SCIP_Real
const*
const vals,
2559 int const*
const nandvars,
2560 SCIP_Longint weight,
2561 SCIP_Longint*
const mult,
2562 char const*
const multisymbol
2573 assert(strcmp(type,
"=") == 0 || strcmp(type,
">=") == 0);
2582 for( v = 0; v <
nvars; ++v )
2586 if(
ABS(*mult) >
ABS(*mult * 10) )
2594 if(
ABS(*mult) >
ABS(*mult * 10) )
2600 if(
ABS(*mult) != 1 )
2605 for( v = nresvars - 1; v > 0; --v )
2617 for( v = 0; v <
nvars; ++v )
2633 assert(pos >= 0 && nandvars[pos] > 0 && andvars[pos] !=
NULL);
2634 assert(andvars[pos][nandvars[pos] - 1] !=
NULL);
2645 (SCIP_Longint)
SCIPround(
scip, vals[v] * (*mult)), multisymbol, negated ?
"~" :
"",
2649 for(
a = nandvars[pos] - 2;
a >= 0; --
a )
2686 SCIP_Real*
const vals,
2688 SCIP_Real
const lhs,
2689 SCIP_Real
const rhs,
2693 int const*
const nandvars,
2694 SCIP_Longint weight,
2695 SCIP_Bool
const transformed,
2696 char const*
const multisymbol
2700 SCIP_Real* activevals;
2701 SCIP_Real activeconstant;
2716 nactivevars =
nvars;
2719 activeconstant = 0.0;
2733 for( v = 0; v < nactivevars; ++v )
2734 activevals[v] = 1.0;
2744 if( activevars !=
NULL )
2752 retcode =
printNLRow(
scip, file,
"=", activevars, activevals, nactivevars, rhs - activeconstant, resvars,
2753 nresvars, andvars, nandvars, weight, &mult, multisymbol);
2760 retcode =
printNLRow(
scip, file,
">=", activevars, activevals, nactivevars, lhs - activeconstant, resvars,
2761 nresvars, andvars, nandvars, weight, &mult, multisymbol);
2769 retcode =
printNLRow(
scip, file,
">=", activevars, activevals, nactivevars, rhs - activeconstant, resvars,
2770 nresvars, andvars, nandvars, weight, &mult, multisymbol);
2793 SCIP_Longint weight,
2795 const char* multisymbol
2805 assert(strcmp(type,
"=") == 0 || strcmp(type,
">=") == 0);
2817 for( v = 0; v <
nvars; ++v )
2821 if(
ABS(*mult) >
ABS(*mult * 10) )
2829 if(
ABS(*mult) >
ABS(*mult * 10) )
2835 if(
ABS(*mult) != 1 )
2846 for( v = 0; v <
nvars; ++v )
2888 SCIP_Longint weight,
2889 SCIP_Bool transformed,
2890 const char* multisymbol
2894 SCIP_Real* activevals;
2895 SCIP_Real activeconstant;
2907 nactivevars =
nvars;
2910 activeconstant = 0.0;
2924 for( v = 0; v < nactivevars; ++v )
2925 activevals[v] = 1.0;
2935 if( activevars !=
NULL )
2943 retcode =
printRow(
scip, file,
"=", activevars, activevals, nactivevars, rhs - activeconstant, weight, &mult,
2951 retcode =
printRow(
scip, file,
">=", activevars, activevals, nactivevars, lhs - activeconstant, weight, &mult,
2960 retcode =
printRow(
scip, file,
">=", activevars, activevals, nactivevars, rhs - activeconstant, weight, &mult,
2979 int* nindicatorconss
2983 const char* conshdlrname;
2993 *nindicatorconss = 0;
2996 for(
c = 0;
c < nconss; ++
c )
3009 if( strcmp(conshdlrname,
"and") == 0 )
3012 if( strcmp(conshdlrname,
"pseudoboolean") == 0 )
3015 ++(*nindicatorconss);
3020 if( strcmp(conshdlrname,
"indicator") == 0 )
3022 ++(*nindicatorconss);
3062 int const*
const nandvars,
3063 char const*
const multisymbol,
3064 SCIP_Bool
const existandconshdlr,
3065 SCIP_Bool
const existands,
3066 SCIP_Bool
const transformed
3070 const char* conshdlrname;
3073 SCIP_Real* consvals;
3074 SCIP_Bool topcostfound =
FALSE;
3094 if( conshdlr !=
NULL )
3111 for(
c = 0;
c < nindconss; ++
c )
3126 if( conshdlr !=
NULL )
3142 for(
c = 0;
c < npbconss; ++
c )
3160 SCIP_Bool pbhashmapcreated =
FALSE;
3161 SCIP_Bool indhashmapcreated =
FALSE;
3164 for(
c = 0;
c < nconss; ++
c )
3171 if( strcmp(conshdlrname,
"pseudoboolean") == 0 )
3173 if( !pbhashmapcreated )
3177 pbhashmapcreated =
TRUE;
3186 else if( strcmp(conshdlrname,
"indicator") == 0 )
3188 if( !indhashmapcreated )
3192 indhashmapcreated =
TRUE;
3209 SCIP_Longint weight = 0LL;
3223 if( linconssofindicatorsmap !=
NULL )
3227 if( artcons !=
NULL )
3231 if( linconssofpbsmap !=
NULL )
3235 if( artcons !=
NULL )
3239 if( indvar !=
NULL )
3245 SCIPwarningMessage(
scip,
"pseudoboolean constraint <%s> will not be printed because its indicator variable has no objective value(= weight of this soft constraint)\n",
SCIPconsGetName(artcons));
3265 topcostfound =
TRUE;
3271 if( strcmp(conshdlrname,
"linear") == 0 )
3278 weight, transformed, multisymbol);
3287 else if( strcmp(conshdlrname,
"setppc") == 0 )
3298 andvars, nandvars, weight, transformed, multisymbol);
3303 consvars,
NULL, nconsvars, 1.0, 1.0, weight, transformed, multisymbol);
3311 weight, transformed, multisymbol);
3324 weight, transformed, multisymbol);
3334 else if( strcmp(conshdlrname,
"logicor") == 0 )
3340 resvars, nresvars, andvars, nandvars, weight, transformed, multisymbol);
3349 else if( strcmp(conshdlrname,
"knapsack") == 0 )
3351 SCIP_Longint* weights;
3359 for( v = 0; v < nconsvars; ++v )
3360 consvals[v] = (SCIP_Real)weights[v];
3366 weight, transformed, multisymbol);
3376 else if( strcmp(conshdlrname,
"varbound") == 0 )
3401 else if( strcmp(conshdlrname,
"indicator") == 0 )
3435 SCIP_Real* scipvalslinear;
3454 for( v = 0; v < nconsvars; ++v )
3458 if( consvars[v] == slackvar )
3460 assert(nonbinarypos == -1);
3476 if( nonbinarypos == -1 )
3498 assert(0 <= nonbinarypos && nonbinarypos < nconsvars);
3502 consvars[nonbinarypos] = consvars[nconsvars];
3503 consvals[nonbinarypos] = consvals[nconsvars];
3509 resvars, nresvars, andvars, nandvars,
3510 weight, transformed, multisymbol);
3516 weight, transformed, multisymbol);
3525 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) );
3531 else if( strcmp(conshdlrname,
"and") == 0 )
3536 assert(existandconshdlr);
3538 else if( strcmp(conshdlrname,
"pseudoboolean") == 0 )
3558 SCIPerrorMessage(
"Cannot print constraint %s with non-integral coefficient or sides in opb-format\n",
3564 if( linconssofpbsmap !=
NULL )
3569 if( linconssofindicatorsmap !=
NULL )
3586 char const*
const multisymbol,
3587 SCIP_Bool
const transformed
3604 for( v = 0; v <
nvars; ++v )
3609 SCIP_Bool neg =
FALSE;
3625 assert(lb > -0.5 && ub < 1.5);
3630 if( lb > 0.5 || ub < 0.5 )
3660 int const*
const nandvars,
3662 char const*
const multisymbol,
3663 SCIP_Bool
const transformed
3667 SCIP_Longint rhslhs;
3684 for(
r = nresvars - 1;
r >= 0; --
r )
3692 resvar = resvars[
r];
3707 if( lb > 0.5 || ub < 0.5 )
3724 for( v = nandvars[
r] - 1; v >= 0; --v )
3741 if( lb > 0.5 || ub < 0.5 )
3758 for(
r = nresvars - 1;
r >= 0; --
r )
3761 resvar = resvars[
r];
3777 for( v = nandvars[
r] - 1; v >= 0; --v )
3793 else if( rhslhs == 1 )
3803 for( v = nandvars[
r] - 1; v >= 0; --v )
3827 SCIP_Bool firstprinted;
3829 firstprinted =
FALSE;
3834 for( v = nandvars[
r] - 1; v >= 0; --v )
3844 firstprinted =
TRUE;
3871 assert(pos >= 0 && nandvars[pos] > 0 && andvars[pos] !=
NULL);
3872 assert(andvars[pos][nandvars[pos] - 1] !=
NULL);
3881 for(
a = nandvars[pos] - 2;
a >= 0; --
a )
3923 SCIP_Bool transformed,
3927 SCIP_Real objoffset,
3935 int const*
const nandvars,
3936 SCIP_Bool
const existandconshdlr,
3937 SCIP_Bool
const existands,
3943 SCIP_Bool usesymbol;
3946 int nindicatorconss;
3968 SCIPvarGetHashkey, SCIPvarIsHashkeyEq, SCIPvarGetHashkeyVal,
NULL) );
3972 objsense,
objscale, objoffset, multisymbol, existands, transformed) );
3975 retcode =
writeOpbConstraints(
scip, file, conss, nconss,
vars,
nvars, resvars, nresvars, andvars, nandvars,
3976 multisymbol, existandconshdlr, existands, transformed);
3978 if( existands && (retcode ==
SCIP_OKAY) )
4004 const char* filename,
4016 opbinput.file =
NULL;
4018 opbinput.linebuf[0] =
'\0';
4021 opbinput.token[0] =
'\0';
4023 opbinput.tokenbuf[0] =
'\0';
4029 opbinput.npushedtokens = 0;
4030 opbinput.linenumber = 1;
4031 opbinput.linepos = 0;
4033 opbinput.eof =
FALSE;
4034 opbinput.haserror =
FALSE;
4035 opbinput.nproblemcoeffs = 0;
4036 opbinput.wbo =
FALSE;
4038 opbinput.nindvars = 0;
4039#if GENCONSNAMES == TRUE
4040 opbinput.consnumber = 0;
4060 if( opbinput.nproblemcoeffs > 0 )
4062 SCIPwarningMessage(
scip,
"there might be <%d> coefficients or weight out of range!\n", opbinput.nproblemcoeffs);
4066 if( opbinput.haserror )
4083 SCIP_Bool transformed,
4087 SCIP_Real objoffset,
4098 SCIP_Bool genericnames,
4104 SCIP_Bool existands;
4105 SCIP_Bool existandconshdlr;
4117 if(
nintvars > 0 || ncontvars + nimplvars > nindicatorconss + nresvars )
4131 for( v =
nvars - 1; v >= 0; --v )
4144 nvars, conss, nconss, resvars, nresvars, andvars, nandvars, existandconshdlr, existands,
result);
4155 for( v =
nvars - 1; v >= 0; --v )
4182 for( v = nfixedvars - 1; v >= 0; --v )
4211 for( v =
nvars - 1; v >= 0; --v )
4223 nvars, conss, nconss, resvars, nresvars, andvars, nandvars, existandconshdlr, existands,
result);
4237 for( v = nresvars - 1; v >= 0; --v )
4290 nvars,
nbinvars,
nintvars, nimplvars, ncontvars, fixedvars, nfixedvars, conss, nconss, genericnames,
result) );
4316 "reading/" READER_NAME "/dynamicconss",
"should model constraints be subject to aging?",
4319 "reading/" READER_NAME "/multisymbol",
"use '*' between coefficients and variables by writing to problem?",
Constraint handler for AND constraints, .
constraint handler for indicator constraints
Constraint handler for knapsack constraints of the form , x binary and .
Constraint handler for linear constraints in their most general form, .
Constraint handler for logicor constraints (equivalent to set covering, but algorithms are suited fo...
constraint handler for 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_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)
int SCIPgetNVarsLogicor(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetRhsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE 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)
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_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_RETCODE SCIPcreateConsPseudoboolean(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR **linvars, int nlinvars, SCIP_Real *linvals, SCIP_VAR ***terms, int nterms, int *ntermvars, SCIP_Real *termvals, SCIP_VAR *indvar, SCIP_Real weight, SCIP_Bool issoftcons, SCIP_VAR *intvar, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
@ SCIP_SETPPCTYPE_PARTITIONING
@ SCIP_SETPPCTYPE_COVERING
@ SCIP_SETPPCTYPE_PACKING
SCIP_RETCODE SCIPwriteOpb(SCIP *scip, FILE *file, const char *name, SCIP_Bool transformed, SCIP_OBJSENSE objsense, SCIP_Real objscale, SCIP_Real objoffset, 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 SCIPreadOpb(SCIP *scip, SCIP_READER *reader, const char *filename, SCIP_RESULT *result)
SCIP_RETCODE SCIPincludeReaderOpb(SCIP *scip)
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
int SCIPgetNOrigConss(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 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)
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
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
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)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
#define SCIPreallocMemoryArray(scip, ptr, newnum)
#define SCIPallocMemoryArray(scip, ptr, num)
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 SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
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_RETCODE SCIPsetReaderWrite(SCIP *scip, SCIP_READER *reader,)
SCIP_RETCODE SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader,)
const char * SCIPreaderGetName(SCIP_READER *reader)
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_Bool SCIPisFeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
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_Real SCIPfloor(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPround(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasIntegral(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 SCIPgetProbvarLinearSum(SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, int varssize, SCIP_Real *constant, int *requiredsize, SCIP_Bool mergemultiples)
SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbOriginal(SCIP_VAR *var)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
int SCIPvarGetIndex(SCIP_VAR *var)
SCIP_RETCODE SCIPchgVarBranchPriority(SCIP *scip, SCIP_VAR *var, int branchpriority)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbOriginal(SCIP_VAR *var)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
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 SCIPchgVarObj(SCIP *scip, SCIP_VAR *var, SCIP_Real newobj)
SCIP_RETCODE SCIPgetBinvarRepresentative(SCIP *scip, SCIP_VAR *var, SCIP_VAR **repvar, SCIP_Bool *negated)
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_Real SCIPconsGetLhs(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success)
SCIP_Real SCIPconsGetRhs(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
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
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 printNonLinearCons(SCIP *const scip, FILE *const file, SCIP_VAR **const vars, SCIP_Real *const vals, int const nvars, SCIP_Real const lhs, SCIP_Real const rhs, SCIP_VAR **const resvars, int const nresvars, SCIP_VAR **const *const andvars, int const *const nandvars, SCIP_Longint weight, SCIP_Bool const transformed, char const *const multisymbol)
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 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 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 const char commentchars[]
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 objscale, SCIP_Real const objoffset, char const *const multisymbol, SCIP_Bool const existands, SCIP_Bool const transformed)
static SCIP_RETCODE printNLRow(SCIP *const scip, FILE *const file, char const *const type, SCIP_VAR **const vars, SCIP_Real const *const vals, int const nvars, SCIP_Real lhs, SCIP_VAR **const resvars, int const nresvars, SCIP_VAR **const *const andvars, int const *const nandvars, SCIP_Longint weight, SCIP_Longint *const mult, char const *const multisymbol)
static void writeBuffer(SCIP *scip, FILE *file, char *linebuffer, int *linecnt)
static void pushToken(OPBINPUT *opbinput)
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 getActiveVariables(SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, SCIP_Real *constant, SCIP_Bool transformed)
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_Bool isEndLine(OPBINPUT *opbinput)
#define OPB_INIT_COEFSSIZE
static SCIP_RETCODE writeOpb(SCIP *scip, FILE *file, const char *name, SCIP_Bool transformed, SCIP_OBJSENSE objsense, SCIP_Real objscale, SCIP_Real objoffset, 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 getMaxAndConsDim(SCIP *scip, OPBINPUT *opbinput, SCIP_Real *objscale, SCIP_Real *objoffset)
static SCIP_RETCODE createVariable(SCIP *scip, SCIP_VAR **var, char *name)
static void syntaxError(SCIP *scip, OPBINPUT *opbinput, const char *msg)
static SCIP_RETCODE readOPBFile(SCIP *scip, OPBINPUT *opbinput, const char *filename)
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)
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_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 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
enum SCIP_Objsense SCIP_OBJSENSE
#define SCIP_DECL_READERWRITE(x)
#define SCIP_DECL_READERREAD(x)
#define SCIP_DECL_READERCOPY(x)
enum SCIP_Result SCIP_RESULT
enum SCIP_Retcode SCIP_RETCODE
@ SCIP_VARSTATUS_ORIGINAL
@ SCIP_VARSTATUS_MULTAGGR
@ SCIP_VARSTATUS_AGGREGATED