67#if !defined(_WIN32) && !defined(_WIN64)
71#define READER_NAME "pipreader"
72#define READER_DESC "file reader for polynomial mixed-integer programs in PIP format"
73#define READER_EXTENSION "pip"
79#define PIP_MAX_LINELEN 65536
80#define PIP_MAX_PUSHEDTOKENS 2
81#define PIP_INIT_MONOMIALSSIZE 128
82#define PIP_INIT_FACTORSSIZE 16
83#define PIP_MAX_PRINTLEN 561
84#define PIP_MAX_NAMELEN 256
85#define PIP_PRINTLEN 100
132 SCIP_Bool initialconss;
133 SCIP_Bool dynamicconss;
134 SCIP_Bool dynamiccols;
135 SCIP_Bool dynamicrows;
162 SCIPerrorMessage(
"Syntax error in line %d: %s ('%s')\n", pipinput->linenumber, msg, pipinput->token);
163 if( pipinput->linebuf[strlen(pipinput->linebuf)-1] ==
'\n' )
171 (void)
SCIPsnprintf(formatstr, 256,
" %%%ds\n", pipinput->linepos);
174 pipinput->haserror =
TRUE;
185 return pipinput->haserror;
219 if( isdigit((
unsigned char)
c) )
221 else if( (*exptype ==
PIP_EXP_NONE) && !(*hasdot) && (
c ==
'.') && isdigit((
unsigned char)nextc) )
226 else if( !firstchar && (*exptype ==
PIP_EXP_NONE) && (
c ==
'e' ||
c ==
'E') )
228 if( nextc ==
'+' || nextc ==
'-' )
233 else if( isdigit((
unsigned char)nextc) )
266 pipinput->linepos = 0;
268 if(
SCIPfgets(pipinput->linebuf, (
int)
sizeof(pipinput->linebuf), pipinput->file) ==
NULL )
270 pipinput->linenumber++;
274 pipinput->haserror =
TRUE;
285 if( commentstart !=
NULL )
287 *commentstart =
'\0';
288 *(commentstart+1) =
'\0';
305 *pointer1 = *pointer2;
325 if( pipinput->npushedtokens > 0 )
327 swapPointers(&pipinput->token, &pipinput->pushedtokens[pipinput->npushedtokens-1]);
328 pipinput->npushedtokens--;
329 SCIPdebugMsg(
scip,
"(line %d) read token again: '%s'\n", pipinput->linenumber, pipinput->token);
334 buf = pipinput->linebuf;
337 if( buf[pipinput->linepos] ==
'\0' )
345 assert(pipinput->linepos == 0);
356 if(
isValueChar(buf[pipinput->linepos], buf[pipinput->linepos+1],
TRUE, &hasdot, &exptype) )
364 pipinput->token[tokenlen] = buf[pipinput->linepos];
368 while(
isValueChar(buf[pipinput->linepos], buf[pipinput->linepos+1],
FALSE, &hasdot, &exptype) );
377 pipinput->token[tokenlen] = buf[pipinput->linepos];
380 if( tokenlen == 1 &&
isTokenChar(pipinput->token[0]) )
389 && (pipinput->token[tokenlen-1] ==
'<' || pipinput->token[tokenlen-1] ==
'>' || pipinput->token[tokenlen-1] ==
'=')
390 && buf[pipinput->linepos] ==
'=' )
394 else if( pipinput->token[tokenlen-1] ==
'=' && (buf[pipinput->linepos] ==
'<' || buf[pipinput->linepos] ==
'>') )
396 pipinput->token[tokenlen-1] = buf[pipinput->linepos];
401 pipinput->token[tokenlen] =
'\0';
403 SCIPdebugMsg(
scip,
"(line %d) read token: '%s'\n", pipinput->linenumber, pipinput->token);
417 swapPointers(&pipinput->pushedtokens[pipinput->npushedtokens], &pipinput->token);
418 pipinput->npushedtokens++;
430 swapPointers(&pipinput->pushedtokens[pipinput->npushedtokens], &pipinput->tokenbuf);
431 pipinput->npushedtokens++;
463 iscolon = (strcmp(pipinput->token,
":") == 0);
474 if( strcasecmp(pipinput->token,
"MINIMIZE") == 0
475 || strcasecmp(pipinput->token,
"MINIMUM") == 0
476 || strcasecmp(pipinput->token,
"MIN") == 0 )
478 SCIPdebugMsg(
scip,
"(line %d) new section: OBJECTIVE\n", pipinput->linenumber);
484 if( strcasecmp(pipinput->token,
"MAXIMIZE") == 0
485 || strcasecmp(pipinput->token,
"MAXIMUM") == 0
486 || strcasecmp(pipinput->token,
"MAX") == 0 )
488 SCIPdebugMsg(
scip,
"(line %d) new section: OBJECTIVE\n", pipinput->linenumber);
494 if( strcasecmp(pipinput->token,
"SUBJECT") == 0 )
500 if( strcasecmp(pipinput->token,
"TO") == 0 )
502 SCIPdebugMsg(
scip,
"(line %d) new section: CONSTRAINTS\n", pipinput->linenumber);
512 if( strcasecmp(pipinput->token,
"SUCH") == 0 )
518 if( strcasecmp(pipinput->token,
"THAT") == 0 )
520 SCIPdebugMsg(
scip,
"(line %d) new section: CONSTRAINTS\n", pipinput->linenumber);
530 if( strcasecmp(pipinput->token,
"st") == 0
531 || strcasecmp(pipinput->token,
"S.T.") == 0
532 || strcasecmp(pipinput->token,
"ST.") == 0 )
534 SCIPdebugMsg(
scip,
"(line %d) new section: CONSTRAINTS\n", pipinput->linenumber);
539 if( strcasecmp(pipinput->token,
"BOUNDS") == 0
540 || strcasecmp(pipinput->token,
"BOUND") == 0 )
542 SCIPdebugMsg(
scip,
"(line %d) new section: BOUNDS\n", pipinput->linenumber);
547 if( strcasecmp(pipinput->token,
"GENERAL") == 0
548 || strcasecmp(pipinput->token,
"GENERALS") == 0
549 || strcasecmp(pipinput->token,
"GEN") == 0
550 || strcasecmp(pipinput->token,
"INTEGER") == 0
551 || strcasecmp(pipinput->token,
"INTEGERS") == 0
552 || strcasecmp(pipinput->token,
"INT") == 0 )
554 SCIPdebugMsg(
scip,
"(line %d) new section: GENERALS\n", pipinput->linenumber);
559 if( strcasecmp(pipinput->token,
"BINARY") == 0
560 || strcasecmp(pipinput->token,
"BINARIES") == 0
561 || strcasecmp(pipinput->token,
"BIN") == 0 )
563 SCIPdebugMsg(
scip,
"(line %d) new section: BINARIES\n", pipinput->linenumber);
568 if( strcasecmp(pipinput->token,
"END") == 0 )
587 assert(*sign == +1 || *sign == -1);
589 if( pipinput->token[1] ==
'\0' )
591 if( *pipinput->token ==
'+' )
593 else if( *pipinput->token ==
'-' )
614 if( strcasecmp(pipinput->token,
"INFINITY") == 0 || strcasecmp(pipinput->token,
"INF") == 0 )
624 val = strtod(pipinput->token, &endptr);
625 if( endptr != pipinput->token && *endptr ==
'\0' )
644 if( strcmp(pipinput->token,
"<") == 0 )
650 else if( strcmp(pipinput->token,
">") == 0 )
656 else if( strcmp(pipinput->token,
"=") == 0 )
671 SCIP_Bool dynamiccols,
696 if( created !=
NULL )
699 else if( created !=
NULL )
731 SCIP_Real** monomialscoef,
742 assert(*monomials !=
NULL || *monomialssize == 0);
744 if( minnmonomials <= *monomialssize )
749 if( *monomials !=
NULL )
757 if( *monomialscoef !=
NULL )
765 *monomialssize = newsize;
775 SCIP_Real** exponents,
786 assert(*exponents !=
NULL || *factorssize == 0);
789 if( minnfactors <= *factorssize )
794 if( *exponents !=
NULL )
804 *factorssize = newsize;
818 SCIP_Bool* newsection
833 SCIP_Real* monomialscoef;
839 SCIP_Real* exponents;
869 if( strcmp(pipinput->token,
":") == 0 )
873 SCIPdebugMsg(
scip,
"(line %d) read constraint name: '%s'\n", pipinput->linenumber, name);
914 SCIP_Bool isnewsection;
921 ((nfactors > 0 || havevalue) && (issign =
isSign(pipinput, &nextcoefsign))) )
926 if( coefsign * coef != 0.0 )
930 monomialscoef[nmonomials] = coefsign * coef;
936 constant += coefsign * coef;
939 if( monomialdegree > 1 )
965 coefsign = nextcoefsign;
966 SCIPdebugMsg(
scip,
"(line %d) read coefficient sign: %+d\n", pipinput->linenumber, coefsign);
974 if(
isSign(pipinput, &coefsign) )
976 SCIPdebugMsg(
scip,
"(line %d) read coefficient sign: %+d\n", pipinput->linenumber, coefsign);
978 if( nfactors > 0 || havevalue )
980 syntaxError(
scip, pipinput,
"sign can only be at beginning of monomial");
981 goto TERMINATE_READPOLYNOMIAL;
989 if( strcmp(pipinput->token,
"*") == 0 )
993 syntaxError(
scip, pipinput,
"cannot have '*' before first variable in monomial");
994 goto TERMINATE_READPOLYNOMIAL;
1001 if( nmonomials > 0 && !havesign )
1003 syntaxError(
scip, pipinput,
"expected sign ('+' or '-') or sense ('<' or '>')");
1004 goto TERMINATE_READPOLYNOMIAL;
1008 if( strcmp(pipinput->token,
"^") == 0 )
1013 goto TERMINATE_READPOLYNOMIAL;
1017 syntaxError(
scip, pipinput,
"cannot have '^' before first variable in monomial");
1018 goto TERMINATE_READPOLYNOMIAL;
1020 exponents[nfactors-1] = exponent;
1022 monomialdegree += (int)exponent - 1;
1026 SCIPdebugMsg(
scip,
"(line %d) read exponent value %g for variable %s\n", pipinput->linenumber, exponent,
1034 SCIPdebugMsg(
scip,
"(line %d) read coefficient value: %g with sign %+d\n", pipinput->linenumber, coef, coefsign);
1039 goto TERMINATE_READPOLYNOMIAL;
1044 syntaxError(
scip, pipinput,
"coefficients can only be at the beginning of a monomial");
1045 goto TERMINATE_READPOLYNOMIAL;
1060 exponents[nfactors] = 1.0;
1067 syntaxError(
scip, pipinput,
"string ended before monomial has finished");
1068 goto TERMINATE_READPOLYNOMIAL;
1075 for(
i = 0;
i < nmonomials; ++
i )
1087 TERMINATE_READPOLYNOMIAL:
1106 SCIP_Bool newsection;
1113 SCIP_Bool modifiable;
1115 SCIP_Bool removable;
1143 if( constant != 0.0 )
1207 SCIP_CALL(
SCIPcreateConsNonlinear(
scip, &nonlinobjcons,
"nonlinobj", expr, lhs, rhs, initial, separate, enforce, check,
propagate, local, modifiable, dynamic, removable) );
1240 SCIP_Real sidevalue;
1243 SCIP_Bool newsection;
1250 SCIP_Bool modifiable;
1252 SCIP_Bool removable;
1264 syntaxError(
scip, pipinput,
"expected constraint sense '<=', '=', or '>='");
1274 if ( !
isSense(pipinput, &sense) )
1276 syntaxError(
scip, pipinput,
"expected constraint sense '<=', '=', or '>='");
1287 if (
isSign(pipinput, &sidesign) )
1300 sidevalue *= sidesign;
1303 initial = pipinput->initialconss;
1310 dynamic = pipinput->dynamicconss;
1311 removable = pipinput->dynamicrows;
1351 for(
i = 0;
i < nchildren; ++
i )
1368 SCIP_CALL(
SCIPcreateConsLinear(
scip, &cons, name, nchildren,
vars, coefs, lhs, rhs, initial, separate, enforce,
1369 check,
propagate, local, modifiable, dynamic, removable,
FALSE) );
1376 SCIP_CALL(
SCIPcreateConsNonlinear(
scip, &cons, name, expr, lhs, rhs, initial, separate, enforce, check,
propagate,
1377 local, modifiable, dynamic, removable) );
1383 SCIPdebugMsg(
scip,
"(line %d) created constraint: ", pipinput->linenumber);
1426 hassign =
isSign(pipinput, &sign);
1439 syntaxError(
scip, pipinput,
"expected bound sense '<=', '=', or '>='");
1483 if(
isSense(pipinput, &rightsense) )
1498 hassign =
isSign(pipinput, &sign);
1513 switch( rightsense )
1537 else if( strcasecmp(pipinput->token,
"FREE") == 0 )
1541 syntaxError(
scip, pipinput,
"variable with bound is marked as 'free'");
1580 SCIP_Bool infeasible;
1615 SCIP_Bool infeasible;
1651 const char* filename
1657 pipinput->file =
SCIPfopen(filename,
"r");
1658 if( pipinput->file ==
NULL )
1672 switch( pipinput->section )
1747 SCIP_Real* constant,
1748 SCIP_Bool transformed
1766 if( requiredsize > *
nvars )
1784 for( v = 0; v < *
nvars; ++v )
1794 *constant += (*scalars)[v];
1795 (*scalars)[v] *= -1.0;
1886 linebuffer[0] =
'\0';
1903 if( (*linecnt) > 0 )
1905 linebuffer[(*linecnt)] =
'\0';
1919 const char* extension
1932 (void) strncat(linebuffer, extension,
PIP_MAX_PRINTLEN - strlen(linebuffer));
1934 (*linecnt) += (int) strlen(extension);
1936 SCIPdebugMsg(
scip,
"linebuffer <%s>, length = %lu\n", linebuffer, (
unsigned long)strlen(linebuffer));
1948 const char* rowname,
1949 const char* rownameextension,
1956 SCIP_Bool transformed
1969 assert( strcmp(type,
"=") == 0 || strcmp(type,
"<=") == 0 || strcmp(type,
">=") == 0 );
1978 if ( strlen(rowname) > 0 || strlen(rownameextension) > 0 )
1985 for( v = 0; v < nlinvars; ++v )
2006 if( quadexpr !=
NULL )
2010 SCIP_Real* activevals;
2011 SCIP_Real* lincoefs;
2013 SCIP_Real activeconstant = 0.0;
2014 int nbilinexprterms;
2026 nactivevars = nlinexprs;
2028 for( v = 0; v < nlinexprs; ++v )
2039 constant += activeconstant;
2042 for( v = 0; v < nactivevars; ++v )
2049 var = activevars[v];
2071 for( v = 0; v < nquadexprs; ++v )
2085 if( lincoef == 0.0 )
2099 for( v = 0; v < nquadexprs; ++v )
2113 if( sqrcoef == 0.0 )
2127 for( v = 0; v < nbilinexprterms; ++v )
2133 SCIP_Real bilincoef;
2204 else if( coef == 1.0 && needsign )
2208 else if( coef == -1.0 )
2270 const char* rowname,
2271 const char* rownameextension,
2283 assert(strcmp(type,
"=") == 0 || strcmp(type,
"<=") == 0 || strcmp(type,
">=") == 0);
2292 if( strlen(rowname) > 0 || strlen(rownameextension) > 0 )
2301 SCIP_Bool needsign =
FALSE;
2338 const char* rowname,
2356 if( strlen(rowname) > 0 )
2386 const char* rowname,
2393 SCIP_Bool transformed
2398 SCIP_Real* activevals =
NULL;
2400 SCIP_Real activeconstant = 0.0;
2412 nactivevars = nlinvars;
2417 if( linvals !=
NULL )
2425 for( v = 0; v < nactivevars; ++v )
2426 activevals[v] = 1.0;
2440 rhs - activeconstant, transformed) );
2448 activevals, nactivevars, quadexpr, lhs - activeconstant, transformed) );
2454 activevals, nactivevars, quadexpr, rhs - activeconstant, transformed) );
2473 const char* rowname,
2517 int* nAggregatedVars,
2525 for (j = 0; j <
nvars; ++j)
2542 (*aggregatedVars)[(*nAggregatedVars)++] =
var;
2557 SCIP_Bool transformed,
2559 int nAggregatedVars,
2566 SCIP_Real* activevals;
2568 SCIP_Real activeconstant = 0.0;
2577 for (j = 0; j < nAggregatedVars; ++j)
2582 activevars[0] = aggregatedVars[j];
2583 activevals[0] = 1.0;
2584 activeconstant = 0.0;
2589 activevals[nactivevars] = -1.0;
2590 activevars[nactivevars] = aggregatedVars[j];
2595 SCIP_CALL(
printRow(
scip, file, consname,
"",
"=", activevars, activevals, nactivevars,
NULL, - activeconstant,
2629 if( isdigit(name[0]) )
2632 for(
i = 0;
i < len; ++
i )
2635 if( isalnum(name[
i]) )
2663 for( v = 0; v <
nvars; ++v )
2679 SCIP_Bool transformed
2685 const char* conshdlrname;
2690 for(
c = 0;
c < nconss; ++
c )
2711 if( strcmp(conshdlrname,
"linear") == 0 )
2734 SCIP_Bool transformed,
2738 SCIP_Real objoffset,
2760 const char* conshdlrname;
2769 int nAggregatedVars;
2776 SCIP_Real* consvals;
2785 nAggregatedVars = 0;
2798 SCIPinfoMessage(
scip, file,
"\\ Variables : %d (%d binary, %d integer, %d implicit integer, %d continuous)\n",
2808 for (v = 0; v <
nvars; ++v)
2849 for (
c = 0;
c < nconss; ++
c)
2864 if( strcmp(conshdlrname,
"linear") == 0 )
2870 else if( strcmp(conshdlrname,
"setppc") == 0 )
2879 consvars,
NULL, nconsvars,
NULL, 1.0, 1.0, transformed) );
2891 else if ( strcmp(conshdlrname,
"logicor") == 0 )
2897 else if ( strcmp(conshdlrname,
"knapsack") == 0 )
2899 SCIP_Longint* weights;
2907 for( v = 0; v < nconsvars; ++v )
2908 consvals[v] = (SCIP_Real)weights[v];
2915 else if ( strcmp(conshdlrname,
"varbound") == 0 )
2932 else if( strcmp(conshdlrname,
"nonlinear") == 0 )
2934 SCIP_Bool ispolynomial;
2935 SCIP_Bool isquadratic;
2946 SCIP_Bool infeasible;
2984 consNonlinear[nConsNonlinear++] = cons;
2986 if( simplifiedexpr !=
NULL )
2991 else if( strcmp(conshdlrname,
"and") == 0 )
2995 consAnd[nConsAnd++] = cons;
3011 for(
c = 0;
c < nConsNonlinear; ++
c )
3019 if( ntmpvars > tmpvarssize )
3031 for (
c = 0;
c < nConsAnd; ++
c)
3048 for (v = 0; v <
nvars; ++v)
3097 for (v = 0; v < nAggregatedVars; ++v)
3099 var = aggregatedVars[v];
3117 for (v = 0; v <
nvars; ++v)
3138 for (v = 0; v <
nvars; ++v)
3234 const char* filename,
3246 pipinput.file =
NULL;
3247 pipinput.linebuf[0] =
'\0';
3248 pipinput.probname[0] =
'\0';
3249 pipinput.objname[0] =
'\0';
3251 pipinput.token[0] =
'\0';
3253 pipinput.tokenbuf[0] =
'\0';
3259 pipinput.npushedtokens = 0;
3260 pipinput.linenumber = 0;
3261 pipinput.linepos = 0;
3264 pipinput.haserror =
FALSE;
3286 if( pipinput.haserror )
Constraint handler for AND 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 nonlinear constraints specified by algebraic expressions
Constraint handler for the set partitioning / packing / covering constraints .
Constraint handler for variable bound constraints .
variable expression handler
SCIP_FILE * SCIPfopen(const char *path, const char *mode)
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_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 ** SCIPgetVarsSetppc(SCIP *scip, SCIP_CONS *cons)
SCIP_EXPR * SCIPgetExprNonlinear(SCIP_CONS *cons)
SCIP_Real SCIPgetRhsNonlinear(SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateConsNonlinear(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_EXPR *expr, 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_VAR * SCIPgetVarVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_Longint * SCIPgetWeightsKnapsack(SCIP *scip, 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_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_Real SCIPgetLhsNonlinear(SCIP_CONS *cons)
@ SCIP_SETPPCTYPE_PARTITIONING
@ SCIP_SETPPCTYPE_COVERING
@ SCIP_SETPPCTYPE_PACKING
SCIP_RETCODE SCIPcreateExprVar(SCIP *scip, SCIP_EXPR **expr, SCIP_VAR *var, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
void SCIPsetConstantExprSum(SCIP_EXPR *expr, SCIP_Real constant)
SCIP_RETCODE SCIPappendExprSumExpr(SCIP *scip, SCIP_EXPR *expr, SCIP_EXPR *child, SCIP_Real childcoef)
SCIP_RETCODE SCIPcreateExprSum(SCIP *scip, SCIP_EXPR **expr, int nchildren, SCIP_EXPR **children, SCIP_Real *coefficients, SCIP_Real constant, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
SCIP_RETCODE SCIPwritePip(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_CONS **conss, int nconss, SCIP_RESULT *result)
SCIP_RETCODE SCIPreadPip(SCIP *scip, SCIP_READER *reader, const char *filename, SCIP_RESULT *result)
SCIP_RETCODE SCIPincludeReaderPip(SCIP *scip)
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPsetObjsense(SCIP *scip, SCIP_OBJSENSE objsense)
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)
int SCIPgetNTotalVars(SCIP *scip)
SCIP_VAR * SCIPfindVar(SCIP *scip, const char *name)
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,...)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPgetConsNVars(SCIP *scip, SCIP_CONS *cons, int *nvars, SCIP_Bool *success)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
SCIP_RETCODE SCIPprintCons(SCIP *scip, SCIP_CONS *cons, FILE *file)
SCIP_Bool SCIPconsIsTransformed(SCIP_CONS *cons)
SCIP_RETCODE SCIPgetConsVars(SCIP *scip, SCIP_CONS *cons, SCIP_VAR **vars, int varssize, SCIP_Bool *success)
SCIP_Bool SCIPconsIsEnabled(SCIP_CONS *cons)
const char * SCIPconsGetName(SCIP_CONS *cons)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
SCIP_RETCODE SCIPcreateExprMonomial(SCIP *scip, SCIP_EXPR **expr, int nfactors, SCIP_VAR **vars, SCIP_Real *exponents, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
int SCIPexprGetNChildren(SCIP_EXPR *expr)
void SCIPexprGetQuadraticBilinTerm(SCIP_EXPR *expr, int termidx, SCIP_EXPR **expr1, SCIP_EXPR **expr2, SCIP_Real *coef, int *pos2, SCIP_EXPR **prodexpr)
SCIP_Real SCIPgetExponentExprPow(SCIP_EXPR *expr)
SCIP_Bool SCIPisExprProduct(SCIP *scip, SCIP_EXPR *expr)
SCIP_Bool SCIPisExprSum(SCIP *scip, SCIP_EXPR *expr)
SCIP_Bool SCIPexprAreQuadraticExprsVariables(SCIP_EXPR *expr)
void SCIPexprGetQuadraticData(SCIP_EXPR *expr, SCIP_Real *constant, int *nlinexprs, SCIP_EXPR ***linexprs, SCIP_Real **lincoefs, int *nquadexprs, int *nbilinexprs, SCIP_Real **eigenvalues, SCIP_Real **eigenvectors)
SCIP_Real * SCIPgetCoefsExprSum(SCIP_EXPR *expr)
SCIP_Bool SCIPisExprValue(SCIP *scip, SCIP_EXPR *expr)
SCIP_Real SCIPgetCoefExprProduct(SCIP_EXPR *expr)
SCIP_RETCODE SCIPreleaseExpr(SCIP *scip, SCIP_EXPR **expr)
SCIP_Bool SCIPisExprVar(SCIP *scip, SCIP_EXPR *expr)
SCIP_RETCODE SCIPprintExpr(SCIP *scip, SCIP_EXPR *expr, FILE *file)
SCIP_Real SCIPgetValueExprValue(SCIP_EXPR *expr)
SCIP_Bool SCIPisExprPower(SCIP *scip, SCIP_EXPR *expr)
SCIP_RETCODE SCIPcheckExprQuadratic(SCIP *scip, SCIP_EXPR *expr, SCIP_Bool *isquadratic)
SCIP_EXPR ** SCIPexprGetChildren(SCIP_EXPR *expr)
SCIP_Real SCIPgetConstantExprSum(SCIP_EXPR *expr)
SCIP_VAR * SCIPgetVarExprVar(SCIP_EXPR *expr)
void SCIPexprGetQuadraticQuadTerm(SCIP_EXPR *quadexpr, int termidx, SCIP_EXPR **expr, SCIP_Real *lincoef, SCIP_Real *sqrcoef, int *nadjbilin, int **adjbilin, SCIP_EXPR **sqrexpr)
SCIP_RETCODE SCIPduplicateExpr(SCIP *scip, SCIP_EXPR *expr, SCIP_EXPR **copyexpr, SCIP_DECL_EXPR_MAPEXPR((*mapexpr)), void *mapexprdata, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
SCIP_RETCODE SCIPsimplifyExpr(SCIP *scip, SCIP_EXPR *rootexpr, SCIP_EXPR **simplified, SCIP_Bool *changed, SCIP_Bool *infeasible, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPreallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPduplicateBufferArray(scip, ptr, source, num)
#define SCIPallocBlockMemoryArray(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_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisIntegral(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisInfinity(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_VAR * SCIPvarGetNegatedVar(SCIP_VAR *var)
SCIP_RETCODE SCIPchgVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbOriginal(SCIP_VAR *var)
SCIP_RETCODE SCIPchgVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
int SCIPvarGetIndex(SCIP_VAR *var)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbOriginal(SCIP_VAR *var)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
SCIP_RETCODE SCIPchgVarType(SCIP *scip, SCIP_VAR *var, SCIP_VARTYPE vartype, SCIP_Bool *infeasible)
SCIP_Real SCIPvarGetLbLocal(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_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_RETCODE SCIPcreateVarBasic(SCIP *scip, SCIP_VAR **var, const char *name, SCIP_Real lb, SCIP_Real ub, SCIP_Real obj, SCIP_VARTYPE vartype)
SCIP_RETCODE SCIPchgVarObj(SCIP *scip, SCIP_VAR *var, SCIP_Real newobj)
int SCIPsnprintf(char *t, int len, const char *s,...)
void SCIPprintSysError(const char *message)
int SCIPstrncpy(char *t, const char *s, int size)
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
public functions to work with algebraic expressions
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
public methods for NLP management
public methods for input file readers
public methods for problem variables
static SCIP_Bool isExprSignomial(SCIP *scip, SCIP_EXPR *expr)
static SCIP_RETCODE getActiveVariables(SCIP *scip, SCIP_VAR ***vars, SCIP_Real **scalars, int *nvars, SCIP_Real *constant, SCIP_Bool transformed)
static SCIP_RETCODE readPolynomial(SCIP *scip, PIPINPUT *pipinput, char *name, SCIP_EXPR **expr, SCIP_Bool *islinear, SCIP_Bool *newsection)
#define PIP_MAX_PUSHEDTOKENS
static SCIP_RETCODE getVariable(SCIP *scip, char *name, SCIP_Bool dynamiccols, SCIP_VAR **var, SCIP_Bool *created)
static void clearLine(char *linebuffer, int *linecnt)
static SCIP_Bool hasError(PIPINPUT *pipinput)
static SCIP_Bool isNewSection(SCIP *scip, PIPINPUT *pipinput)
static SCIP_Bool getNextToken(SCIP *scip, PIPINPUT *pipinput)
static SCIP_RETCODE readGenerals(SCIP *scip, PIPINPUT *pipinput)
static SCIP_RETCODE readStart(SCIP *scip, PIPINPUT *pipinput)
static SCIP_Bool isExprPolynomial(SCIP *scip, SCIP_EXPR *expr)
static const char tokenchars[]
static SCIP_Bool isSign(PIPINPUT *pipinput, int *sign)
static SCIP_Bool getNextLine(SCIP *scip, PIPINPUT *pipinput)
static const char commentchars[]
static void checkVarnames(SCIP *scip, SCIP_VAR **vars, int nvars)
static SCIP_RETCODE ensureMonomialsSize(SCIP *scip, SCIP_EXPR ***monomials, SCIP_Real **monomialscoef, int *monomialssize, int minnmonomials)
static void printSignomial(SCIP *scip, FILE *file, char *linebuffer, int *linecnt, SCIP_EXPR *expr, SCIP_Real coef, SCIP_Bool needsign)
static const char namechars[]
static SCIP_RETCODE printAggregatedCons(SCIP *scip, FILE *file, SCIP_Bool transformed, int nvars, int nAggregatedVars, SCIP_VAR **aggregatedVars)
static SCIP_Bool isNameValid(const char *name)
static void swapTokenBuffer(PIPINPUT *pipinput)
static SCIP_Bool isValueChar(char c, char nextc, SCIP_Bool firstchar, SCIP_Bool *hasdot, PIPEXPTYPE *exptype)
static SCIP_RETCODE printNonlinearCons(SCIP *scip, FILE *file, const char *rowname, SCIP_EXPR *expr, SCIP_Real lhs, SCIP_Real rhs)
static SCIP_RETCODE collectAggregatedVars(int nvars, SCIP_VAR **vars, int *nAggregatedVars, SCIP_VAR ***aggregatedVars, SCIP_HASHTABLE **varAggregated)
static SCIP_RETCODE printQuadraticCons(SCIP *scip, FILE *file, const char *rowname, SCIP_VAR **linvars, SCIP_Real *linvals, int nlinvars, SCIP_EXPR *quadexpr, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool transformed)
static SCIP_RETCODE readBinaries(SCIP *scip, PIPINPUT *pipinput)
enum PipSection PIPSECTION
#define PIP_INIT_MONOMIALSSIZE
static SCIP_Bool isSense(PIPINPUT *pipinput, PIPSENSE *sense)
static void pushBufferToken(PIPINPUT *pipinput)
static void endLine(SCIP *scip, FILE *file, char *linebuffer, int *linecnt)
static void pushToken(PIPINPUT *pipinput)
static void syntaxError(SCIP *scip, PIPINPUT *pipinput, const char *msg)
static void printRowAnd(SCIP *scip, FILE *file, const char *rowname, SCIP_CONS *cons)
#define PIP_INIT_FACTORSSIZE
static SCIP_Bool isDelimChar(char c)
static SCIP_RETCODE readConstraints(SCIP *scip, PIPINPUT *pipinput)
static void swapPointers(char **pointer1, char **pointer2)
static void printRowNl(SCIP *scip, FILE *file, const char *rowname, const char *rownameextension, const char *type, SCIP_EXPR *expr, SCIP_Real rhs)
enum PipExpType PIPEXPTYPE
static SCIP_RETCODE printRow(SCIP *scip, FILE *file, const char *rowname, const char *rownameextension, const char *type, SCIP_VAR **linvars, SCIP_Real *linvals, int nlinvars, SCIP_EXPR *quadexpr, SCIP_Real rhs, SCIP_Bool transformed)
static SCIP_RETCODE readObjective(SCIP *scip, PIPINPUT *pipinput)
static SCIP_RETCODE ensureFactorsSize(SCIP *scip, SCIP_VAR ***vars, SCIP_Real **exponents, int *factorssize, int minnfactors)
static SCIP_Bool isValue(SCIP *scip, PIPINPUT *pipinput, SCIP_Real *value)
static void checkConsnames(SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_Bool transformed)
static SCIP_RETCODE readPIPFile(SCIP *scip, PIPINPUT *pipinput, const char *filename)
static const char delimchars[]
static void appendLine(SCIP *scip, FILE *file, char *linebuffer, int *linecnt, const char *extension)
static SCIP_RETCODE readBounds(SCIP *scip, PIPINPUT *pipinput)
static SCIP_Bool isTokenChar(char c)
file reader for polynomial mixed-integer programs in PIP 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 SCIP variables
#define SCIP_DECL_HASHKEYEQ(x)
#define SCIP_DECL_HASHGETKEY(x)
#define SCIP_DECL_HASHKEYVAL(x)
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_VARTYPE_CONTINUOUS
@ SCIP_VARSTATUS_ORIGINAL
@ SCIP_VARSTATUS_MULTAGGR
@ SCIP_VARSTATUS_AGGREGATED
enum SCIP_Varstatus SCIP_VARSTATUS