27 #if defined(_WIN32) || defined(_WIN64) 46 #define READER_NAME "pipreader" 47 #define READER_DESC "file reader for polynomial mixed-integer programs in PIP format" 48 #define READER_EXTENSION "pip" 54 #define PIP_MAX_LINELEN 65536 55 #define PIP_MAX_PUSHEDTOKENS 2 56 #define PIP_INIT_VARSSIZE 256 57 #define PIP_INIT_MONOMIALSSIZE 128 58 #define PIP_INIT_FACTORSSIZE 16 59 #define PIP_MAX_PRINTLEN 561 60 #define PIP_MAX_NAMELEN 256 61 #define PIP_PRINTLEN 100 135 assert(pipinput !=
NULL);
137 SCIPerrorMessage(
"Syntax error in line %d: %s ('%s')\n", pipinput->linenumber, msg, pipinput->token);
138 if( pipinput->linebuf[strlen(pipinput->linebuf)-1] ==
'\n' )
146 (void)
SCIPsnprintf(formatstr, 256,
" %%%ds\n", pipinput->linepos);
149 pipinput->haserror =
TRUE;
158 assert(pipinput !=
NULL);
160 return pipinput->haserror;
191 assert(hasdot !=
NULL);
192 assert(exptype !=
NULL);
194 if( isdigit((
unsigned char)c) )
196 else if( (*exptype ==
PIP_EXP_NONE) && !(*hasdot) && (c ==
'.') && isdigit((
unsigned char)nextc) )
201 else if( !firstchar && (*exptype ==
PIP_EXP_NONE) && (c ==
'e' || c ==
'E') )
203 if( nextc ==
'+' || nextc ==
'-' )
208 else if( isdigit((
unsigned char)nextc) )
234 assert(pipinput !=
NULL);
240 pipinput->linepos = 0;
242 if(
SCIPfgets(pipinput->linebuf, (
int)
sizeof(pipinput->linebuf), pipinput->file) ==
NULL )
244 pipinput->linenumber++;
248 pipinput->haserror =
TRUE;
258 commentstart = strchr(pipinput->linebuf,
commentchars[i]);
259 if( commentstart !=
NULL )
261 *commentstart =
'\0';
262 *(commentstart+1) =
'\0';
279 *pointer1 = *pointer2;
295 assert(pipinput !=
NULL);
299 if( pipinput->npushedtokens > 0 )
301 swapPointers(&pipinput->token, &pipinput->pushedtokens[pipinput->npushedtokens-1]);
302 pipinput->npushedtokens--;
303 SCIPdebugMsg(scip,
"(line %d) read token again: '%s'\n", pipinput->linenumber, pipinput->token);
308 buf = pipinput->linebuf;
311 if( buf[pipinput->linepos] ==
'\0' )
316 SCIPdebugMsg(scip,
"(line %d) end of file\n", pipinput->linenumber);
319 assert(pipinput->linepos == 0);
330 if(
isValueChar(buf[pipinput->linepos], buf[pipinput->linepos+1],
TRUE, &hasdot, &exptype) )
338 pipinput->token[tokenlen] = buf[pipinput->linepos];
342 while(
isValueChar(buf[pipinput->linepos], buf[pipinput->linepos+1],
FALSE, &hasdot, &exptype) );
351 pipinput->token[tokenlen] = buf[pipinput->linepos];
354 if( tokenlen == 1 &&
isTokenChar(pipinput->token[0]) )
363 && (pipinput->token[tokenlen-1] ==
'<' || pipinput->token[tokenlen-1] ==
'>' || pipinput->token[tokenlen-1] ==
'=')
364 && buf[pipinput->linepos] ==
'=' )
368 else if( pipinput->token[tokenlen-1] ==
'=' && (buf[pipinput->linepos] ==
'<' || buf[pipinput->linepos] ==
'>') )
370 pipinput->token[tokenlen-1] = buf[pipinput->linepos];
375 pipinput->token[tokenlen] =
'\0';
377 SCIPdebugMsg(scip,
"(line %d) read token: '%s'\n", pipinput->linenumber, pipinput->token);
388 assert(pipinput !=
NULL);
391 swapPointers(&pipinput->pushedtokens[pipinput->npushedtokens], &pipinput->token);
392 pipinput->npushedtokens++;
401 assert(pipinput !=
NULL);
404 swapPointers(&pipinput->pushedtokens[pipinput->npushedtokens], &pipinput->tokenbuf);
405 pipinput->npushedtokens++;
414 assert(pipinput !=
NULL);
428 assert(pipinput !=
NULL);
437 iscolon = (strcmp(pipinput->token,
":") == 0);
448 if( strcasecmp(pipinput->token,
"MINIMIZE") == 0
449 || strcasecmp(pipinput->token,
"MINIMUM") == 0
450 || strcasecmp(pipinput->token,
"MIN") == 0 )
452 SCIPdebugMsg(scip,
"(line %d) new section: OBJECTIVE\n", pipinput->linenumber);
458 if( strcasecmp(pipinput->token,
"MAXIMIZE") == 0
459 || strcasecmp(pipinput->token,
"MAXIMUM") == 0
460 || strcasecmp(pipinput->token,
"MAX") == 0 )
462 SCIPdebugMsg(scip,
"(line %d) new section: OBJECTIVE\n", pipinput->linenumber);
468 if( strcasecmp(pipinput->token,
"SUBJECT") == 0 )
474 if( strcasecmp(pipinput->token,
"TO") == 0 )
476 SCIPdebugMsg(scip,
"(line %d) new section: CONSTRAINTS\n", pipinput->linenumber);
486 if( strcasecmp(pipinput->token,
"SUCH") == 0 )
492 if( strcasecmp(pipinput->token,
"THAT") == 0 )
494 SCIPdebugMsg(scip,
"(line %d) new section: CONSTRAINTS\n", pipinput->linenumber);
504 if( strcasecmp(pipinput->token,
"st") == 0
505 || strcasecmp(pipinput->token,
"S.T.") == 0
506 || strcasecmp(pipinput->token,
"ST.") == 0 )
508 SCIPdebugMsg(scip,
"(line %d) new section: CONSTRAINTS\n", pipinput->linenumber);
513 if( strcasecmp(pipinput->token,
"BOUNDS") == 0
514 || strcasecmp(pipinput->token,
"BOUND") == 0 )
516 SCIPdebugMsg(scip,
"(line %d) new section: BOUNDS\n", pipinput->linenumber);
521 if( strcasecmp(pipinput->token,
"GENERAL") == 0
522 || strcasecmp(pipinput->token,
"GENERALS") == 0
523 || strcasecmp(pipinput->token,
"GEN") == 0
524 || strcasecmp(pipinput->token,
"INTEGER") == 0
525 || strcasecmp(pipinput->token,
"INTEGERS") == 0
526 || strcasecmp(pipinput->token,
"INT") == 0 )
528 SCIPdebugMsg(scip,
"(line %d) new section: GENERALS\n", pipinput->linenumber);
533 if( strcasecmp(pipinput->token,
"BINARY") == 0
534 || strcasecmp(pipinput->token,
"BINARIES") == 0
535 || strcasecmp(pipinput->token,
"BIN") == 0 )
537 SCIPdebugMsg(scip,
"(line %d) new section: BINARIES\n", pipinput->linenumber);
542 if( strcasecmp(pipinput->token,
"END") == 0 )
544 SCIPdebugMsg(scip,
"(line %d) new section: END\n", pipinput->linenumber);
559 assert(pipinput !=
NULL);
560 assert(sign !=
NULL);
561 assert(*sign == +1 || *sign == -1);
563 if( pipinput->token[1] ==
'\0' )
565 if( *pipinput->token ==
'+' )
567 else if( *pipinput->token ==
'-' )
585 assert(pipinput !=
NULL);
586 assert(value !=
NULL);
588 if( strcasecmp(pipinput->token,
"INFINITY") == 0 || strcasecmp(pipinput->token,
"INF") == 0 )
598 val = strtod(pipinput->token, &endptr);
599 if( endptr != pipinput->token && *endptr ==
'\0' )
616 assert(pipinput !=
NULL);
618 if( strcmp(pipinput->token,
"<") == 0 )
624 else if( strcmp(pipinput->token,
">") == 0 )
630 else if( strcmp(pipinput->token,
"=") == 0 )
650 assert(name !=
NULL);
659 SCIPdebugMsg(scip,
"creating new variable: <%s>\n", name);
670 if( created !=
NULL )
673 else if( created !=
NULL )
686 assert(pipinput !=
NULL);
711 assert(scip !=
NULL);
712 assert(monomials !=
NULL);
713 assert(monomialssize !=
NULL);
714 assert(*monomials !=
NULL || *monomialssize == 0);
716 if( minnmonomials <= *monomialssize )
721 if( *monomials !=
NULL )
729 *monomialssize = newsize;
746 assert(scip !=
NULL);
747 assert(exponents !=
NULL);
748 assert(varidxs !=
NULL);
749 assert(factorssize !=
NULL);
750 assert(*exponents !=
NULL || *factorssize == 0);
751 assert(*varidxs !=
NULL || *factorssize == 0);
752 assert((*exponents !=
NULL) == (*varidxs !=
NULL));
754 if( minnfactors <= *factorssize )
759 if( *exponents !=
NULL )
769 *factorssize = newsize;
786 assert(scip !=
NULL);
787 assert(varssize !=
NULL);
788 assert(vars !=
NULL);
789 assert(*vars !=
NULL || *varssize == 0);
790 assert(nvars !=
NULL);
791 assert(*nvars <= *varssize);
792 assert(varhash !=
NULL);
794 assert(varidx !=
NULL);
800 assert(*varidx >= 0);
801 assert(*varidx < *nvars);
809 if( *nvars + 1 > *varssize )
821 assert(*vars !=
NULL);
823 (*vars)[*nvars] = var;
870 assert(scip !=
NULL);
871 assert(pipinput !=
NULL);
872 assert(name !=
NULL);
873 assert(exprtree !=
NULL);
874 assert(degree !=
NULL);
875 assert(newsection !=
NULL);
898 if( strcmp(pipinput->token,
":") == 0 )
903 SCIPdebugMsg(scip,
"(line %d) read constraint name: '%s'\n", pipinput->linenumber, name);
957 ((nfactors > 0 || havevalue) && (issign =
isSign(pipinput, &nextcoefsign))) )
964 &monomials[nmonomials], coefsign * coef, nfactors, varidxs, exponents) );
969 constant += coefsign * coef;
972 if( monomialdegree > *degree )
973 *degree = monomialdegree;
998 coefsign = nextcoefsign;
999 SCIPdebugMsg(scip,
"(line %d) read coefficient sign: %+d\n", pipinput->linenumber, coefsign);
1007 if(
isSign(pipinput, &coefsign) )
1009 SCIPdebugMsg(scip,
"(line %d) read coefficient sign: %+d\n", pipinput->linenumber, coefsign);
1011 if( nfactors > 0 || havevalue )
1013 syntaxError(scip, pipinput,
"sign can only be at beginning of monomial");
1014 goto TERMINATE_READPOLYNOMIAL;
1022 if( strcmp(pipinput->token,
"*") == 0 )
1026 syntaxError(scip, pipinput,
"cannot have '*' before first variable in monomial");
1027 goto TERMINATE_READPOLYNOMIAL;
1034 if( nmonomials > 0 && !havesign )
1036 syntaxError(scip, pipinput,
"expected sign ('+' or '-') or sense ('<' or '>')");
1037 goto TERMINATE_READPOLYNOMIAL;
1041 if( strcmp(pipinput->token,
"^") == 0 )
1045 syntaxError(scip, pipinput,
"expected exponent value after '^'");
1046 goto TERMINATE_READPOLYNOMIAL;
1050 syntaxError(scip, pipinput,
"cannot have '^' before first variable in monomial");
1051 goto TERMINATE_READPOLYNOMIAL;
1053 exponents[nfactors-1] = exponent;
1055 monomialdegree += (int)exponent - 1;
1059 SCIPdebugMsg(scip,
"(line %d) read exponent value %g for variable %s\n", pipinput->linenumber, exponent,
1065 if(
isValue(scip, pipinput, &coef) )
1067 SCIPdebugMsg(scip,
"(line %d) read coefficient value: %g with sign %+d\n", pipinput->linenumber, coef, coefsign);
1071 syntaxError(scip, pipinput,
"two consecutive values");
1072 goto TERMINATE_READPOLYNOMIAL;
1077 syntaxError(scip, pipinput,
"coefficients can only be at the beginning of a monomial");
1078 goto TERMINATE_READPOLYNOMIAL;
1093 exponents[nfactors] = 1.0;
1094 varidxs[nfactors] = varidx;
1101 syntaxError(scip, pipinput,
"string ended before monomial has finished");
1102 goto TERMINATE_READPOLYNOMIAL;
1107 for( i = 0; i < nvars; ++i )
1114 nmonomials, monomials, constant,
FALSE) );
1121 SCIPdebugMsg(scip,
"read polynomial of degree %d: ", *degree);
1125 TERMINATE_READPOLYNOMIAL:
1159 assert(expr !=
NULL);
1169 for( i = 0; i < nmonomials; ++i )
1185 assert(varidx >= 0);
1200 assert(varidx >= 0);
1207 quadvars2[*nquadterms] = quadvars1[*nquadterms];
1219 assert(varidx >= 0);
1226 assert(varidx >= 0);
1261 assert(pipinput !=
NULL);
1285 assert(expr !=
NULL);
1298 assert(degree >= 0);
1310 for( i = 0; i < nmonomials; ++i )
1318 assert(varidx >= 0);
1329 else if( degree == 2 )
1353 getLinearAndQuadraticCoefs(scip, exprtree, &constant, &nlinvars, linvars, lincoefs, &nquadterms, quadvars1, quadvars2, quadcoefs);
1370 SCIP_CALL(
SCIPcreateConsQuadratic(scip, &quadobjcons,
"quadobj", nlinvars, linvars, lincoefs, nquadterms, quadvars1, quadvars2, quadcoefs, lhs, rhs,
1371 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable) );
1376 SCIPdebugMsg(scip,
"(line %d) added constraint <%s> to represent quadratic objective: ", pipinput->linenumber,
SCIPconsGetName(quadobjcons));
1389 else if( degree > 2 )
1416 SCIP_CALL(
SCIPcreateConsNonlinear(scip, &nonlinobjcons,
"nonlinobj", 1, &nonlinobjvar, &minusone, 1, &exprtree,
NULL, lhs, rhs,
1417 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable,
FALSE) );
1421 SCIPdebugMsg(scip,
"(line %d) added constraint <%s> to represent nonlinear objective: ", pipinput->linenumber,
SCIPconsGetName(nonlinobjcons));
1429 if( exprtree !=
NULL )
1480 assert(pipinput !=
NULL);
1488 if ( exprtree !=
NULL )
1489 syntaxError(scip, pipinput,
"expected constraint sense '<=', '=', or '>='");
1496 syntaxError(scip, pipinput,
"expected constraint sense '<=', '=', or '>='");
1504 syntaxError(scip, pipinput,
"missing right hand side");
1507 if (
isSign(pipinput, &sidesign) )
1511 syntaxError(scip, pipinput,
"missing value of right hand side");
1515 if ( !
isValue(scip, pipinput, &sidevalue) )
1517 syntaxError(scip, pipinput,
"expected value as right hand side");
1520 sidevalue *= sidesign;
1523 initial = pipinput->initialconss;
1530 dynamic = pipinput->dynamicconss;
1531 removable = pipinput->dynamicrows;
1556 SCIP_CALL_TERMINATE( retcode,
SCIPcreateConsNonlinear(scip, &cons, name, 0,
NULL,
NULL, 1, &exprtree,
NULL, lhs, rhs,
1557 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable,
FALSE), TERMINATE );
1562 assert(expr !=
NULL);
1572 getLinearAndQuadraticCoefs(scip, exprtree, &constant, &nlinvars, linvars, lincoefs, &nquadcoefs, quadvars1, quadvars2, quadcoefs);
1578 lhs = sidevalue - constant;
1583 rhs = sidevalue - constant;
1586 lhs = sidevalue - constant;
1587 rhs = sidevalue - constant;
1595 if( nquadcoefs == 0 )
1598 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable,
FALSE);
1603 nquadcoefs, quadvars1, quadvars2, quadcoefs, lhs, rhs,
1604 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable);
1618 SCIPdebugMsg(scip,
"(line %d) created constraint: ", pipinput->linenumber);
1624 if( exprtree !=
NULL )
1644 assert(pipinput !=
NULL);
1667 hassign =
isSign(pipinput, &sign);
1675 if(
isValue(scip, pipinput, &value) )
1680 syntaxError(scip, pipinput,
"expected bound sense '<=', '=', or '>='");
1714 syntaxError(scip, pipinput,
"expected variable name");
1724 if(
isSense(pipinput, &rightsense) )
1733 syntaxError(scip, pipinput,
"expected value or sign");
1739 hassign =
isSign(pipinput, &sign);
1747 if( !
isValue(scip, pipinput, &value) )
1754 switch( rightsense )
1774 syntaxError(scip, pipinput,
"the two bound senses do not fit");
1778 else if( strcasecmp(pipinput->token,
"FREE") == 0 )
1782 syntaxError(scip, pipinput,
"variable with bound is marked as 'free'");
1815 assert(pipinput !=
NULL);
1831 syntaxError(scip, pipinput,
"unknown variable in generals section");
1850 assert(pipinput !=
NULL);
1866 syntaxError(scip, pipinput,
"unknown variable in binaries section");
1892 const char* filename
1895 assert(pipinput !=
NULL);
1898 pipinput->file =
SCIPfopen(filename,
"r");
1899 if( pipinput->file ==
NULL )
1913 switch( pipinput->section )
1995 assert( scip !=
NULL );
1996 assert( vars !=
NULL );
1997 assert( scalars !=
NULL );
1998 assert( nvars !=
NULL );
1999 assert( constant !=
NULL );
2005 if( requiredsize > *nvars )
2011 assert( requiredsize <= *nvars );
2016 for( v = 0; v < *nvars; ++v )
2029 assert( linebuffer !=
NULL );
2030 assert( linecnt !=
NULL );
2033 linebuffer[0] =
'\0';
2045 assert( scip !=
NULL );
2046 assert( linebuffer !=
NULL );
2047 assert( linecnt !=
NULL );
2049 if( (*linecnt) > 0 )
2051 linebuffer[(*linecnt)] =
'\0';
2065 const char* extension
2068 assert( scip !=
NULL );
2069 assert( linebuffer !=
NULL );
2070 assert( linecnt !=
NULL );
2071 assert( extension !=
NULL );
2080 (*linecnt) += (int) strlen(extension);
2082 SCIPdebugMsg(scip,
"linebuffer <%s>, length = %lu\n", linebuffer, (
unsigned long)strlen(linebuffer));
2085 endLine(scip, file, linebuffer, linecnt);
2094 const char* rowname,
2095 const char* rownameextension,
2117 assert( scip !=
NULL );
2118 assert( strcmp(type,
"=") == 0 || strcmp(type,
"<=") == 0 || strcmp(type,
">=") == 0 );
2119 assert( nlinvars == 0 || (linvars !=
NULL && linvals !=
NULL) );
2120 assert( nquadvarterms == 0 || quadvarterms !=
NULL );
2123 assert( nbilinterms == 0 || (bilinterms !=
NULL && nquadvarterms >= 2) );
2128 appendLine(scip, file, linebuffer, &linecnt,
" ");
2131 if ( strlen(rowname) > 0 || strlen(rownameextension) > 0 )
2134 appendLine(scip, file, linebuffer, &linecnt, consname);
2138 for( v = 0; v < nlinvars; ++v )
2141 assert( var !=
NULL );
2145 appendLine(scip, file, linebuffer, &linecnt,
" ");
2150 appendLine(scip, file, linebuffer, &linecnt, buffer);
2154 if( nquadvarterms > 0 )
2157 for( v = 0; v < nquadvarterms; ++v )
2159 if( quadvarterms[v].lincoef == 0.0 )
2164 appendLine(scip, file, linebuffer, &linecnt,
" ");
2169 appendLine(scip, file, linebuffer, &linecnt, buffer);
2175 for( v = 0; v < nquadvarterms; ++v )
2177 if( quadvarterms[v].sqrcoef == 0.0 )
2182 appendLine(scip, file, linebuffer, &linecnt,
" ");
2187 appendLine(scip, file, linebuffer, &linecnt, buffer);
2191 for( v = 0; v < nbilinterms; ++v )
2195 appendLine(scip, file, linebuffer, &linecnt,
" ");
2201 appendLine(scip, file, linebuffer, &linecnt, buffer);
2213 appendLine(scip, file, linebuffer, &linecnt,
" ");
2214 appendLine(scip, file, linebuffer, &linecnt, buffer);
2216 endLine(scip, file, linebuffer, &linecnt);
2225 const char* rowname,
2226 const char* rownameextension,
2249 assert( scip !=
NULL );
2250 assert( strcmp(type,
"=") == 0 || strcmp(type,
"<=") == 0 || strcmp(type,
">=") == 0 );
2251 assert( nlinvars == 0 || (linvars !=
NULL && linvals !=
NULL) );
2252 assert( nexprtrees == 0 || exprtrees !=
NULL );
2253 assert( nexprtrees == 0 || exprtreecoefs !=
NULL );
2258 appendLine(scip, file, linebuffer, &linecnt,
" ");
2261 if ( strlen(rowname) > 0 || strlen(rownameextension) > 0 )
2264 appendLine(scip, file, linebuffer, &linecnt, consname);
2268 for( v = 0; v < nlinvars; ++v )
2271 assert( var !=
NULL );
2275 appendLine(scip, file, linebuffer, &linecnt,
" ");
2280 appendLine(scip, file, linebuffer, &linecnt, buffer);
2284 for( e = 0; e < nexprtrees; ++e )
2295 assert(nchildren == 0 || children !=
NULL);
2299 appendLine(scip, file, linebuffer, &linecnt,
" ");
2303 for( c = 0; c < nchildren; ++c )
2316 appendLine(scip, file, linebuffer, &linecnt, buffer);
2328 appendLine(scip, file, linebuffer, &linecnt, buffer);
2338 appendLine(scip, file, linebuffer, &linecnt, buffer);
2348 appendLine(scip, file, linebuffer, &linecnt, buffer);
2358 appendLine(scip, file, linebuffer, &linecnt, buffer);
2367 appendLine(scip, file, linebuffer, &linecnt, buffer);
2376 appendLine(scip, file, linebuffer, &linecnt, buffer);
2385 appendLine(scip, file, linebuffer, &linecnt, buffer);
2394 appendLine(scip, file, linebuffer, &linecnt, buffer);
2400 for( c = 0; c < nchildren; ++c )
2404 appendLine(scip, file, linebuffer, &linecnt,
" ");
2409 appendLine(scip, file, linebuffer, &linecnt, buffer);
2418 appendLine(scip, file, linebuffer, &linecnt, buffer);
2420 for( c = 0; c < nchildren; ++c )
2424 appendLine(scip, file, linebuffer, &linecnt,
" ");
2429 appendLine(scip, file, linebuffer, &linecnt, buffer);
2440 appendLine(scip, file, linebuffer, &linecnt, buffer);
2443 for( c = 0; c < nchildren; ++c )
2447 appendLine(scip, file, linebuffer, &linecnt,
" ");
2452 appendLine(scip, file, linebuffer, &linecnt, buffer);
2465 appendLine(scip, file, linebuffer, &linecnt, buffer);
2470 for( c = 0; c < nchildren; ++c )
2477 appendLine(scip, file, linebuffer, &linecnt,
" ");
2482 appendLine(scip, file, linebuffer, &linecnt, buffer);
2490 appendLine(scip, file, linebuffer, &linecnt,
" ");
2506 appendLine(scip, file, linebuffer, &linecnt, buffer);
2521 appendLine(scip, file, linebuffer, &linecnt, buffer);
2527 assert(monomial !=
NULL);
2530 appendLine(scip, file, linebuffer, &linecnt, buffer);
2536 appendLine(scip, file, linebuffer, &linecnt,
" ");
2543 appendLine(scip, file, linebuffer, &linecnt, buffer);
2567 appendLine(scip, file, linebuffer, &linecnt,
" ");
2568 appendLine(scip, file, linebuffer, &linecnt, buffer);
2570 endLine(scip, file, linebuffer, &linecnt);
2579 const char* rowname,
2598 assert( scip !=
NULL );
2599 assert( rowname !=
NULL );
2601 assert( nlinvars == 0 || linvars !=
NULL );
2602 assert( nquadvarterms == 0 || quadvarterms !=
NULL );
2603 assert( nbilinterms == 0 || bilinterms !=
NULL );
2605 assert( lhs <= rhs );
2610 nactivevars = nlinvars;
2615 if( linvals !=
NULL )
2623 for( v = 0; v < nactivevars; ++v )
2624 activevals[v] = 1.0;
2637 printRow(scip, file, rowname,
"",
"=", activevars, activevals, nactivevars,
2638 quadvarterms, nquadvarterms, bilinterms, nbilinterms,
2639 rhs - activeconstant);
2647 activevars, activevals, nactivevars,
2648 quadvarterms, nquadvarterms, bilinterms, nbilinterms,
2649 lhs - activeconstant);
2655 activevars, activevals, nactivevars,
2656 quadvarterms, nquadvarterms, bilinterms, nbilinterms,
2657 rhs - activeconstant);
2676 const char* rowname,
2694 assert( scip !=
NULL );
2695 assert( rowname !=
NULL );
2697 assert( nlinvars == 0 || linvars !=
NULL );
2698 assert( nexprtrees == 0 || exprtrees !=
NULL );
2699 assert( nexprtrees == 0 || exprtreecoefs !=
NULL );
2701 assert( lhs <= rhs );
2706 nactivevars = nlinvars;
2711 if( linvals !=
NULL )
2719 for( v = 0; v < nactivevars; ++v )
2720 activevals[v] = 1.0;
2733 printRowNl(scip, file, rowname,
"",
"=", activevars, activevals, nactivevars,
2734 exprtrees, exprtreecoefs, nexprtrees,
2735 rhs - activeconstant);
2743 activevars, activevals, nactivevars,
2744 exprtrees, exprtreecoefs, nexprtrees,
2745 lhs - activeconstant);
2751 activevars, activevals, nactivevars,
2752 exprtrees, exprtreecoefs, nexprtrees,
2753 rhs - activeconstant);
2773 int* nAggregatedVars,
2781 for (j = 0; j < nvars; ++j)
2798 (*aggregatedVars)[(*nAggregatedVars)++] = var;
2815 int nAggregatedVars,
2827 assert( scip !=
NULL );
2833 for (j = 0; j < nAggregatedVars; ++j)
2838 activevars[0] = aggregatedVars[j];
2839 activevals[0] = 1.0;
2840 activeconstant = 0.0;
2845 activevals[nactivevars] = -1.0;
2846 activevars[nactivevars] = aggregatedVars[j];
2851 printRow(scip, file, consname,
"",
"=", activevars, activevals, nactivevars,
NULL, 0,
NULL, 0, - activeconstant);
2871 assert(scip !=
NULL);
2872 assert(vars !=
NULL || nvars == 0);
2875 for( v = 0; v < nvars; ++v )
2879 SCIPwarningMessage(scip,
"there is a variable name which has to be cut down to %d characters; LP might be corrupted\n",
2898 const char* conshdlrname;
2900 assert( scip !=
NULL );
2901 assert( conss !=
NULL );
2903 for( c = 0; c < nconss; ++c )
2906 assert(cons !=
NULL );
2912 assert( conshdlr !=
NULL );
2917 if( strcmp(conshdlrname,
"linear") == 0 )
2925 SCIPwarningMessage(scip,
"there is a constraint name which has to be cut down to %d characters;\n",
2932 SCIPwarningMessage(scip,
"there is a constraint name which has to be cut down to %d characters;\n",
2973 const char* conshdlrname;
2988 int nAggregatedVars;
3002 assert( scip !=
NULL );
3004 nAggregatedVars = 0;
3020 SCIPinfoMessage(scip, file,
"\\ Variables : %d (%d binary, %d integer, %d implicit integer, %d continuous)\n",
3021 nvars, nbinvars, nintvars, nimplvars, ncontvars);
3030 appendLine(scip, file, linebuffer, &linecnt,
" Obj:");
3032 for (v = 0; v < nvars; ++v)
3047 appendLine(scip, file, linebuffer, &linecnt,
" ");
3052 appendLine(scip, file, linebuffer, &linecnt, buffer);
3055 endLine(scip, file, linebuffer, &linecnt);
3067 for (c = 0; c < nconss; ++c)
3070 assert( cons !=
NULL);
3076 assert( conshdlr !=
NULL );
3082 if( strcmp(conshdlrname,
"linear") == 0 )
3088 else if( strcmp(conshdlrname,
"setppc") == 0 )
3097 consvars,
NULL, nconsvars,
NULL, 0,
NULL, 0, 1.0, 1.0, transformed) );
3109 else if ( strcmp(conshdlrname,
"logicor") == 0 )
3115 else if ( strcmp(conshdlrname,
"knapsack") == 0 )
3125 for( v = 0; v < nconsvars; ++v )
3133 else if ( strcmp(conshdlrname,
"varbound") == 0 )
3144 SCIP_CALL(
printQuadraticCons(scip, file, consname, consvars, consvals, 2,
NULL, 0,
NULL, 0,
3150 else if( strcmp(conshdlrname,
"quadratic") == 0 )
3159 consQuadratic[nConsQuadratic++] = cons;
3161 else if( strcmp(conshdlrname,
"nonlinear") == 0 )
3167 ispolynomial =
TRUE;
3168 for( e = 0; e < nexprtrees && ispolynomial; ++e )
3172 assert(expr !=
NULL);
3195 ispolynomial =
FALSE;
3206 ispolynomial =
FALSE;
3226 ispolynomial =
FALSE;
3237 ispolynomial =
FALSE;
3247 ispolynomial =
FALSE;
3260 consNonlinear[nConsNonlinear++] = cons;
3269 else if( strcmp(conshdlrname,
"abspower") == 0 )
3324 &z, &zcoef, 1, &exprtree, &treecoef, 1,
3329 consAbspower[nConsAbspower++] = cons;
3338 else if( strcmp(conshdlrname,
"bivariate") == 0 )
3343 ispolynomial =
TRUE;
3346 assert(expr !=
NULL);
3369 ispolynomial =
FALSE;
3380 ispolynomial =
FALSE;
3400 ispolynomial =
FALSE;
3411 ispolynomial =
FALSE;
3423 ispolynomial =
FALSE;
3440 &z, &zcoef, z ==
NULL ? 0 : 1, &exprtree, &one, 1,
3443 consBivariate[nConsBivariate++] = cons;
3452 else if( strcmp(conshdlrname,
"and") == 0 )
3473 SCIP_CALL(
printNonlinearCons(scip, file, consname, &resultant, &minusone, 1, &exprtree, &one, 1, 0.0, 0.0, transformed) );
3478 consAnd[nConsAnd++] = cons;
3482 SCIPwarningMessage(scip,
"constraint handler <%s> cannot print requested format\n", conshdlrname );
3494 for (c = 0; c < nConsQuadratic; ++c)
3496 cons = consQuadratic[c];
3500 &nAggregatedVars, &aggregatedVars, &varAggregated) );
3505 for (c = 0; c < nConsNonlinear; ++c)
3507 cons = consNonlinear[c];
3511 assert(exprtree !=
NULL);
3516 &nAggregatedVars, &aggregatedVars, &varAggregated) );
3522 for (c = 0; c < nConsAbspower; ++c)
3526 cons = consAbspower[c];
3534 for (c = 0; c < nConsAnd; ++c)
3547 for (c = 0; c < nConsBivariate; ++c)
3551 cons = consBivariate[c];
3568 for (v = 0; v < nvars; ++v)
3571 assert( var !=
NULL );
3617 for (v = 0; v < nAggregatedVars; ++v)
3619 var = aggregatedVars[v];
3620 assert( var !=
NULL );
3637 for (v = 0; v < nvars; ++v)
3640 assert( var !=
NULL );
3646 appendLine(scip, file, linebuffer, &linecnt, buffer);
3650 endLine(scip, file, linebuffer, &linecnt);
3658 for (v = 0; v < nvars; ++v)
3661 assert( var !=
NULL );
3667 appendLine(scip, file, linebuffer, &linecnt, buffer);
3670 endLine(scip, file, linebuffer, &linecnt);
3697 assert(reader !=
NULL);
3723 nvars, nbinvars, nintvars, nimplvars, ncontvars, conss, nconss, result) );
3756 const char* filename,
3765 pipinput.file =
NULL;
3766 pipinput.linebuf[0] =
'\0';
3767 pipinput.probname[0] =
'\0';
3768 pipinput.objname[0] =
'\0';
3770 pipinput.token[0] =
'\0';
3772 pipinput.tokenbuf[0] =
'\0';
3778 pipinput.npushedtokens = 0;
3779 pipinput.linenumber = 0;
3780 pipinput.linepos = 0;
3783 pipinput.haserror =
FALSE;
3794 for( i = PIP_MAX_PUSHEDTOKENS - 1; i >= 0 ; --i )
3805 if( pipinput.haserror )
SCIP_Real SCIPgetCoefLinearAbspower(SCIP *scip, SCIP_CONS *cons)
enum SCIP_Result SCIP_RESULT
SCIP_VAR * SCIPgetNonlinearVarAbspower(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetLinearVarsQuadratic(SCIP *scip, SCIP_CONS *cons)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
SCIP_Real SCIPgetLinearCoefBivariate(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE printNonlinearCons(SCIP *scip, FILE *file, const char *rowname, SCIP_VAR **linvars, SCIP_Real *linvals, int nlinvars, SCIP_EXPRTREE **exprtrees, SCIP_Real *exprtreecoefs, int nexprtrees, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool transformed)
static SCIP_RETCODE ensureFactorsSize(SCIP *scip, SCIP_Real **exponents, int **varidxs, int *factorssize, int minnfactors)
static SCIP_DECL_HASHGETKEY(hashGetKeyVar)
SCIP_Bool SCIPconsIsEnabled(SCIP_CONS *cons)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
int * SCIPexprGetMonomialChildIndices(SCIP_EXPRDATA_MONOMIAL *monomial)
#define PIP_INIT_MONOMIALSSIZE
Constraint handler for variable bound constraints .
#define PIP_INIT_FACTORSSIZE
SCIP_RETCODE SCIPhashtableInsert(SCIP_HASHTABLE *hashtable, void *element)
SCIP_Real SCIPgetRhsBivariate(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetOffsetAbspower(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsSetppc(SCIP *scip, SCIP_CONS *cons)
SCIP_EXPROP SCIPexprGetOperator(SCIP_EXPR *expr)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
int SCIPgetNVarsLogicor(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPreadPip(SCIP *scip, SCIP_READER *reader, const char *filename, SCIP_RESULT *result)
SCIP_VAR * SCIPgetLinearVarAbspower(SCIP *scip, SCIP_CONS *cons)
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 SCIPcalcMemGrowSize(SCIP *scip, int num)
static SCIP_RETCODE printAggregatedCons(SCIP *scip, FILE *file, SCIP_Bool transformed, int nvars, int nAggregatedVars, SCIP_VAR **aggregatedVars)
static SCIP_RETCODE readConstraints(SCIP *scip, PIPINPUT *pipinput)
const char * SCIPexpropGetName(SCIP_EXPROP op)
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
#define PIP_MAX_PUSHEDTOKENS
SCIP_RETCODE SCIPexprCreateMonomial(BMS_BLKMEM *blkmem, SCIP_EXPRDATA_MONOMIAL **monomial, SCIP_Real coef, int nfactors, int *childidxs, SCIP_Real *exponents)
static SCIP_RETCODE readObjective(SCIP *scip, PIPINPUT *pipinput)
static void getLinearAndQuadraticCoefs(SCIP *scip, SCIP_EXPRTREE *exprtree, SCIP_Real *constant, int *nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int *nquadterms, SCIP_VAR **quadvars1, SCIP_VAR **quadvars2, SCIP_Real *quadcoefs)
const char * SCIPreaderGetName(SCIP_READER *reader)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
SCIP_Real SCIPexprGetRealPowerExponent(SCIP_EXPR *expr)
int SCIPexprGetOpIndex(SCIP_EXPR *expr)
static SCIP_RETCODE ensureMonomialsSize(SCIP *scip, SCIP_EXPRDATA_MONOMIAL ***monomials, int *monomialssize, int minnmonomials)
SCIP_Real SCIPexprGetPolynomialConstant(SCIP_EXPR *expr)
static void endLine(SCIP *scip, FILE *file, char *linebuffer, int *linecnt)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
static void printRow(SCIP *scip, FILE *file, const char *rowname, const char *rownameextension, const char *type, SCIP_VAR **linvars, SCIP_Real *linvals, int nlinvars, SCIP_QUADVARTERM *quadvarterms, int nquadvarterms, SCIP_BILINTERM *bilinterms, int nbilinterms, SCIP_Real rhs)
SCIP_Real * SCIPgetLinearCoefsNonlinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPinfinity(SCIP *scip)
int SCIPsnprintf(char *t, int len, const char *s,...)
SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
enum SCIP_Retcode SCIP_RETCODE
static void checkVarnames(SCIP *scip, SCIP_VAR **vars, int nvars)
enum SCIP_Varstatus SCIP_VARSTATUS
SCIP_RETCODE SCIPcreateVarBasic(SCIP *scip, SCIP_VAR **var, const char *name, SCIP_Real lb, SCIP_Real ub, SCIP_Real obj, SCIP_VARTYPE vartype)
SCIP_Real SCIPgetRhsNonlinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPconsIsTransformed(SCIP_CONS *cons)
SCIP_RETCODE SCIPexprtreeSetVars(SCIP_EXPRTREE *tree, int nvars, SCIP_VAR **vars)
SCIP_VAR ** SCIPgetVarsKnapsack(SCIP *scip, SCIP_CONS *cons)
static SCIP_Bool isValueChar(char c, char nextc, SCIP_Bool firstchar, SCIP_Bool *hasdot, PIPEXPTYPE *exptype)
static SCIP_RETCODE readBounds(SCIP *scip, PIPINPUT *pipinput)
SCIP_MESSAGEHDLR * SCIPgetMessagehdlr(SCIP *scip)
Constraint handler for AND constraints, .
#define SCIPduplicateBufferArray(scip, ptr, source, num)
SCIP_EXPRTREE ** SCIPgetExprtreesNonlinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPchgVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPexprtreeCreate(BMS_BLKMEM *blkmem, SCIP_EXPRTREE **tree, SCIP_EXPR *root, int nvars, int nparams, SCIP_Real *params)
#define SCIPfreeBufferArray(scip, ptr)
Constraint handler for the set partitioning / packing / covering constraints .
#define SCIPdebugPrintCons(x, y, z)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
#define SCIPdebugMsgPrint
SCIP_Real SCIPgetRhsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetLhsQuadratic(SCIP *scip, SCIP_CONS *cons)
static SCIP_Bool hasError(PIPINPUT *pipinput)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
SCIP_VAR ** SCIPexprtreeGetVars(SCIP_EXPRTREE *tree)
SCIP_RETCODE SCIPaddLinearVarQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
int SCIPgetNExprtreesNonlinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateConsQuadratic(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadterms, SCIP_VAR **quadvars1, SCIP_VAR **quadvars2, SCIP_Real *quadcoefs, 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_EXPRDATA_MONOMIAL ** SCIPexprGetMonomials(SCIP_EXPR *expr)
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)
int SCIPgetNQuadVarTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
int SCIPexprGetMonomialNFactors(SCIP_EXPRDATA_MONOMIAL *monomial)
int SCIPexprGetIntPowerExponent(SCIP_EXPR *expr)
static void appendLine(SCIP *scip, FILE *file, char *linebuffer, int *linecnt, const char *extension)
SCIP_RETCODE SCIPexprtreePrintWithNames(SCIP_EXPRTREE *tree, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
static SCIP_RETCODE getVariable(SCIP *scip, char *name, SCIP_Bool dynamiccols, SCIP_VAR **var, SCIP_Bool *created)
SCIP_EXPRTREE * SCIPgetExprtreeBivariate(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNBilinTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR * SCIPfindVar(SCIP *scip, const char *name)
SCIP_RETCODE SCIPchgVarType(SCIP *scip, SCIP_VAR *var, SCIP_VARTYPE vartype, SCIP_Bool *infeasible)
SCIP_FILE * SCIPfopen(const char *path, const char *mode)
enum PipSection PIPSECTION
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
static const char delimchars[]
SCIP_RETCODE SCIPsetObjsense(SCIP *scip, SCIP_OBJSENSE objsense)
Constraint handler for knapsack constraints of the form , x binary and .
static const char tokenchars[]
SCIP_VAR ** SCIPgetVarsAnd(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR * SCIPgetVarVarbound(SCIP *scip, SCIP_CONS *cons)
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPvarGetLbOriginal(SCIP_VAR *var)
SCIP_VAR * SCIPgetResultantAnd(SCIP *scip, SCIP_CONS *cons)
SCIP_Real * SCIPexprGetQuadLinearCoefs(SCIP_EXPR *expr)
SCIP_Real SCIPgetRhsVarbound(SCIP *scip, SCIP_CONS *cons)
Constraint handler for logicor constraints (equivalent to set covering, but algorithms are suited fo...
SCIP_Real SCIPvarGetUbOriginal(SCIP_VAR *var)
SCIP_Real * SCIPgetCoefsLinearVarsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetVbdcoefVarbound(SCIP *scip, SCIP_CONS *cons)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
struct SCIP_File SCIP_FILE
char * SCIPfgets(char *s, int size, SCIP_FILE *stream)
const char * SCIPconsGetName(SCIP_CONS *cons)
SCIP_RETCODE SCIPchgVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
SCIPInterval sign(const SCIPInterval &x)
SCIP_VAR ** SCIPgetVarsLogicor(SCIP *scip, SCIP_CONS *cons)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_Real SCIPexprGetQuadConstant(SCIP_EXPR *expr)
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
constraint handler for quadratic constraints
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
static void checkConsnames(SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_Bool transformed)
SCIP_Real * SCIPgetExprtreeCoefsNonlinear(SCIP *scip, SCIP_CONS *cons)
static SCIP_Bool isValue(SCIP *scip, PIPINPUT *pipinput, SCIP_Real *value)
file reader for polynomial mixed-integer programs in PIP format
int SCIPexprtreeGetNVars(SCIP_EXPRTREE *tree)
SCIP_VAR * SCIPgetVbdvarVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPexprCreatePolynomial(BMS_BLKMEM *blkmem, SCIP_EXPR **expr, int nchildren, SCIP_EXPR **children, int nmonomials, SCIP_EXPRDATA_MONOMIAL **monomials, SCIP_Real constant, SCIP_Bool copymonomials)
SCIP_RETCODE SCIPgetProbvarLinearSum(SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, int varssize, SCIP_Real *constant, int *requiredsize, SCIP_Bool mergemultiples)
static SCIP_DECL_READERWRITE(readerWritePip)
static void swapPointers(char **pointer1, char **pointer2)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
static SCIP_Bool isSense(PIPINPUT *pipinput, PIPSENSE *sense)
SCIP_BILINTERM * SCIPgetBilinTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_EXPR * SCIPexprtreeGetRoot(SCIP_EXPRTREE *tree)
SCIP_Longint SCIPgetCapacityKnapsack(SCIP *scip, SCIP_CONS *cons)
static SCIP_Bool isDelimChar(char c)
SCIP_RETCODE SCIPchgVarObj(SCIP *scip, SCIP_VAR *var, SCIP_Real newobj)
SCIP_Real SCIPgetRhsQuadratic(SCIP *scip, SCIP_CONS *cons)
#define SCIPallocBufferArray(scip, ptr, num)
static SCIP_Bool isNewSection(SCIP *scip, PIPINPUT *pipinput)
public data structures and miscellaneous methods
SCIP_EXPR ** SCIPexprGetChildren(SCIP_EXPR *expr)
static SCIP_DECL_HASHKEYVAL(hashKeyValVar)
SCIP_RETCODE SCIPincludeReaderBasic(SCIP *scip, SCIP_READER **readerptr, const char *name, const char *desc, const char *extension, SCIP_READERDATA *readerdata)
SCIP_Real SCIPgetLhsBivariate(SCIP *scip, SCIP_CONS *cons)
void SCIPprintSysError(const char *message)
enum SCIP_Objsense SCIP_OBJSENSE
SCIP_Real SCIPgetLhsNonlinear(SCIP *scip, SCIP_CONS *cons)
enum PipExpType PIPEXPTYPE
SCIP_SETPPCTYPE SCIPgetTypeSetppc(SCIP *scip, SCIP_CONS *cons)
constraint handler for nonlinear constraints
SCIP_RETCODE SCIPprintCons(SCIP *scip, SCIP_CONS *cons, FILE *file)
static void pushToken(PIPINPUT *pipinput)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
int SCIPexprGetNChildren(SCIP_EXPR *expr)
static void pushBufferToken(PIPINPUT *pipinput)
SCIP_RETCODE SCIPexprCreate(BMS_BLKMEM *blkmem, SCIP_EXPR **expr, SCIP_EXPROP op,...)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
SCIP_RETCODE SCIPexprtreeFree(SCIP_EXPRTREE **tree)
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)
static SCIP_Bool isSign(PIPINPUT *pipinput, int *sign)
SCIP_RETCODE SCIPsetReaderWrite(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERWRITE((*readerwrite)))
static void swapTokenBuffer(PIPINPUT *pipinput)
SCIP_RETCODE SCIPincludeReaderPip(SCIP *scip)
constraint handler for bivariate nonlinear constraints
Constraint handler for linear constraints in their most general form, .
#define SCIP_EXPR_DEGREEINFINITY
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
static SCIP_RETCODE readPIPFile(SCIP *scip, PIPINPUT *pipinput, const char *filename)
SCIP_Real SCIPexprGetMonomialCoef(SCIP_EXPRDATA_MONOMIAL *monomial)
Constraint handler for absolute power constraints .
SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
static SCIP_DECL_READERCOPY(readerCopyPip)
SCIP_RETCODE SCIPsetReaderCopy(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERCOPY((*readercopy)))
#define PIP_INIT_VARSSIZE
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_VAR ** SCIPgetVarsSetppc(SCIP *scip, SCIP_CONS *cons)
void SCIPhashtableFree(SCIP_HASHTABLE **hashtable)
SCIP_VAR * SCIPgetLinearVarBivariate(SCIP *scip, SCIP_CONS *cons)
static SCIP_DECL_READERREAD(readerReadPip)
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)
static SCIP_RETCODE readBinaries(SCIP *scip, PIPINPUT *pipinput)
int SCIPgetNLinearVarsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPisIntegral(SCIP *scip, SCIP_Real val)
SCIP_Real * SCIPexprGetLinearCoefs(SCIP_EXPR *expr)
int SCIPgetNLinearVarsNonlinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetRhsAbspower(SCIP *scip, SCIP_CONS *cons)
static const SCIP_Real scalars[]
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
SCIP_VAR ** SCIPgetVarsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPexprGetOpReal(SCIP_EXPR *expr)
static SCIP_RETCODE readGenerals(SCIP *scip, PIPINPUT *pipinput)
static SCIP_RETCODE readStart(SCIP *scip, PIPINPUT *pipinput)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
SCIP_QUADELEM * SCIPexprGetQuadElements(SCIP_EXPR *expr)
static void clearLine(char *linebuffer, int *linecnt)
static SCIP_DECL_HASHKEYEQ(hashKeyEqVar)
int SCIPexprGetNMonomials(SCIP_EXPR *expr)
static SCIP_RETCODE printQuadraticCons(SCIP *scip, FILE *file, const char *rowname, SCIP_VAR **linvars, SCIP_Real *linvals, int nlinvars, SCIP_QUADVARTERM *quadvarterms, int nquadvarterms, SCIP_BILINTERM *bilinterms, int nbilinterms, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool transformed)
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
SCIP_VAR ** SCIPgetLinearVarsNonlinear(SCIP *scip, SCIP_CONS *cons)
#define SCIP_CALL_TERMINATE(retcode, x, TERM)
int SCIPgetNVarsAnd(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateConsNonlinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nexprtrees, SCIP_EXPRTREE **exprtrees, SCIP_Real *nonlincoefs, 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)
int SCIPgetNVarsKnapsack(SCIP *scip, SCIP_CONS *cons)
static void printRowNl(SCIP *scip, FILE *file, const char *rowname, const char *rownameextension, const char *type, SCIP_VAR **linvars, SCIP_Real *linvals, int nlinvars, SCIP_EXPRTREE **exprtrees, SCIP_Real *exprtreecoefs, int nexprtrees, SCIP_Real rhs)
static SCIP_Bool isTokenChar(char c)
SCIP_Real SCIPgetExponentAbspower(SCIP *scip, SCIP_CONS *cons)
SCIP_Real * SCIPexprGetMonomialExponents(SCIP_EXPRDATA_MONOMIAL *monomial)
SCIP_RETCODE SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERREAD((*readerread)))
static SCIP_Bool getNextLine(SCIP *scip, PIPINPUT *pipinput)
int SCIPvarGetIndex(SCIP_VAR *var)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Bool SCIPhashtableExists(SCIP_HASHTABLE *hashtable, void *element)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_Real * SCIPgetValsLinear(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE getVariableIndex(SCIP *scip, SCIP_VAR ***vars, int *varssize, int *nvars, SCIP_HASHMAP *varhash, SCIP_VAR *var, int *varidx)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
static const char commentchars[]
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
#define BMSclearMemoryArray(ptr, num)
SCIP_Real SCIPgetLhsAbspower(SCIP *scip, SCIP_CONS *cons)
SCIP_QUADVARTERM * SCIPgetQuadVarTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
static void syntaxError(SCIP *scip, PIPINPUT *pipinput, const char *msg)
int SCIPfclose(SCIP_FILE *fp)
SCIP_Longint * SCIPgetWeightsKnapsack(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE readPolynomial(SCIP *scip, PIPINPUT *pipinput, char *name, SCIP_EXPRTREE **exprtree, int *degree, SCIP_Bool *newsection)
SCIP_Real SCIPgetLhsVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPexprGetLinearConstant(SCIP_EXPR *expr)
SCIP_Real SCIPround(SCIP *scip, SCIP_Real val)
static SCIP_RETCODE collectAggregatedVars(SCIP *scip, int nvars, SCIP_VAR **vars, int *nAggregatedVars, SCIP_VAR ***aggregatedVars, SCIP_HASHTABLE **varAggregated)
int SCIPexprGetNQuadElements(SCIP_EXPR *expr)
int SCIPgetNVarsLinear(SCIP *scip, SCIP_CONS *cons)
static SCIP_Bool getNextToken(SCIP *scip, PIPINPUT *pipinput)
static SCIP_RETCODE getActiveVariables(SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, SCIP_Real *constant, SCIP_Bool transformed)
SCIP_Real SCIPgetLhsLinear(SCIP *scip, SCIP_CONS *cons)
#define SCIPreallocBufferArray(scip, ptr, num)