122#if !defined(_WIN32) && !defined(_WIN64)
126#define READER_NAME "opbreader"
127#define READER_DESC "file reader for pseudo-Boolean problem in opb format"
128#define READER_EXTENSION "opb"
130#define GENCONSNAMES TRUE
131#define LINEAROBJECTIVE TRUE
136#define INDICATORVARNAME "indicatorvar"
137#define INDICATORSLACKVARNAME "indslack"
138#define TOPCOSTCONSNAME "topcostcons"
143#define OPB_MAX_LINELEN 65536
144#define OPB_MAX_PUSHEDTOKENS 2
145#define OPB_INIT_COEFSSIZE 8192
184#if GENCONSNAMES == TRUE
207 SCIPerrorMessage(
"Syntax error in line %d: %s found <%s>\n", opbinput->linenumber, msg, opbinput->token);
208 if( opbinput->linebuf[opbinput->linebufsize - 1] ==
'\n' )
217 opbinput->haserror =
TRUE;
228 return opbinput->haserror;
288 if( isdigit((
unsigned char)
c) )
290 else if( (*exptype ==
OPB_EXP_NONE) && !(*hasdot) && (
c ==
'.') )
295 else if( !firstchar && (*exptype ==
OPB_EXP_NONE) && (
c ==
'e' ||
c ==
'E') )
297 if( nextc ==
'+' || nextc ==
'-' )
302 else if( isdigit((
unsigned char)nextc) )
331 opbinput->linepos = 0;
332 opbinput->linebuf[opbinput->linebufsize - 2] =
'\0';
334 if(
SCIPfgets(opbinput->linebuf, opbinput->linebufsize, opbinput->file) ==
NULL )
337 opbinput->linenumber++;
340 while( opbinput->linebuf[opbinput->linebufsize - 2] !=
'\0' )
347 opbinput->linebuf[newsize-2] =
'\0';
348 if (
SCIPfgets(opbinput->linebuf + opbinput->linebufsize - 1, newsize - opbinput->linebufsize + 1, opbinput->file) ==
NULL )
350 opbinput->linebufsize = newsize;
353 opbinput->linebuf[opbinput->linebufsize - 1] =
'\0';
361 if( commentstart !=
NULL )
363 *commentstart =
'\0';
364 *(commentstart+1) =
'\0';
384 *pointer1 = *pointer2;
401 assert(opbinput->linepos < opbinput->linebufsize);
404 if( opbinput->npushedtokens > 0 )
406 swapPointers(&opbinput->token, &opbinput->pushedtokens[opbinput->npushedtokens-1]);
407 opbinput->npushedtokens--;
408 SCIPdebugMsg(
scip,
"(line %d) read token again: '%s'\n", opbinput->linenumber, opbinput->token);
413 buf = opbinput->linebuf;
416 if( buf[opbinput->linepos] ==
'\0' )
423 assert(opbinput->linepos == 0);
425 buf = opbinput->linebuf;
430 assert(opbinput->linepos < opbinput->linebufsize);
436 if(
isValueChar(buf[opbinput->linepos], buf[opbinput->linepos+1],
TRUE, &hasdot, &exptype) )
444 opbinput->token[tokenlen] = buf[opbinput->linepos];
448 while(
isValueChar(buf[opbinput->linepos], buf[opbinput->linepos+1],
FALSE, &hasdot, &exptype) );
457 opbinput->token[tokenlen] = buf[opbinput->linepos];
460 if( tokenlen == 1 &&
isTokenChar(opbinput->token[0]) )
470 && (opbinput->token[tokenlen-1] ==
'<' || opbinput->token[tokenlen-1] ==
'>' || opbinput->token[tokenlen-1] ==
'=')
471 && buf[opbinput->linepos] ==
'=' )
475 else if( opbinput->token[tokenlen-1] ==
'=' && (buf[opbinput->linepos] ==
'<' || buf[opbinput->linepos] ==
'>') )
477 opbinput->token[tokenlen-1] = buf[opbinput->linepos];
482 opbinput->token[tokenlen] =
'\0';
484 SCIPdebugMsg(
scip,
"(line %d) read token: '%s'\n", opbinput->linenumber, opbinput->token);
498 swapPointers(&opbinput->pushedtokens[opbinput->npushedtokens], &opbinput->token);
499 opbinput->npushedtokens++;
511 swapPointers(&opbinput->pushedtokens[opbinput->npushedtokens], &opbinput->tokenbuf);
512 opbinput->npushedtokens++;
534 if( *(opbinput->token) ==
';')
549 assert(*sign == +1 || *sign == -1);
551 if( strlen(opbinput->token) == 1 )
553 assert(opbinput->token[1] ==
'\0');
555 if( *opbinput->token ==
'+' )
557 else if( *opbinput->token ==
'-' )
578 if( strcasecmp(opbinput->token,
"INFINITY") == 0 || strcasecmp(opbinput->token,
"INF") == 0 )
588 val = strtod(opbinput->token, &endptr);
589 if( endptr != opbinput->token && *endptr ==
'\0' )
592 if( strlen(opbinput->token) > 18 )
593 opbinput->nproblemcoeffs++;
610 if( strcmp(opbinput->token,
"<") == 0 )
616 else if( strcmp(opbinput->token,
">") == 0 )
622 else if( strcmp(opbinput->token,
"=") == 0 )
642 if( strcmp(opbinput->token,
"[") == 0 )
658 if( strcmp(opbinput->token,
"]") == 0 )
673 SCIP_Bool dynamiccols;
678 initial = !dynamiccols;
679 removable = dynamiccols;
718 name = opbinput->token;
722 while(!isdigit((
unsigned char) *name ) && !
isTokenChar(*name) && !opbinput->haserror )
748 if( *
nvars == *varssize )
758 opbinput->haserror =
TRUE;
760 name = opbinput->token;
780 SCIP_Real** lincoefs,
784 SCIP_Real** termcoefs,
787 int*
const ntermcoefs,
788 SCIP_Bool*
const newsection,
789 SCIP_Bool*
const isNonlinear,
790 SCIP_Bool*
const issoftcons,
791 SCIP_Real*
const weight
798 SCIP_Bool haveweightstart;
799 SCIP_Bool haveweightend;
830 *isNonlinear =
FALSE;
844 if( strcmp(opbinput->token,
":") == 0 )
850 SCIPdebugMsg(
scip,
"(line %d) read constraint name: '%s'\n", opbinput->linenumber, name);
855 syntaxError(
scip, opbinput,
"Soft top cost line needs to be the first non-comment line, and without any objective function.\n");
862 SCIPdebugMsg(
scip,
"(line %d) constraint has no name\n", opbinput->linenumber);
876 opbinput->eof =
TRUE;
898 haveweightstart =
FALSE;
899 haveweightend =
FALSE;
920 if(
isSign(opbinput, &coefsign) )
922 SCIPdebugMsg(
scip,
"(line %d) read coefficient sign: %+d\n", opbinput->linenumber, coefsign);
931 if( (*nlincoefs > 0 || *ntermcoefs > 0 || ntmpcoefs > 0) && !havesign )
937 SCIPdebugMsg(
scip,
"(line %d) read coefficient value: %g with sign %+d\n", opbinput->linenumber, coef, coefsign);
946 if( strcmp(name,
"soft") == 0 )
950 tmpcoefs[ntmpcoefs] = coefsign * coef;
962 SCIPwarningMessage(
scip,
"Found in line %d a soft constraint, without having read a starting top-cost line.\n", opbinput->linenumber);
964 haveweightstart =
TRUE;
970 *weight = coefsign * coef;
971 SCIPdebugMsg(
scip,
"(line %d) found soft constraint weight: %g\n", opbinput->linenumber, *weight);
976 haveweightend =
TRUE;
984 if( haveweightstart != haveweightend )
991 if( strcmp(name,
"soft") == 0 )
1003 *isNonlinear =
TRUE;
1005 SCIPdebugMsg(
scip,
"(line %d) found linear term: %+g", opbinput->linenumber, coefsign * coef);
1009 for( v = 0; v < ntmpvars; ++v )
1018 assert(*ntermcoefs <= *termcoefssize);
1020 if( *ntermcoefs >= *termcoefssize )
1028 *termcoefssize = newsize;
1030 assert(*ntermcoefs < *termcoefssize);
1036 (*ntermvars)[*ntermcoefs] = ntmpvars;
1039 for( --ntmpvars; ntmpvars >= 0; --ntmpvars )
1041 (*terms)[*ntermcoefs][ntmpvars] = tmpvars[ntmpvars];
1044 (*termcoefs)[*ntermcoefs] = coefsign * coef;
1049 SCIPwarningMessage(
scip,
"coefficient %g in line %d not integral.\n", (*termcoefs)[*ntermcoefs], opbinput->linenumber);
1069 assert(*nlincoefs <= *lincoefssize);
1071 if( *nlincoefs >= *lincoefssize )
1078 *lincoefssize = newsize;
1080 assert(*nlincoefs < *lincoefssize);
1083 (*linvars)[*nlincoefs] = tmpvars[0];
1084 (*lincoefs)[*nlincoefs] = coefsign * coef;
1089 SCIPwarningMessage(
scip,
"coefficient %g in line %d not integral.\n", (*lincoefs)[*nlincoefs], opbinput->linenumber);
1105 if( !opbinput->haserror )
1116 assert(*nlincoefs == 0 && *ntermcoefs == 0);
1119 (*lincoefs)[*nlincoefs] = tmpcoefs[0];
1143 SCIP_Real
const scale,
1145 SCIP_Real*
const coefs,
1148 SCIP_Real*
const termcoefs,
1149 int*
const ntermvars,
1150 int const ntermcoefs
1157 assert(ntermcoefs == 0 || (terms !=
NULL && ntermvars !=
NULL && termcoefs !=
NULL));
1165 if( strcmp(sense,
"max" ) == 0 )
1174 if( ntermcoefs > 0 )
1176#if (LINEAROBJECTIVE == TRUE)
1184 for( t = 0; t < ntermcoefs; ++t )
1191 nvars = ntermvars[t];
1209#ifdef WITH_DEBUG_SOLUTION
1210 if( SCIPdebugIsMainscip(
scip) )
1212 SCIP_Real val = 0.0;
1214 for( v =
nvars - 1; v >= 0; --v )
1247 for( v = 0; v < ntermcoefs; ++v )
1249 if( termcoefs[v] < 0 )
1255 for( v = 0; v < ncoefs; ++v )
1277#ifdef WITH_DEBUG_SOLUTION
1278 if( SCIPdebugIsMainscip(
scip) )
1280 SCIP_Real artval = 0.0;
1283 for( t = 0; t < ntermcoefs; ++t )
1286 nvars = ntermvars[t];
1290 for( v =
nvars - 1; v >= 0; --v )
1299 artval += (((val < 0.5) ? 0.0 : 1.0) * termcoefs[t]);
1324 for( v = 0; v < ncoefs; ++v )
1352 int* nNonlinearConss
1358 SCIP_Real* lincoefs;
1362 SCIP_Real* termcoefs;
1368 SCIP_Real sidevalue;
1371 SCIP_Bool newsection;
1372 SCIP_Bool initialconss;
1373 SCIP_Bool dynamicconss;
1374 SCIP_Bool dynamicrows;
1381 SCIP_Bool modifiable;
1383 SCIP_Bool removable;
1384 SCIP_Bool isNonlinear;
1386 SCIP_Bool issoftcons;
1400 SCIP_CALL(
readCoefficients(
scip, opbinput, name, &linvars, &lincoefs, &nlincoefs, &lincoefssize, &terms, &termcoefs, &ntermvars, &termcoefssize,
1401 &ntermcoefs, &newsection, &isNonlinear, &issoftcons, &weight) );
1403 if(
hasError(opbinput) || opbinput->eof )
1407 if( strcmp(name,
"min") == 0 || strcmp(name,
"max") == 0 )
1411 syntaxError(
scip, opbinput,
"Cannot have an objective function when having soft constraints.\n");
1416 SCIP_CALL(
setObjective(
scip, opbinput, name,
objscale, linvars, lincoefs, nlincoefs, terms, termcoefs, ntermvars, ntermcoefs) );
1418 else if( strcmp(name,
"soft") == 0 )
1421 opbinput->wbo =
TRUE;
1422 if( nlincoefs == 0 )
1428 opbinput->topcost = lincoefs[0];
1430 SCIPdebugMsg(
scip,
"Weighted Boolean Optimization problem has topcost of %g\n", opbinput->topcost);
1432 else if( nlincoefs > 0 )
1443 if( !
isSense(opbinput, &sense) )
1445 syntaxError(
scip, opbinput,
"expected constraint sense '=' or '>='.");
1456 if(
isSign(opbinput, &sidesign) )
1469 sidevalue *= sidesign;
1504 initial = initialconss;
1512 removable = dynamicrows;
1518 ++(opbinput->nindvars);
1527 if( ntermcoefs > 0 || issoftcons )
1529#if GENCONSNAMES == TRUE
1531 ++(opbinput->consnumber);
1536 ntermvars, termcoefs, indvar, weight, issoftcons,
NULL, lhs, rhs,
1537 initial, separate, enforce, check,
propagate, local, modifiable, dynamic, removable,
FALSE);
1543#if GENCONSNAMES == TRUE
1545 ++(opbinput->consnumber);
1550 initial, separate, enforce, check,
propagate, local, modifiable, dynamic, removable,
FALSE);
1556 SCIPdebugMsg(
scip,
"(line %d) created constraint: ", opbinput->linenumber);
1561 ++(*nNonlinearConss);
1566 for( t = ntermcoefs - 1; t >= 0; --t )
1589 SCIP_Real* objoffset
1603 commentstart =
NULL;
1607 opbinput->linebuf[opbinput->linebufsize - 2] =
'\0';
1611 if(
SCIPfgets(opbinput->linebuf, opbinput->linebufsize, opbinput->file) ==
NULL )
1618 while( opbinput->linebuf[opbinput->linebufsize - 2] !=
'\0' )
1625 opbinput->linebuf[newsize-2] =
'\0';
1626 if (
SCIPfgets(opbinput->linebuf + opbinput->linebufsize - 1, newsize - opbinput->linebufsize + 1, opbinput->file) ==
NULL )
1628 opbinput->linebufsize = newsize;
1630 opbinput->linebuf[opbinput->linebufsize - 1] =
'\0';
1638 if( commentstart !=
NULL )
1641 nproducts = strstr(opbinput->linebuf,
"#product= ");
1642 if( nproducts !=
NULL )
1647 nproducts += strlen(
"#product= ");
1658 if( pos !=
NULL && strcmp(pos,
"sizeproduct=") == 0 )
1671 str = strstr(opbinput->linebuf,
"Obj. scale : ");
1674 str += strlen(
"Obj. scale : ");
1680 str = strstr(opbinput->linebuf,
"Obj. offset : ");
1683 str += strlen(
"Obj. offset : ");
1684 *objoffset = atof(str);
1689 *commentstart =
'\0';
1695 while(commentstart !=
NULL && !stop);
1705 const char* filename
1709 SCIP_Real objoffset;
1710 int nNonlinearConss;
1717 opbinput->file =
SCIPfopen(filename,
"r");
1718 if( opbinput->file ==
NULL )
1737 opbinput->objsense = (
SCIP_OBJSENSE)(-1 * (
int)(opbinput->objsense));
1744 nNonlinearConss = 0;
1755 SCIP_Real* topcosts;
1759 SCIP_Longint topcostrhs;
1773 topcostvars[ntopcostvars] =
vars[
i];
1784 (SCIP_Real) topcostrhs,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE) );
1810 SCIP_Bool
const transformed
1822 for( v =
nvars - 1; v >= 0; --v )
1835 for( v =
nvars - 1; v >= 0; --v )
1847 SCIPdebugMsg(
scip,
"A variable couldn't retransformed to an original variable.\n");
1858 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);
1875 SCIP_Real* constant,
1876 SCIP_Bool transformed
1892 if( requiredsize > *
nvars )
1902 for( v = 0; v < *
nvars; ++v )
1917 SCIP_Bool
const transformed,
1922 SCIP_Bool*
const existandconshdlr,
1923 SCIP_Bool*
const existands
1943 if( conshdlr !=
NULL )
1947 int* shouldnotbeinand;
1957 *existandconshdlr =
TRUE;
1972 for(
c = norigconss - 1;
c >= 0; --
c )
1979 andconss[nandconss] = origconss[
c];
1992 *nresvars = nandconss;
2005 for(
c = nandconss - 1;
c >= 0; --
c )
2023 SCIPsortPtrPtrInt((
void**)(*resvars), (
void**)(*andvars), (*nandvars), SCIPvarComp, (*nresvars));
2034 for(
r = *nresvars - 1;
r >= 0; --
r )
2037 shouldnotbeinand[ncontainedands] =
r;
2042 while( v < (*nandvars)[
r] )
2060 for(
a = ncontainedands - 1;
a >= 0; --
a )
2061 if( shouldnotbeinand[
a] == pos )
2080 shouldnotbeinand[ncontainedands] = pos;
2086 (*nandvars)[
r] = (*nandvars)[
r] + (*nandvars)[pos] - 1;
2090 for(
a = (*nandvars)[pos] - 1;
a >= 0; --
a )
2091 (*andvars)[
r][(*nandvars)[
r] -
a - 1] = (*andvars)[pos][
a];
2111 *existandconshdlr =
FALSE;
2128 linebuffer[0] =
'\0';
2146 if( (*linecnt) > 0 )
2148 linebuffer[(*linecnt)] =
'\0';
2162 const char* extension
2174 (void) strncat(linebuffer, extension,
OPB_MAX_LINELEN - (
unsigned int)(*linecnt));
2175 (*linecnt) += (int) strlen(extension);
2188 int const*
const nandvars,
2192 SCIP_Real
const objoffset,
2193 char const*
const multisymbol,
2194 SCIP_Bool
const existands,
2195 SCIP_Bool
const transformed
2202 SCIP_Bool objective;
2221 for( v = 0; v <
nvars; ++v )
2250 if( topcostcons !=
NULL )
2277 if( conshdlr !=
NULL )
2288 for(
c = 0;
c < nconss; ++
c )
2293 SCIP_Bool topcostfound;
2303 topcostfound =
FALSE;
2305 for(
w = 0;
w < nlinvars; ++
w )
2308 topcostfound =
TRUE;
2312 topcostfound =
FALSE;
2332 if( conshdlr !=
NULL )
2343 for(
c = 0;
c < nconss; ++
c )
2348 SCIP_Bool topcostfound;
2358 topcostfound =
FALSE;
2360 for(
w = 0;
w < ntopvars; ++
w )
2363 topcostfound =
TRUE;
2367 topcostfound =
FALSE;
2389 if( conshdlr !=
NULL )
2400 for(
c = 0;
c < nconss; ++
c )
2405 SCIP_Bool topcostfound;
2415 topcostfound =
FALSE;
2417 for(
w = 0;
w < ntopvars; ++
w )
2420 topcostfound =
TRUE;
2424 topcostfound =
FALSE;
2457 assert(mult * 10 > mult);
2484 for(
c = nresvars - 1;
c > 0; --
c )
2489 for( v = 0; v <
nvars; ++v )
2515 assert(pos >= 0 && nandvars[pos] > 0 && andvars[pos] !=
NULL);
2516 assert(andvars[pos][nandvars[pos] - 1] !=
NULL);
2522 (SCIP_Longint) (
SCIPvarGetObj(
var) * mult), multisymbol, negated ?
"~" :
"",
2526 for(
a = nandvars[pos] - 2;
a >= 0; --
a )
2555 char const*
const type,
2557 SCIP_Real
const*
const vals,
2563 int const*
const nandvars,
2564 SCIP_Longint weight,
2565 SCIP_Longint*
const mult,
2566 char const*
const multisymbol
2577 assert(strcmp(type,
"=") == 0 || strcmp(type,
">=") == 0);
2586 for( v = 0; v <
nvars; ++v )
2590 if(
ABS(*mult) >
ABS(*mult * 10) )
2598 if(
ABS(*mult) >
ABS(*mult * 10) )
2604 if(
ABS(*mult) != 1 )
2609 for( v = nresvars - 1; v > 0; --v )
2621 for( v = 0; v <
nvars; ++v )
2637 assert(pos >= 0 && nandvars[pos] > 0 && andvars[pos] !=
NULL);
2638 assert(andvars[pos][nandvars[pos] - 1] !=
NULL);
2649 (SCIP_Longint)
SCIPround(
scip, vals[v] * (*mult)), multisymbol, negated ?
"~" :
"",
2653 for(
a = nandvars[pos] - 2;
a >= 0; --
a )
2690 SCIP_Real*
const vals,
2692 SCIP_Real
const lhs,
2693 SCIP_Real
const rhs,
2697 int const*
const nandvars,
2698 SCIP_Longint weight,
2699 SCIP_Bool
const transformed,
2700 char const*
const multisymbol
2704 SCIP_Real* activevals;
2705 SCIP_Real activeconstant;
2720 nactivevars =
nvars;
2723 activeconstant = 0.0;
2737 for( v = 0; v < nactivevars; ++v )
2738 activevals[v] = 1.0;
2748 if( activevars !=
NULL )
2756 retcode =
printNLRow(
scip, file,
"=", activevars, activevals, nactivevars, rhs - activeconstant, resvars,
2757 nresvars, andvars, nandvars, weight, &mult, multisymbol);
2764 retcode =
printNLRow(
scip, file,
">=", activevars, activevals, nactivevars, lhs - activeconstant, resvars,
2765 nresvars, andvars, nandvars, weight, &mult, multisymbol);
2773 retcode =
printNLRow(
scip, file,
">=", activevars, activevals, nactivevars, rhs - activeconstant, resvars,
2774 nresvars, andvars, nandvars, weight, &mult, multisymbol);
2797 SCIP_Longint weight,
2799 const char* multisymbol
2809 assert(strcmp(type,
"=") == 0 || strcmp(type,
">=") == 0);
2821 for( v = 0; v <
nvars; ++v )
2825 if(
ABS(*mult) >
ABS(*mult * 10) )
2833 if(
ABS(*mult) >
ABS(*mult * 10) )
2839 if(
ABS(*mult) != 1 )
2850 for( v = 0; v <
nvars; ++v )
2892 SCIP_Longint weight,
2893 SCIP_Bool transformed,
2894 const char* multisymbol
2898 SCIP_Real* activevals;
2899 SCIP_Real activeconstant;
2911 nactivevars =
nvars;
2914 activeconstant = 0.0;
2928 for( v = 0; v < nactivevars; ++v )
2929 activevals[v] = 1.0;
2939 if( activevars !=
NULL )
2947 retcode =
printRow(
scip, file,
"=", activevars, activevals, nactivevars, rhs - activeconstant, weight, &mult,
2955 retcode =
printRow(
scip, file,
">=", activevars, activevals, nactivevars, lhs - activeconstant, weight, &mult,
2964 retcode =
printRow(
scip, file,
">=", activevars, activevals, nactivevars, rhs - activeconstant, weight, &mult,
2983 int* nindicatorconss
2987 const char* conshdlrname;
2997 *nindicatorconss = 0;
3000 for(
c = 0;
c < nconss; ++
c )
3013 if( strcmp(conshdlrname,
"and") == 0 )
3016 if( strcmp(conshdlrname,
"pseudoboolean") == 0 )
3019 ++(*nindicatorconss);
3024 if( strcmp(conshdlrname,
"indicator") == 0 )
3026 ++(*nindicatorconss);
3066 int const*
const nandvars,
3067 char const*
const multisymbol,
3068 SCIP_Bool
const existandconshdlr,
3069 SCIP_Bool
const existands,
3070 SCIP_Bool
const transformed
3074 const char* conshdlrname;
3077 SCIP_Real* consvals;
3078 SCIP_Bool topcostfound =
FALSE;
3098 if( conshdlr !=
NULL )
3115 for(
c = 0;
c < nindconss; ++
c )
3130 if( conshdlr !=
NULL )
3146 for(
c = 0;
c < npbconss; ++
c )
3164 SCIP_Bool pbhashmapcreated =
FALSE;
3165 SCIP_Bool indhashmapcreated =
FALSE;
3168 for(
c = 0;
c < nconss; ++
c )
3175 if( strcmp(conshdlrname,
"pseudoboolean") == 0 )
3177 if( !pbhashmapcreated )
3181 pbhashmapcreated =
TRUE;
3190 else if( strcmp(conshdlrname,
"indicator") == 0 )
3192 if( !indhashmapcreated )
3196 indhashmapcreated =
TRUE;
3213 SCIP_Longint weight = 0LL;
3227 if( linconssofindicatorsmap !=
NULL )
3231 if( artcons !=
NULL )
3235 if( linconssofpbsmap !=
NULL )
3239 if( artcons !=
NULL )
3243 if( indvar !=
NULL )
3249 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));
3269 topcostfound =
TRUE;
3275 if( strcmp(conshdlrname,
"linear") == 0 )
3282 weight, transformed, multisymbol);
3291 else if( strcmp(conshdlrname,
"setppc") == 0 )
3302 andvars, nandvars, weight, transformed, multisymbol);
3307 consvars,
NULL, nconsvars, 1.0, 1.0, weight, transformed, multisymbol);
3315 weight, transformed, multisymbol);
3328 weight, transformed, multisymbol);
3338 else if( strcmp(conshdlrname,
"logicor") == 0 )
3344 resvars, nresvars, andvars, nandvars, weight, transformed, multisymbol);
3353 else if( strcmp(conshdlrname,
"knapsack") == 0 )
3355 SCIP_Longint* weights;
3363 for( v = 0; v < nconsvars; ++v )
3364 consvals[v] = (SCIP_Real)weights[v];
3370 weight, transformed, multisymbol);
3380 else if( strcmp(conshdlrname,
"varbound") == 0 )
3405 else if( strcmp(conshdlrname,
"indicator") == 0 )
3439 SCIP_Real* scipvalslinear;
3458 for( v = 0; v < nconsvars; ++v )
3462 if( consvars[v] == slackvar )
3464 assert(nonbinarypos == -1);
3480 if( nonbinarypos == -1 )
3502 assert(0 <= nonbinarypos && nonbinarypos < nconsvars);
3506 consvars[nonbinarypos] = consvars[nconsvars];
3507 consvals[nonbinarypos] = consvals[nconsvars];
3513 resvars, nresvars, andvars, nandvars,
3514 weight, transformed, multisymbol);
3520 weight, transformed, multisymbol);
3529 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) );
3535 else if( strcmp(conshdlrname,
"and") == 0 )
3540 assert(existandconshdlr);
3542 else if( strcmp(conshdlrname,
"pseudoboolean") == 0 )
3562 SCIPerrorMessage(
"Cannot print constraint %s with non-integral coefficient or sides in opb-format\n",
3568 if( linconssofpbsmap !=
NULL )
3573 if( linconssofindicatorsmap !=
NULL )
3590 char const*
const multisymbol,
3591 SCIP_Bool
const transformed
3608 for( v = 0; v <
nvars; ++v )
3613 SCIP_Bool neg =
FALSE;
3629 assert(lb > -0.5 && ub < 1.5);
3634 if( lb > 0.5 || ub < 0.5 )
3664 int const*
const nandvars,
3666 char const*
const multisymbol,
3667 SCIP_Bool
const transformed
3671 SCIP_Longint rhslhs;
3688 for(
r = nresvars - 1;
r >= 0; --
r )
3696 resvar = resvars[
r];
3711 if( lb > 0.5 || ub < 0.5 )
3728 for( v = nandvars[
r] - 1; v >= 0; --v )
3745 if( lb > 0.5 || ub < 0.5 )
3762 for(
r = nresvars - 1;
r >= 0; --
r )
3765 resvar = resvars[
r];
3781 for( v = nandvars[
r] - 1; v >= 0; --v )
3797 else if( rhslhs == 1 )
3807 for( v = nandvars[
r] - 1; v >= 0; --v )
3831 SCIP_Bool firstprinted;
3833 firstprinted =
FALSE;
3838 for( v = nandvars[
r] - 1; v >= 0; --v )
3848 firstprinted =
TRUE;
3875 assert(pos >= 0 && nandvars[pos] > 0 && andvars[pos] !=
NULL);
3876 assert(andvars[pos][nandvars[pos] - 1] !=
NULL);
3885 for(
a = nandvars[pos] - 2;
a >= 0; --
a )
3927 SCIP_Bool transformed,
3931 SCIP_Real objoffset,
3939 int const*
const nandvars,
3940 SCIP_Bool
const existandconshdlr,
3941 SCIP_Bool
const existands,
3947 SCIP_Bool usesymbol;
3950 int nindicatorconss;
3972 SCIPvarGetHashkey, SCIPvarIsHashkeyEq, SCIPvarGetHashkeyVal,
NULL) );
3976 objsense,
objscale, objoffset, multisymbol, existands, transformed) );
3979 retcode =
writeOpbConstraints(
scip, file, conss, nconss,
vars,
nvars, resvars, nresvars, andvars, nandvars,
3980 multisymbol, existandconshdlr, existands, transformed);
3982 if( existands && (retcode ==
SCIP_OKAY) )
4008 const char* filename,
4020 opbinput.file =
NULL;
4022 opbinput.linebuf[0] =
'\0';
4025 opbinput.token[0] =
'\0';
4027 opbinput.tokenbuf[0] =
'\0';
4033 opbinput.npushedtokens = 0;
4034 opbinput.linenumber = 1;
4035 opbinput.linepos = 0;
4037 opbinput.eof =
FALSE;
4038 opbinput.haserror =
FALSE;
4039 opbinput.nproblemcoeffs = 0;
4040 opbinput.wbo =
FALSE;
4042 opbinput.nindvars = 0;
4043#if GENCONSNAMES == TRUE
4044 opbinput.consnumber = 0;
4064 if( opbinput.nproblemcoeffs > 0 )
4066 SCIPwarningMessage(
scip,
"there might be <%d> coefficients or weight out of range!\n", opbinput.nproblemcoeffs);
4070 if( opbinput.haserror )
4087 SCIP_Bool transformed,
4091 SCIP_Real objoffset,
4102 SCIP_Bool genericnames,
4108 SCIP_Bool existands;
4109 SCIP_Bool existandconshdlr;
4121 if(
nintvars > 0 || ncontvars + nimplvars > nindicatorconss + nresvars )
4135 for( v =
nvars - 1; v >= 0; --v )
4148 nvars, conss, nconss, resvars, nresvars, andvars, nandvars, existandconshdlr, existands,
result);
4159 for( v =
nvars - 1; v >= 0; --v )
4186 for( v = nfixedvars - 1; v >= 0; --v )
4215 for( v =
nvars - 1; v >= 0; --v )
4227 nvars, conss, nconss, resvars, nresvars, andvars, nandvars, existandconshdlr, existands,
result);
4241 for( v = nresvars - 1; v >= 0; --v )
4294 nvars,
nbinvars,
nintvars, nimplvars, ncontvars, fixedvars, nfixedvars, conss, nconss, genericnames,
result) );
4320 "reading/" READER_NAME "/dynamicconss",
"should model constraints be subject to aging?",
4323 "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 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