54 #define READER_NAME "mpsreader" 55 #define READER_DESC "file reader for MIQPs in IBM's Mathematical Programming System format" 56 #define READER_EXTENSION "mps" 58 #define DEFAULT_LINEARIZE_ANDS TRUE 59 #define DEFAULT_AGGRLINEARIZATION_ANDS TRUE 65 #define MPS_MAX_LINELEN 1024 66 #define MPS_MAX_NAMELEN 256 67 #define MPS_MAX_VALUELEN 26 68 #define MPS_MAX_FIELDLEN 20 70 #define PATCH_CHAR '_' 74 struct SCIP_ReaderData
155 assert(mpsi != NULL);
164 (*mpsi)->haserror =
FALSE;
165 (*mpsi)->isinteger =
FALSE;
166 (*mpsi)->isnewformat =
FALSE;
167 (*mpsi)->buf [0] =
'\0';
168 (*mpsi)->probname[0] =
'\0';
169 (*mpsi)->objname [0] =
'\0';
201 assert(mpsi != NULL);
203 return mpsi->section;
212 assert(mpsi != NULL);
223 assert(mpsi != NULL);
234 assert(mpsi != NULL);
245 assert(mpsi != NULL);
256 assert(mpsi != NULL);
267 assert(mpsi != NULL);
275 const char* mpsinputProbname(
279 assert(mpsi != NULL);
281 return mpsi->probname;
291 assert(mpsi != NULL);
293 return mpsi->objname;
302 assert(mpsi != NULL);
304 return mpsi->objsense;
313 assert(mpsi != NULL);
315 return mpsi->haserror;
324 assert(mpsi != NULL);
326 return mpsi->isinteger;
336 assert(mpsi != NULL);
338 mpsi->section = section;
348 assert(mpsi != NULL);
349 assert(probname != NULL);
350 assert(strlen(probname) <
sizeof(mpsi->probname));
362 assert(mpsi != NULL);
363 assert(objname != NULL);
364 assert(strlen(objname) <
sizeof(mpsi->objname));
376 assert(mpsi != NULL);
378 mpsi->objsense = sense;
386 assert(mpsi != NULL);
390 mpsi->haserror =
TRUE;
399 const char* what_name,
401 const char* entity_name,
405 assert(mpsi != NULL);
406 assert(what != NULL);
407 assert(what_name != NULL);
408 assert(entity != NULL);
409 assert(entity_name != NULL);
412 "Warning line %d: %s \"%s\" for %s \"%s\" ignored\n", mpsi->lineno, what, what_name, entity, entity_name);
424 for(i = pos; i < 80; i++)
439 while( (beg <= end) && (buf[end] ==
BLANK) )
442 while( (beg <= end) && (buf[beg] ==
BLANK) )
445 for( i = beg; i <= end; i++ )
446 if( buf[i] ==
BLANK )
466 mpsi->f0 = mpsi->f1 = mpsi->f2 = mpsi->f3 = mpsi->f4 = mpsi->f5 = 0;
473 if( NULL ==
SCIPfgets(mpsi->buf, (
int)
sizeof(mpsi->buf), mpsi->fp) )
477 while( *mpsi->buf ==
'*' );
480 len = (
unsigned int) strlen(mpsi->buf);
482 for( i = 0; i < len; i++ )
483 if( (mpsi->buf[i] ==
'\t') || (mpsi->buf[i] ==
'\n') || (mpsi->buf[i] ==
'\r') )
484 mpsi->buf[i] =
BLANK;
491 assert(strlen(mpsi->buf) >= 80);
494 if( *mpsi->buf !=
BLANK )
496 mpsi->f0 =
SCIPstrtok(&mpsi->buf[0],
" ", &nexttok);
498 assert(mpsi->f0 != 0);
506 if( !mpsi->isnewformat )
509 if( (mpsi->buf[14] ==
'$') && (mpsi->buf[13] ==
' ') )
511 else if( (mpsi->buf[39] ==
'$') && (mpsi->buf[38] ==
' ') )
515 space = mpsi->buf[12] | mpsi->buf[13]
516 | mpsi->buf[22] | mpsi->buf[23]
517 | mpsi->buf[36] | mpsi->buf[37] | mpsi->buf[38]
518 | mpsi->buf[47] | mpsi->buf[48]
519 | mpsi->buf[61] | mpsi->buf[62] | mpsi->buf[63];
529 number = isdigit((
unsigned char)mpsi->buf[24]) || isdigit((
unsigned char)mpsi->buf[25])
530 || isdigit((
unsigned char)mpsi->buf[26]) || isdigit((
unsigned char)mpsi->buf[27])
531 || isdigit((
unsigned char)mpsi->buf[28]) || isdigit((
unsigned char)mpsi->buf[29])
532 || isdigit((
unsigned char)mpsi->buf[30]) || isdigit((
unsigned char)mpsi->buf[31])
533 || isdigit((
unsigned char)mpsi->buf[32]) || isdigit((
unsigned char)mpsi->buf[33])
534 || isdigit((
unsigned char)mpsi->buf[34]) || isdigit((
unsigned char)mpsi->buf[35]);
539 if( number || len < 14 )
550 mpsi->isnewformat =
TRUE;
555 mpsi->isnewformat =
TRUE;
571 if( NULL == (mpsi->f1 =
SCIPstrtok(s,
" ", &nexttok)) )
574 if( (NULL == (mpsi->f2 =
SCIPstrtok(NULL,
" ", &nexttok))) || (*mpsi->f2 ==
'$') )
579 if( !strcmp(mpsi->f2,
"'MARKER'") )
582 if( (NULL == (mpsi->f3 =
SCIPstrtok(NULL,
" ", &nexttok))) || (*mpsi->f3 ==
'$') )
589 if( !strcmp(mpsi->f3,
"'INTORG'") )
590 mpsi->isinteger =
TRUE;
591 else if( !strcmp(mpsi->f3,
"'INTEND'") )
592 mpsi->isinteger =
FALSE;
596 if( !strcmp(mpsi->f3,
"'MARKER'") )
599 if( (NULL == (mpsi->f4 =
SCIPstrtok(NULL,
" ", &nexttok))) || (*mpsi->f4 ==
'$') )
606 if( !strcmp(mpsi->f4,
"'INTORG'") )
607 mpsi->isinteger =
TRUE;
608 else if( !strcmp(mpsi->f4,
"'INTEND'") )
609 mpsi->isinteger =
FALSE;
613 if( (NULL == (mpsi->f5 =
SCIPstrtok(NULL,
" ", &nexttok))) || (*mpsi->f5 ==
'$') )
619 is_empty = (mpsi->f0 == NULL && mpsi->f1 == NULL);
621 while( is_marker || is_empty );
633 assert(mpsi != NULL);
648 assert(mpsi != NULL);
649 assert(name != NULL);
671 assert(mpsi != NULL);
718 assert(mpsi != NULL);
770 assert(mpsi != NULL);
859 dynamic = mpsi->dynamicconss;
866 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable,
FALSE) );
870 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable,
FALSE) );
874 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable,
FALSE) );
942 !mpsi->dynamiccols, mpsi->dynamiccols, NULL, NULL, NULL, NULL, NULL) );
948 !mpsi->dynamiccols, mpsi->dynamiccols, NULL, NULL, NULL, NULL, NULL) );
1038 SCIPwarningMessage(scip,
"reading rhs section, a field is missing, assuming that the vector name is the missing one(, row identfier <%s>)\n",
mpsinputField2(mpsi));
1046 if( *rhsname ==
'\0' )
1183 SCIPwarningMessage(scip,
"reading ranged section, a field is missing, assuming that the vector name is the missing one(, row identfier <%s>)\n",
mpsinputField2(mpsi));
1191 if( *rngname ==
'\0' )
1326 goto READBOUNDS_FINISH;
1391 if( *bndname ==
'\0' )
1415 assert(var != NULL);
1435 assert(!infeasible);
1467 SCIPwarningMessage(scip,
"variable <%s> declared as integral has a non-integral lower bound (%.14g) -> if feasible, bounds will be adjusted\n",
SCIPvarGetName(var), val);
1476 SCIPwarningMessage(scip,
"variable <%s> declared as integral has a non-integral lower bound (%.14g) -> if feasible, bounds will be adjusted\n",
SCIPvarGetName(var), val);
1492 SCIPwarningMessage(scip,
"variable <%s> declared as integral has a non-integral upper bound (%.14g) -> if feasible, bounds will be adjusted\n",
SCIPvarGetName(var), val);
1502 SCIPwarningMessage(scip,
"variable <%s> declared as integral has a non-integral upper bound (%.14g) -> if feasible, bounds will be adjusted\n",
SCIPvarGetName(var), val);
1509 if( semicontsize <= nsemicont )
1512 if( semicont == NULL )
1521 assert(semicont != NULL);
1522 semicont[nsemicont] = var;
1580 assert(*bndname !=
'\0');
1604 assert(semicont != NULL);
1607 for( i = 0; i < nsemicont; ++i )
1613 assert(oldlb >= 0.0);
1684 initial = mpsi->initialconss;
1690 dynamic = mpsi->dynamicconss;
1691 removable = mpsi->dynamicrows;
1729 assert( type == 1 || type == 2 );
1752 SCIP_CALL(
SCIPcreateConsSOS1(scip, &cons, name, 0, NULL, NULL, initial, separate, enforce, check, propagate,
1753 local, dynamic, removable,
FALSE) );
1757 assert( type == 2 );
1758 SCIP_CALL(
SCIPcreateConsSOS2(scip, &cons, name, 0, NULL, NULL, initial, separate, enforce, check, propagate,
1759 local, dynamic, removable,
FALSE) );
1762 SCIPdebugMsg(scip,
"created constraint <%s> of type %d.\n", name, type);
1772 if( consType != 1 && consType != 2 )
1798 assert( consType == 1 || consType == 2 );
1862 SCIPdebugMsg(scip,
"read %s objective\n", isQuadObj ?
"QUADOBJ" :
"QMATRIX");
1910 for( k = 1; k <= 2; ++k )
1926 coef = strtod(field, &endptr);
1927 if( endptr == field || *endptr !=
'\0' )
1941 assert(newsize > size);
1948 quadvars1[cnt] = var1;
1949 quadvars2[cnt] = var2;
1950 quadcoefs[cnt] = coef;
1955 if( var1 == var2 || !isQuadObj )
1956 quadcoefs[cnt] /= 2.0;
1978 SCIP_Bool initial, separate, enforce, check, propagate;
1979 SCIP_Bool local, modifiable, dynamic, removable;
2015 retcode =
SCIPcreateConsQuadratic(scip, &cons,
"qmatrix", 1, &qmatrixvar, &minusone, cnt, quadvars1, quadvars2, quadcoefs, lhs, rhs,
2016 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable);
2030 SCIPwarningMessage(scip,
"%s section has no entries.\n", isQuadObj ?
"QUADOBJ" :
"QMATRIX");
2076 if( lincons == NULL )
2152 assert(newsize > size);
2159 quadvars1[cnt] = var1;
2160 quadvars2[cnt] = var2;
2161 quadcoefs[cnt] = coef;
2245 initial = mpsi->initialconss;
2251 dynamic = mpsi->dynamicconss;
2252 removable = mpsi->dynamicrows;
2253 stickingatnode =
FALSE;
2289 SCIPerrorMessage(
"Indicator constraints need to be introduced by 'IF' in column 1.\n");
2296 if( lincons == NULL )
2314 if( binvar == NULL )
2337 assert( binvar != NULL );
2371 for( i = 0; i < nlinvars; ++i )
2373 vars[i] = linvars[i];
2374 vals[i] = -linvals[i];
2382 initial, separate, enforce, check, propagate, local, dynamic, removable, stickingatnode);
2401 for (i = 0; i < nlinvars; ++i)
2416 NULL, NULL, NULL, NULL, NULL) );
2434 initial, separate, enforce, check, propagate, local, dynamic, removable, stickingatnode) );
2464 const char* filename
2472 assert(scip != NULL);
2473 assert(filename != NULL);
2487 SCIP_CALL_TERMINATE( retcode,
SCIPcreateProb(scip, mpsi->probname, NULL, NULL, NULL, NULL, NULL, NULL, NULL), TERMINATE );
2574 assert(consnamefreq != NULL);
2575 assert(consnamefreq->
consname != NULL);
2577 return (
void*)consnamefreq->
consname;
2584 const char* string1 = (
const char*)key1;
2585 const char* string2 = (
const char*)key2;
2621 width =
MAX(8u, width);
2633 unsigned int maxnamelen
2636 unsigned int fieldwidth;
2639 assert( scip != NULL );
2640 assert( col1 != NULL );
2641 assert( col2 != NULL );
2644 assert( maxnamelen > 0 );
2662 unsigned int fieldwidth;
2665 assert( scip != NULL );
2666 assert( col1 != NULL );
2667 assert( col2 != NULL );
2668 assert( strlen(col1) <= 2 );
2670 assert( maxnamelen == -1 || maxnamelen > 0 );
2672 if( maxnamelen < 0 )
2680 (void)
SCIPsnprintf(format, 32,
" %%-2.2s %%-%ds ", fieldwidth);
2691 const char* varname,
2695 unsigned int maxnamelen
2700 assert( scip != NULL );
2701 assert( recordcnt != NULL );
2702 assert( *recordcnt >= 0 && *recordcnt < 2 );
2706 if( *recordcnt == 0 )
2709 printStart(scip, file,
"", varname, (
int) maxnamelen);
2713 printRecord(scip, file, consname, valuestr, maxnamelen);
2716 if( *recordcnt == 2 )
2736 assert( scip != NULL );
2739 assert( name != NULL );
2771 (*matrix)->nentries = 0;
2772 (*matrix)->sentries = slots;
2788 if( matrix->nentries + capacity >= matrix->sentries )
2790 matrix->sentries = matrix->sentries * 2 + capacity;
2834 assert( scip != NULL );
2835 assert( nvars == 0 || vars != NULL );
2837 assert( matrix != NULL );
2846 nactivevars = nvars;
2857 for( v = 0; v < nactivevars; ++v )
2858 activevals[v] = 1.0;
2866 if( requiredsize > nactivevars )
2872 assert( requiredsize <= nactivevars );
2877 for( v = 0; v < nactivevars; ++v )
2887 activevals[v] *= -1.0;
2888 activeconstant += 1.0;
2895 assert( matrix->nentries + nactivevars < matrix->sentries );
2897 for( v = 0; v < nactivevars; ++v )
2899 matrix->values[matrix->nentries] = activevals[v];
2900 matrix->columns[matrix->nentries] = activevars[v];
2901 matrix->rows[matrix->nentries] =
consname;
2906 (*rhs) -= activeconstant;
2930 assert( scip != NULL );
2931 assert( aggvars != NULL );
2932 assert( naggvars != NULL );
2933 assert( saggvars != NULL );
2936 for( v = 0; v < nvars; ++v )
2948 assert( varAggregated != NULL );
2953 if ( *saggvars <= *naggvars )
2957 assert( newsize > *saggvars );
2959 *saggvars = newsize;
2962 (*aggvars)[*naggvars] = var;
2965 assert( *naggvars <= *saggvars );
2979 unsigned int* maxnamelen,
2980 const char*** varnames,
2989 assert( scip != NULL );
2990 assert( vars != NULL );
2991 assert( maxnamelen != NULL );
3000 for( v = 0; v < nvars; ++v )
3005 assert( var != NULL );
3016 (*maxnamelen) =
MAX(*maxnamelen, (
unsigned int) l);
3026 (*varnames)[v] = varname;
3031 SCIPwarningMessage(scip,
"there are %d variable names which have to be cut down to %d characters; LP might be corrupted\n",
3044 unsigned int* maxnamelen,
3045 const char*** consnames,
3055 assert(scip != NULL);
3056 assert(maxnamelen != NULL);
3064 hashGetKeyNamefreq, hashKeyEqString, SCIPhashKeyValString, NULL) );
3066 for( i = 0; i < nconss; ++i )
3073 assert( cons != NULL );
3082 SCIPwarningMessage(scip,
"At least one name of a constraint is empty, so file will be written with generic names.\n");
3089 consnamefreqs[i].
freq = 0;
3095 consnamefreq->
freq += 1;
3096 consnamefreqs[i] = *consnamefreq;
3097 freq = consnamefreq->
freq;
3107 SCIPwarningMessage(scip,
"Constraints have duplicate name and are too long to fix, so file will be written with generic names.\n");
3113 (*maxnamelen) =
MAX(*maxnamelen, (
unsigned int) l);
3151 unsigned int maxnamelen
3156 const char* varname;
3162 SCIPsortPtrPtrReal((
void**) matrix->columns, (
void**) matrix->rows, matrix->values, SCIPvarComp, matrix->nentries);
3169 for( v = 0; v < matrix->nentries; )
3171 var = matrix->columns[v];
3172 assert( var != NULL );
3184 printStart(scip, file,
"",
"INTEND", (
int) maxnamelen);
3185 printRecord(scip, file,
"'MARKER'",
"", maxnamelen);
3186 printRecord(scip, file,
"'INTEND'",
"", maxnamelen);
3193 printStart(scip, file,
"",
"INTSTART", (
int) maxnamelen);
3194 printRecord(scip, file,
"'MARKER'",
"", maxnamelen);
3195 printRecord(scip, file,
"'INTORG'",
"", maxnamelen);
3212 value = matrix->values[v];
3215 printEntry(scip, file, varname, matrix->rows[v], value, &recordcnt, maxnamelen);
3218 while( v < matrix->nentries && var == matrix->columns[v] );
3220 if( recordcnt == 1 )
3227 printStart(scip, file,
"",
"INTEND", (
int) maxnamelen);
3228 printRecord(scip, file,
"'MARKER'",
"", maxnamelen);
3229 printRecord(scip, file,
"'INTEND'",
"", maxnamelen);
3241 const char** consnames,
3243 unsigned int maxnamelen
3249 assert( rhss != NULL );
3255 for( c = 0; c < nconss; ++c )
3261 assert(consnames[c] != NULL);
3263 printEntry(scip, file,
"RHS", consnames[c], rhss[c], &recordcnt, maxnamelen);
3266 if( recordcnt == 1 )
3278 const char** consnames,
3280 unsigned int maxnamelen
3287 const char* conshdlrname;
3296 for( c = 0; c < nconss; ++c )
3299 assert( cons != NULL);
3306 assert( consnames[c] != NULL );
3309 assert( conshdlr != NULL );
3313 if( strcmp(conshdlrname,
"linear") == 0 )
3318 else if( strcmp(conshdlrname,
"varbound") == 0 )
3328 assert(
SCIPisGT(scip, rhs, lhs) );
3329 printEntry(scip, file,
"RANGE", consnames[c], rhs - lhs, &recordcnt, maxnamelen);
3359 const char** varnames,
3361 unsigned int maxnamelen
3369 const char* varname;
3372 assert(scip != NULL);
3373 assert(vars != NULL);
3374 assert(nfixvars == 0 || fixvars != NULL);
3376 sectionName =
FALSE;
3379 for( v = 0; v < nvars; ++v )
3382 assert( var != NULL );
3389 varname = varnames[v];
3417 printStart(scip, file,
"LO",
"Bound", (
int) maxnamelen);
3418 printRecord(scip, file, varname, valuestr, maxnamelen);
3422 printStart(scip, file,
"UP",
"Bound", (
int) maxnamelen);
3423 printRecord(scip, file, varname, valuestr, maxnamelen);
3427 printStart(scip, file,
"BV",
"Bound", (
int) maxnamelen);
3445 printStart(scip, file,
"FR",
"Bound", (
int) maxnamelen);
3462 printStart(scip, file,
"FX",
"Bound", (
int) maxnamelen);
3463 printRecord(scip, file, varname, valuestr, maxnamelen);
3479 printStart(scip, file,
"MI",
"Bound", (
int) maxnamelen);
3498 printStart(scip, file,
"LO",
"Bound", (
int) maxnamelen);
3499 printRecord(scip, file, varname, valuestr, maxnamelen);
3517 printStart(scip, file,
"PL",
"Bound", (
int) maxnamelen);
3530 printStart(scip, file,
"UP",
"Bound", (
int) maxnamelen);
3531 printRecord(scip, file, varname, valuestr, maxnamelen);
3537 for( v = 0; v < naggvars; ++v )
3546 assert( var != NULL );
3549 varname = varnames[nvars + v];
3555 printStart(scip, file,
"BV",
"Bound", (
int) maxnamelen);
3562 printStart(scip, file,
"FR",
"Bound", (
int) maxnamelen);
3569 for( v = 0; v < nfixvars; ++v )
3572 assert(transformed);
3573 assert(fixvars != NULL && fixvars[v] != NULL);
3578 assert(var != NULL);
3582 varname = varnames[nvars + naggvars + v];
3598 printStart(scip, file,
"FX",
"Bound", (
int) maxnamelen);
3599 printRecord(scip, file, varname, valuestr, maxnamelen);
3614 assert(
scip != NULL);
3615 assert(reader != NULL);
3634 assert(readerdata != NULL);
3647 assert(reader != NULL);
3649 assert(
scip != NULL);
3650 assert(result != NULL);
3682 const char** consnames;
3685 const char* conshdlrname;
3693 const char* varname;
3694 const char** varnames;
3727 unsigned int maxnamelen;
3731 assert(reader != NULL);
3733 assert(
scip != NULL);
3734 assert(result != NULL);
3775 saggvars = nfixedvars;
3779 if( nfixedvars > 0 )
3784 varFixedHash = NULL;
3791 indicatorSlackHash = NULL;
3795 assert( matrix->sentries >= nvars );
3798 assert(readerdata != NULL);
3803 if( readerdata->linearizeands )
3807 if( andconshdlr != NULL )
3811 for( c = nconss - 1; c >= 0; --c )
3814 assert(conshdlr != NULL);
3818 if( strcmp(conshdlrname,
"and") == 0 )
3820 if( readerdata->aggrlinearizationands )
3826 assert(naddrows >= 0);
3842 SCIPinfoMessage(
scip, file,
"* Variables : %d (%d binary, %d integer, %d implicit integer, %d continuous)\n",
3843 nvars, nbinvars, nintvars, nimplvars, ncontvars);
3863 for( v = 0; v < nvars; ++v )
3875 assert( matrix->nentries < matrix->sentries );
3877 matrix->values[matrix->nentries] = value;
3878 matrix->columns[matrix->nentries] = var;
3879 matrix->rows[matrix->nentries] =
"Obj";
3886 for( c = 0; c < nconss; ++c )
3889 assert( cons != NULL);
3897 assert( conshdlr != NULL );
3902 consname = consnames[c];
3904 if( strcmp(conshdlrname,
"linear") == 0 )
3930 else if( strcmp(conshdlrname,
"setppc") == 0 )
3951 else if( strcmp(conshdlrname,
"logicor") == 0 )
3961 else if( strcmp(conshdlrname,
"knapsack") == 0 )
3973 for( i = 0; i < nconsvars; ++i )
3983 else if( strcmp(conshdlrname,
"varbound") == 0 )
4021 else if( strcmp(conshdlrname,
"indicator") == 0 )
4028 assert( slackvar != NULL );
4029 assert( indicatorSlackHash != NULL );
4043 assert( binvar != NULL );
4050 consIndicator[nConsIndicator++] = cons;
4053 else if( strcmp(conshdlrname,
"SOS1") == 0 )
4056 consSOS1[nConsSOS1++] = cons;
4068 else if( strcmp(conshdlrname,
"SOS2") == 0 )
4071 consSOS2[nConsSOS2++] = cons;
4082 else if( strcmp(conshdlrname,
"quadratic") == 0 )
4089 consQuadratic[nConsQuadratic++] = cons;
4125 transformed, matrix, &rhss[c]) );
4130 consvars = quadvars;
4138 else if( strcmp(conshdlrname,
"soc") == 0 )
4146 consSOC[nConsSOC++] = cons;
4156 for( v = 0; v < nconsvars; ++v )
4161 lincoefs[v] = 2 * offset * coef * coef;
4162 rhs -= offset * offset * coef * coef;
4178 lincoef = -2 * offset * coef * coef;
4179 rhs += offset * offset * coef * coef;
4196 else if( strcmp(conshdlrname,
"and") == 0 )
4198 if( readerdata->linearizeands )
4218 l = (int) strlen(consname);
4221 if( !readerdata->aggrlinearizationands )
4223 rowvars[0] = resultant;
4228 n = (int) log10((
double)nrowvars) + 1 + l;
4235 maxnamelen =
MAX(maxnamelen, (
unsigned int) n);
4238 for( v = 0; v < nrowvars; ++v )
4244 n = (int) log10((
double)v) + 2;
4257 assert(k < nconss + naddrows);
4258 consnames[k] = rowname;
4260 (void)
SCIPsnprintf(rowname, n + 1,
"%s_%d", consname, v);
4261 rowvars[1] = operands[v];
4275 for( v = nrowvars - 1; v >= 0; --v )
4277 rowvars[v] = operands[v];
4281 rowvars[nrowvars] = resultant;
4284 if( readerdata->aggrlinearizationands )
4297 maxnamelen =
MAX(maxnamelen, (
unsigned int) n);
4302 assert(k < nconss + naddrows);
4303 consnames[k] = rowname;
4306 (void)
SCIPsnprintf(rowname, n + 1,
"%s_op", consname);
4308 rowvals[nrowvars] = (
SCIP_Real) nrowvars;
4322 rowvals[nrowvars] = 1.0;
4327 rhss[c] = -nrowvars + 1.0;
4355 SCIPwarningMessage(
scip,
"there are %d and-constraint-rownames which have to be cut down to %d characters; MPS file might be corrupted\n",
4360 if( varFixedHash != NULL )
4363 if( indicatorSlackHash != NULL && nConsIndicator == 0 )
4366 assert( indicatorSlackHash == NULL );
4378 for( c = 0; c < naggvars; ++c )
4389 maxnamelen =
MAX(maxnamelen, (
unsigned int) l);
4395 varnames[nvars + c] = namestr;
4404 l = strlen(namestr);
4405 maxnamelen =
MAX(maxnamelen, (
unsigned int) l);
4406 consnames[nconss + naddrows + c] = namestr;
4407 rhss[nconss + naddrows + c] = 0.0;
4414 matrix->values[matrix->nentries] = -1.0;
4415 matrix->columns[matrix->nentries] = aggvars[c];
4416 matrix->rows[matrix->nentries] = namestr;
4423 if( nfixedvars > 0 )
4425 int startpos = nvars + naggvars;
4434 for( v = nfixedvars - 1; v >= 0; --v )
4446 maxnamelen =
MAX(maxnamelen, (
unsigned int) l);
4451 varnames[startpos + nfixvars] = namestr;
4452 fixvars[nfixvars] = var;
4461 matrix->values[matrix->nentries] = 0.0;
4462 matrix->columns[matrix->nentries] = var;
4463 matrix->rows[matrix->nentries] =
"Obj";
4480 printBoundSection(
scip, file, vars, nvars, aggvars, naggvars, fixvars, nfixvars, transformed, varnames, indicatorSlackHash, maxnamelen);
4482 if( nfixedvars > 0 )
4488 if( nConsSOS1 > 0 || nConsSOS2 > 0 )
4498 for( c = 0; c < nConsSOS1; ++c )
4509 for( v = 0; v < nconsvars; ++v )
4517 if( sosweights != NULL )
4527 for( c = 0; c < nConsSOS2; ++c )
4538 for( v = 0; v < nconsvars; ++v )
4546 if( sosweights != NULL )
4560 if( nConsQuadratic > 0 )
4564 const char* varname2;
4567 SCIPdebugMsg(
scip,
"start printing QCMATRIX sections for quadratic constraints\n");
4570 for( c = 0; c < nConsQuadratic; ++c )
4572 cons = consQuadratic[c];
4583 for( v = 0; v < nconsvars; ++v )
4585 if( quadvarterms[v].sqrcoef == 0.0 )
4603 for( v = 0; v < nbilin; ++v )
4605 if( bilinterms[v].coef == 0.0 )
4639 SCIPdebugMsg(
scip,
"start printing QCMATRIX sections for soc constraints\n");
4642 for( c = 0; c < nConsSOC; ++c )
4653 for( v = 0; v < nconsvars; ++v )
4655 if( coefs[v] == 0.0 )
4691 if( nConsIndicator > 0 )
4699 for( c = 0; c < nConsIndicator; ++c )
4705 cons = consIndicator[c];
4748 if( indicatorSlackHash != NULL )
4765 for( v = nvars + naggvars + nfixvars - 1; v >= 0; --v )
4769 for( c = nconss + naddrows + naggvars - 1; c >= 0; --c )
4808 "reading/" READER_NAME "/linearize-and-constraints",
4809 "should possible \"and\" constraint be linearized when writing the mps file?",
4813 "should an aggregated linearization for and constraints be used?",
static SCIP_RETCODE collectAggregatedVars(SCIP *scip, SCIP_VAR **vars, int nvars, SCIP_VAR ***aggvars, int *naggvars, int *saggvars, SCIP_HASHTABLE *varAggregated)
SCIP_VAR ** SCIPgetLinearVarsQuadratic(SCIP *scip, SCIP_CONS *cons)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
static void mpsinputSetObjsense(MPSINPUT *mpsi, SCIP_OBJSENSE sense)
enum SCIP_BoundType SCIP_BOUNDTYPE
SCIP_Bool SCIPisFeasZero(SCIP *scip, SCIP_Real val)
static SCIP_RETCODE readMps(SCIP *scip, const char *filename)
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
SCIP_VAR ** SCIPgetLhsVarsSOC(SCIP *scip, SCIP_CONS *cons)
static SCIP_DECL_READERCOPY(readerCopyMps)
SCIP_Bool SCIPconsIsEnabled(SCIP_CONS *cons)
int SCIPmemccpy(char *dest, const char *src, char stop, unsigned int cnt)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_DECL_HASHGETKEY(hashGetKeyNamefreq)
SCIP_Bool SCIPconsIsDynamic(SCIP_CONS *cons)
static void printRangeSection(SCIP *scip, FILE *file, SCIP_CONS **conss, int nconss, const char **consnames, SCIP_Bool transformed, unsigned int maxnamelen)
Constraint handler for variable bound constraints .
static void mpsinputSyntaxerror(MPSINPUT *mpsi)
SCIP_VAR ** SCIPgetVarsSOS1(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPhashtableInsert(SCIP_HASHTABLE *hashtable, void *element)
static SCIP_RETCODE readQMatrix(MPSINPUT *mpsi, SCIP_Bool isQuadObj, SCIP *scip)
SCIP_RETCODE SCIPaddOrigObjoffset(SCIP *scip, SCIP_Real addval)
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
int SCIPgetNVarsSetppc(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
int SCIPgetNVarsLogicor(SCIP *scip, SCIP_CONS *cons)
static void printBoundSection(SCIP *scip, FILE *file, SCIP_VAR **vars, int nvars, SCIP_VAR **aggvars, int naggvars, SCIP_VAR **fixvars, int nfixvars, SCIP_Bool transformed, const char **varnames, SCIP_HASHTABLE *indicatorSlackHash, unsigned int maxnamelen)
void SCIPsortPtrPtrReal(void **ptrarray1, void **ptrarray2, SCIP_Real *realarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
SCIP_Real * SCIPgetLhsOffsetsSOC(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)
static void mpsinputSetObjname(MPSINPUT *mpsi, const char *objname)
SCIP_RETCODE SCIPdelCons(SCIP *scip, SCIP_CONS *cons)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
SCIP_RETCODE SCIPaddVarSOS2(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real weight)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
static SCIP_RETCODE checkSparseMatrixCapacity(SCIP *scip, SPARSEMATRIX *matrix, int capacity)
SCIP_Real * SCIPgetWeightsSOS1(SCIP *scip, SCIP_CONS *cons)
static SCIP_DECL_READERFREE(readerFreeMps)
SCIP_RETCODE SCIPprintTransProblem(SCIP *scip, FILE *file, const char *extension, SCIP_Bool genericnames)
const char * SCIPreaderGetName(SCIP_READER *reader)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
constraint handler for indicator constraints
static SCIP_DECL_HASHKEYVAL(hashKeyValVar)
static void printColumnSection(SCIP *scip, FILE *file, SPARSEMATRIX *matrix, SCIP_HASHMAP *varnameHashmap, SCIP_HASHTABLE *indicatorSlackHash, unsigned int maxnamelen)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
SCIP_Real SCIPinfinity(SCIP *scip)
int SCIPsnprintf(char *t, int len, const char *s,...)
enum SCIP_Retcode SCIP_RETCODE
static void mpsinputEntryIgnored(SCIP *scip, MPSINPUT *mpsi, const char *what, const char *what_name, const char *entity, const char *entity_name, SCIP_VERBLEVEL verblevel)
enum SCIP_Varstatus SCIP_VARSTATUS
static void mpsinputInsertName(MPSINPUT *mpsi, const char *name, SCIP_Bool second)
enum SCIP_VerbLevel SCIP_VERBLEVEL
static void mpsinputInsertField4(MPSINPUT *mpsi, const char *str)
static const char * mpsinputField4(const MPSINPUT *mpsi)
SCIP_VAR ** SCIPgetVarsKnapsack(SCIP *scip, SCIP_CONS *cons)
#define SCIPfreeBlockMemory(scip, ptr)
Constraint handler for AND constraints, .
#define SCIPduplicateBufferArray(scip, ptr, source, num)
int SCIPgetNVarsSOS2(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)
constraint handler for second order cone constraints
#define SCIPfreeBufferArray(scip, ptr)
Constraint handler for the set partitioning / packing / covering constraints .
#define SCIPallocBlockMemory(scip, ptr)
#define SCIPdebugPrintCons(x, y, z)
SCIP_Bool SCIPconsIsRemovable(SCIP_CONS *cons)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
SCIP_Real SCIPgetRhsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetLhsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPaddCoefLinear(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real val)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
static SCIP_RETCODE readRows(MPSINPUT *mpsi, SCIP *scip)
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)
static SCIP_Bool mpsinputReadLine(MPSINPUT *mpsi)
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)
SCIP_VAR * SCIPvarGetNegatedVar(SCIP_VAR *var)
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
int SCIPgetNBilinTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR * SCIPgetSlackVarIndicator(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)
SCIP_READERDATA * SCIPreaderGetData(SCIP_READER *reader)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
SCIP_RETCODE SCIPsetObjsense(SCIP *scip, SCIP_OBJSENSE objsense)
Constraint handler for knapsack constraints of the form , x binary and .
SCIP_VAR ** SCIPgetVarsAnd(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR * SCIPgetVarVarbound(SCIP *scip, SCIP_CONS *cons)
static void printEntry(SCIP *scip, FILE *file, const char *varname, const char *consname, SCIP_Real value, int *recordcnt, unsigned int maxnamelen)
static const char * mpsinputObjname(const MPSINPUT *mpsi)
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_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_Bool mpsinputIsInteger(const MPSINPUT *mpsi)
static SCIP_OBJSENSE mpsinputObjsense(const MPSINPUT *mpsi)
static SCIP_RETCODE readRhs(MPSINPUT *mpsi, SCIP *scip)
SCIP_Real SCIPgetRhsVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsSOS2(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPaddVarSOS1(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real weight)
static SCIP_RETCODE readCols(MPSINPUT *mpsi, SCIP *scip)
Constraint handler for logicor constraints (equivalent to set covering, but algorithms are suited fo...
#define SCIPallocBuffer(scip, ptr)
SCIP_Real SCIPvarGetUbOriginal(SCIP_VAR *var)
SCIP_Real * SCIPgetCoefsLinearVarsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetVbdcoefVarbound(SCIP *scip, SCIP_CONS *cons)
#define SCIPfreeBufferArrayNull(scip, ptr)
static SCIP_RETCODE readBounds(MPSINPUT *mpsi, SCIP *scip)
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_Bool SCIPconsIsPropagated(SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsLogicor(SCIP *scip, SCIP_CONS *cons)
struct SparseMatrix SPARSEMATRIX
const char * SCIPvarGetName(SCIP_VAR *var)
#define DEFAULT_LINEARIZE_ANDS
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
constraint handler for quadratic constraints
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
SCIP_CONS * SCIPfindCons(SCIP *scip, const char *name)
SCIP_RETCODE SCIPprintOrigProblem(SCIP *scip, FILE *file, const char *extension, SCIP_Bool genericnames)
SCIP_VAR * SCIPgetVbdvarVarbound(SCIP *scip, SCIP_CONS *cons)
static void patchField(char *buf, int beg, int end)
SCIP_RETCODE SCIPgetProbvarLinearSum(SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, int varssize, SCIP_Real *constant, int *requiredsize, SCIP_Bool mergemultiples)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
SCIP_Bool SCIPconsIsLocal(SCIP_CONS *cons)
SCIP_BILINTERM * SCIPgetBilinTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetRhsOffsetSOC(SCIP *scip, SCIP_CONS *cons)
SCIP_Longint SCIPgetCapacityKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPchgVarObj(SCIP *scip, SCIP_VAR *var, SCIP_Real newobj)
SCIP_Real SCIPgetRhsQuadratic(SCIP *scip, SCIP_CONS *cons)
#define SCIPallocBufferArray(scip, ptr, num)
struct SCIP_ReaderData SCIP_READERDATA
public data structures and miscellaneous methods
int SCIPgetNLhsVarsSOC(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateConsIndicatorLinCons(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *binvar, SCIP_CONS *lincons, SCIP_VAR *slackvar, 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)
static SCIP_RETCODE readSOS(MPSINPUT *mpsi, SCIP *scip)
SCIP_RETCODE SCIPincludeReaderBasic(SCIP *scip, SCIP_READER **readerptr, const char *name, const char *desc, const char *extension, SCIP_READERDATA *readerdata)
void SCIPprintSysError(const char *message)
enum SCIP_Objsense SCIP_OBJSENSE
SCIP_VAR * SCIPgetRhsVarSOC(SCIP *scip, SCIP_CONS *cons)
static void printRecord(SCIP *scip, FILE *file, const char *col1, const char *col2, unsigned int maxnamelen)
static const char * mpsinputField5(const MPSINPUT *mpsi)
SCIP_SETPPCTYPE SCIPgetTypeSetppc(SCIP *scip, SCIP_CONS *cons)
SCIP_Real * SCIPgetWeightsSOS2(SCIP *scip, SCIP_CONS *cons)
static MPSSECTION mpsinputSection(const MPSINPUT *mpsi)
int SCIPvarGetNLocksUp(SCIP_VAR *var)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsChecked(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsInitial(SCIP_CONS *cons)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
static SCIP_RETCODE readObjsen(SCIP *scip, MPSINPUT *mpsi)
int SCIPgetNVarsSOS1(SCIP *scip, SCIP_CONS *cons)
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 const char * mpsinputField1(const MPSINPUT *mpsi)
SCIP_RETCODE SCIPsetReaderWrite(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERWRITE((*readerwrite)))
static void printRowType(SCIP *scip, FILE *file, SCIP_Real lhs, SCIP_Real rhs, const char *name)
static SCIP_RETCODE readIndicators(MPSINPUT *mpsi, SCIP *scip)
Constraint handler for linear constraints in their most general form, .
void * SCIPhashtableRetrieve(SCIP_HASHTABLE *hashtable, void *key)
SCIP_RETCODE SCIPchgRhsLinear(SCIP *scip, SCIP_CONS *cons, SCIP_Real rhs)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
SCIP_VAR * SCIPgetBinaryVarIndicator(SCIP_CONS *cons)
SCIP_RETCODE SCIPsetReaderCopy(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERCOPY((*readercopy)))
static SCIP_Bool mpsinputHasError(const MPSINPUT *mpsi)
SCIP_VAR ** SCIPgetVarsSetppc(SCIP *scip, SCIP_CONS *cons)
void SCIPhashtableFree(SCIP_HASHTABLE **hashtable)
#define SCIP_HASHSIZE_NAMES
static unsigned int computeFieldWidth(unsigned int width)
static const char * mpsinputField0(const MPSINPUT *mpsi)
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)
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 void mpsinputSetSection(MPSINPUT *mpsi, MPSSECTION section)
static void clearFrom(char *buf, unsigned int pos)
int SCIPgetNLinearVarsQuadratic(SCIP *scip, SCIP_CONS *cons)
#define SCIPfreeBuffer(scip, ptr)
static void mpsinputSetProbname(MPSINPUT *mpsi, const char *probname)
int SCIPvarGetNLocksDown(SCIP_VAR *var)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisIntegral(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
SCIP_VAR ** SCIPgetVarsLinear(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE checkVarnames(SCIP *scip, SCIP_VAR **vars, int nvars, unsigned int *maxnamelen, const char ***varnames, SCIP_HASHMAP **varnameHashmap)
static const char * mpsinputField3(const MPSINPUT *mpsi)
static SCIP_DECL_READERWRITE(readerWriteMps)
static void freeMatrix(SCIP *scip, SPARSEMATRIX *matrix)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
SCIP_Real SCIPgetLhsConstantSOC(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetRhsCoefSOC(SCIP *scip, SCIP_CONS *cons)
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
static SCIP_RETCODE mpsinputCreate(SCIP *scip, MPSINPUT **mpsi, SCIP_FILE *fp)
SCIP_Bool SCIPconsIsModifiable(SCIP_CONS *cons)
static void mpsinputFree(SCIP *scip, MPSINPUT **mpsi)
#define SCIP_CALL_TERMINATE(retcode, x, TERM)
int SCIPgetNVarsAnd(SCIP *scip, SCIP_CONS *cons)
constraint handler for SOS type 1 constraints
int SCIPgetNVarsKnapsack(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE initializeMatrix(SCIP *scip, SPARSEMATRIX **matrix, int slots)
static SCIP_RETCODE readRanges(MPSINPUT *mpsi, SCIP *scip)
SCIP_Bool SCIPconsIsEnforced(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsSeparated(SCIP_CONS *cons)
SCIP_RETCODE SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERREAD((*readerread)))
int SCIPvarGetIndex(SCIP_VAR *var)
static void printBoundSectionName(SCIP *scip, FILE *file)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Bool SCIPhashtableExists(SCIP_HASHTABLE *hashtable, void *element)
enum MpsSection MPSSECTION
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)
static SCIP_RETCODE checkConsnames(SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_Bool transformed, unsigned int *maxnamelen, const char ***consnames, SCIP_Bool *error)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
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)
enum SCIP_Vartype SCIP_VARTYPE
constraint handler for SOS type 2 constraints
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 SCIPchgLhsLinear(SCIP *scip, SCIP_CONS *cons, SCIP_Real lhs)
static const char * mpsinputField2(const MPSINPUT *mpsi)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
static SCIP_DECL_HASHKEYEQ(hashKeyEqString)
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
#define DEFAULT_AGGRLINEARIZATION_ANDS
static void printRhsSection(SCIP *scip, FILE *file, int nconss, const char **consnames, SCIP_Real *rhss, unsigned int maxnamelen)
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
SCIP_QUADVARTERM * SCIPgetQuadVarTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
int SCIPfclose(SCIP_FILE *fp)
static SCIP_RETCODE readObjname(SCIP *scip, MPSINPUT *mpsi)
constraint handler for bound disjunction constraints
static void printStart(SCIP *scip, FILE *file, const char *col1, const char *col2, int maxnamelen)
SCIP_CONS * SCIPgetLinearConsIndicator(SCIP_CONS *cons)
SCIP_Longint * SCIPgetWeightsKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetLhsVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPvarIsIntegral(SCIP_VAR *var)
char * SCIPstrtok(char *s, const char *delim, char **ptrptr)
int SCIPgetNVarsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Real * SCIPgetLhsCoefsSOC(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetLhsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPsetReaderFree(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERFREE((*readerfree)))
static SCIP_DECL_READERREAD(readerReadMps)
SCIP_RETCODE SCIPincludeReaderMps(SCIP *scip)
SCIP_RETCODE SCIPgetNegatedVar(SCIP *scip, SCIP_VAR *var, SCIP_VAR **negvar)
static SCIP_RETCODE getLinearCoeffs(SCIP *scip, const char *consname, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SCIP_Bool transformed, SPARSEMATRIX *matrix, SCIP_Real *rhs)
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)
(extended) MPS file reader
SCIP_Bool SCIPvarIsNegated(SCIP_VAR *var)
#define SCIPreallocBufferArray(scip, ptr, num)
static SCIP_RETCODE readQCMatrix(MPSINPUT *mpsi, SCIP *scip)
static SCIP_RETCODE readName(SCIP *scip, MPSINPUT *mpsi)