74#define READER_NAME "lpreader"
75#define READER_DESC "file reader for MIPs in IBM CPLEX's LP file format"
76#define READER_EXTENSION "lp"
78#define DEFAULT_LINEARIZE_ANDS TRUE
79#define DEFAULT_AGGRLINEARIZATION_ANDS TRUE
85#define LP_MAX_LINELEN 65536
86#define LP_MAX_PUSHEDTOKENS 2
87#define LP_INIT_COEFSSIZE 8192
88#define LP_INIT_QUADCOEFSSIZE 16
89#define LP_MAX_PRINTLEN 561
90#define LP_MAX_NAMELEN 256
91#define LP_PRINTLEN 100
166 SCIPerrorMessage(
"Syntax error in line %d ('%s'): %s \n", lpinput->linenumber, lpinput->token, msg);
167 if( lpinput->linebuf[lpinput->linebufsize - 1] ==
'\n' )
175 (void)
SCIPsnprintf(formatstr, 256,
" %%%ds\n", lpinput->linepos);
177 lpinput->section =
LP_END;
178 lpinput->haserror =
TRUE;
189 return lpinput->haserror;
250 if( isdigit((
unsigned char)
c) )
252 else if( (*exptype ==
LP_EXP_NONE) && !(*hasdot) && (
c ==
'.') && ( isdigit((
unsigned char)nextc) || isspace((
unsigned char)nextc) || nextc ==
'e' || nextc ==
'E') )
257 else if( !firstchar && (*exptype ==
LP_EXP_NONE) && (
c ==
'e' ||
c ==
'E') )
259 if( nextc ==
'+' || nextc ==
'-' )
264 else if( isdigit((
unsigned char)nextc) )
275 else if(
c ==
'/' && isdigit((
unsigned char)nextc) )
303 lpinput->linepos = 0;
304 lpinput->linebuf[lpinput->linebufsize - 2] =
'\0';
306 if(
SCIPfgets(lpinput->linebuf, lpinput->linebufsize, lpinput->file) ==
NULL )
314 lpinput->linenumber++;
317 while( lpinput->linebuf[lpinput->linebufsize - 2] !=
'\0' )
324 lpinput->linebuf[newsize-2] =
'\0';
325 if (
SCIPfgets(lpinput->linebuf + lpinput->linebufsize - 1, newsize - lpinput->linebufsize + 1, lpinput->file) ==
NULL )
327 lpinput->linebufsize = newsize;
329 lpinput->linebuf[lpinput->linebufsize - 1] =
'\0';
337 if( commentstart !=
NULL )
339 *commentstart =
'\0';
340 *(commentstart+1) =
'\0';
359 *pointer1 = *pointer2;
376 assert(lpinput->linepos < lpinput->linebufsize);
379 if( lpinput->npushedtokens > 0 )
381 swapPointers(&lpinput->token, &lpinput->pushedtokens[lpinput->npushedtokens-1]);
382 lpinput->npushedtokens--;
384 SCIPdebugMsg(
scip,
"(line %d) read token again: '%s'\n", lpinput->linenumber, lpinput->token);
389 buf = lpinput->linebuf;
392 if( buf[lpinput->linepos] ==
'\0' )
396 lpinput->section =
LP_END;
400 assert(lpinput->linepos == 0);
402 buf = lpinput->linebuf;
407 assert(lpinput->linepos < lpinput->linebufsize);
413 if(
isValueChar(buf[lpinput->linepos], buf[lpinput->linepos+1],
TRUE, &hasdot, &exptype) )
421 lpinput->token[tokenlen] = buf[lpinput->linepos];
425 while(
isValueChar(buf[lpinput->linepos], buf[lpinput->linepos+1],
FALSE, &hasdot, &exptype) );
434 lpinput->token[tokenlen] = buf[lpinput->linepos];
437 if( tokenlen == 1 &&
isTokenChar(lpinput->token[0]) )
446 if( tokenlen >= 1 && lpinput->token[tokenlen-1] ==
'^' && buf[lpinput->linepos] ==
'2' )
451 && (lpinput->token[tokenlen-1] ==
'<' || lpinput->token[tokenlen-1] ==
'>' || lpinput->token[tokenlen-1] ==
'=')
452 && buf[lpinput->linepos] ==
'=' )
456 else if( lpinput->token[tokenlen-1] ==
'=' && (buf[lpinput->linepos] ==
'<' || buf[lpinput->linepos] ==
'>') )
458 lpinput->token[tokenlen-1] = buf[lpinput->linepos];
463 lpinput->token[tokenlen] =
'\0';
465 SCIPdebugMsg(
scip,
"(line %d) read token: '%s'\n", lpinput->linenumber, lpinput->token);
479 swapPointers(&lpinput->pushedtokens[lpinput->npushedtokens], &lpinput->token);
480 lpinput->npushedtokens++;
492 swapPointers(&lpinput->pushedtokens[lpinput->npushedtokens], &lpinput->tokenbuf);
493 lpinput->npushedtokens++;
526 iscolon = (*lpinput->token ==
':');
537 len = strlen(lpinput->token);
541 if( len > 1 && (len < 9 || len == 15) )
546 while( lpinput->token[
c] !=
'\0' )
548 token[
c] = toupper((
unsigned char)lpinput->token[
c]);
554 if( (len == 3 && strcmp(token,
"MIN") == 0)
555 || (len == 7 && strcmp(token,
"MINIMUM") == 0)
556 || (len == 8 && strcmp(token,
"MINIMIZE") == 0) )
558 SCIPdebugMsg(
scip,
"(line %d) new section: OBJECTIVE\n", lpinput->linenumber);
564 if( (len == 3 && strcmp(token,
"MAX") == 0)
565 || (len == 7 && strcmp(token,
"MAXIMUM") == 0)
566 || (len == 8 && strcmp(token,
"MAXIMIZE") == 0) )
568 SCIPdebugMsg(
scip,
"(line %d) new section: OBJECTIVE\n", lpinput->linenumber);
574 if( len == 7 && strcmp(token,
"SUBJECT") == 0 )
582 SCIPdebugMsg(
scip,
"(line %d) new section: CONSTRAINTS\n", lpinput->linenumber);
584 lpinput->inlazyconstraints =
FALSE;
585 lpinput->inusercuts =
FALSE;
594 if( len == 4 && strcmp(token,
"SUCH") == 0 )
602 SCIPdebugMsg(
scip,
"(line %d) new section: CONSTRAINTS\n", lpinput->linenumber);
604 lpinput->inlazyconstraints =
FALSE;
605 lpinput->inusercuts =
FALSE;
614 if( (len == 2 && strcmp(token,
"ST") == 0)
615 || (len == 3 && strcmp(token,
"ST.") == 0)
616 || (len == 4 && strcmp(token,
"S.T.") == 0) )
618 SCIPdebugMsg(
scip,
"(line %d) new section: CONSTRAINTS\n", lpinput->linenumber);
620 lpinput->inlazyconstraints =
FALSE;
621 lpinput->inusercuts =
FALSE;
625 if( len == 4 && strcmp(token,
"LAZY") == 0 )
633 SCIPdebugMsg(
scip,
"(line %d) new section: CONSTRAINTS (lazy)\n", lpinput->linenumber);
635 lpinput->inlazyconstraints =
TRUE;
636 lpinput->inusercuts =
FALSE;
645 if( len == 4 && strcmp(token,
"USER") == 0 )
653 SCIPdebugMsg(
scip,
"(line %d) new section: CONSTRAINTS (user cuts)\n", lpinput->linenumber);
655 lpinput->inlazyconstraints =
FALSE;
656 lpinput->inusercuts =
TRUE;
665 if( (len == 5 && strcmp(token,
"BOUND") == 0)
666 || (len == 6 && strcmp(token,
"BOUNDS") == 0) )
673 if( (len == 3 && (strcmp(token,
"GEN") == 0 || strcmp(token,
"INT") == 0))
674 || (len == 7 && (strcmp(token,
"GENERAL") == 0 || strcmp(token,
"INTEGER") == 0))
675 || (len == 8 && (strcmp(token,
"GENERALS") == 0 || strcmp(token,
"INTEGERS") == 0)) )
677 SCIPdebugMsg(
scip,
"(line %d) new section: GENERALS\n", lpinput->linenumber);
682 if( (len == 3 && strcmp(token,
"BIN") == 0)
683 || (len == 6 && strcmp(token,
"BINARY") == 0)
684 || (len == 8 && strcmp(token,
"BINARIES") == 0) )
686 SCIPdebugMsg(
scip,
"(line %d) new section: BINARIES\n", lpinput->linenumber);
691 if( (len == 4 && strcmp(token,
"SEMI") == 0)
692 || (len == 5 && strcmp(token,
"SEMIS") == 0)
693 || (len == 15 && strcmp(token,
"SEMI-CONTINUOUS") == 0) )
695 SCIPdebugMsg(
scip,
"(line %d) new section: SEMICONTINUOUS\n", lpinput->linenumber);
700 if( len == 3 && strcmp(token,
"SOS") == 0 )
703 lpinput->section =
LP_SOS;
707 if( len == 3 && strcmp(token,
"END") == 0 )
710 lpinput->section =
LP_END;
727 assert(*sign == +1 || *sign == -1);
729 if( lpinput->token[1] ==
'\0' )
731 if( *lpinput->token ==
'+' )
733 else if( *lpinput->token ==
'-' )
764 val = strtod(lpinput->token, &endptr);
765 if( endptr != lpinput->token && *endptr ==
'\0' )
814 if( strcmp(lpinput->token,
"<") == 0 )
820 else if( strcmp(lpinput->token,
">") == 0 )
826 else if( strcmp(lpinput->token,
"=") == 0 )
857 initial = !dynamiccols;
858 removable = dynamiccols;
876 if( created !=
NULL )
879 else if( created !=
NULL )
985 if( strcmp(lpinput->token,
":") == 0 )
991 SCIPdebugMsg(
scip,
"(line %d) read constraint name: '%s'\n", lpinput->linenumber, name);
1022 firstquadvar =
NULL;
1028 if( lpinput->token[1] ==
'\0' && ( *lpinput->token ==
'+' || *lpinput->token ==
'-' ) )
1031 if( isobjective && havevalue &&
var ==
NULL )
1039 SCIPdebugMsg(
scip,
"(line %d) read objective offset %g\n", lpinput->linenumber, coefsign * coef);
1040 haveobjoffset =
TRUE;
1041 *objoffset = coefsign * coef;
1046 if(
isSign(lpinput, &coefsign) )
1054 SCIPdebugMsg(
scip,
"(line %d) read coefficient sign: %+d\n", lpinput->linenumber, coefsign);
1062 SCIPdebugMsg(
scip,
"(line %d) read coefficient value: %g with sign %+d\n", lpinput->linenumber, coef, coefsign);
1083 syntaxError(
scip, lpinput,
"no constant values allowed for constraints in lp file format");
1101 if( (isobjective || (!havevalue && !havesign)) && !inquadpart &&
isNewSection(
scip, lpinput) )
1103 if( havesign && !havevalue )
1105 SCIPwarningMessage(
scip,
"skipped single sign %c without value or variable in objective\n", coefsign == 1 ?
'+' :
'-');
1116 SCIPdebugMsg(
scip,
"(line %d) read objective offset %g\n", lpinput->linenumber, coefsign * coef);
1117 *objoffset = coefsign * coef;
1125 if( *lpinput->token ==
'[' )
1129 syntaxError(
scip, lpinput,
"cannot start quadratic part while already in quadratic part.");
1132 if( havesign && coefsign != +1 )
1134 syntaxError(
scip, lpinput,
"cannot have '-' in front of quadratic part.");
1139 syntaxError(
scip, lpinput,
"cannot have value in front of quadratic part.");
1143 SCIPdebugMsg(
scip,
"(line %d) start quadratic part\n", lpinput->linenumber);
1149 if( *lpinput->token ==
']' )
1153 syntaxError(
scip, lpinput,
"cannot end quadratic part before starting one.");
1156 if( havesign || havevalue || firstquadvar !=
NULL )
1158 if( firstquadvar ==
NULL )
1160 syntaxError(
scip, lpinput,
"expected value or first quadratic variable.");
1177 syntaxError(
scip, lpinput,
"expected '/2' or '/ 2' after end of quadratic part in objective.");
1180 if( strcmp(lpinput->token,
"/2") == 0 )
1182 SCIPdebugMsg(
scip,
"(line %d) saw '/2' or '/ 2' after quadratic part in objective\n", lpinput->linenumber);
1184 else if( *lpinput->token ==
'/' )
1189 syntaxError(
scip, lpinput,
"expected '/2' or '/ 2' after end of quadratic part in objective.");
1192 SCIPdebugMsg(
scip,
"(line %d) saw '/ 2' after quadratic part in objective\n", lpinput->linenumber);
1196 syntaxError(
scip, lpinput,
"expected '/2' or '/ 2' after end of quadratic part in objective.");
1205 if( *lpinput->token ==
'*' )
1209 syntaxError(
scip, lpinput,
"cannot have '*' outside of quadratic part.");
1212 if( firstquadvar ==
NULL )
1214 syntaxError(
scip, lpinput,
"cannot have '*' before first variable in quadratic term.");
1222 if( !inquadpart && *ncoefs > 0 && !havesign )
1224 syntaxError(
scip, lpinput,
"expected sign ('+' or '-') or sense ('<' or '>').");
1227 if( inquadpart && *nquadcoefs > 0 && !havesign )
1235 if( *lpinput->token ==
'^' )
1239 syntaxError(
scip, lpinput,
"cannot have squares ('^2') outside of quadratic part.");
1242 if( firstquadvar ==
NULL )
1244 syntaxError(
scip, lpinput,
"cannot have square '^2' before variable.");
1263 if( *ncoefs >= *coefssize )
1266 oldcoefssize = *coefssize;
1268 *coefssize =
MAX(*coefssize, (*ncoefs)+1);
1272 assert(*ncoefs < *coefssize);
1275 (*vars)[*ncoefs] =
var;
1276 (*coefs)[*ncoefs] = coefsign * coef;
1282 if( firstquadvar ==
NULL )
1294 if( *nquadcoefs >= *quadcoefssize )
1296 int oldquadcoefssize;
1297 oldquadcoefssize = *quadcoefssize;
1298 *quadcoefssize *= 2;
1299 *quadcoefssize =
MAX(*quadcoefssize, (*nquadcoefs)+1);
1304 assert(*nquadcoefs < *quadcoefssize);
1307 (*quadvars1)[*nquadcoefs] = firstquadvar;
1308 (*quadvars2)[*nquadcoefs] =
var;
1309 (*quadcoefs)[*nquadcoefs] = coefsign * coef;
1311 (*quadcoefs)[*nquadcoefs] /= 2.0;
1321 firstquadvar =
NULL;
1366 *newsection =
FALSE;
1393 if( strcmp(lpinput->token,
":") == 0 )
1399 SCIPdebugMsg(
scip,
"(line %d) read constraint name: '%s'\n", lpinput->linenumber, name);
1426 firstquadvar =
NULL;
1431 if( lpinput->token[1] ==
'\0' && ( *lpinput->token ==
'+' || *lpinput->token ==
'-' ) )
1434 if( isobjective && havevalue &&
var ==
NULL )
1443 haveobjoffset =
TRUE;
1449 if(
isSign(lpinput, &coefsign) )
1451 SCIPdebugMsg(
scip,
"(line %d) read coefficient sign: %+d\n", lpinput->linenumber, coefsign);
1486 if( (isobjective || (!havevalue && !havesign)) && !inquadpart &&
isNewSection(
scip, lpinput) )
1488 if( havesign && !havevalue )
1490 SCIPwarningMessage(
scip,
"skipped single sign %c without value or variable in objective\n", coefsign == 1 ?
'+' :
'-');
1510 if( *lpinput->token ==
'[' )
1512 syntaxError(
scip, lpinput,
"cannot start quadratic part while in exact solving mode.");
1517 if( *lpinput->token ==
']' )
1519 syntaxError(
scip, lpinput,
"cannot end quadratic part while in exact solving mode.");
1524 if( !inquadpart && *ncoefs > 0 && !havesign )
1526 syntaxError(
scip, lpinput,
"expected sign ('+' or '-') or sense ('<' or '>').");
1532 if( *lpinput->token ==
'^' )
1536 syntaxError(
scip, lpinput,
"cannot have squares ('^2') outside of quadratic part.");
1539 if( firstquadvar ==
NULL )
1541 syntaxError(
scip, lpinput,
"cannot have square '^2' before variable.");
1560 if( *ncoefs >= *coefssize )
1563 oldcoefssize = *coefssize;
1565 *coefssize =
MAX(*coefssize, (*ncoefs)+1);
1569 assert(*ncoefs < *coefssize);
1572 (*vars)[*ncoefs] =
var;
1583 firstquadvar =
NULL;
1616 objoffset, &newsection), TERMINATE );
1628 for(
i = 0;
i < ncoefs; ++
i )
1680 &quadcoefssize, &quadvars1, &quadvars2, &quadcoefs, &nquadcoefs, &objoffset, &newsection) );
1692 for(
i = 0;
i < ncoefs; ++
i )
1705 if( nquadcoefs > 0 )
1729 SCIP_CALL(
SCIPcreateConsQuadraticNonlinear(
scip, &quadobjcons,
"quadobj", 1, &quadobjvar, &minusone, nquadcoefs, quadvars1, quadvars2, quadcoefs, lhs, rhs,
1797 syntaxError(
scip, lpinput,
"value for binary variable must be '0' or '1'.");
1824 &quadcoefssize, &quadvars1, &quadvars2, &quadcoefs, &nquadcoefs,
NULL, &newsection) );
1833 if( nquadcoefs > 0 )
1836 syntaxError(
scip, lpinput,
"quadratic indicator constraints not supported.");
1839 if( name2[0] !=
'\0' )
1841 syntaxError(
scip, lpinput,
"did not expect name for linear constraint.");
1851 if( !
isSense(lpinput, &linsense) )
1853 syntaxError(
scip, lpinput,
"expected constraint sense '<=', '=', or '>='.");
1865 if(
isSign(lpinput, &linsidesign) )
1878 linsidevalue *= linsidesign;
1885 linrhs = -linsidevalue;
1886 for( j = 0; j < nlincoefs; ++j )
1890 linrhs = linsidevalue;
1894 linrhs = linsidevalue;
1905 initial = lpinput->initialconss && !lpinput->inlazyconstraints && !lpinput->inusercuts;
1907 enforce = !lpinput->inusercuts;
1908 check = !lpinput->inusercuts;
1911 dynamic = lpinput->dynamicconss;
1912 removable = lpinput->dynamicrows || lpinput->inusercuts;
1921 SCIPdebugMsg(
scip,
"(line %d) created constraint%s: ", lpinput->linenumber,
1922 lpinput->inlazyconstraints ?
" (lazy)" : (lpinput->inusercuts ?
" (user cut)" :
""));
1933 for( j = 0; j < nlincoefs; ++j )
1943 SCIPdebugMsg(
scip,
"(line %d) created constraint%s: ", lpinput->linenumber,
1944 lpinput->inlazyconstraints ?
" (lazy)" : (lpinput->inusercuts ?
" (user cut)" :
""));
2012 NULL, &newsection) );
2019 syntaxError(
scip, lpinput,
"expected constraint sense '<=', '=', or '>='.");
2029 if( !
isSense(lpinput, &sense) )
2031 syntaxError(
scip, lpinput,
"expected constraint sense '<=', '=', or '>='.");
2043 if(
isSign(lpinput, &sidesign) )
2081 isIndicatorCons =
FALSE;
2085 if ( *lpinput->token ==
'<' )
2087 int linepos = lpinput->linepos-1;
2093 if ( *lpinput->token ==
'-' )
2099 if ( *lpinput->token ==
'>' )
2101 lpinput->linepos = linepos;
2104 "SCIP does not support equivalence (<->) indicator constraints; consider using the \"->\" form.");
2111 lpinput->linepos = linepos;
2116 if ( *lpinput->token ==
'-' )
2125 if ( *lpinput->token ==
'>' )
2126 isIndicatorCons =
TRUE;
2141 if( !isIndicatorCons )
2144 initial = lpinput->initialconss && !lpinput->inlazyconstraints && !lpinput->inusercuts;
2146 enforce = !lpinput->inusercuts;
2147 check = !lpinput->inusercuts;
2151 dynamic = lpinput->dynamicconss;
2152 removable = lpinput->dynamicrows || lpinput->inusercuts;
2161 SCIPdebugMsg(
scip,
"(line %d) created constraint%s: ", lpinput->linenumber,
2162 lpinput->inlazyconstraints ?
" (lazy)" : (lpinput->inusercuts ?
" (user cut)" :
""));
2171 syntaxError(
scip, lpinput,
"Indicator part can only consist of one binary variable.");
2177 syntaxError(
scip, lpinput,
"There cannot be a coefficient before the binary indicator variable.");
2182 syntaxError(
scip, lpinput,
"Indicator part cannot handle equations.");
2261 &quadcoefssize, &quadvars1, &quadvars2, &quadcoefs, &nquadcoefs,
NULL, &newsection) );
2267 if( ncoefs > 0 || nquadcoefs > 0 )
2268 syntaxError(
scip, lpinput,
"expected constraint sense '<=', '=', or '>='.");
2278 if( !
isSense(lpinput, &sense) )
2280 syntaxError(
scip, lpinput,
"expected constraint sense '<=', '=', or '>='.");
2292 if(
isSign(lpinput, &sidesign) )
2305 sidevalue *= sidesign;
2330 isIndicatorCons =
FALSE;
2334 if ( *lpinput->token ==
'<' )
2336 int linepos = lpinput->linepos-1;
2342 if ( *lpinput->token ==
'-' )
2348 if ( *lpinput->token ==
'>' )
2350 lpinput->linepos = linepos;
2353 "SCIP does not support equivalence (<->) indicator constraints; consider using the \"->\" form.");
2360 lpinput->linepos = linepos;
2365 if ( *lpinput->token ==
'-' )
2374 if ( *lpinput->token ==
'>' )
2375 isIndicatorCons =
TRUE;
2390 if( !isIndicatorCons )
2393 initial = lpinput->initialconss && !lpinput->inlazyconstraints && !lpinput->inusercuts;
2395 enforce = !lpinput->inusercuts;
2396 check = !lpinput->inusercuts;
2400 dynamic = lpinput->dynamicconss;
2401 removable = lpinput->dynamicrows || lpinput->inusercuts;
2402 if( nquadcoefs == 0 )
2410 nquadcoefs, quadvars1, quadvars2, quadcoefs, lhs, rhs,
2411 initial,
separate, enforce, check,
propagate, local, modifiable, dynamic, removable);
2418 SCIPdebugMsg(
scip,
"(line %d) created constraint%s: ", lpinput->linenumber,
2419 lpinput->inlazyconstraints ?
" (lazy)" : (lpinput->inusercuts ?
" (user cut)" :
""));
2426 if( ncoefs != 1 || nquadcoefs > 0 )
2428 syntaxError(
scip, lpinput,
"Indicator part can only consist of one binary variable.");
2434 syntaxError(
scip, lpinput,
"There cannot be a coefficient before the binary indicator variable.");
2439 syntaxError(
scip, lpinput,
"Indicator part cannot handle equations.");
2495 hassign =
isSign(lpinput, &sign);
2508 syntaxError(
scip, lpinput,
"expected bound sense '<=', '=', or '>='.");
2552 if(
isSense(lpinput, &rightsense) )
2567 hassign =
isSign(lpinput, &sign);
2582 switch( rightsense )
2610 syntaxError(
scip, lpinput,
"variable with bound is marked as 'free'.");
2678 hassign =
isSign(lpinput, &sign);
2691 syntaxError(
scip, lpinput,
"expected bound sense '<=', '=', or '>='.");
2735 if(
isSense(lpinput, &rightsense) )
2750 hassign =
isSign(lpinput, &sign);
2765 switch( rightsense )
2793 syntaxError(
scip, lpinput,
"variable with bound is marked as 'free'.");
2986 syntaxError(
scip, lpinput,
"unknown variable in semi-continuous section.");
3047 initial = lpinput->initialconss;
3053 dynamic = lpinput->dynamicconss;
3054 removable = lpinput->dynamicrows;
3074 if( strcmp(lpinput->token,
":") == 0 )
3101 if( strcmp(lpinput->token,
":") == 0 )
3105 lpinput->token[0] =
':';
3106 lpinput->token[1] =
'\0';
3115 if( strcmp(lpinput->token,
"S1") == 0 )
3118 SCIP_CALL(
SCIPcreateConsSOS1(
scip, &cons, name, 0,
NULL,
NULL, initial,
separate, enforce, check,
propagate,
3119 local, dynamic, removable,
FALSE) );
3121 else if( strcmp(lpinput->token,
"S2") == 0 )
3124 SCIP_CALL(
SCIPcreateConsSOS2(
scip, &cons, name, 0,
NULL,
NULL, initial,
separate, enforce, check,
propagate,
3125 local, dynamic, removable,
FALSE) );
3129 syntaxError(
scip, lpinput,
"SOS constraint type other than 1 or 2 appeared.");
3132 assert( type == 1 || type == 2 );
3139 syntaxError(
scip, lpinput,
"SOS constraint type has to be followed by two colons.");
3146 syntaxError(
scip, lpinput,
"SOS constraint type has to be followed by two colons.");
3193 if(
isSign(lpinput, &sign) )
3247 const char* filename
3255 lpinput->file =
SCIPfopen(filename,
"r");
3256 if( lpinput->file ==
NULL )
3264 SCIP_CALL_TERMINATE( retcode,
SCIPcreateProb(
scip, filename,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL), TERMINATE );
3270 switch( lpinput->section )
3374 if( requiredsize > *
nvars )
3392 for( v = 0; v < *
nvars; ++v )
3402 *constant += (*scalars)[v];
3403 (*scalars)[v] *= -1.0;
3421 linebuffer[0] =
'\0';
3438 if( (*linecnt) > 0 )
3440 linebuffer[(*linecnt)] =
'\0';
3454 const char* extension
3467 (void) strncat(linebuffer, extension,
LP_MAX_PRINTLEN - strlen(linebuffer));
3469 (*linecnt) += (int) strlen(extension);
3471 SCIPdebugMsg(
scip,
"linebuffer <%s>, length = %lu\n", linebuffer, (
unsigned long)strlen(linebuffer));
3482 const char* rowname,
3483 const char* rownameextension,
3503 assert(strcmp(type,
"=") == 0 || strcmp(type,
"<=") == 0 || strcmp(type,
">=") == 0);
3512 if( strlen(rowname) > 0 || strlen(rownameextension) > 0 )
3524 for( v = 0; v < nlinvars; ++v )
3554 if( quadexpr !=
NULL )
3562 int nbilinexprterms;
3574 nactivevars = nlinexprs;
3576 for( v = 0; v < nlinexprs; ++v )
3587 constant += activeconstant;
3590 for( v = 0; v < nactivevars; ++v )
3597 var = activevars[v];
3628 for( v = 0; v < nquadexprs; ++v )
3642 if( lincoef == 0.0 )
3668 for( v = 0; v < nquadexprs; ++v )
3682 if( sqrcoef == 0.0 )
3705 for( v = 0; v < nbilinexprterms; ++v )
3777 const char* rowname,
3778 const char* rownameextension,
3796 assert(strcmp(type,
"=") == 0 || strcmp(type,
"<=") == 0 || strcmp(type,
">=") == 0);
3805 if( strlen(rowname) > 0 || strlen(rownameextension) > 0 )
3817 for( v = 0; v < nlinvars; ++v )
3887 const char* rowname,
3914 nactivevars = nlinvars;
3919 if( linvals !=
NULL )
3927 for( v = 0; v < nactivevars; ++v )
3928 activevals[v] = 1.0;
3942 rhs - activeconstant, transformed) );
3950 nactivevars, quadexpr, lhs - activeconstant, transformed) );
3956 nactivevars, quadexpr, rhs - activeconstant, transformed) );
3975 const char* rowname,
3991 assert( type == 1 || type == 2 );
3999 if( strlen(rowname) > 0 )
4009 for( v = 0; v <
nvars; ++v )
4013 if( weights !=
NULL )
4034 const char* consname,
4061 if( !aggrlinearizationands )
4063 vars[0] = resultant;
4068 for( v = 0; v <
nvars; ++v )
4071 vars[1] = operands[v];
4080 for( v =
nvars - 1; v >= 0; --v )
4082 vars[v] = operands[v];
4089 if( aggrlinearizationands )
4136 for( v = 0; v <
nvars; ++v )
4153 if ( *saggvars <= *naggvars )
4157 assert( newsize > *saggvars );
4159 *saggvars = newsize;
4162 (*aggvars)[*naggvars] =
var;
4165 assert( *naggvars <= *saggvars );
4179 int nAggregatedVars,
4197 for( j = 0; j < nAggregatedVars; ++j )
4202 activevars[0] = aggregatedVars[j];
4203 activevals[0] = 1.0;
4204 activeconstant = 0.0;
4209 activevals[nactivevars] = -1.0;
4210 activevars[nactivevars] = aggregatedVars[j];
4215 SCIP_CALL(
printRow(
scip, file, consname,
"",
"=", activevars, activevals, nactivevars,
NULL, - activeconstant,
4240 printwarning =
TRUE;
4243 for( v = 0; v <
nvars; ++v )
4247 SCIPwarningMessage(
scip,
"there is a variable name which has to be cut down to %d characters; LP might be corrupted\n",
4256 "it is not possible to read the generated LP file with SCIP; " \
4257 "use write/genproblem or write/gentransproblem for generic variable names\n");
4258 printwarning =
FALSE;
4275 const char* conshdlrname;
4281 for(
c = 0;
c < nconss; ++
c )
4300 if( strcmp(conshdlrname,
"linear") == 0 )
4318 if( printwarning && isdigit((
unsigned char)
SCIPconsGetName(cons)[0]) )
4321 "it is not possible to read the generated LP file with SCIP; " \
4322 "use write/genproblem or write/gentransproblem for generic variable names\n");
4323 printwarning =
FALSE;
4379 vars,
nvars, nbinvars, nintvars, nimplvars, ncontvars, conss, nconss,
result) );
4414 "reading/" READER_NAME "/linearize-and-constraints",
4415 "should possible \"and\" constraint be linearized when writing the lp file?",
4419 "should an aggregated linearization for and constraints be used?",
4430 const char* filename,
4442 lpinput.file =
NULL;
4444 lpinput.linebuf[0] =
'\0';
4446 lpinput.probname[0] =
'\0';
4447 lpinput.objname[0] =
'\0';
4449 lpinput.token[0] =
'\0';
4451 lpinput.tokenbuf[0] =
'\0';
4457 lpinput.npushedtokens = 0;
4458 lpinput.linenumber = 0;
4459 lpinput.linepos = 0;
4462 lpinput.inlazyconstraints =
FALSE;
4463 lpinput.inusercuts =
FALSE;
4464 lpinput.haserror =
FALSE;
4490 if( lpinput.haserror )
4542 const char* conshdlrname;
4551 int nConsIndicator = 0;
4574 int nintegers =
nvars - ncontvars;
4582 if( conshdlrInd !=
NULL )
4597 for(
c = 0;
c < nConsInd; ++
c )
4610 for(
c = 0;
c < nconss; ++
c )
4619 if( strcmp(conshdlrname,
"indicator") == 0 )
4641 assert(implintlevel >= -2);
4642 assert(implintlevel <= 2);
4654 SCIPinfoMessage(
scip, file,
"\\ Variables : %d (%d binary, %d integer, %d implicit integer, %d continuous)\n",
4655 nvars, nbinvars, nintvars, nimplvars, ncontvars);
4665 for( v = 0; v <
nvars; ++v )
4676 if( objexact !=
NULL )
4748 if( objexact !=
NULL )
4780 if( zeroobj || objoffset != 0.0 )
4801 if( reader !=
NULL )
4806 linearizeands = readerdata->linearizeands;
4807 aggrlinearizationands = readerdata->aggrlinearizationands;
4824 for(
c = 0;
c < nconss; ++
c )
4846 if( strcmp(conshdlrname,
"linear") == 0 )
4852 else if( strcmp(conshdlrname,
"setppc") == 0 )
4861 consvars,
NULL, nconsvars,
NULL, 1.0, 1.0, transformed) );
4873 else if( strcmp(conshdlrname,
"logicor") == 0 )
4879 else if( strcmp(conshdlrname,
"knapsack") == 0 )
4889 for( v = 0; v < nconsvars; ++v )
4897 else if( strcmp(conshdlrname,
"varbound") == 0 )
4914 else if( strcmp(conshdlrname,
"SOS1") == 0 )
4917 consSOS1[nConsSOS1++] = cons;
4919 else if( strcmp(conshdlrname,
"SOS2") == 0 )
4922 consSOS2[nConsSOS2++] = cons;
4924 else if( strcmp(conshdlrname,
"indicator") == 0 )
4963 if( strlen(consname) > 0 )
4972 for( v = 0; v < nlinvars; ++v )
4975 if(
var != slackvar )
4977 consvars[cnt] =
var;
4978 consvals[cnt++] = linvals[v];
4992 consIndicator[nConsIndicator++] = cons;
4994 else if( strcmp(conshdlrname,
"nonlinear") == 0 )
5011 if( changed && !infeasible )
5035 consExpr[nConsExpr++] = cons;
5043 else if( strcmp(conshdlrname,
"and") == 0 )
5057 else if(strcmp(conshdlrname,
"exactlinear") == 0 )
5098 for(
c = 0;
c < nConsSOS1; ++
c )
5108 for(
c = 0;
c < nConsSOS2; ++
c )
5118 for(
c = 0;
c < nConsExpr; ++
c )
5126 if( ntmpvars > tmpvarssize )
5138 for(
c = 0;
c < nConsIndicator; ++
c )
5142 cons = consIndicator[
c];
5156 for( v = 0; v <
nvars; ++v )
5205 for( v = 0; v < naggvars; ++v )
5219 for( v = 0; v < nintegers; ++v )
5238 for( v = 0; v < naggvars; ++v )
5264 for( v = nbinvars; v < nintegers; ++v )
5297 for( v = 0; v < naggvars; ++v )
5335 if( conshdlrInd !=
NULL )
5339 if( nConsSOS1 > 0 || nConsSOS2 > 0 )
5345 for(
c = 0;
c < nConsSOS1; ++
c )
5357 for(
c = 0;
c < nConsSOS2; ++
c )
Constraint handler for AND constraints, .
constraint handler for bound disjunction constraints
Constraint handler for linear constraints in their most general form, .
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 nonlinear constraints specified by algebraic expressions
Constraint handler for the set partitioning / packing / covering constraints .
constraint handler for SOS type 1 constraints
constraint handler for SOS type 2 constraints
Constraint handler for variable bound constraints .
#define SCIP_CALL_ABORT(x)
#define SCIP_CALL_TERMINATE(retcode, x, TERM)
SCIP_FILE * SCIPfopen(const char *path, const char *mode)
int SCIPfclose(SCIP_FILE *fp)
char * SCIPfgets(char *s, int size, SCIP_FILE *stream)
SCIP_RETCODE SCIPcheckQuadraticNonlinear(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *isquadratic)
int SCIPgetNVarsKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetVbdcoefVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_RATIONAL * SCIPgetLhsExactLinear(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_RATIONAL * SCIPgetRhsExactLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateConsExactLinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_RATIONAL **vals, SCIP_RATIONAL *lhs, SCIP_RATIONAL *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 * SCIPgetWeightsSOS2(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsSOS2(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsExactLinear(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)
SCIP_RETCODE SCIPaddVarSOS1(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real weight)
SCIP_RETCODE SCIPcreateConsBounddisjunction(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_BOUNDTYPE *boundtypes, SCIP_Real *bounds, 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_RETCODE SCIPcreateConsIndicator(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *binvar, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
int SCIPgetNVarsAnd(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsExactLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Real * SCIPgetValsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateConsSOS1(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *weights, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
SCIP_VAR * SCIPgetVbdvarVarbound(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsSetppc(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsSOS2(SCIP *scip, SCIP_CONS *cons)
SCIP_Real * SCIPgetWeightsSOS1(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_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 SCIPcreateConsSOS2(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *weights, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
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 ** SCIPgetVarsSOS1(SCIP *scip, SCIP_CONS *cons)
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 SCIPcreateConsQuadraticNonlinear(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)
int SCIPgetNVarsSOS1(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetLhsNonlinear(SCIP_CONS *cons)
SCIP_RATIONAL ** SCIPgetValsExactLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPaddVarSOS2(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real weight)
@ SCIP_SETPPCTYPE_PARTITIONING
@ SCIP_SETPPCTYPE_COVERING
@ SCIP_SETPPCTYPE_PACKING
SCIP_RETCODE SCIPreadLp(SCIP *scip, SCIP_READER *reader, const char *filename, SCIP_RESULT *result)
SCIP_RETCODE SCIPwriteLp(SCIP *scip, FILE *file, const char *name, SCIP_Bool transformed, SCIP_OBJSENSE objsense, SCIP_Real objoffset, SCIP_Real objscale, SCIP_RATIONAL *objoffsetexact, SCIP_RATIONAL *objscaleexact, SCIP_VAR **vars, int nvars, int nbinvars, int nintvars, int nimplvars, int ncontvars, SCIP_CONS **conss, int nconss, SCIP_RESULT *result)
SCIP_RETCODE SCIPincludeReaderLp(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 SCIPaddOrigObjoffset(SCIP *scip, SCIP_Real addval)
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)
SCIP_RETCODE SCIPaddOrigObjoffsetExact(SCIP *scip, SCIP_RATIONAL *addval)
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
SCIP_RETCODE SCIPhashmapSetImageInt(SCIP_HASHMAP *hashmap, void *origin, int image)
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)
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)
SCIP_RETCODE SCIPgetIntParam(SCIP *scip, const char *name, int *value)
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_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 SCIPconsIsDeleted(SCIP_CONS *cons)
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_Bool SCIPisExact(SCIP *scip)
void SCIPexprGetQuadraticBilinTerm(SCIP_EXPR *expr, int termidx, SCIP_EXPR **expr1, SCIP_EXPR **expr2, SCIP_Real *coef, int *pos2, SCIP_EXPR **prodexpr)
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_RETCODE SCIPreleaseExpr(SCIP *scip, SCIP_EXPR **expr)
SCIP_Bool SCIPisExprVar(SCIP *scip, SCIP_EXPR *expr)
SCIP_RETCODE SCIPcheckExprQuadratic(SCIP *scip, SCIP_EXPR *expr, SCIP_Bool *isquadratic)
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)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
BMS_BUFMEM * SCIPbuffer(SCIP *scip)
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)
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
#define SCIPfreeBlockMemory(scip, ptr)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
#define SCIPallocBlockMemory(scip, ptr)
void SCIPrationalMult(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
void SCIPrationalSetInfinity(SCIP_RATIONAL *res)
void SCIPrationalAdd(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
SCIP_Real SCIPrationalGetReal(SCIP_RATIONAL *rational)
SCIP_Bool SCIPrationalIsString(const char *desc)
int SCIPrationalToString(SCIP_RATIONAL *rational, char *str, int strlen)
SCIP_RETCODE SCIPrationalCreateBlockArray(BMS_BLKMEM *mem, SCIP_RATIONAL ***rational, int size)
void SCIPrationalSetReal(SCIP_RATIONAL *res, SCIP_Real real)
void SCIPrationalFreeBuffer(BMS_BUFMEM *bufmem, SCIP_RATIONAL **rational)
SCIP_RETCODE SCIPrationalCreateBuffer(BMS_BUFMEM *bufmem, SCIP_RATIONAL **rational)
SCIP_Bool SCIPrationalIsZero(SCIP_RATIONAL *rational)
void SCIPrationalSetRational(SCIP_RATIONAL *res, SCIP_RATIONAL *src)
void SCIPrationalSetString(SCIP_RATIONAL *res, const char *desc)
void SCIPrationalSetNegInfinity(SCIP_RATIONAL *res)
SCIP_Bool SCIPrationalIsNegative(SCIP_RATIONAL *rational)
SCIP_Bool SCIPrationalIsInfinity(SCIP_RATIONAL *rational)
void SCIPrationalFreeBlockArray(BMS_BLKMEM *mem, SCIP_RATIONAL ***ratblockarray, int size)
SCIP_Bool SCIPrationalIsEQReal(SCIP_RATIONAL *rat, SCIP_Real real)
SCIP_Bool SCIPrationalIsNegInfinity(SCIP_RATIONAL *rational)
SCIP_RETCODE SCIPrationalReallocBlockArray(BMS_BLKMEM *mem, SCIP_RATIONAL ***result, int oldlen, int newlen)
SCIP_Bool SCIPrationalIsEQ(SCIP_RATIONAL *rat1, SCIP_RATIONAL *rat2)
void SCIPrationalMultReal(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_Real op2)
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_READERDATA * SCIPreaderGetData(SCIP_READER *reader)
SCIP_RETCODE SCIPsetReaderWrite(SCIP *scip, SCIP_READER *reader,)
SCIP_READER * SCIPfindReader(SCIP *scip, const char *name)
SCIP_RETCODE SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader,)
const char * SCIPreaderGetName(SCIP_READER *reader)
SCIP_RETCODE SCIPsetReaderFree(SCIP *scip, SCIP_READER *reader,)
void SCIPreaderMarkExact(SCIP_READER *reader)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasZero(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
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 SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
SCIP_VAR * SCIPvarGetNegatedVar(SCIP_VAR *var)
SCIP_RETCODE SCIPchgVarUbExact(SCIP *scip, SCIP_VAR *var, SCIP_RATIONAL *newbound)
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 SCIPaddVarExactData(SCIP *scip, SCIP_VAR *var, SCIP_RATIONAL *lb, SCIP_RATIONAL *ub, SCIP_RATIONAL *obj)
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 SCIPgetProbvarLinearSum(SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, int varssize, SCIP_Real *constant, int *requiredsize)
SCIP_RETCODE SCIPchgVarType(SCIP *scip, SCIP_VAR *var, SCIP_VARTYPE vartype, SCIP_Bool *infeasible)
SCIP_RETCODE SCIPgetNegatedVar(SCIP *scip, SCIP_VAR *var, SCIP_VAR **negvar)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
SCIP_Bool SCIPvarIsNegated(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_IMPLINTTYPE SCIPvarGetImplType(SCIP_VAR *var)
SCIP_RETCODE SCIPchgVarObjExact(SCIP *scip, SCIP_VAR *var, SCIP_RATIONAL *newobj)
SCIP_RETCODE SCIPchgVarObj(SCIP *scip, SCIP_VAR *var, SCIP_Real newobj)
SCIP_RETCODE SCIPchgVarLbExact(SCIP *scip, SCIP_VAR *var, SCIP_RATIONAL *newbound)
SCIP_RATIONAL * SCIPvarGetObjExact(SCIP_VAR *var)
int SCIPstrcasecmp(const char *s1, const char *s2)
int SCIPsnprintf(char *t, int len, const char *s,...)
void SCIPprintSysError(const char *message)
int SCIPmemccpy(char *dest, const char *src, char stop, unsigned int cnt)
assert(minobj< SCIPgetCutoffbound(scip))
static SCIP_Bool propagate
static const SCIP_Real scalars[]
memory allocation routines
#define BMSclearMemoryArray(ptr, num)
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
public methods for input file readers
public methods for problem variables
wrapper for rational number arithmetic
#define LP_INIT_COEFSSIZE
static SCIP_Bool hasError(LPINPUT *lpinput)
static const char commentchars[]
#define LP_MAX_PUSHEDTOKENS
static SCIP_Bool isTokenChar(char c)
static SCIP_RETCODE printAndCons(SCIP *scip, FILE *file, const char *consname, SCIP_CONS *cons, SCIP_Bool aggrlinearizationands, SCIP_Bool transformed)
static SCIP_RETCODE getActiveVariables(SCIP *scip, SCIP_VAR ***vars, SCIP_Real **scalars, int *nvars, SCIP_Real *constant, SCIP_Bool transformed)
static SCIP_Bool isSign(LPINPUT *lpinput, int *sign)
static SCIP_Bool isNewSection(SCIP *scip, LPINPUT *lpinput)
#define LP_INIT_QUADCOEFSSIZE
static void clearLine(char *linebuffer, int *linecnt)
static SCIP_Bool hasError(LPINPUT *lpinput)
static void pushToken(LPINPUT *lpinput)
static SCIP_Bool getNextLine(SCIP *scip, LPINPUT *lpinput)
static void swapTokenBuffer(LPINPUT *lpinput)
static SCIP_RETCODE readConstraints(SCIP *scip, LPINPUT *lpinput)
static SCIP_RETCODE readBinaries(SCIP *scip, LPINPUT *lpinput)
static SCIP_RETCODE readSemicontinuous(SCIP *scip, LPINPUT *lpinput)
static SCIP_Bool getNextToken(SCIP *scip, LPINPUT *lpinput)
static void printSosCons(SCIP *scip, FILE *file, const char *rowname, SCIP_VAR **vars, SCIP_Real *weights, int nvars, int type)
static void checkVarnames(SCIP *scip, SCIP_VAR **vars, int nvars)
static SCIP_Bool isValueChar(char c, char nextc, SCIP_Bool firstchar, SCIP_Bool *hasdot, LPEXPTYPE *exptype)
static SCIP_RETCODE printAggregatedCons(SCIP *scip, FILE *file, SCIP_Bool transformed, int nvars, int nAggregatedVars, SCIP_VAR **aggregatedVars)
static SCIP_RETCODE readGenerals(SCIP *scip, LPINPUT *lpinput)
static SCIP_RETCODE readConstraintsRational(SCIP *scip, LPINPUT *lpinput)
static SCIP_Bool isValueRational(SCIP *scip, LPINPUT *lpinput, SCIP_RATIONAL *value)
#define LP_MAX_PUSHEDTOKENS
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 readBoundsRational(SCIP *scip, LPINPUT *lpinput)
static SCIP_RETCODE readObjective(SCIP *scip, LPINPUT *lpinput)
static SCIP_Bool isValue(SCIP *scip, LPINPUT *lpinput, SCIP_Real *value)
static SCIP_RETCODE readSos(SCIP *scip, LPINPUT *lpinput)
static SCIP_RETCODE createIndicatorConstraint(SCIP *scip, LPINPUT *lpinput, const char *name, SCIP_VAR *binvar, SCIP_Real binvalue)
static void syntaxError(SCIP *scip, LPINPUT *lpinput, const char *msg)
static void pushBufferToken(LPINPUT *lpinput)
static void endLine(SCIP *scip, FILE *file, char *linebuffer, int *linecnt)
static SCIP_RETCODE readCoefficients(SCIP *scip, LPINPUT *lpinput, SCIP_Bool isobjective, char *name, int *coefssize, SCIP_VAR ***vars, SCIP_Real **coefs, int *ncoefs, int *quadcoefssize, SCIP_VAR ***quadvars1, SCIP_VAR ***quadvars2, SCIP_Real **quadcoefs, int *nquadcoefs, SCIP_Real *objoffset, SCIP_Bool *newsection)
static SCIP_Bool isSense(LPINPUT *lpinput, LPSENSE *sense)
static SCIP_Bool isDelimChar(char c)
static void swapPointers(char **pointer1, char **pointer2)
static SCIP_RETCODE readBounds(SCIP *scip, LPINPUT *lpinput)
static SCIP_RETCODE readObjectiveRational(SCIP *scip, LPINPUT *lpinput)
#define DEFAULT_AGGRLINEARIZATION_ANDS
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 readCoefficientsRational(SCIP *scip, LPINPUT *lpinput, SCIP_Bool isobjective, char *name, int *coefssize, SCIP_VAR ***vars, SCIP_RATIONAL ***coefs, int *ncoefs, SCIP_RATIONAL *objoffset, SCIP_Bool *newsection)
static SCIP_RETCODE readStart(SCIP *scip, LPINPUT *lpinput)
static SCIP_RETCODE collectAggregatedVars(SCIP *scip, SCIP_VAR **vars, int nvars, SCIP_VAR ***aggvars, int *naggvars, int *saggvars, SCIP_HASHTABLE *varAggregated)
static SCIP_RETCODE readLPFile(SCIP *scip, LPINPUT *lpinput, const char *filename)
static SCIP_RETCODE printRowExact(SCIP *scip, FILE *file, const char *rowname, const char *rownameextension, const char *type, SCIP_VAR **linvars, SCIP_RATIONAL **linvals, int nlinvars, SCIP_RATIONAL *rhs)
static void checkConsnames(SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_Bool transformed)
static void appendLine(SCIP *scip, FILE *file, char *linebuffer, int *linecnt, const char *extension)
static SCIP_RETCODE getVariable(SCIP *scip, char *name, SCIP_VAR **var, SCIP_Bool *created)
#define DEFAULT_LINEARIZE_ANDS
static SCIP_Bool isTokenChar(char c)
public methods for constraint handler plugins and constraints
public methods for exact solving
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
static SCIP_RETCODE separate(SCIP *scip, SCIP_SEPA *sepa, SCIP_SOL *sol, SCIP_RESULT *result)
Main separation function.
struct SCIP_Cons SCIP_CONS
struct SCIP_Conshdlr SCIP_CONSHDLR
struct SCIP_Expr SCIP_EXPR
enum SCIP_BoundType SCIP_BOUNDTYPE
struct SCIP_HashMap SCIP_HASHMAP
#define SCIP_DECL_HASHKEYEQ(x)
#define SCIP_DECL_HASHGETKEY(x)
#define SCIP_DECL_HASHKEYVAL(x)
struct SCIP_HashTable SCIP_HASHTABLE
enum SCIP_Objsense SCIP_OBJSENSE
struct SCIP_Rational SCIP_RATIONAL
#define SCIP_DECL_READERWRITE(x)
struct SCIP_ReaderData SCIP_READERDATA
struct SCIP_Reader SCIP_READER
#define SCIP_DECL_READERREAD(x)
#define SCIP_DECL_READERCOPY(x)
#define SCIP_DECL_READERFREE(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