121#if !defined(_WIN32) && !defined(_WIN64)
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 LINEAROBJECTIVE TRUE
135#define INDICATORVARNAME "indicatorvar"
136#define INDICATORSLACKVARNAME "indslack"
137#define TOPCOSTCONSNAME "topcostcons"
142#define OPB_MAX_LINELEN 65536
143#define OPB_MAX_PUSHEDTOKENS 2
144#define OPB_INIT_COEFSSIZE 8192
183#if GENCONSNAMES == TRUE
206 SCIPerrorMessage(
"Syntax error in line %d: %s found <%s>\n", opbinput->linenumber, msg, opbinput->token);
207 if( opbinput->linebuf[opbinput->linebufsize - 1] ==
'\n' )
216 opbinput->haserror =
TRUE;
227 return opbinput->haserror;
287 if( isdigit((
unsigned char)
c) )
289 else if( (*exptype ==
OPB_EXP_NONE) && !(*hasdot) && (
c ==
'.') )
294 else if( !firstchar && (*exptype ==
OPB_EXP_NONE) && (
c ==
'e' ||
c ==
'E') )
296 if( nextc ==
'+' || nextc ==
'-' )
301 else if( isdigit((
unsigned char)nextc) )
330 opbinput->linepos = 0;
331 opbinput->linebuf[opbinput->linebufsize - 2] =
'\0';
333 if(
SCIPfgets(opbinput->linebuf, opbinput->linebufsize, opbinput->file) ==
NULL )
336 opbinput->linenumber++;
339 while( opbinput->linebuf[opbinput->linebufsize - 2] !=
'\0' )
346 opbinput->linebuf[newsize-2] =
'\0';
347 if (
SCIPfgets(opbinput->linebuf + opbinput->linebufsize - 1, newsize - opbinput->linebufsize + 1, opbinput->file) ==
NULL )
349 opbinput->linebufsize = newsize;
352 opbinput->linebuf[opbinput->linebufsize - 1] =
'\0';
360 if( commentstart !=
NULL )
362 *commentstart =
'\0';
363 *(commentstart+1) =
'\0';
383 *pointer1 = *pointer2;
400 assert(opbinput->linepos < opbinput->linebufsize);
403 if( opbinput->npushedtokens > 0 )
405 swapPointers(&opbinput->token, &opbinput->pushedtokens[opbinput->npushedtokens-1]);
406 opbinput->npushedtokens--;
407 SCIPdebugMsg(
scip,
"(line %d) read token again: '%s'\n", opbinput->linenumber, opbinput->token);
412 buf = opbinput->linebuf;
415 if( buf[opbinput->linepos] ==
'\0' )
422 assert(opbinput->linepos == 0);
424 buf = opbinput->linebuf;
429 assert(opbinput->linepos < opbinput->linebufsize);
435 if(
isValueChar(buf[opbinput->linepos], buf[opbinput->linepos+1],
TRUE, &hasdot, &exptype) )
443 opbinput->token[tokenlen] = buf[opbinput->linepos];
447 while(
isValueChar(buf[opbinput->linepos], buf[opbinput->linepos+1],
FALSE, &hasdot, &exptype) );
456 opbinput->token[tokenlen] = buf[opbinput->linepos];
459 if( tokenlen == 1 &&
isTokenChar(opbinput->token[0]) )
469 && (opbinput->token[tokenlen-1] ==
'<' || opbinput->token[tokenlen-1] ==
'>' || opbinput->token[tokenlen-1] ==
'=')
470 && buf[opbinput->linepos] ==
'=' )
474 else if( opbinput->token[tokenlen-1] ==
'=' && (buf[opbinput->linepos] ==
'<' || buf[opbinput->linepos] ==
'>') )
476 opbinput->token[tokenlen-1] = buf[opbinput->linepos];
481 opbinput->token[tokenlen] =
'\0';
483 SCIPdebugMsg(
scip,
"(line %d) read token: '%s'\n", opbinput->linenumber, opbinput->token);
497 swapPointers(&opbinput->pushedtokens[opbinput->npushedtokens], &opbinput->token);
498 opbinput->npushedtokens++;
510 swapPointers(&opbinput->pushedtokens[opbinput->npushedtokens], &opbinput->tokenbuf);
511 opbinput->npushedtokens++;
533 if( *(opbinput->token) ==
';')
548 assert(*sign == +1 || *sign == -1);
550 if( strlen(opbinput->token) == 1 )
552 assert(opbinput->token[1] ==
'\0');
554 if( *opbinput->token ==
'+' )
556 else if( *opbinput->token ==
'-' )
577 if( strcasecmp(opbinput->token,
"INFINITY") == 0 || strcasecmp(opbinput->token,
"INF") == 0 )
587 val = strtod(opbinput->token, &endptr);
588 if( endptr != opbinput->token && *endptr ==
'\0' )
591 if( strlen(opbinput->token) > 18 )
592 opbinput->nproblemcoeffs++;
609 if( strcmp(opbinput->token,
"<") == 0 )
615 else if( strcmp(opbinput->token,
">") == 0 )
621 else if( strcmp(opbinput->token,
"=") == 0 )
641 if( strcmp(opbinput->token,
"[") == 0 )
657 if( strcmp(opbinput->token,
"]") == 0 )
672 SCIP_Bool dynamiccols;
677 initial = !dynamiccols;
678 removable = dynamiccols;
717 name = opbinput->token;
721 while(!isdigit((
unsigned char) *name ) && !
isTokenChar(*name) && !opbinput->haserror )
747 if( *
nvars == *varssize )
757 opbinput->haserror =
TRUE;
759 name = opbinput->token;
779 SCIP_Real** lincoefs,
783 SCIP_Real** termcoefs,
786 int*
const ntermcoefs,
787 SCIP_Bool*
const newsection,
788 SCIP_Bool*
const isNonlinear,
789 SCIP_Bool*
const issoftcons,
790 SCIP_Real*
const weight
797 SCIP_Bool haveweightstart;
798 SCIP_Bool haveweightend;
829 *isNonlinear =
FALSE;
843 if( strcmp(opbinput->token,
":") == 0 )
849 SCIPdebugMsg(
scip,
"(line %d) read constraint name: '%s'\n", opbinput->linenumber, name);
854 syntaxError(
scip, opbinput,
"Soft top cost line needs to be the first non-comment line, and without any objective function.\n");
861 SCIPdebugMsg(
scip,
"(line %d) constraint has no name\n", opbinput->linenumber);
875 opbinput->eof =
TRUE;
897 haveweightstart =
FALSE;
898 haveweightend =
FALSE;
919 if(
isSign(opbinput, &coefsign) )
921 SCIPdebugMsg(
scip,
"(line %d) read coefficient sign: %+d\n", opbinput->linenumber, coefsign);
930 if( (*nlincoefs > 0 || *ntermcoefs > 0 || ntmpcoefs > 0) && !havesign )
936 SCIPdebugMsg(
scip,
"(line %d) read coefficient value: %g with sign %+d\n", opbinput->linenumber, coef, coefsign);
945 if( strcmp(name,
"soft") == 0 )
949 tmpcoefs[ntmpcoefs] = coefsign * coef;
961 SCIPwarningMessage(
scip,
"Found in line %d a soft constraint, without having read a starting top-cost line.\n", opbinput->linenumber);
963 haveweightstart =
TRUE;
969 *weight = coefsign * coef;
970 SCIPdebugMsg(
scip,
"(line %d) found soft constraint weight: %g\n", opbinput->linenumber, *weight);
975 haveweightend =
TRUE;
983 if( haveweightstart != haveweightend )
990 if( strcmp(name,
"soft") == 0 )
1002 *isNonlinear =
TRUE;
1004 SCIPdebugMsg(
scip,
"(line %d) found linear term: %+g", opbinput->linenumber, coefsign * coef);
1008 for( v = 0; v < ntmpvars; ++v )
1017 assert(*ntermcoefs <= *termcoefssize);
1019 if( *ntermcoefs >= *termcoefssize )
1027 *termcoefssize = newsize;
1029 assert(*ntermcoefs < *termcoefssize);
1035 (*ntermvars)[*ntermcoefs] = ntmpvars;
1038 for( --ntmpvars; ntmpvars >= 0; --ntmpvars )
1040 (*terms)[*ntermcoefs][ntmpvars] = tmpvars[ntmpvars];
1043 (*termcoefs)[*ntermcoefs] = coefsign * coef;
1048 SCIPwarningMessage(
scip,
"coefficient %g in line %d not integral.\n", (*termcoefs)[*ntermcoefs], opbinput->linenumber);
1068 assert(*nlincoefs <= *lincoefssize);
1070 if( *nlincoefs >= *lincoefssize )
1077 *lincoefssize = newsize;
1079 assert(*nlincoefs < *lincoefssize);
1082 (*linvars)[*nlincoefs] = tmpvars[0];
1083 (*lincoefs)[*nlincoefs] = coefsign * coef;
1088 SCIPwarningMessage(
scip,
"coefficient %g in line %d not integral.\n", (*lincoefs)[*nlincoefs], opbinput->linenumber);
1104 if( !opbinput->haserror )
1115 assert(*nlincoefs == 0 && *ntermcoefs == 0);
1118 (*lincoefs)[*nlincoefs] = tmpcoefs[0];
1142 SCIP_Real
const scale,
1144 SCIP_Real*
const coefs,
1147 SCIP_Real*
const termcoefs,
1148 int*
const ntermvars,
1149 int const ntermcoefs
1156 assert(ntermcoefs == 0 || (terms !=
NULL && ntermvars !=
NULL && termcoefs !=
NULL));
1164 if( strcmp(sense,
"max" ) == 0 )
1173 if( ntermcoefs > 0 )
1175#if (LINEAROBJECTIVE == TRUE)
1183 for( t = 0; t < ntermcoefs; ++t )
1190 nvars = ntermvars[t];
1208#ifdef WITH_DEBUG_SOLUTION
1209 if( SCIPdebugIsMainscip(
scip) )
1211 SCIP_Real val = 0.0;
1213 for( v =
nvars - 1; v >= 0; --v )
1246 for( v = 0; v < ntermcoefs; ++v )
1248 if( termcoefs[v] < 0 )
1254 for( v = 0; v < ncoefs; ++v )
1276#ifdef WITH_DEBUG_SOLUTION
1277 if( SCIPdebugIsMainscip(
scip) )
1279 SCIP_Real artval = 0.0;
1282 for( t = 0; t < ntermcoefs; ++t )
1285 nvars = ntermvars[t];
1289 for( v =
nvars - 1; v >= 0; --v )
1298 artval += (((val < 0.5) ? 0.0 : 1.0) * termcoefs[t]);
1323 for( v = 0; v < ncoefs; ++v )
1351 int* nNonlinearConss
1357 SCIP_Real* lincoefs;
1361 SCIP_Real* termcoefs;
1367 SCIP_Real sidevalue;
1370 SCIP_Bool newsection;
1371 SCIP_Bool initialconss;
1372 SCIP_Bool dynamicconss;
1373 SCIP_Bool dynamicrows;
1380 SCIP_Bool modifiable;
1382 SCIP_Bool removable;
1383 SCIP_Bool isNonlinear;
1385 SCIP_Bool issoftcons;
1399 SCIP_CALL(
readCoefficients(
scip, opbinput, name, &linvars, &lincoefs, &nlincoefs, &lincoefssize, &terms, &termcoefs, &ntermvars, &termcoefssize,
1400 &ntermcoefs, &newsection, &isNonlinear, &issoftcons, &weight) );
1402 if(
hasError(opbinput) || opbinput->eof )
1406 if( strcmp(name,
"min") == 0 || strcmp(name,
"max") == 0 )
1410 syntaxError(
scip, opbinput,
"Cannot have an objective function when having soft constraints.\n");
1415 SCIP_CALL(
setObjective(
scip, opbinput, name,
objscale, linvars, lincoefs, nlincoefs, terms, termcoefs, ntermvars, ntermcoefs) );
1417 else if( strcmp(name,
"soft") == 0 )
1420 opbinput->wbo =
TRUE;
1421 if( nlincoefs == 0 )
1427 opbinput->topcost = lincoefs[0];
1429 SCIPdebugMsg(
scip,
"Weighted Boolean Optimization problem has topcost of %g\n", opbinput->topcost);
1431 else if( nlincoefs > 0 )
1442 if( !
isSense(opbinput, &sense) )
1444 syntaxError(
scip, opbinput,
"expected constraint sense '=' or '>='.");
1455 if(
isSign(opbinput, &sidesign) )
1468 sidevalue *= sidesign;
1503 initial = initialconss;
1511 removable = dynamicrows;
1517 ++(opbinput->nindvars);
1526 if( ntermcoefs > 0 || issoftcons )
1528#if GENCONSNAMES == TRUE
1530 ++(opbinput->consnumber);
1535 ntermvars, termcoefs, indvar, weight, issoftcons,
NULL, lhs, rhs,
1536 initial, separate, enforce, check,
propagate, local, modifiable, dynamic, removable,
FALSE);
1542#if GENCONSNAMES == TRUE
1544 ++(opbinput->consnumber);
1549 initial, separate, enforce, check,
propagate, local, modifiable, dynamic, removable,
FALSE);
1555 SCIPdebugMsg(
scip,
"(line %d) created constraint: ", opbinput->linenumber);
1560 ++(*nNonlinearConss);
1565 for( t = ntermcoefs - 1; t >= 0; --t )
1588 SCIP_Real* objoffset
1602 commentstart =
NULL;
1606 opbinput->linebuf[opbinput->linebufsize - 2] =
'\0';
1610 if(
SCIPfgets(opbinput->linebuf, opbinput->linebufsize, opbinput->file) ==
NULL )
1617 while( opbinput->linebuf[opbinput->linebufsize - 2] !=
'\0' )
1624 opbinput->linebuf[newsize-2] =
'\0';
1625 if (
SCIPfgets(opbinput->linebuf + opbinput->linebufsize - 1, newsize - opbinput->linebufsize + 1, opbinput->file) ==
NULL )
1627 opbinput->linebufsize = newsize;
1629 opbinput->linebuf[opbinput->linebufsize - 1] =
'\0';
1637 if( commentstart !=
NULL )
1640 nproducts = strstr(opbinput->linebuf,
"#product= ");
1641 if( nproducts !=
NULL )
1646 nproducts += strlen(
"#product= ");
1657 if( pos !=
NULL && strcmp(pos,
"sizeproduct=") == 0 )
1670 str = strstr(opbinput->linebuf,
"Obj. scale : ");
1673 str += strlen(
"Obj. scale : ");
1679 str = strstr(opbinput->linebuf,
"Obj. offset : ");
1682 str += strlen(
"Obj. offset : ");
1683 *objoffset = atof(str);
1688 *commentstart =
'\0';
1694 while(commentstart !=
NULL && !stop);
1704 const char* filename
1708 SCIP_Real objoffset;
1709 int nNonlinearConss;
1716 opbinput->file =
SCIPfopen(filename,
"r");
1717 if( opbinput->file ==
NULL )
1736 opbinput->objsense = (
SCIP_OBJSENSE)(-1 * (
int)(opbinput->objsense));
1743 nNonlinearConss = 0;
1754 SCIP_Real* topcosts;
1758 SCIP_Longint topcostrhs;
1772 topcostvars[ntopcostvars] =
vars[
i];
1783 (SCIP_Real) topcostrhs,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
FALSE,
FALSE,
FALSE,
FALSE,
FALSE) );
1809 SCIP_Bool
const transformed
1821 for( v =
nvars - 1; v >= 0; --v )
1834 for( v =
nvars - 1; v >= 0; --v )
1846 SCIPdebugMsg(
scip,
"A variable couldn't retransformed to an original variable.\n");
1857 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);
1874 SCIP_Real* constant,
1875 SCIP_Bool transformed
1891 if( requiredsize > *
nvars )
1901 for( v = 0; v < *
nvars; ++v )
1916 SCIP_Bool
const transformed,
1921 SCIP_Bool*
const existandconshdlr,
1922 SCIP_Bool*
const existands
1942 if( conshdlr !=
NULL )
1946 int* shouldnotbeinand;
1956 *existandconshdlr =
TRUE;
1971 for(
c = norigconss - 1;
c >= 0; --
c )
1978 andconss[nandconss] = origconss[
c];
1991 *nresvars = nandconss;
2004 for(
c = nandconss - 1;
c >= 0; --
c )
2022 SCIPsortPtrPtrInt((
void**)(*resvars), (
void**)(*andvars), (*nandvars), SCIPvarComp, (*nresvars));
2033 for(
r = *nresvars - 1;
r >= 0; --
r )
2036 shouldnotbeinand[ncontainedands] =
r;
2041 while( v < (*nandvars)[
r] )
2059 for(
a = ncontainedands - 1;
a >= 0; --
a )
2060 if( shouldnotbeinand[
a] == pos )
2079 shouldnotbeinand[ncontainedands] = pos;
2085 (*nandvars)[
r] = (*nandvars)[
r] + (*nandvars)[pos] - 1;
2089 for(
a = (*nandvars)[pos] - 1;
a >= 0; --
a )
2090 (*andvars)[
r][(*nandvars)[
r] -
a - 1] = (*andvars)[pos][
a];
2110 *existandconshdlr =
FALSE;
2127 linebuffer[0] =
'\0';
2145 if( (*linecnt) > 0 )
2147 linebuffer[(*linecnt)] =
'\0';
2161 const char* extension
2173 (void) strncat(linebuffer, extension,
OPB_MAX_LINELEN - (
unsigned int)(*linecnt));
2174 (*linecnt) += (int) strlen(extension);
2187 int const*
const nandvars,
2191 SCIP_Real
const objoffset,
2192 char const*
const multisymbol,
2193 SCIP_Bool
const existands,
2194 SCIP_Bool
const transformed
2201 SCIP_Bool objective;
2220 for( v = 0; v <
nvars; ++v )
2249 if( topcostcons !=
NULL )
2276 if( conshdlr !=
NULL )
2287 for(
c = 0;
c < nconss; ++
c )
2292 SCIP_Bool topcostfound;
2302 topcostfound =
FALSE;
2304 for(
w = 0;
w < nlinvars; ++
w )
2307 topcostfound =
TRUE;
2311 topcostfound =
FALSE;
2331 if( conshdlr !=
NULL )
2342 for(
c = 0;
c < nconss; ++
c )
2347 SCIP_Bool topcostfound;
2357 topcostfound =
FALSE;
2359 for(
w = 0;
w < ntopvars; ++
w )
2362 topcostfound =
TRUE;
2366 topcostfound =
FALSE;
2388 if( conshdlr !=
NULL )
2399 for(
c = 0;
c < nconss; ++
c )
2404 SCIP_Bool topcostfound;
2414 topcostfound =
FALSE;
2416 for(
w = 0;
w < ntopvars; ++
w )
2419 topcostfound =
TRUE;
2423 topcostfound =
FALSE;
2456 assert(mult * 10 > mult);
2483 for(
c = nresvars - 1;
c > 0; --
c )
2488 for( v =
nvars - 1; v >= 0; --v )
2514 assert(pos >= 0 && nandvars[pos] > 0 && andvars[pos] !=
NULL);
2515 assert(andvars[pos][nandvars[pos] - 1] !=
NULL);
2521 (SCIP_Longint) (
SCIPvarGetObj(
var) * mult), multisymbol, negated ?
"~" :
"",
2525 for(
a = nandvars[pos] - 2;
a >= 0; --
a )
2554 char const*
const type,
2556 SCIP_Real
const*
const vals,
2562 int const*
const nandvars,
2563 SCIP_Longint weight,
2564 SCIP_Longint*
const mult,
2565 char const*
const multisymbol
2576 assert(strcmp(type,
"=") == 0 || strcmp(type,
">=") == 0);
2585 for( v = 0; v <
nvars; ++v )
2589 if(
ABS(*mult) >
ABS(*mult * 10) )
2597 if(
ABS(*mult) >
ABS(*mult * 10) )
2603 if(
ABS(*mult) != 1 )
2608 for( v = nresvars - 1; v > 0; --v )
2620 for( v = 0; v <
nvars; ++v )
2636 assert(pos >= 0 && nandvars[pos] > 0 && andvars[pos] !=
NULL);
2637 assert(andvars[pos][nandvars[pos] - 1] !=
NULL);
2648 (SCIP_Longint)
SCIPround(
scip, vals[v] * (*mult)), multisymbol, negated ?
"~" :
"",
2652 for(
a = nandvars[pos] - 2;
a >= 0; --
a )
2689 SCIP_Real*
const vals,
2691 SCIP_Real
const lhs,
2692 SCIP_Real
const rhs,
2696 int const*
const nandvars,
2697 SCIP_Longint weight,
2698 SCIP_Bool
const transformed,
2699 char const*
const multisymbol
2703 SCIP_Real* activevals;
2704 SCIP_Real activeconstant;
2719 nactivevars =
nvars;
2722 activeconstant = 0.0;
2736 for( v = 0; v < nactivevars; ++v )
2737 activevals[v] = 1.0;
2747 if( activevars !=
NULL )
2755 retcode =
printNLRow(
scip, file,
"=", activevars, activevals, nactivevars, rhs - activeconstant, resvars,
2756 nresvars, andvars, nandvars, weight, &mult, multisymbol);
2763 retcode =
printNLRow(
scip, file,
">=", activevars, activevals, nactivevars, lhs - activeconstant, resvars,
2764 nresvars, andvars, nandvars, weight, &mult, multisymbol);
2772 retcode =
printNLRow(
scip, file,
">=", activevars, activevals, nactivevars, rhs - activeconstant, resvars,
2773 nresvars, andvars, nandvars, weight, &mult, multisymbol);
2796 SCIP_Longint weight,
2798 const char* multisymbol
2808 assert(strcmp(type,
"=") == 0 || strcmp(type,
">=") == 0);
2820 for( v = 0; v <
nvars; ++v )
2824 if(
ABS(*mult) >
ABS(*mult * 10) )
2832 if(
ABS(*mult) >
ABS(*mult * 10) )
2838 if(
ABS(*mult) != 1 )
2849 for( v = 0; v <
nvars; ++v )
2891 SCIP_Longint weight,
2892 SCIP_Bool transformed,
2893 const char* multisymbol
2897 SCIP_Real* activevals;
2898 SCIP_Real activeconstant;
2910 nactivevars =
nvars;
2913 activeconstant = 0.0;
2927 for( v = 0; v < nactivevars; ++v )
2928 activevals[v] = 1.0;
2938 if( activevars !=
NULL )
2946 retcode =
printRow(
scip, file,
"=", activevars, activevals, nactivevars, rhs - activeconstant, weight, &mult,
2954 retcode =
printRow(
scip, file,
">=", activevars, activevals, nactivevars, lhs - activeconstant, weight, &mult,
2963 retcode =
printRow(
scip, file,
">=", activevars, activevals, nactivevars, rhs - activeconstant, weight, &mult,
2982 SCIP_Real*
const linvals,
2985 int*
const ntermvars,
2986 SCIP_Real*
const termvals,
2987 int const ntermvals,
2988 SCIP_Bool**
const negatedarrays,
2992 const char* multisymbol
3003 assert(strcmp(type,
"=") == 0 || strcmp(type,
">=") == 0);
3009 assert(negatedarrays !=
NULL || ntermvals == 0);
3021 for( v = 0; v < nlinvars; ++v )
3025 if(
ABS(*mult) >
ABS(*mult * 10) )
3032 for( v = 0; v < ntermvals; ++v )
3036 if(
ABS(*mult) >
ABS(*mult * 10) )
3044 if(
ABS(*mult) >
ABS(*mult * 10) )
3050 if(
ABS(*mult) != 1 )
3054 if( indvar !=
NULL )
3064 for( v = 0; v < nlinvars; ++v )
3079 for( t = 0; t < ntermvals; ++t )
3084 for( v = 0; v < ntermvars[t]; ++v )
3088 var = termvars[t][v];
3091 negated = negatedarrays[t][v];
3118 SCIP_Real*
const linvals,
3121 int*
const ntermvars,
3122 SCIP_Real*
const termvals,
3123 int const ntermvals,
3125 SCIP_Real
const lhs,
3126 SCIP_Real
const rhs,
3127 SCIP_Bool transformed,
3128 const char* multisymbol
3132 SCIP_Bool** negatedarrays;
3134 SCIP_Real* activelinvals;
3136 SCIP_Real activelinconstant;
3152 activelinconstant = 0.0;
3155 nactivelinvars = nlinvars;
3156 if( nactivelinvars > 0 )
3166 activelinvars =
NULL;
3167 activelinvals =
NULL;
3179 for( v = ntermvals - 1; v >= 0; --v )
3181 assert(ntermvars[v] > 0);
3201 activetermvars =
NULL;
3202 negatedarrays =
NULL;
3214 retcode =
printPBRow(
scip, file,
"=", activelinvars, activelinvals, nactivelinvars, activetermvars,
3215 ntermvars, termvals, ntermvals, negatedarrays, indvar, rhs - activelinconstant, &mult, multisymbol);
3222 retcode =
printPBRow(
scip, file,
">=", activelinvars, activelinvals, nactivelinvars, activetermvars,
3223 ntermvars, termvals, ntermvals, negatedarrays, indvar, lhs - activelinconstant, &mult, multisymbol);
3232 retcode =
printPBRow(
scip, file,
">=", activelinvars, activelinvals, nactivelinvars, activetermvars,
3233 ntermvars, termvals, ntermvals, negatedarrays, indvar, rhs - activelinconstant, &mult, multisymbol);
3243 for( v = 0; v < ntermvals; ++v )
3255 if( nactivelinvars > 0 )
3271 int* nsplitlinearconss
3275 const char* conshdlrname;
3285 *nsplitlinearconss = 0;
3288 for(
c = 0;
c < nconss; ++
c )
3297 if( strcmp(conshdlrname,
"linear") == 0 )
3300 ++(*nsplitlinearconss);
3303 ++(*nsplitlinearconss);
3308 if( strcmp(conshdlrname,
"varbound") == 0 )
3311 ++(*nsplitlinearconss);
3314 ++(*nsplitlinearconss);
3333 int const*
const nandvars,
3334 char const*
const multisymbol,
3335 SCIP_Bool
const existandconshdlr,
3336 SCIP_Bool
const existands,
3337 SCIP_Bool
const transformed
3341 const char* conshdlrname;
3344 SCIP_Real* consvals;
3364 if( conshdlr !=
NULL )
3381 for(
c = 0;
c < nindconss; ++
c )
3396 if( conshdlr !=
NULL )
3412 for(
c = 0;
c < npbconss; ++
c )
3430 SCIP_Bool pbhashmapcreated =
FALSE;
3431 SCIP_Bool indhashmapcreated =
FALSE;
3434 for(
c = 0;
c < nconss; ++
c )
3441 if( strcmp(conshdlrname,
"pseudoboolean") == 0 )
3443 if( !pbhashmapcreated )
3447 pbhashmapcreated =
TRUE;
3456 else if( strcmp(conshdlrname,
"indicator") == 0 )
3458 if( !indhashmapcreated )
3462 indhashmapcreated =
TRUE;
3496 if( linconssofpbsmap !=
NULL )
3498 if( artcons ==
NULL && linconssofindicatorsmap !=
NULL )
3501 if( artcons ==
NULL )
3503 if( strcmp(conshdlrname,
"linear") == 0 )
3510 0LL, transformed, multisymbol);
3519 else if( strcmp(conshdlrname,
"setppc") == 0 )
3530 andvars, nandvars, 0LL, transformed, multisymbol);
3535 consvars,
NULL, nconsvars, 1.0, 1.0, 0LL, transformed, multisymbol);
3543 0LL, transformed, multisymbol);
3556 0LL, transformed, multisymbol);
3566 else if( strcmp(conshdlrname,
"logicor") == 0 )
3572 resvars, nresvars, andvars, nandvars, 0LL, transformed, multisymbol);
3581 else if( strcmp(conshdlrname,
"knapsack") == 0 )
3583 SCIP_Longint* weights;
3591 for( v = 0; v < nconsvars; ++v )
3592 consvals[v] = (SCIP_Real)weights[v];
3598 0LL, transformed, multisymbol);
3608 else if( strcmp(conshdlrname,
"varbound") == 0 )
3633 else if( strcmp(conshdlrname,
"pseudoboolean") == 0 )
3639 SCIP_Real* andcoefs ;
3641 SCIP_Real* lincoefs ;
3647 assert(termvarssize >= 0);
3657 for( t = termvarssize - 1; t >= 0; --t )
3685 else if( strcmp(conshdlrname,
"indicator") == 0 )
3690 SCIP_Longint weight;
3721 SCIP_Real* scipvalslinear;
3740 for( v = 0; v < nconsvars; ++v )
3744 if( consvars[v] == slackvar )
3746 assert(nonbinarypos == -1);
3762 if( nonbinarypos == -1 )
3784 assert(0 <= nonbinarypos && nonbinarypos < nconsvars);
3788 consvars[nonbinarypos] = consvars[nconsvars];
3789 consvals[nonbinarypos] = consvals[nconsvars];
3795 resvars, nresvars, andvars, nandvars,
3796 weight, transformed, multisymbol);
3802 weight, transformed, multisymbol);
3811 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) );
3817 else if( strcmp(conshdlrname,
"and") == 0 )
3821 assert(existandconshdlr);
3837 SCIPerrorMessage(
"Cannot print constraint %s with non-integral coefficient or sides in opb-format\n",
3843 if( linconssofpbsmap !=
NULL )
3848 if( linconssofindicatorsmap !=
NULL )
3865 char const*
const multisymbol,
3866 SCIP_Bool
const transformed
3883 for( v = 0; v <
nvars; ++v )
3888 SCIP_Bool neg =
FALSE;
3904 assert(lb > -0.5 && ub < 1.5);
3909 if( lb > 0.5 || ub < 0.5 )
3939 int const*
const nandvars,
3941 char const*
const multisymbol,
3942 SCIP_Bool
const transformed
3946 SCIP_Longint rhslhs;
3963 for(
r = nresvars - 1;
r >= 0; --
r )
3971 resvar = resvars[
r];
3986 if( lb > 0.5 || ub < 0.5 )
4003 for( v = nandvars[
r] - 1; v >= 0; --v )
4020 if( lb > 0.5 || ub < 0.5 )
4037 for(
r = nresvars - 1;
r >= 0; --
r )
4040 resvar = resvars[
r];
4056 for( v = nandvars[
r] - 1; v >= 0; --v )
4072 else if( rhslhs == 1 )
4082 for( v = nandvars[
r] - 1; v >= 0; --v )
4106 SCIP_Bool firstprinted;
4108 firstprinted =
FALSE;
4113 for( v = nandvars[
r] - 1; v >= 0; --v )
4123 firstprinted =
TRUE;
4150 assert(pos >= 0 && nandvars[pos] > 0 && andvars[pos] !=
NULL);
4151 assert(andvars[pos][nandvars[pos] - 1] !=
NULL);
4160 for(
a = nandvars[pos] - 2;
a >= 0; --
a )
4202 SCIP_Bool transformed,
4206 SCIP_Real objoffset,
4214 int const*
const nandvars,
4215 SCIP_Bool
const existandconshdlr,
4216 SCIP_Bool
const existands,
4222 SCIP_Bool usesymbol;
4225 int nsplitlinearconss;
4243 SCIPinfoMessage(
scip, file,
"* Constraints : %d\n", nconss - nlinearconss + nsplitlinearconss);
4247 SCIPvarGetHashkey, SCIPvarIsHashkeyEq, SCIPvarGetHashkeyVal,
NULL) );
4251 objsense,
objscale, objoffset, multisymbol, existands, transformed) );
4254 retcode =
writeOpbConstraints(
scip, file, conss, nconss,
vars,
nvars, resvars, nresvars, andvars, nandvars,
4255 multisymbol, existandconshdlr, existands, transformed);
4257 if( existands && (retcode ==
SCIP_OKAY) )
4283 const char* filename,
4295 opbinput.file =
NULL;
4297 opbinput.linebuf[0] =
'\0';
4300 opbinput.token[0] =
'\0';
4302 opbinput.tokenbuf[0] =
'\0';
4308 opbinput.npushedtokens = 0;
4309 opbinput.linenumber = 1;
4310 opbinput.linepos = 0;
4312 opbinput.eof =
FALSE;
4313 opbinput.haserror =
FALSE;
4314 opbinput.nproblemcoeffs = 0;
4315 opbinput.wbo =
FALSE;
4317 opbinput.nindvars = 0;
4318#if GENCONSNAMES == TRUE
4319 opbinput.consnumber = 0;
4339 if( opbinput.nproblemcoeffs > 0 )
4341 SCIPwarningMessage(
scip,
"there might be <%d> coefficients or weight out of range!\n", opbinput.nproblemcoeffs);
4345 if( opbinput.haserror )
4362 SCIP_Bool transformed,
4366 SCIP_Real objoffset,
4377 SCIP_Bool genericnames,
4394 SCIP_Bool existands;
4395 SCIP_Bool existandconshdlr;
4410 for( v =
nvars - 1; v >= 0; --v )
4423 nvars, conss, nconss, resvars, nresvars, andvars, nandvars, existandconshdlr, existands,
result);
4434 for( v =
nvars - 1; v >= 0; --v )
4461 for( v = nfixedvars - 1; v >= 0; --v )
4490 for( v =
nvars - 1; v >= 0; --v )
4502 nvars, conss, nconss, resvars, nresvars, andvars, nandvars, existandconshdlr, existands,
result);
4513 for( v = nresvars - 1; v >= 0; --v )
4568 nvars,
nbinvars,
nintvars, nimplvars, ncontvars, fixedvars, nfixedvars, conss, nconss, genericnames,
result) );
4594 "reading/" READER_NAME "/dynamicconss",
"should model constraints be subject to aging?",
4597 "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 SCIPgetNAndsPseudoboolean(SCIP *const scip, SCIP_CONS *const cons)
int SCIPgetNLinVarsWithoutAndPseudoboolean(SCIP *const scip, SCIP_CONS *const cons)
int SCIPgetNVarsAnd(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPgetLinDatasWithoutAndPseudoboolean(SCIP *const scip, SCIP_CONS *const cons, SCIP_VAR **const linvars, SCIP_Real *const lincoefs, int *const nlinvars)
SCIP_Real * SCIPgetValsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetLhsPseudoboolean(SCIP *const scip, SCIP_CONS *const 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_RETCODE SCIPgetAndDatasPseudoboolean(SCIP *const scip, SCIP_CONS *const cons, SCIP_CONS **const andconss, SCIP_Real *const andcoefs, int *const nandconss)
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_Real SCIPgetRhsPseudoboolean(SCIP *const scip, SCIP_CONS *const cons)
@ 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_RETCODE SCIPgetBinvarRepresentatives(SCIP *scip, int nvars, SCIP_VAR **vars, SCIP_VAR **repvars, SCIP_Bool *negated)
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
#define BMSclearMemoryArray(ptr, num)
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_RETCODE printPseudobooleanCons(SCIP *const scip, FILE *const file, SCIP_VAR **const linvars, SCIP_Real *const linvals, int const nlinvars, SCIP_VAR ***const termvars, int *const ntermvars, SCIP_Real *const termvals, int const ntermvals, SCIP_VAR *const indvar, SCIP_Real const lhs, SCIP_Real const rhs, SCIP_Bool transformed, const char *multisymbol)
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 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_RETCODE printPBRow(SCIP *const scip, FILE *const file, const char *type, SCIP_VAR **const linvars, SCIP_Real *const linvals, int const nlinvars, SCIP_VAR ***const termvars, int *const ntermvars, SCIP_Real *const termvals, int const ntermvals, SCIP_Bool **const negatedarrays, SCIP_VAR *const indvar, SCIP_Real lhs, SCIP_Longint *mult, const char *multisymbol)
static SCIP_Bool isSense(OPBINPUT *opbinput, OPBSENSE *sense)
static void determineTotalNumberLinearConss(SCIP *const scip, SCIP_CONS **const conss, int const nconss, int *nlinearconss, int *nsplitlinearconss)
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