71#if !defined(_WIN32) && !defined(_WIN64)
76#define READER_NAME "lpreader"
77#define READER_DESC "file reader for MIPs in IBM CPLEX's LP file format"
78#define READER_EXTENSION "lp"
80#define DEFAULT_LINEARIZE_ANDS TRUE
81#define DEFAULT_AGGRLINEARIZATION_ANDS TRUE
87#define LP_MAX_LINELEN 65536
88#define LP_MAX_PUSHEDTOKENS 2
89#define LP_INIT_COEFSSIZE 8192
90#define LP_INIT_QUADCOEFSSIZE 16
91#define LP_MAX_PRINTLEN 561
92#define LP_MAX_NAMELEN 256
93#define LP_PRINTLEN 100
99 SCIP_Bool linearizeands;
100 SCIP_Bool aggrlinearizationands;
139 SCIP_Bool inlazyconstraints;
140 SCIP_Bool inusercuts;
141 SCIP_Bool initialconss;
142 SCIP_Bool dynamicconss;
143 SCIP_Bool dynamiccols;
144 SCIP_Bool dynamicrows;
168 SCIPerrorMessage(
"Syntax error in line %d ('%s'): %s \n", lpinput->linenumber, lpinput->token, msg);
169 if( lpinput->linebuf[lpinput->linebufsize - 1] ==
'\n' )
177 (void)
SCIPsnprintf(formatstr, 256,
" %%%ds\n", lpinput->linepos);
179 lpinput->section =
LP_END;
180 lpinput->haserror =
TRUE;
191 return lpinput->haserror;
252 if( isdigit((
unsigned char)
c) )
254 else if( (*exptype ==
LP_EXP_NONE) && !(*hasdot) && (
c ==
'.') && ( isdigit((
unsigned char)nextc) || isspace((
unsigned char)nextc) || nextc ==
'e' || nextc ==
'E') )
259 else if( !firstchar && (*exptype ==
LP_EXP_NONE) && (
c ==
'e' ||
c ==
'E') )
261 if( nextc ==
'+' || nextc ==
'-' )
266 else if( isdigit((
unsigned char)nextc) )
295 lpinput->linepos = 0;
296 lpinput->linebuf[lpinput->linebufsize - 2] =
'\0';
298 if(
SCIPfgets(lpinput->linebuf, lpinput->linebufsize, lpinput->file) ==
NULL )
306 lpinput->linenumber++;
309 while( lpinput->linebuf[lpinput->linebufsize - 2] !=
'\0' )
316 lpinput->linebuf[newsize-2] =
'\0';
317 if (
SCIPfgets(lpinput->linebuf + lpinput->linebufsize - 1, newsize - lpinput->linebufsize + 1, lpinput->file) ==
NULL )
319 lpinput->linebufsize = newsize;
321 lpinput->linebuf[lpinput->linebufsize - 1] =
'\0';
329 if( commentstart !=
NULL )
331 *commentstart =
'\0';
332 *(commentstart+1) =
'\0';
351 *pointer1 = *pointer2;
368 assert(lpinput->linepos < lpinput->linebufsize);
371 if( lpinput->npushedtokens > 0 )
373 swapPointers(&lpinput->token, &lpinput->pushedtokens[lpinput->npushedtokens-1]);
374 lpinput->npushedtokens--;
376 SCIPdebugMsg(
scip,
"(line %d) read token again: '%s'\n", lpinput->linenumber, lpinput->token);
381 buf = lpinput->linebuf;
384 if( buf[lpinput->linepos] ==
'\0' )
388 lpinput->section =
LP_END;
392 assert(lpinput->linepos == 0);
394 buf = lpinput->linebuf;
399 assert(lpinput->linepos < lpinput->linebufsize);
405 if(
isValueChar(buf[lpinput->linepos], buf[lpinput->linepos+1],
TRUE, &hasdot, &exptype) )
413 lpinput->token[tokenlen] = buf[lpinput->linepos];
417 while(
isValueChar(buf[lpinput->linepos], buf[lpinput->linepos+1],
FALSE, &hasdot, &exptype) );
426 lpinput->token[tokenlen] = buf[lpinput->linepos];
429 if( tokenlen == 1 &&
isTokenChar(lpinput->token[0]) )
438 if( tokenlen >= 1 && lpinput->token[tokenlen-1] ==
'^' && buf[lpinput->linepos] ==
'2' )
443 && (lpinput->token[tokenlen-1] ==
'<' || lpinput->token[tokenlen-1] ==
'>' || lpinput->token[tokenlen-1] ==
'=')
444 && buf[lpinput->linepos] ==
'=' )
448 else if( lpinput->token[tokenlen-1] ==
'=' && (buf[lpinput->linepos] ==
'<' || buf[lpinput->linepos] ==
'>') )
450 lpinput->token[tokenlen-1] = buf[lpinput->linepos];
455 lpinput->token[tokenlen] =
'\0';
457 SCIPdebugMsg(
scip,
"(line %d) read token: '%s'\n", lpinput->linenumber, lpinput->token);
471 swapPointers(&lpinput->pushedtokens[lpinput->npushedtokens], &lpinput->token);
472 lpinput->npushedtokens++;
484 swapPointers(&lpinput->pushedtokens[lpinput->npushedtokens], &lpinput->tokenbuf);
485 lpinput->npushedtokens++;
518 iscolon = (*lpinput->token ==
':');
529 len = strlen(lpinput->token);
533 if( len > 1 && (len < 9 || len == 15) )
538 while( lpinput->token[
c] !=
'\0' )
540 token[
c] = toupper(lpinput->token[
c]);
546 if( (len == 3 && strcmp(token,
"MIN") == 0)
547 || (len == 7 && strcmp(token,
"MINIMUM") == 0)
548 || (len == 8 && strcmp(token,
"MINIMIZE") == 0) )
550 SCIPdebugMsg(
scip,
"(line %d) new section: OBJECTIVE\n", lpinput->linenumber);
556 if( (len == 3 && strcmp(token,
"MAX") == 0)
557 || (len == 7 && strcmp(token,
"MAXIMUM") == 0)
558 || (len == 8 && strcmp(token,
"MAXIMIZE") == 0) )
560 SCIPdebugMsg(
scip,
"(line %d) new section: OBJECTIVE\n", lpinput->linenumber);
566 if( len == 7 && strcmp(token,
"SUBJECT") == 0 )
572 if( strcasecmp(lpinput->token,
"TO") == 0 )
574 SCIPdebugMsg(
scip,
"(line %d) new section: CONSTRAINTS\n", lpinput->linenumber);
576 lpinput->inlazyconstraints =
FALSE;
577 lpinput->inusercuts =
FALSE;
586 if( len == 4 && strcmp(token,
"SUCH") == 0 )
592 if( strcasecmp(lpinput->token,
"THAT") == 0 )
594 SCIPdebugMsg(
scip,
"(line %d) new section: CONSTRAINTS\n", lpinput->linenumber);
596 lpinput->inlazyconstraints =
FALSE;
597 lpinput->inusercuts =
FALSE;
606 if( (len == 2 && strcmp(token,
"ST") == 0)
607 || (len == 3 && strcmp(token,
"ST.") == 0)
608 || (len == 4 && strcmp(token,
"S.T.") == 0) )
610 SCIPdebugMsg(
scip,
"(line %d) new section: CONSTRAINTS\n", lpinput->linenumber);
612 lpinput->inlazyconstraints =
FALSE;
613 lpinput->inusercuts =
FALSE;
617 if( len == 4 && strcmp(token,
"LAZY") == 0 )
623 if( strcasecmp(lpinput->token,
"CONSTRAINTS") == 0 )
625 SCIPdebugMsg(
scip,
"(line %d) new section: CONSTRAINTS (lazy)\n", lpinput->linenumber);
627 lpinput->inlazyconstraints =
TRUE;
628 lpinput->inusercuts =
FALSE;
637 if( len == 4 && strcmp(token,
"USER") == 0 )
643 if( strcasecmp(lpinput->token,
"CUTS") == 0 )
645 SCIPdebugMsg(
scip,
"(line %d) new section: CONSTRAINTS (user cuts)\n", lpinput->linenumber);
647 lpinput->inlazyconstraints =
FALSE;
648 lpinput->inusercuts =
TRUE;
657 if( (len == 5 && strcmp(token,
"BOUND") == 0)
658 || (len == 6 && strcmp(token,
"BOUNDS") == 0) )
665 if( (len == 3 && (strcmp(token,
"GEN") == 0 || strcmp(token,
"INT") == 0))
666 || (len == 7 && (strcmp(token,
"GENERAL") == 0 || strcmp(token,
"INTEGER") == 0))
667 || (len == 8 && (strcmp(token,
"GENERALS") == 0 || strcmp(token,
"INTEGERS") == 0)) )
669 SCIPdebugMsg(
scip,
"(line %d) new section: GENERALS\n", lpinput->linenumber);
674 if( (len == 3 && strcmp(token,
"BIN") == 0)
675 || (len == 6 && strcmp(token,
"BINARY") == 0)
676 || (len == 8 && strcmp(token,
"BINARIES") == 0) )
678 SCIPdebugMsg(
scip,
"(line %d) new section: BINARIES\n", lpinput->linenumber);
683 if( (len == 4 && strcmp(token,
"SEMI") == 0)
684 || (len == 5 && strcmp(token,
"SEMIS") == 0)
685 || (len == 15 && strcmp(token,
"SEMI-CONTINUOUS") == 0) )
687 SCIPdebugMsg(
scip,
"(line %d) new section: SEMICONTINUOUS\n", lpinput->linenumber);
692 if( len == 3 && strcmp(token,
"SOS") == 0 )
695 lpinput->section =
LP_SOS;
699 if( len == 3 && strcmp(token,
"END") == 0 )
702 lpinput->section =
LP_END;
719 assert(*sign == +1 || *sign == -1);
721 if( lpinput->token[1] ==
'\0' )
723 if( *lpinput->token ==
'+' )
725 else if( *lpinput->token ==
'-' )
746 if( strcasecmp(lpinput->token,
"INFINITY") == 0 || strcasecmp(lpinput->token,
"INF") == 0 )
756 val = strtod(lpinput->token, &endptr);
757 if( endptr != lpinput->token && *endptr ==
'\0' )
776 if( strcmp(lpinput->token,
"<") == 0 )
782 else if( strcmp(lpinput->token,
">") == 0 )
788 else if( strcmp(lpinput->token,
"=") == 0 )
814 SCIP_Bool dynamiccols;
819 initial = !dynamiccols;
820 removable = dynamiccols;
834 if( created !=
NULL )
837 else if( created !=
NULL )
869 SCIP_Bool isobjective,
879 SCIP_Real** quadcoefs,
881 SCIP_Real* objoffset,
882 SCIP_Bool* newsection
888 SCIP_Bool haveobjoffset =
FALSE;
891 SCIP_Bool inquadpart;
943 if( strcmp(lpinput->token,
":") == 0 )
949 SCIPdebugMsg(
scip,
"(line %d) read constraint name: '%s'\n", lpinput->linenumber, name);
986 if( lpinput->token[1] ==
'\0' && ( *lpinput->token ==
'+' || *lpinput->token ==
'-' ) )
989 if( isobjective && havevalue &&
var ==
NULL )
997 SCIPdebugMsg(
scip,
"(line %d) read objective offset %g\n", lpinput->linenumber, coefsign * coef);
998 haveobjoffset =
TRUE;
999 *objoffset = coefsign * coef;
1004 if(
isSign(lpinput, &coefsign) )
1012 SCIPdebugMsg(
scip,
"(line %d) read coefficient sign: %+d\n", lpinput->linenumber, coefsign);
1020 SCIPdebugMsg(
scip,
"(line %d) read coefficient value: %g with sign %+d\n", lpinput->linenumber, coef, coefsign);
1041 syntaxError(
scip, lpinput,
"no constant values allowed for constraints in lp file format");
1059 if( (isobjective || (!havevalue && !havesign)) && !inquadpart &&
isNewSection(
scip, lpinput) )
1061 if( havesign && !havevalue )
1063 SCIPwarningMessage(
scip,
"skipped single sign %c without value or variable in objective\n", coefsign == 1 ?
'+' :
'-');
1074 SCIPdebugMsg(
scip,
"(line %d) read objective offset %g\n", lpinput->linenumber, coefsign * coef);
1075 *objoffset = coefsign * coef;
1083 if( *lpinput->token ==
'[' )
1087 syntaxError(
scip, lpinput,
"cannot start quadratic part while already in quadratic part.");
1090 if( havesign && coefsign != +1 )
1092 syntaxError(
scip, lpinput,
"cannot have '-' in front of quadratic part.");
1097 syntaxError(
scip, lpinput,
"cannot have value in front of quadratic part.");
1101 SCIPdebugMsg(
scip,
"(line %d) start quadratic part\n", lpinput->linenumber);
1107 if( *lpinput->token ==
']' )
1111 syntaxError(
scip, lpinput,
"cannot end quadratic part before starting one.");
1114 if( havesign || havevalue || firstquadvar !=
NULL )
1116 if( firstquadvar ==
NULL )
1118 syntaxError(
scip, lpinput,
"expected value or first quadratic variable.");
1135 syntaxError(
scip, lpinput,
"expected '/2' or '/ 2' after end of quadratic part in objective.");
1138 if( strcmp(lpinput->token,
"/2") == 0 )
1140 SCIPdebugMsg(
scip,
"(line %d) saw '/2' or '/ 2' after quadratic part in objective\n", lpinput->linenumber);
1142 else if( *lpinput->token ==
'/' )
1147 syntaxError(
scip, lpinput,
"expected '/2' or '/ 2' after end of quadratic part in objective.");
1150 SCIPdebugMsg(
scip,
"(line %d) saw '/ 2' after quadratic part in objective\n", lpinput->linenumber);
1154 syntaxError(
scip, lpinput,
"expected '/2' or '/ 2' after end of quadratic part in objective.");
1163 if( *lpinput->token ==
'*' )
1167 syntaxError(
scip, lpinput,
"cannot have '*' outside of quadratic part.");
1170 if( firstquadvar ==
NULL )
1172 syntaxError(
scip, lpinput,
"cannot have '*' before first variable in quadratic term.");
1180 if( !inquadpart && *ncoefs > 0 && !havesign )
1182 syntaxError(
scip, lpinput,
"expected sign ('+' or '-') or sense ('<' or '>').");
1185 if( inquadpart && *nquadcoefs > 0 && !havesign )
1193 if( *lpinput->token ==
'^' )
1197 syntaxError(
scip, lpinput,
"cannot have squares ('^2') outside of quadratic part.");
1200 if( firstquadvar ==
NULL )
1202 syntaxError(
scip, lpinput,
"cannot have square '^2' before variable.");
1221 if( *ncoefs >= *coefssize )
1224 oldcoefssize = *coefssize;
1226 *coefssize =
MAX(*coefssize, (*ncoefs)+1);
1230 assert(*ncoefs < *coefssize);
1233 (*vars)[*ncoefs] =
var;
1234 (*coefs)[*ncoefs] = coefsign * coef;
1240 if( firstquadvar ==
NULL )
1252 if( *nquadcoefs >= *quadcoefssize )
1254 int oldquadcoefssize;
1255 oldquadcoefssize = *quadcoefssize;
1256 *quadcoefssize *= 2;
1257 *quadcoefssize =
MAX(*quadcoefssize, (*nquadcoefs)+1);
1262 assert(*nquadcoefs < *quadcoefssize);
1265 (*quadvars1)[*nquadcoefs] = firstquadvar;
1266 (*quadvars2)[*nquadcoefs] =
var;
1267 (*quadcoefs)[*nquadcoefs] = coefsign * coef;
1269 (*quadcoefs)[*nquadcoefs] /= 2.0;
1279 firstquadvar =
NULL;
1297 SCIP_Real* quadcoefs;
1298 SCIP_Bool newsection;
1299 SCIP_Real objoffset;
1309 &quadcoefssize, &quadvars1, &quadvars2, &quadcoefs, &nquadcoefs, &objoffset, &newsection) );
1321 for(
i = 0;
i < ncoefs; ++
i )
1334 if( nquadcoefs > 0 )
1358 SCIP_CALL(
SCIPcreateConsQuadraticNonlinear(
scip, &quadobjcons,
"quadobj", 1, &quadobjvar, &minusone, nquadcoefs, quadvars1, quadvars2, quadcoefs, lhs, rhs,
1392 SCIP_Real* lincoefs;
1395 SCIP_Real* quadcoefs;
1399 SCIP_Real linsidevalue;
1401 SCIP_Bool newsection;
1402 SCIP_Bool linConsEQ;
1410 SCIP_Bool removable;
1426 syntaxError(
scip, lpinput,
"value for binary variable must be '0' or '1'.");
1433 SCIP_Bool infeasible;
1453 &quadcoefssize, &quadvars1, &quadvars2, &quadcoefs, &nquadcoefs,
NULL, &newsection) );
1462 if( nquadcoefs > 0 )
1465 syntaxError(
scip, lpinput,
"quadratic indicator constraints not supported.");
1468 if( name2[0] !=
'\0' )
1470 syntaxError(
scip, lpinput,
"did not expect name for linear constraint.");
1480 if( !
isSense(lpinput, &linsense) )
1482 syntaxError(
scip, lpinput,
"expected constraint sense '<=', '=', or '>='.");
1494 if(
isSign(lpinput, &linsidesign) )
1507 linsidevalue *= linsidesign;
1514 linrhs = -linsidevalue;
1515 for( j = 0; j < nlincoefs; ++j )
1519 linrhs = linsidevalue;
1523 linrhs = linsidevalue;
1534 initial = lpinput->initialconss && !lpinput->inlazyconstraints && !lpinput->inusercuts;
1536 enforce = !lpinput->inusercuts;
1537 check = !lpinput->inusercuts;
1540 dynamic = lpinput->dynamicconss;
1541 removable = lpinput->dynamicrows || lpinput->inusercuts;
1544 initial, separate, enforce, check,
propagate, local, dynamic, removable,
FALSE);
1550 SCIPdebugMsg(
scip,
"(line %d) created constraint%s: ", lpinput->linenumber,
1551 lpinput->inlazyconstraints ?
" (lazy)" : (lpinput->inusercuts ?
" (user cut)" :
""));
1562 for( j = 0; j < nlincoefs; ++j )
1566 initial, separate, enforce, check,
propagate, local, dynamic, removable,
FALSE);
1572 SCIPdebugMsg(
scip,
"(line %d) created constraint%s: ", lpinput->linenumber,
1573 lpinput->inlazyconstraints ?
" (lazy)" : (lpinput->inusercuts ?
" (user cut)" :
""));
1613 SCIP_Real* quadcoefs;
1616 SCIP_Real sidevalue;
1619 SCIP_Bool newsection;
1626 SCIP_Bool modifiable;
1628 SCIP_Bool removable;
1629 SCIP_Bool isIndicatorCons;
1642 &quadcoefssize, &quadvars1, &quadvars2, &quadcoefs, &nquadcoefs,
NULL, &newsection) );
1648 if( ncoefs > 0 || nquadcoefs > 0 )
1649 syntaxError(
scip, lpinput,
"expected constraint sense '<=', '=', or '>='.");
1659 if( !
isSense(lpinput, &sense) )
1661 syntaxError(
scip, lpinput,
"expected constraint sense '<=', '=', or '>='.");
1673 if(
isSign(lpinput, &sidesign) )
1686 sidevalue *= sidesign;
1711 isIndicatorCons =
FALSE;
1715 if ( *lpinput->token ==
'<' )
1717 int linepos = lpinput->linepos-1;
1723 if ( *lpinput->token ==
'-' )
1729 if ( *lpinput->token ==
'>' )
1731 lpinput->linepos = linepos;
1734 "SCIP does not support equivalence (<->) indicator constraints; consider using the \"->\" form.");
1741 lpinput->linepos = linepos;
1746 if ( *lpinput->token ==
'-' )
1755 if ( *lpinput->token ==
'>' )
1756 isIndicatorCons =
TRUE;
1771 if( !isIndicatorCons )
1774 initial = lpinput->initialconss && !lpinput->inlazyconstraints && !lpinput->inusercuts;
1776 enforce = !lpinput->inusercuts;
1777 check = !lpinput->inusercuts;
1781 dynamic = lpinput->dynamicconss;
1782 removable = lpinput->dynamicrows || lpinput->inusercuts;
1783 if( nquadcoefs == 0 )
1786 initial, separate, enforce, check,
propagate, local, modifiable, dynamic, removable,
FALSE);
1791 nquadcoefs, quadvars1, quadvars2, quadcoefs, lhs, rhs,
1792 initial, separate, enforce, check,
propagate, local, modifiable, dynamic, removable);
1799 SCIPdebugMsg(
scip,
"(line %d) created constraint%s: ", lpinput->linenumber,
1800 lpinput->inlazyconstraints ?
" (lazy)" : (lpinput->inusercuts ?
" (user cut)" :
""));
1807 if( ncoefs != 1 || nquadcoefs > 0 )
1809 syntaxError(
scip, lpinput,
"Indicator part can only consist of one binary variable.");
1815 syntaxError(
scip, lpinput,
"There cannot be a coefficient before the binary indicator variable.");
1820 syntaxError(
scip, lpinput,
"Indicator part cannot handle equations.");
1870 hassign =
isSign(lpinput, &sign);
1883 syntaxError(
scip, lpinput,
"expected bound sense '<=', '=', or '>='.");
1927 if(
isSense(lpinput, &rightsense) )
1942 hassign =
isSign(lpinput, &sign);
1957 switch( rightsense )
1981 else if( strcasecmp(lpinput->token,
"FREE") == 0 )
1985 syntaxError(
scip, lpinput,
"variable with bound is marked as 'free'.");
2026 SCIP_Bool infeasible;
2071 SCIP_Bool infeasible;
2125 SCIP_Real bounds[2];
2130 if( strcasecmp(lpinput->token,
"SEMI") == 0 )
2138 if( strcasecmp(lpinput->token,
"-") == 0 )
2140 if( !
getNextToken(
scip, lpinput) || strcasecmp(lpinput->token,
"CONTINUOUS") != 0 )
2162 syntaxError(
scip, lpinput,
"unknown variable in semi-continuous section.");
2215 SCIP_Bool initial, separate, enforce, check,
propagate;
2216 SCIP_Bool local, dynamic, removable;
2223 initial = lpinput->initialconss;
2229 dynamic = lpinput->dynamicconss;
2230 removable = lpinput->dynamicrows;
2250 if( strcmp(lpinput->token,
":") == 0 )
2277 if( strcmp(lpinput->token,
":") == 0 )
2281 lpinput->token[0] =
':';
2282 lpinput->token[1] =
'\0';
2291 if( strcmp(lpinput->token,
"S1") == 0 )
2294 SCIP_CALL(
SCIPcreateConsSOS1(
scip, &cons, name, 0,
NULL,
NULL, initial, separate, enforce, check,
propagate,
2295 local, dynamic, removable,
FALSE) );
2297 else if( strcmp(lpinput->token,
"S2") == 0 )
2300 SCIP_CALL(
SCIPcreateConsSOS2(
scip, &cons, name, 0,
NULL,
NULL, initial, separate, enforce, check,
propagate,
2301 local, dynamic, removable,
FALSE) );
2305 syntaxError(
scip, lpinput,
"SOS constraint type other than 1 or 2 appeared.");
2308 assert( type == 1 || type == 2 );
2315 syntaxError(
scip, lpinput,
"SOS constraint type has to be followed by two colons.");
2322 syntaxError(
scip, lpinput,
"SOS constraint type has to be followed by two colons.");
2369 if(
isSign(lpinput, &sign) )
2423 const char* filename
2429 lpinput->file =
SCIPfopen(filename,
"r");
2430 if( lpinput->file ==
NULL )
2444 switch( lpinput->section )
2527 SCIP_Real* constant,
2528 SCIP_Bool transformed
2546 if( requiredsize > *
nvars )
2564 for( v = 0; v < *
nvars; ++v )
2574 *constant += (*scalars)[v];
2575 (*scalars)[v] *= -1.0;
2593 linebuffer[0] =
'\0';
2610 if( (*linecnt) > 0 )
2612 linebuffer[(*linecnt)] =
'\0';
2626 const char* extension
2639 (void) strncat(linebuffer, extension,
LP_MAX_PRINTLEN - strlen(linebuffer));
2641 (*linecnt) += (int) strlen(extension);
2643 SCIPdebugMsg(
scip,
"linebuffer <%s>, length = %lu\n", linebuffer, (
unsigned long)strlen(linebuffer));
2655 const char* rowname,
2656 const char* rownameextension,
2663 SCIP_Bool transformed
2676 assert( strcmp(type,
"=") == 0 || strcmp(type,
"<=") == 0 || strcmp(type,
">=") == 0 );
2685 if( strlen(rowname) > 0 || strlen(rownameextension) > 0 )
2692 for( v = 0; v < nlinvars; ++v )
2713 if( quadexpr !=
NULL )
2717 SCIP_Real* activevals;
2718 SCIP_Real* lincoefs;
2720 SCIP_Real activeconstant = 0.0;
2721 int nbilinexprterms;
2733 nactivevars = nlinexprs;
2735 for( v = 0; v < nlinexprs; ++v )
2746 constant += activeconstant;
2749 for( v = 0; v < nactivevars; ++v )
2756 var = activevars[v];
2778 for( v = 0; v < nquadexprs; ++v )
2792 if( lincoef == 0.0 )
2809 for( v = 0; v < nquadexprs; ++v )
2823 if( sqrcoef == 0.0 )
2837 for( v = 0; v < nbilinexprterms; ++v )
2843 SCIP_Real bilincoef;
2893 const char* rowname,
2900 SCIP_Bool transformed
2905 SCIP_Real* activevals =
NULL;
2907 SCIP_Real activeconstant = 0.0;
2920 nactivevars = nlinvars;
2925 if( linvals !=
NULL )
2933 for( v = 0; v < nactivevars; ++v )
2934 activevals[v] = 1.0;
2948 rhs - activeconstant, transformed) );
2956 nactivevars, quadexpr, lhs - activeconstant, transformed) );
2962 nactivevars, quadexpr, rhs - activeconstant, transformed) );
2981 const char* rowname,
2997 assert( type == 1 || type == 2 );
3005 if( strlen(rowname) > 0 )
3015 for( v = 0; v <
nvars; ++v )
3019 if( weights !=
NULL )
3040 const char* consname,
3042 SCIP_Bool aggrlinearizationands,
3043 SCIP_Bool transformed
3067 if( !aggrlinearizationands )
3069 vars[0] = resultant;
3074 for( v = 0; v <
nvars; ++v )
3077 vars[1] = operands[v];
3086 for( v =
nvars - 1; v >= 0; --v )
3088 vars[v] = operands[v];
3095 if( aggrlinearizationands )
3142 for( v = 0; v <
nvars; ++v )
3159 if ( *saggvars <= *naggvars )
3163 assert( newsize > *saggvars );
3165 *saggvars = newsize;
3168 (*aggvars)[*naggvars] =
var;
3171 assert( *naggvars <= *saggvars );
3183 SCIP_Bool transformed,
3185 int nAggregatedVars,
3192 SCIP_Real* activevals;
3194 SCIP_Real activeconstant = 0.0;
3203 for( j = 0; j < nAggregatedVars; ++j )
3208 activevars[0] = aggregatedVars[j];
3209 activevals[0] = 1.0;
3210 activeconstant = 0.0;
3215 activevals[nactivevars] = -1.0;
3216 activevars[nactivevars] = aggregatedVars[j];
3221 SCIP_CALL(
printRow(
scip, file, consname,
"",
"=", activevars, activevals, nactivevars,
NULL, - activeconstant,
3240 SCIP_Bool printwarning;
3246 printwarning =
TRUE;
3249 for( v = 0; v <
nvars; ++v )
3253 SCIPwarningMessage(
scip,
"there is a variable name which has to be cut down to %d characters; LP might be corrupted\n",
3262 "it is not possible to read the generated LP file with SCIP; " \
3263 "use write/genproblem or write/gentransproblem for generic variable names\n");
3264 printwarning =
FALSE;
3275 SCIP_Bool transformed
3281 const char* conshdlrname;
3282 SCIP_Bool printwarning =
TRUE;
3287 for(
c = 0;
c < nconss; ++
c )
3306 if( strcmp(conshdlrname,
"linear") == 0 )
3324 if( printwarning && isdigit((
unsigned char)
SCIPconsGetName(cons)[0]) )
3327 "it is not possible to read the generated LP file with SCIP; " \
3328 "use write/genproblem or write/gentransproblem for generic variable names\n");
3329 printwarning =
FALSE;
3417 "reading/" READER_NAME "/linearize-and-constraints",
3418 "should possible \"and\" constraint be linearized when writing the lp file?",
3422 "should an aggregated linearization for and constraints be used?",
3433 const char* filename,
3445 lpinput.file =
NULL;
3447 lpinput.linebuf[0] =
'\0';
3449 lpinput.probname[0] =
'\0';
3450 lpinput.objname[0] =
'\0';
3452 lpinput.token[0] =
'\0';
3454 lpinput.tokenbuf[0] =
'\0';
3460 lpinput.npushedtokens = 0;
3461 lpinput.linenumber = 0;
3462 lpinput.linepos = 0;
3465 lpinput.inlazyconstraints =
FALSE;
3466 lpinput.inusercuts =
FALSE;
3467 lpinput.haserror =
FALSE;
3493 if( lpinput.haserror )
3511 SCIP_Bool transformed,
3515 SCIP_Real objoffset,
3529 SCIP_Bool linearizeands;
3530 SCIP_Bool aggrlinearizationands;
3542 const char* conshdlrname;
3551 int nConsIndicator = 0;
3563 SCIP_Real* consvals;
3579 if( conshdlrInd !=
NULL )
3594 for(
c = 0;
c < nConsInd; ++
c )
3607 for(
c = 0;
c < nconss; ++
c )
3616 if( strcmp(conshdlrname,
"indicator") == 0 )
3639 SCIPinfoMessage(
scip, file,
"\\ Variables : %d (%d binary, %d integer, %d implicit integer, %d continuous)\n",
3650 for( v = 0; v <
nvars; ++v )
3684 if( zeroobj &&
nvars >= 1 )
3699 if( reader !=
NULL )
3704 linearizeands = readerdata->linearizeands;
3705 aggrlinearizationands = readerdata->aggrlinearizationands;
3722 for(
c = 0;
c < nconss; ++
c )
3744 if( strcmp(conshdlrname,
"linear") == 0 )
3750 else if( strcmp(conshdlrname,
"setppc") == 0 )
3759 consvars,
NULL, nconsvars,
NULL, 1.0, 1.0, transformed) );
3771 else if( strcmp(conshdlrname,
"logicor") == 0 )
3777 else if( strcmp(conshdlrname,
"knapsack") == 0 )
3779 SCIP_Longint* weights;
3787 for( v = 0; v < nconsvars; ++v )
3788 consvals[v] = (SCIP_Real)weights[v];
3795 else if( strcmp(conshdlrname,
"varbound") == 0 )
3812 else if( strcmp(conshdlrname,
"SOS1") == 0 )
3815 consSOS1[nConsSOS1++] = cons;
3817 else if( strcmp(conshdlrname,
"SOS2") == 0 )
3820 consSOS2[nConsSOS2++] = cons;
3822 else if( strcmp(conshdlrname,
"indicator") == 0 )
3861 if( strlen(consname) > 0 )
3870 for( v = 0; v < nlinvars; ++v )
3873 if(
var != slackvar )
3875 consvars[cnt] =
var;
3876 consvals[cnt++] = linvals[v];
3890 consIndicator[nConsIndicator++] = cons;
3892 else if( strcmp(conshdlrname,
"nonlinear") == 0 )
3894 SCIP_Bool isquadratic;
3912 consExpr[nConsExpr++] = cons;
3915 else if( strcmp(conshdlrname,
"and") == 0 )
3946 for(
c = 0;
c < nConsSOS1; ++
c )
3956 for(
c = 0;
c < nConsSOS2; ++
c )
3966 for(
c = 0;
c < nConsExpr; ++
c )
3974 if( ntmpvars > tmpvarssize )
3986 for(
c = 0;
c < nConsIndicator; ++
c )
3990 cons = consIndicator[
c];
4004 for( v = 0; v <
nvars; ++v )
4053 for( v = 0; v < naggvars; ++v )
4070 for( v = 0; v <
nvars; ++v )
4084 for( v = 0; v < naggvars; ++v )
4106 for( v = 0; v <
nvars; ++v )
4120 for( v = 0; v < naggvars; ++v )
4139 if( conshdlrInd !=
NULL )
4143 if( nConsSOS1 > 0 || nConsSOS2 > 0 )
4149 for(
c = 0;
c < nConsSOS1; ++
c )
4161 for(
c = 0;
c < nConsSOS2; ++
c )
Constraint handler for AND constraints, .
constraint handler for bound disjunction constraints
constraint handler for indicator constraints
Constraint handler for knapsack constraints of the form , x binary and .
Constraint handler for linear constraints in their most general form, .
Constraint handler for logicor constraints (equivalent to set covering, but algorithms are suited fo...
constraint handler for 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)
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)
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 * SCIPgetWeightsSOS2(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsSOS2(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)
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_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 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 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)
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
SCIP_RETCODE SCIPhashmapSetImage(SCIP_HASHMAP *hashmap, void *origin, void *image)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
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)
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)
void SCIPexprGetQuadraticBilinTerm(SCIP_EXPR *expr, int termidx, SCIP_EXPR **expr1, SCIP_EXPR **expr2, SCIP_Real *coef, int *pos2, SCIP_EXPR **prodexpr)
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_Bool SCIPisExprVar(SCIP *scip, 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)
#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)
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
#define SCIPfreeBlockMemory(scip, ptr)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
#define SCIPallocBlockMemory(scip, ptr)
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,)
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 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_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_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 SCIPmemccpy(char *dest, const char *src, char stop, unsigned int cnt)
assert(minobj< SCIPgetCutoffbound(scip))
static SCIP_Bool propagate
static const SCIP_Real scalars[]
memory allocation routines
#define BMSclearMemoryArray(ptr, num)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
public methods for managing constraints
wrapper functions to map file i/o to standard or zlib file i/o
struct SCIP_File SCIP_FILE
public methods for message output
#define SCIPdebugPrintCons(x, y, z)
public data structures and miscellaneous methods
public methods for input file readers
public methods for problem variables
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)
#define LP_INIT_COEFSSIZE
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 const char commentchars[]
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)
#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 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)
#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 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 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 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
enum SCIP_BoundType SCIP_BOUNDTYPE
#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)
struct SCIP_ReaderData SCIP_READERDATA
#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