Scippy

SCIP

Solving Constraint Integer Programs

Detailed Description

(extended) MPS file reader

Author
Thorsten Koch
Tobias Achterberg
Marc Pfetsch
Stefan Heinz
Stefan Vigerske
Michael Winkler

This reader/writer handles MPS files in extended MPS format, as it is used by CPLEX. In the extended format the limits on variable name lengths and coefficients are considerably relaxed. The columns in the format are then separated by whitespaces.

Definition in file reader_mps.c.

#include "blockmemshell/memory.h"
#include <ctype.h>
#include "scip/cons_and.h"
#include "scip/cons_bounddisjunction.h"
#include "scip/cons_nonlinear.h"
#include "scip/cons_exactlinear.h"
#include "scip/cons_indicator.h"
#include "scip/cons_knapsack.h"
#include "scip/cons_linear.h"
#include "scip/cons_logicor.h"
#include "scip/cons_setppc.h"
#include "scip/cons_sos1.h"
#include "scip/cons_sos2.h"
#include "scip/cons_varbound.h"
#include "scip/pub_cons.h"
#include "scip/pub_fileio.h"
#include "scip/pub_message.h"
#include "scip/pub_misc.h"
#include "scip/pub_misc_sort.h"
#include "scip/pub_reader.h"
#include "scip/pub_var.h"
#include "scip/reader_mps.h"
#include "scip/rational.h"
#include "scip/scip_cons.h"
#include "scip/scip_exact.h"
#include "scip/scip_mem.h"
#include "scip/scip_message.h"
#include "scip/scip_numerics.h"
#include "scip/scip_param.h"
#include "scip/scip_prob.h"
#include "scip/scip_reader.h"
#include "scip/scip_solvingstats.h"
#include "scip/scip_var.h"
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Data Structures

struct  ConsNameFreq
 

Macros

#define READER_NAME   "mpsreader"
 
#define READER_DESC   "file reader for MIQPs in IBM's Mathematical Programming System format"
 
#define READER_EXTENSION   "mps"
 
#define DEFAULT_LINEARIZE_ANDS   TRUE
 
#define DEFAULT_AGGRLINEARIZATION_ANDS   TRUE
 
#define MPS_MAX_LINELEN   1024
 
#define MPS_MAX_NAMELEN   256
 
#define MPS_MAX_VALUELEN   26
 
#define MPS_MAX_FIELDLEN   20
 
#define PATCH_CHAR   '_'
 
#define BLANK   ' '
 
#define MPSINTCOMP_LEVEL(IMPLINTLEVEL)
 

Typedefs

typedef enum MpsSection MPSSECTION
 
typedef struct MpsInput MPSINPUT
 
typedef struct SparseMatrix SPARSEMATRIX
 
typedef struct ConsNameFreq CONSNAMEFREQ
 

Enumerations

enum  MpsSection {
  MPS_NAME ,
  MPS_OBJSEN ,
  MPS_OBJNAME ,
  MPS_ROWS ,
  MPS_USERCUTS ,
  MPS_LAZYCONS ,
  MPS_COLUMNS ,
  MPS_RHS ,
  MPS_RANGES ,
  MPS_BOUNDS ,
  MPS_SOS ,
  MPS_QUADOBJ ,
  MPS_QMATRIX ,
  MPS_QCMATRIX ,
  MPS_INDICATORS ,
  MPS_ENDATA
}
 

Functions

static SCIP_RETCODE mpsinputCreate (SCIP *scip, MPSINPUT **mpsi, SCIP_FILE *fp)
 
static void mpsinputFree (SCIP *scip, MPSINPUT **mpsi)
 
static MPSSECTION mpsinputSection (const MPSINPUT *mpsi)
 
static const char * mpsinputField0 (const MPSINPUT *mpsi)
 
static const char * mpsinputField1 (const MPSINPUT *mpsi)
 
static const char * mpsinputField2 (const MPSINPUT *mpsi)
 
static const char * mpsinputField3 (const MPSINPUT *mpsi)
 
static const char * mpsinputField4 (const MPSINPUT *mpsi)
 
static const char * mpsinputField5 (const MPSINPUT *mpsi)
 
static const char * mpsinputObjname (const MPSINPUT *mpsi)
 
static SCIP_OBJSENSE mpsinputObjsense (const MPSINPUT *mpsi)
 
static SCIP_Bool mpsinputHasError (const MPSINPUT *mpsi)
 
static SCIP_Bool mpsinputIsInteger (const MPSINPUT *mpsi)
 
static void mpsinputSetSection (MPSINPUT *mpsi, MPSSECTION section)
 
static void mpsinputSetProbname (MPSINPUT *mpsi, const char *probname)
 
static void mpsinputSetObjname (MPSINPUT *mpsi, const char *objname)
 
static void mpsinputSetObjsense (MPSINPUT *mpsi, SCIP_OBJSENSE sense)
 
static void mpsinputSyntaxerror (MPSINPUT *mpsi)
 
static void mpsinputEntryIgnored (SCIP *scip, MPSINPUT *mpsi, const char *what, const char *what_name, const char *entity, const char *entity_name, SCIP_VERBLEVEL verblevel)
 
static void clearFrom (char *buf, unsigned int pos)
 
static void patchField (char *buf, int beg, int end)
 
static SCIP_Bool mpsinputReadLine (MPSINPUT *mpsi)
 
static void mpsinputInsertField4 (MPSINPUT *mpsi, const char *str)
 
static void mpsinputInsertName (MPSINPUT *mpsi, const char *name, SCIP_Bool second)
 
static SCIP_RETCODE addVarNameToStorage (SCIP *scip, const char ***varnames, int *varnamessize, int *nvars, const char *colname)
 
static SCIP_RETCODE addConsNameToStorage (SCIP *scip, const char ***consnames, int *consnamessize, int *ncons, const char *rowname)
 
static SCIP_RETCODE readName (SCIP *scip, MPSINPUT *mpsi)
 
static SCIP_RETCODE readObjsen (SCIP *scip, MPSINPUT *mpsi)
 
static SCIP_RETCODE readObjname (SCIP *scip, MPSINPUT *mpsi)
 
static SCIP_RETCODE readRows (MPSINPUT *mpsi, SCIP *scip, const char ***consnames, int *consnamessize, int *nconsnames)
 
static SCIP_RETCODE readRowsExact (MPSINPUT *mpsi, SCIP *scip, const char ***consnames, int *consnamessize, int *nconsnames)
 
static SCIP_RETCODE readCols (MPSINPUT *mpsi, SCIP *scip, const char ***varnames, int *varnamessize, int *nvarnames)
 
static SCIP_RETCODE readColsExact (MPSINPUT *mpsi, SCIP *scip, const char ***varnames, int *varnamessize, int *nvarnames)
 
static SCIP_RETCODE readRhs (MPSINPUT *mpsi, SCIP *scip)
 
static SCIP_RETCODE readRhsExact (MPSINPUT *mpsi, SCIP *scip)
 
static SCIP_RETCODE readRanges (MPSINPUT *mpsi, SCIP *scip)
 
static SCIP_RETCODE readRangesExact (MPSINPUT *mpsi, SCIP *scip)
 
static SCIP_RETCODE readBounds (MPSINPUT *mpsi, SCIP *scip)
 
static SCIP_RETCODE readBoundsExact (MPSINPUT *mpsi, SCIP *scip)
 
static SCIP_RETCODE readSOS (MPSINPUT *mpsi, SCIP *scip)
 
static SCIP_RETCODE readQMatrix (MPSINPUT *mpsi, SCIP_Bool isQuadObj, SCIP *scip)
 
static SCIP_RETCODE readQCMatrix (MPSINPUT *mpsi, SCIP *scip)
 
static SCIP_RETCODE readIndicators (MPSINPUT *mpsi, SCIP *scip)
 
static SCIP_RETCODE readMps (SCIP *scip, const char *filename, const char ***varnames, const char ***consnames, int *varnamessize, int *consnamessize, int *nvarnames, int *nconsnames)
 
static SCIP_RETCODE readMpsExact (SCIP *scip, const char *filename, const char ***varnames, const char ***consnames, int *varnamessize, int *consnamessize, int *nvarnames, int *nconsnames)
 
static SCIP_DECL_HASHGETKEY (hashGetKeyNamefreq)
 
static SCIP_DECL_HASHKEYEQ (hashKeyEqString)
 
static SCIP_DECL_HASHGETKEY (hashGetKeyVar)
 
static SCIP_DECL_HASHKEYEQ (hashKeyEqVar)
 
static SCIP_DECL_HASHKEYVAL (hashKeyValVar)
 
static unsigned int computeFieldWidth (unsigned int width)
 
static void printRecord (SCIP *scip, FILE *file, const char *col1, const char *col2, unsigned int maxnamelen)
 
static void printStart (SCIP *scip, FILE *file, const char *col1, const char *col2, int maxnamelen)
 
static void printEntry (SCIP *scip, FILE *file, const char *varname, const char *consname, SCIP_Real value, int *recordcnt, unsigned int maxnamelen)
 
static void printRowType (SCIP *scip, FILE *file, SCIP_Real lhs, SCIP_Real rhs, const char *name)
 
static SCIP_RETCODE initializeMatrix (SCIP *scip, SPARSEMATRIX **matrix, int slots)
 
static SCIP_RETCODE checkSparseMatrixCapacity (SCIP *scip, SPARSEMATRIX *matrix, int capacity)
 
static void freeMatrix (SCIP *scip, SPARSEMATRIX *matrix)
 
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)
 
static SCIP_RETCODE collectAggregatedVars (SCIP *scip, SCIP_VAR **vars, int nvars, SCIP_VAR ***aggvars, int *naggvars, int *saggvars, SCIP_HASHTABLE *varAggregated)
 
static SCIP_RETCODE checkVarnames (SCIP *scip, SCIP_VAR **vars, int nvars, unsigned int *maxnamelen, const char ***varnames, SCIP_HASHMAP **varnameHashmap)
 
static SCIP_RETCODE checkConsnames (SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_Bool transformed, unsigned int *maxnamelen, const char ***consnames, SCIP_Bool *error)
 
static SCIP_Bool writeVarIsIntegral (SCIP_VAR *var, int implintlevel)
 
static SCIP_DECL_SORTPTRCOMP (mpsIntCompM2)
 
static void printRhsSection (SCIP *scip, FILE *file, int nconss, const char **consnames, SCIP_Real *rhss, unsigned int maxnamelen, SCIP_Real objoffset)
 
static void printRangeSection (SCIP *scip, FILE *file, SCIP_CONS **conss, int nconss, const char **consnames, SCIP_Bool transformed, unsigned int maxnamelen)
 
static void printBoundSectionName (SCIP *scip, FILE *file)
 
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)
 
static SCIP_DECL_READERCOPY (readerCopyMps)
 
static SCIP_DECL_READERFREE (readerFreeMps)
 
static SCIP_DECL_READERREAD (readerReadMps)
 
static SCIP_DECL_READERWRITE (readerWriteMps)
 
SCIP_RETCODE SCIPincludeReaderMps (SCIP *scip)
 
SCIP_RETCODE SCIPreadMps (SCIP *scip, SCIP_READER *reader, const char *filename, SCIP_RESULT *result, const char ***varnames, const char ***consnames, int *varnamessize, int *consnamessize, int *nvarnames, int *nconsnames)
 
SCIP_RETCODE SCIPwriteMps (SCIP *scip, SCIP_READER *reader, 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_VAR **fixedvars, int nfixedvars, SCIP_CONS **conss, int nconss, SCIP_RESULT *result)
 

Macro Definition Documentation

◆ READER_NAME

#define READER_NAME   "mpsreader"

Definition at line 81 of file reader_mps.c.

◆ READER_DESC

#define READER_DESC   "file reader for MIQPs in IBM's Mathematical Programming System format"

Definition at line 82 of file reader_mps.c.

◆ READER_EXTENSION

#define READER_EXTENSION   "mps"

Definition at line 83 of file reader_mps.c.

◆ DEFAULT_LINEARIZE_ANDS

#define DEFAULT_LINEARIZE_ANDS   TRUE

should possible "and" constraint be linearized when writing the mps file?

Definition at line 85 of file reader_mps.c.

◆ DEFAULT_AGGRLINEARIZATION_ANDS

#define DEFAULT_AGGRLINEARIZATION_ANDS   TRUE

should an aggregated linearization for and constraints be used?

Definition at line 86 of file reader_mps.c.

◆ MPS_MAX_LINELEN

#define MPS_MAX_LINELEN   1024

Definition at line 92 of file reader_mps.c.

◆ MPS_MAX_NAMELEN

#define MPS_MAX_NAMELEN   256

Definition at line 93 of file reader_mps.c.

◆ MPS_MAX_VALUELEN

#define MPS_MAX_VALUELEN   26

Definition at line 94 of file reader_mps.c.

◆ MPS_MAX_FIELDLEN

#define MPS_MAX_FIELDLEN   20

Definition at line 95 of file reader_mps.c.

◆ PATCH_CHAR

#define PATCH_CHAR   '_'

Definition at line 97 of file reader_mps.c.

◆ BLANK

#define BLANK   ' '

Definition at line 98 of file reader_mps.c.

◆ MPSINTCOMP_LEVEL

#define MPSINTCOMP_LEVEL (   IMPLINTLEVEL)
Value:
{ \
SCIP_Bool integral1 = writeVarIsIntegral((SCIP_VAR*)elem1, IMPLINTLEVEL); \
SCIP_Bool integral2 = writeVarIsIntegral((SCIP_VAR*)elem2, IMPLINTLEVEL); \
\
if( integral1 != integral2 ) \
return integral1 ? -1 : +1; \
\
return SCIPvarComp(elem1, elem2); \
}
static SCIP_Bool writeVarIsIntegral(SCIP_VAR *var, int implintlevel)
Definition: reader_mps.c:4309

template implementation of mpsIntComp for given implied integral level

Definition at line 4324 of file reader_mps.c.

Typedef Documentation

◆ MPSSECTION

typedef enum MpsSection MPSSECTION

Definition at line 127 of file reader_mps.c.

◆ MPSINPUT

typedef struct MpsInput MPSINPUT

Definition at line 153 of file reader_mps.c.

◆ SPARSEMATRIX

typedef struct SparseMatrix SPARSEMATRIX

Definition at line 164 of file reader_mps.c.

◆ CONSNAMEFREQ

typedef struct ConsNameFreq CONSNAMEFREQ

Definition at line 172 of file reader_mps.c.

Enumeration Type Documentation

◆ MpsSection

enum MpsSection

enum containing all mps sections

Enumerator
MPS_NAME 
MPS_OBJSEN 
MPS_OBJNAME 
MPS_ROWS 
MPS_USERCUTS 
MPS_LAZYCONS 
MPS_COLUMNS 
MPS_RHS 
MPS_RANGES 
MPS_BOUNDS 
MPS_SOS 
MPS_QUADOBJ 
MPS_QMATRIX 
MPS_QCMATRIX 
MPS_INDICATORS 
MPS_ENDATA 

Definition at line 108 of file reader_mps.c.

Function Documentation

◆ mpsinputCreate()

static SCIP_RETCODE mpsinputCreate ( SCIP scip,
MPSINPUT **  mpsi,
SCIP_FILE fp 
)
static

creates the mps input structure

Parameters
scipSCIP data structure
mpsimps input structure
fpfile object for the input file

Definition at line 176 of file reader_mps.c.

References FALSE, MPS_NAME, NULL, SCIP_CALL, SCIP_OBJSENSE_MINIMIZE, SCIP_OKAY, SCIPallocBlockMemory, and SCIPgetBoolParam().

Referenced by readMps(), and readMpsExact().

◆ mpsinputFree()

static void mpsinputFree ( SCIP scip,
MPSINPUT **  mpsi 
)
static

free the mps input structure

Parameters
scipSCIP data structure
mpsimps input structure

Definition at line 214 of file reader_mps.c.

References SCIPfreeBlockMemory.

Referenced by readMps(), and readMpsExact().

◆ mpsinputSection()

static MPSSECTION mpsinputSection ( const MPSINPUT mpsi)
static

returns the current section

Parameters
mpsimps input structure

Definition at line 224 of file reader_mps.c.

References NULL.

Referenced by readMps(), readMpsExact(), readRows(), and readRowsExact().

◆ mpsinputField0()

static const char * mpsinputField0 ( const MPSINPUT mpsi)
static

return the current value of field 0

Parameters
mpsimps input structure

Definition at line 235 of file reader_mps.c.

References NULL.

Referenced by readBounds(), readBoundsExact(), readCols(), readColsExact(), readIndicators(), readName(), readObjname(), readObjsen(), readQCMatrix(), readQMatrix(), readRanges(), readRangesExact(), readRhs(), readRhsExact(), readRows(), readRowsExact(), and readSOS().

◆ mpsinputField1()

static const char * mpsinputField1 ( const MPSINPUT mpsi)
static

return the current value of field 1

Parameters
mpsimps input structure

Definition at line 246 of file reader_mps.c.

References NULL.

Referenced by readBounds(), readBoundsExact(), readCols(), readColsExact(), readIndicators(), readName(), readObjname(), readObjsen(), readQCMatrix(), readQMatrix(), readRanges(), readRangesExact(), readRhs(), readRhsExact(), readRows(), readRowsExact(), and readSOS().

◆ mpsinputField2()

static const char * mpsinputField2 ( const MPSINPUT mpsi)
static

return the current value of field 2

Parameters
mpsimps input structure

Definition at line 257 of file reader_mps.c.

References NULL.

Referenced by readBounds(), readBoundsExact(), readCols(), readColsExact(), readIndicators(), readQCMatrix(), readQMatrix(), readRanges(), readRangesExact(), readRhs(), readRhsExact(), readRows(), readRowsExact(), and readSOS().

◆ mpsinputField3()

static const char * mpsinputField3 ( const MPSINPUT mpsi)
static

return the current value of field 3

Parameters
mpsimps input structure

Definition at line 268 of file reader_mps.c.

References NULL.

Referenced by readBounds(), readBoundsExact(), readCols(), readColsExact(), readIndicators(), readQCMatrix(), readQMatrix(), readRanges(), readRangesExact(), readRhs(), readRhsExact(), and readSOS().

◆ mpsinputField4()

static const char * mpsinputField4 ( const MPSINPUT mpsi)
static

return the current value of field 4

Parameters
mpsimps input structure

Definition at line 279 of file reader_mps.c.

References NULL.

Referenced by readBounds(), readBoundsExact(), readCols(), readColsExact(), readIndicators(), readQCMatrix(), readQMatrix(), readRanges(), readRangesExact(), readRhs(), readRhsExact(), and readSOS().

◆ mpsinputField5()

static const char * mpsinputField5 ( const MPSINPUT mpsi)
static

return the current value of field 5

Parameters
mpsimps input structure

Definition at line 290 of file reader_mps.c.

References NULL.

Referenced by readCols(), readColsExact(), readQCMatrix(), readQMatrix(), readRanges(), readRangesExact(), readRhs(), readRhsExact(), and readSOS().

◆ mpsinputObjname()

static const char * mpsinputObjname ( const MPSINPUT mpsi)
static

returns the objective name

Parameters
mpsimps input structure

Definition at line 301 of file reader_mps.c.

References NULL.

Referenced by readCols(), readColsExact(), readRhs(), readRhsExact(), readRows(), and readRowsExact().

◆ mpsinputObjsense()

static SCIP_OBJSENSE mpsinputObjsense ( const MPSINPUT mpsi)
static

returns the objective sense

Parameters
mpsimps input structure

Definition at line 312 of file reader_mps.c.

References NULL.

Referenced by readMps(), readMpsExact(), and readQMatrix().

◆ mpsinputHasError()

static SCIP_Bool mpsinputHasError ( const MPSINPUT mpsi)
static

returns if an error was detected

Parameters
mpsimps input structure

Definition at line 323 of file reader_mps.c.

References NULL.

Referenced by readMps(), and readMpsExact().

◆ mpsinputIsInteger()

static SCIP_Bool mpsinputIsInteger ( const MPSINPUT mpsi)
static

returns the value of the Bool "is integer" in the mps input

Parameters
mpsimps input structure

Definition at line 334 of file reader_mps.c.

References NULL.

Referenced by readCols(), and readColsExact().

◆ mpsinputSetSection()

static void mpsinputSetSection ( MPSINPUT mpsi,
MPSSECTION  section 
)
static

set the section in the mps input structure to given section

Parameters
mpsimps input structure
sectionsection that is set

Definition at line 345 of file reader_mps.c.

References NULL.

Referenced by readBounds(), readBoundsExact(), readCols(), readColsExact(), readIndicators(), readName(), readObjname(), readObjsen(), readQCMatrix(), readQMatrix(), readRanges(), readRangesExact(), readRhs(), readRhsExact(), readRows(), readRowsExact(), and readSOS().

◆ mpsinputSetProbname()

static void mpsinputSetProbname ( MPSINPUT mpsi,
const char *  probname 
)
static

set the problem name in the mps input structure to given problem name

Parameters
mpsimps input structure
probnamename of the problem to set

Definition at line 357 of file reader_mps.c.

References MPS_MAX_NAMELEN, NULL, and SCIPmemccpy().

Referenced by readName().

◆ mpsinputSetObjname()

static void mpsinputSetObjname ( MPSINPUT mpsi,
const char *  objname 
)
static

set the objective name in the mps input structure to given objective name

Parameters
mpsimps input structure
objnamename of the objective function to set

Definition at line 371 of file reader_mps.c.

References MPS_MAX_NAMELEN, NULL, and SCIPmemccpy().

Referenced by readObjname(), readRows(), and readRowsExact().

◆ mpsinputSetObjsense()

static void mpsinputSetObjsense ( MPSINPUT mpsi,
SCIP_OBJSENSE  sense 
)
static

set the objective sense in the mps input structure to given objective sense

Parameters
mpsimps input structure
sensesense of the objective function

Definition at line 385 of file reader_mps.c.

References NULL.

Referenced by readObjsen().

◆ mpsinputSyntaxerror()

◆ mpsinputEntryIgnored()

static void mpsinputEntryIgnored ( SCIP scip,
MPSINPUT mpsi,
const char *  what,
const char *  what_name,
const char *  entity,
const char *  entity_name,
SCIP_VERBLEVEL  verblevel 
)
static

method post a ignore message

Parameters
scipSCIP data structure
mpsimps input structure
whatwhat get ignored
what_namename of that object
entityentity
entity_nameentity name
verblevelSCIP verblevel for this message

Definition at line 409 of file reader_mps.c.

References NULL, and SCIPverbMessage().

Referenced by readBounds(), readBoundsExact(), readCols(), readColsExact(), readQCMatrix(), readQMatrix(), readRanges(), readRangesExact(), readRhs(), readRhsExact(), readRows(), readRowsExact(), and readSOS().

◆ clearFrom()

static void clearFrom ( char *  buf,
unsigned int  pos 
)
static

fill the line from pos up to column 80 with blanks.

Parameters
bufbuffer to clear
posposition to start the clearing process

Definition at line 431 of file reader_mps.c.

References BLANK.

Referenced by mpsinputReadLine().

◆ patchField()

static void patchField ( char *  buf,
int  beg,
int  end 
)
static

change all blanks inside a field to PATCH_CHAR.

Parameters
bufbuffer to patch
begposition to begin
endposition to end

Definition at line 445 of file reader_mps.c.

References BLANK, and PATCH_CHAR.

Referenced by mpsinputReadLine().

◆ mpsinputReadLine()

◆ mpsinputInsertField4()

static void mpsinputInsertField4 ( MPSINPUT mpsi,
const char *  str 
)
static

Insert str as field 4 and shift all other fields up.

Parameters
mpsimps input structure
strstr to insert

Definition at line 649 of file reader_mps.c.

References NULL.

Referenced by readBounds(), and readBoundsExact().

◆ mpsinputInsertName()

static void mpsinputInsertName ( MPSINPUT mpsi,
const char *  name,
SCIP_Bool  second 
)
static

Insert name as field 1 or 2 and shift all other fields up.

Parameters
mpsimps input structure
namename to insert
secondinsert as second field?

Definition at line 663 of file reader_mps.c.

References NULL.

Referenced by readBounds(), readBoundsExact(), readRanges(), readRangesExact(), readRhs(), and readRhsExact().

◆ addVarNameToStorage()

static SCIP_RETCODE addVarNameToStorage ( SCIP scip,
const char ***  varnames,
int *  varnamessize,
int *  nvars,
const char *  colname 
)
static

Add variable name to storage

Parameters
scipSCIP data structure
varnamesthe variable name storage
varnamessizethe size of the variable names storage
nvarsthe number of variables
colnamethe name of the variable

Definition at line 687 of file reader_mps.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPduplicateBlockMemoryArray, and SCIPensureBlockMemoryArray.

Referenced by readCols(), and readColsExact().

◆ addConsNameToStorage()

static SCIP_RETCODE addConsNameToStorage ( SCIP scip,
const char ***  consnames,
int *  consnamessize,
int *  ncons,
const char *  rowname 
)
static

Add constraint name to storage

Parameters
scipSCIP data structure
consnamesthe constraint name storage
consnamessizethe size of the constraint names storage
nconsthe number of constraint
rownamethe name of the constraint

Definition at line 709 of file reader_mps.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPduplicateBlockMemoryArray, and SCIPensureBlockMemoryArray.

Referenced by readRows(), and readRowsExact().

◆ readName()

static SCIP_RETCODE readName ( SCIP scip,
MPSINPUT mpsi 
)
static

Process NAME section.

Parameters
scipSCIP data structure
mpsimps input structure

Definition at line 731 of file reader_mps.c.

References MPS_LAZYCONS, MPS_OBJNAME, MPS_OBJSEN, MPS_ROWS, MPS_USERCUTS, mpsinputField0(), mpsinputField1(), mpsinputReadLine(), mpsinputSetProbname(), mpsinputSetSection(), mpsinputSyntaxerror(), NULL, SCIP_OKAY, and SCIPdebugMsg.

Referenced by readMps(), and readMpsExact().

◆ readObjsen()

static SCIP_RETCODE readObjsen ( SCIP scip,
MPSINPUT mpsi 
)
static

Process OBJSEN section. This Section is a CPLEX extension.

Parameters
scipSCIP data structure
mpsimps input structure

Definition at line 779 of file reader_mps.c.

References MPS_LAZYCONS, MPS_OBJNAME, MPS_ROWS, MPS_USERCUTS, mpsinputField0(), mpsinputField1(), mpsinputReadLine(), mpsinputSetObjsense(), mpsinputSetSection(), mpsinputSyntaxerror(), NULL, SCIP_OBJSENSE_MAXIMIZE, SCIP_OBJSENSE_MINIMIZE, SCIP_OKAY, and SCIPdebugMsg.

Referenced by readMps(), and readMpsExact().

◆ readObjname()

static SCIP_RETCODE readObjname ( SCIP scip,
MPSINPUT mpsi 
)
static

Process OBJNAME section. This Section is a CPLEX extension.

Parameters
scipSCIP data structure
mpsimps input structure

Definition at line 838 of file reader_mps.c.

References MPS_LAZYCONS, MPS_ROWS, MPS_USERCUTS, mpsinputField0(), mpsinputField1(), mpsinputReadLine(), mpsinputSetObjname(), mpsinputSetSection(), mpsinputSyntaxerror(), NULL, SCIP_OKAY, and SCIPdebugMsg.

Referenced by readMps(), and readMpsExact().

◆ readRows()

static SCIP_RETCODE readRows ( MPSINPUT mpsi,
SCIP scip,
const char ***  consnames,
int *  consnamessize,
int *  nconsnames 
)
static

Process ROWS, USERCUTS, or LAZYCONS section.

Parameters
mpsimps input structure
scipSCIP data structure
consnamesstorage for the constraint names, or NULL
consnamessizethe size of the constraint names storage, or NULL
nconsnamesthe number of stored constraint names, or NULL

Definition at line 877 of file reader_mps.c.

References addConsNameToStorage(), FALSE, MPS_COLUMNS, MPS_LAZYCONS, MPS_ROWS, MPS_USERCUTS, mpsinputEntryIgnored(), mpsinputField0(), mpsinputField1(), mpsinputField2(), mpsinputObjname(), mpsinputReadLine(), mpsinputSection(), mpsinputSetObjname(), mpsinputSetSection(), mpsinputSyntaxerror(), NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_VERBLEVEL_NORMAL, SCIPaddCons(), SCIPcreateConsLinear(), SCIPdebugMsg, SCIPfindCons(), SCIPinfinity(), SCIPreleaseCons(), separate(), and TRUE.

Referenced by readMps().

◆ readRowsExact()

static SCIP_RETCODE readRowsExact ( MPSINPUT mpsi,
SCIP scip,
const char ***  consnames,
int *  consnamessize,
int *  nconsnames 
)
static

Process ROWS, USERCUTS, or LAZYCONS section. (exact version)

Parameters
mpsimps input structure
scipSCIP data structure
consnamesstorage for the constraint names, or NULL
consnamessizethe size of the constraint names storage, or NULL
nconsnamesthe number of stored constraint names, or NULL

Definition at line 973 of file reader_mps.c.

References addConsNameToStorage(), FALSE, MPS_COLUMNS, MPS_LAZYCONS, MPS_ROWS, MPS_USERCUTS, mpsinputEntryIgnored(), mpsinputField0(), mpsinputField1(), mpsinputField2(), mpsinputObjname(), mpsinputReadLine(), mpsinputSection(), mpsinputSetObjname(), mpsinputSetSection(), mpsinputSyntaxerror(), NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_VERBLEVEL_NORMAL, SCIPaddCons(), SCIPbuffer(), SCIPcreateConsExactLinear(), SCIPdebugMsg, SCIPfindCons(), SCIPrationalCreateBuffer(), SCIPrationalFreeBuffer(), SCIPrationalSetInfinity(), SCIPrationalSetNegInfinity(), SCIPrationalSetReal(), SCIPreleaseCons(), separate(), and TRUE.

Referenced by readMpsExact().

◆ readCols()

static SCIP_RETCODE readCols ( MPSINPUT mpsi,
SCIP scip,
const char ***  varnames,
int *  varnamessize,
int *  nvarnames 
)
static

◆ readColsExact()

static SCIP_RETCODE readColsExact ( MPSINPUT mpsi,
SCIP scip,
const char ***  varnames,
int *  varnamessize,
int *  nvarnames 
)
static

◆ readRhs()

◆ readRhsExact()

◆ readRanges()

◆ readRangesExact()

◆ readBounds()

◆ readBoundsExact()

static SCIP_RETCODE readBoundsExact ( MPSINPUT mpsi,
SCIP scip 
)
static

Process BOUNDS section.

Parameters
mpsimps input structure
scipSCIP data structure

Definition at line 2329 of file reader_mps.c.

References FALSE, MPS_ENDATA, MPS_INDICATORS, MPS_MAX_NAMELEN, MPS_QCMATRIX, MPS_QMATRIX, MPS_QUADOBJ, MPS_SOS, mpsinputEntryIgnored(), mpsinputField0(), mpsinputField1(), mpsinputField2(), mpsinputField3(), mpsinputField4(), mpsinputInsertField4(), mpsinputInsertName(), mpsinputReadLine(), mpsinputSetSection(), mpsinputSyntaxerror(), NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_VARTYPE_BINARY, SCIP_VARTYPE_CONTINUOUS, SCIP_VARTYPE_INTEGER, SCIP_VERBLEVEL_NORMAL, SCIPABORT, SCIPaddVar(), SCIPaddVarExactData(), SCIPallocBufferArray, SCIPbuffer(), SCIPcalcMemGrowSize(), SCIPchgVarLbExact(), SCIPchgVarType(), SCIPchgVarUbExact(), SCIPcreateVar(), SCIPdebugMsg, SCIPerrorMessage, SCIPfindVar(), SCIPfreeBufferArrayNull, SCIPinfinity(), SCIPmemccpy(), SCIPrationalCanonicalize(), SCIPrationalCreateBuffer(), SCIPrationalFreeBuffer(), SCIPrationalGetReal(), SCIPrationalIsGT(), SCIPrationalIsGTReal(), SCIPrationalIsInfinity(), SCIPrationalIsIntegral(), SCIPrationalIsLT(), SCIPrationalIsNegative(), SCIPrationalIsZero(), SCIPrationalSetInfinity(), SCIPrationalSetNegInfinity(), SCIPrationalSetReal(), SCIPrationalSetString(), SCIPreallocBufferArray, SCIPreleaseVar(), SCIPtightenVarLbExact(), SCIPtightenVarUbExact(), SCIPvarGetLbGlobal(), SCIPvarGetLbGlobalExact(), SCIPvarGetName(), SCIPvarGetType(), SCIPvarGetUbGlobal(), SCIPvarGetUbGlobalExact(), SCIPvarIsImpliedIntegral(), SCIPwarningMessage(), and TRUE.

Referenced by readMpsExact().

◆ readSOS()

◆ readQMatrix()

static SCIP_RETCODE readQMatrix ( MPSINPUT mpsi,
SCIP_Bool  isQuadObj,
SCIP scip 
)
static

Process QMATRIX or QUADOBJ section.

  • We read the QMATRIX or QUADOBJ section, which is a nonstandard section introduced by CPLEX.
  • We create a quadratic constraint for this matrix and add a variable to the objective to represent the value of the QMATRIX.
  • For a QMATRIX, we expect that both lower and upper diagonal elements are given and every coefficient has to be divided by 2.0.
  • For a QUADOBJ, we expect that only the upper diagonal elements are given and thus only coefficients on the diagonal have to be divided by 2.0.
Parameters
mpsimps input structure
isQuadObjwhether we actually read a QUADOBJ section
scipSCIP data structure

Definition at line 2880 of file reader_mps.c.

References FALSE, MPS_ENDATA, MPS_INDICATORS, MPS_QCMATRIX, mpsinputEntryIgnored(), mpsinputField0(), mpsinputField1(), mpsinputField2(), mpsinputField3(), mpsinputField4(), mpsinputField5(), mpsinputObjsense(), mpsinputReadLine(), mpsinputSetSection(), mpsinputSyntaxerror(), NULL, SCIP_Bool, SCIP_CALL, SCIP_OBJSENSE_MINIMIZE, SCIP_OKAY, SCIP_READERROR, SCIP_Real, SCIP_VARTYPE_CONTINUOUS, SCIP_VERBLEVEL_NORMAL, SCIPaddCons(), SCIPaddVar(), SCIPallocBufferArray, SCIPcalcMemGrowSize(), SCIPconsGetName(), SCIPcreateConsQuadraticNonlinear(), SCIPcreateVar(), SCIPdebugMsg, SCIPdebugPrintCons, SCIPerrorMessage, SCIPfindVar(), SCIPfreeBufferArray, SCIPinfinity(), SCIPisExact(), SCIPreallocBufferArray, SCIPreleaseCons(), SCIPreleaseVar(), SCIPvarGetName(), SCIPwarningMessage(), separate(), and TRUE.

Referenced by readMps(), and readMpsExact().

◆ readQCMatrix()

◆ readIndicators()

static SCIP_RETCODE readIndicators ( MPSINPUT mpsi,
SCIP scip 
)
static

Process INDICATORS section.

We read the INDICATORS section, which is a nonstandard section introduced by CPLEX. Note that CPLEX does not allow ranged rows.

If the linear constraints are equations or ranged rows, we generate two indicator constraints.

The section has to come after the QMATRIX* sections.

Parameters
mpsimps input structure
scipSCIP data structure

Definition at line 3289 of file reader_mps.c.

References FALSE, MPS_ENDATA, MPS_MAX_NAMELEN, mpsinputField0(), mpsinputField1(), mpsinputField2(), mpsinputField3(), mpsinputField4(), mpsinputReadLine(), mpsinputSetSection(), mpsinputSyntaxerror(), NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_READERROR, SCIP_Real, SCIP_VARTYPE_BINARY, SCIPaddCons(), SCIPallocBufferArray, SCIPchgLhsLinear(), SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPcreateConsIndicator(), SCIPcreateConsIndicatorLinConsPure(), SCIPdebugMsg, SCIPdebugPrintCons, SCIPerrorMessage, SCIPfindCons(), SCIPfindVar(), SCIPfreeBufferArray, SCIPgetLhsLinear(), SCIPgetNegatedVar(), SCIPgetNVarsLinear(), SCIPgetRhsLinear(), SCIPgetValsLinear(), SCIPgetVarsLinear(), SCIPinfinity(), SCIPisExact(), SCIPisInfinity(), SCIPreleaseCons(), SCIPsnprintf(), SCIPvarGetType(), separate(), and TRUE.

Referenced by readMps(), and readMpsExact().

◆ readMps()

static SCIP_RETCODE readMps ( SCIP scip,
const char *  filename,
const char ***  varnames,
const char ***  consnames,
int *  varnamessize,
int *  consnamessize,
int *  nvarnames,
int *  nconsnames 
)
static

Read LP in "MPS File Format".

A specification of the MPS format can be found at

http://plato.asu.edu/ftp/mps_format.txt, ftp://ftp.caam.rice.edu/pub/people/bixby/miplib/mps_format,

and in the

CPLEX Reference Manual

This routine should read all valid MPS format files. What it will not do, is to find all cases where a file is ill formed. If this happens it may complain and read nothing or read "something".

Parameters
scipSCIP data structure
filenamename of the input file
varnamesstorage for the variable names, or NULL
consnamesstorage for the constraint names, or NULL
varnamessizethe size of the variable names storage, or NULL
consnamessizethe size of the constraint names storage, or NULL
nvarnamesthe number of stored variable names, or NULL
nconsnamesthe number of stored constraint names, or NULL

Definition at line 3504 of file reader_mps.c.

References FALSE, MPS_BOUNDS, MPS_COLUMNS, MPS_ENDATA, MPS_INDICATORS, MPS_LAZYCONS, MPS_OBJNAME, MPS_OBJSEN, MPS_QCMATRIX, MPS_QMATRIX, MPS_QUADOBJ, MPS_RANGES, MPS_RHS, MPS_ROWS, MPS_SOS, MPS_USERCUTS, mpsinputCreate(), mpsinputFree(), mpsinputHasError(), mpsinputObjsense(), mpsinputSection(), mpsinputSyntaxerror(), NULL, readBounds(), readCols(), readIndicators(), readName(), readObjname(), readObjsen(), readQCMatrix(), readQMatrix(), readRanges(), readRhs(), readRows(), readSOS(), SCIP_CALL, SCIP_CALL_TERMINATE, SCIP_NOFILE, SCIP_READERROR, SCIPcreateProb(), SCIPerrorMessage, SCIPfclose(), SCIPfopen(), SCIPprintSysError(), SCIPsetObjsense(), and TRUE.

Referenced by SCIPreadMps().

◆ readMpsExact()

static SCIP_RETCODE readMpsExact ( SCIP scip,
const char *  filename,
const char ***  varnames,
const char ***  consnames,
int *  varnamessize,
int *  consnamessize,
int *  nvarnames,
int *  nconsnames 
)
static

Read LP in "MPS File Format" (version for exact solving mode, numbers can also be rationals).

A specification of the MPS format can be found at

http://plato.asu.edu/ftp/mps_format.txt, ftp://ftp.caam.rice.edu/pub/people/bixby/miplib/mps_format,

and in the

CPLEX Reference Manual

This routine should read all valid MPS format files. What it will not do, is to find all cases where a file is ill formed. If this happens it may complain and read nothing or read "something".

Parameters
scipSCIP data structure
filenamename of the input file
varnamesstorage for the variable names, or NULL
consnamesstorage for the constraint names, or NULL
varnamessizethe size of the variable names storage, or NULL
consnamessizethe size of the constraint names storage, or NULL
nvarnamesthe number of stored variable names, or NULL
nconsnamesthe number of stored constraint names, or NULL

Definition at line 3624 of file reader_mps.c.

References FALSE, MPS_BOUNDS, MPS_COLUMNS, MPS_ENDATA, MPS_INDICATORS, MPS_LAZYCONS, MPS_OBJNAME, MPS_OBJSEN, MPS_QCMATRIX, MPS_QMATRIX, MPS_QUADOBJ, MPS_RANGES, MPS_RHS, MPS_ROWS, MPS_SOS, MPS_USERCUTS, mpsinputCreate(), mpsinputFree(), mpsinputHasError(), mpsinputObjsense(), mpsinputSection(), mpsinputSyntaxerror(), NULL, readBoundsExact(), readColsExact(), readIndicators(), readName(), readObjname(), readObjsen(), readQCMatrix(), readQMatrix(), readRangesExact(), readRhsExact(), readRowsExact(), readSOS(), SCIP_CALL, SCIP_CALL_TERMINATE, SCIP_NOFILE, SCIP_READERROR, SCIPcreateProb(), SCIPerrorMessage, SCIPfclose(), SCIPfopen(), SCIPisExact(), SCIPprintSysError(), SCIPsetObjsense(), and TRUE.

Referenced by SCIPreadMps().

◆ SCIP_DECL_HASHGETKEY() [1/2]

static SCIP_DECL_HASHGETKEY ( hashGetKeyNamefreq  )
static

gets the key (i.e. the name) of the given namefreq

Definition at line 3735 of file reader_mps.c.

References ConsNameFreq::consname, and NULL.

◆ SCIP_DECL_HASHKEYEQ() [1/2]

static SCIP_DECL_HASHKEYEQ ( hashKeyEqString  )
static

returns TRUE iff both keys (i.e. strings) are equal up to max length

Definition at line 3747 of file reader_mps.c.

References MPS_MAX_NAMELEN.

◆ SCIP_DECL_HASHGETKEY() [2/2]

static SCIP_DECL_HASHGETKEY ( hashGetKeyVar  )
static

hash key retrieval function for variables

Definition at line 3757 of file reader_mps.c.

◆ SCIP_DECL_HASHKEYEQ() [2/2]

static SCIP_DECL_HASHKEYEQ ( hashKeyEqVar  )
static

returns TRUE iff the indices of both variables are equal

Definition at line 3764 of file reader_mps.c.

References FALSE, and TRUE.

◆ SCIP_DECL_HASHKEYVAL()

static SCIP_DECL_HASHKEYVAL ( hashKeyValVar  )
static

returns the hash value of the key

Definition at line 3773 of file reader_mps.c.

References SCIPvarGetIndex().

◆ computeFieldWidth()

static unsigned int computeFieldWidth ( unsigned int  width)
static

computes the field width such that the output file is nicely arranged

Parameters
widthrequired width

Definition at line 3782 of file reader_mps.c.

References MAX, MIN, and MPS_MAX_FIELDLEN.

Referenced by printRecord(), and printStart().

◆ printRecord()

static void printRecord ( SCIP scip,
FILE *  file,
const char *  col1,
const char *  col2,
unsigned int  maxnamelen 
)
static

output two strings in columns 1 and 2 with computed widths

Parameters
scipSCIP data structure
fileoutput file (or NULL for standard output)
col1column 1
col2column 2
maxnamelenmaximum name length

Definition at line 3793 of file reader_mps.c.

References computeFieldWidth(), MPS_MAX_NAMELEN, MPS_MAX_VALUELEN, NULL, SCIPinfoMessage(), and SCIPsnprintf().

Referenced by printBoundSection(), printEntry(), SCIP_DECL_SORTPTRCOMP(), and SCIPwriteMps().

◆ printStart()

static void printStart ( SCIP scip,
FILE *  file,
const char *  col1,
const char *  col2,
int  maxnamelen 
)
static

output two strings in columns 1 (width 2) and 2 (width 8)

Parameters
scipSCIP data structure
fileoutput file (or NULL for standard output)
col1column 1
col2column 2
maxnamelenmaximum name length (-1 if irrelevant)

Definition at line 3819 of file reader_mps.c.

References computeFieldWidth(), MPS_MAX_NAMELEN, NULL, SCIPinfoMessage(), and SCIPsnprintf().

Referenced by printBoundSection(), printEntry(), printRowType(), SCIP_DECL_SORTPTRCOMP(), and SCIPwriteMps().

◆ printEntry()

static void printEntry ( SCIP scip,
FILE *  file,
const char *  varname,
const char *  consname,
SCIP_Real  value,
int *  recordcnt,
unsigned int  maxnamelen 
)
static

prints the given data as column entry

Parameters
scipSCIP data structure
fileoutput file (or NULL for standard output)
varnamevariable name
consnameconstraint name
valuevalue to display
recordcntpointer to store the number of records per line
maxnamelenmaximum name length

Definition at line 3853 of file reader_mps.c.

References ConsNameFreq::consname, MPS_MAX_VALUELEN, NULL, printRecord(), printStart(), SCIPinfoMessage(), and SCIPsnprintf().

Referenced by printRangeSection(), printRhsSection(), and SCIP_DECL_SORTPTRCOMP().

◆ printRowType()

static void printRowType ( SCIP scip,
FILE *  file,
SCIP_Real  lhs,
SCIP_Real  rhs,
const char *  name 
)
static

prints the constraint type to file stream

Parameters
scipSCIP data structure
fileoutput file (or NULL for standard output)
lhsleft hand side
rhsright hand side
nameconstraint name

Definition at line 3891 of file reader_mps.c.

References NULL, printStart(), SCIPinfoMessage(), SCIPisEQ(), SCIPisGT(), SCIPisInfinity(), and SCIPsnprintf().

Referenced by SCIPwriteMps().

◆ initializeMatrix()

static SCIP_RETCODE initializeMatrix ( SCIP scip,
SPARSEMATRIX **  matrix,
int  slots 
)
static

initializes the sparse matrix

Parameters
scipSCIP data structure
matrixpointer to sparse matrix containing the entries
slotsnumber of slots

Definition at line 3929 of file reader_mps.c.

References SCIP_CALL, SCIP_OKAY, SCIPallocBuffer, and SCIPallocBufferArray.

Referenced by SCIPwriteMps().

◆ checkSparseMatrixCapacity()

static SCIP_RETCODE checkSparseMatrixCapacity ( SCIP scip,
SPARSEMATRIX matrix,
int  capacity 
)
static

this method takes care that the required capacity is available in the sparse matrix

Parameters
scipSCIP data structure
matrixsparse matrix for storing the coefficient
capacityneeded capacity

Definition at line 3947 of file reader_mps.c.

References SCIP_CALL, SCIP_OKAY, and SCIPreallocBufferArray.

Referenced by getLinearCoeffs(), and SCIPwriteMps().

◆ freeMatrix()

static void freeMatrix ( SCIP scip,
SPARSEMATRIX matrix 
)
static

frees the sparse matrix

Parameters
scipSCIP data structure
matrixsparse matrix to free

Definition at line 3965 of file reader_mps.c.

References SCIPfreeBuffer, and SCIPfreeBufferArray.

Referenced by SCIPwriteMps().

◆ getLinearCoeffs()

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 
)
static

computes the coefficient for the given variables and linear constraint information

Parameters
scipSCIP data structure
consnamename of the constraint
varsarray of variables
valsarray of coefficients values (or NULL if all coefficient values are 1)
nvarsnumber of variables
transformedtransformed constraint?
matrixsparse matrix for storing the coefficient
rhspointer to right hand side

Definition at line 3980 of file reader_mps.c.

References checkSparseMatrixCapacity(), ConsNameFreq::consname, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_VARSTATUS_NEGATED, SCIPallocBufferArray, SCIPduplicateBufferArray, SCIPfreeBufferArray, SCIPgetProbvarLinearSum(), SCIPisInfinity(), SCIPreallocBufferArray, SCIPvarGetNegatedVar(), SCIPvarGetOrigvarSum(), and SCIPvarGetStatus().

Referenced by SCIPwriteMps().

◆ collectAggregatedVars()

static SCIP_RETCODE collectAggregatedVars ( SCIP scip,
SCIP_VAR **  vars,
int  nvars,
SCIP_VAR ***  aggvars,
int *  naggvars,
int *  saggvars,
SCIP_HASHTABLE varAggregated 
)
static

check whether given variables are aggregated and put them into an array without duplication

Parameters
scipSCIP data structure
varsvariable array
nvarsnumber of active variables in the problem
aggvarspointer to array storing the aggregated variables on output
naggvarspointer to number of aggregated variables on output
saggvarspointer to number of slots in aggvars array
varAggregatedhashtable for checking duplicates

Definition at line 4083 of file reader_mps.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIP_VARSTATUS_AGGREGATED, SCIP_VARSTATUS_MULTAGGR, SCIP_VARSTATUS_NEGATED, SCIPcalcMemGrowSize(), SCIPhashtableExists(), SCIPhashtableInsert(), SCIPreallocBlockMemoryArray, and SCIPvarGetStatus().

Referenced by SCIPwriteMps().

◆ checkVarnames()

static SCIP_RETCODE checkVarnames ( SCIP scip,
SCIP_VAR **  vars,
int  nvars,
unsigned int *  maxnamelen,
const char ***  varnames,
SCIP_HASHMAP **  varnameHashmap 
)
static

method check if the variable names are not longer than MPS_MAX_NAMELEN - 1

Parameters
scipSCIP data structure
varsarray of variables
nvarsnumber of variables
maxnamelenpointer to store the maximum name length
varnamespointer to array of variable names
varnameHashmappointer to hash map storing variable, variable name mapping

Definition at line 4140 of file reader_mps.c.

References MAX, MPS_MAX_NAMELEN, NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBufferArray, SCIPblkmem(), SCIPhashmapCreate(), SCIPhashmapExists(), SCIPhashmapInsert(), SCIPsnprintf(), SCIPvarGetName(), and SCIPwarningMessage().

Referenced by SCIPwriteMps().

◆ checkConsnames()

static SCIP_RETCODE checkConsnames ( SCIP scip,
SCIP_CONS **  conss,
int  nconss,
SCIP_Bool  transformed,
unsigned int *  maxnamelen,
const char ***  consnames,
SCIP_Bool error 
)
static

method check if the constraint names are not longer than MPS_MAX_NAMELEN - 1

Parameters
scipSCIP data structure
conssarray of all constraints
nconssnumber of all constraints
transformedTRUE iff problem is the transformed problem
maxnamelenpointer to store the maximum name length
consnamespointer to array of constraint names
errorpointer to store whether all constraint names exist

Definition at line 4204 of file reader_mps.c.

References ConsNameFreq::consname, FALSE, ConsNameFreq::freq, MAX, MPS_MAX_NAMELEN, NULL, SCIP_CALL, SCIP_HASHSIZE_NAMES, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPblkmem(), SCIPconsGetName(), SCIPconsIsEnabled(), SCIPfreeBufferArray, SCIPhashtableCreate(), SCIPhashtableFree(), SCIPhashtableInsert(), SCIPhashtableRetrieve(), SCIPsnprintf(), SCIPwarningMessage(), and TRUE.

Referenced by SCIPwriteMps().

◆ writeVarIsIntegral()

static SCIP_Bool writeVarIsIntegral ( SCIP_VAR var,
int  implintlevel 
)
static

returns whether to print an integrality constraint for the given variable

Parameters
varvariable to check
implintlevelimplied integral level

Definition at line 4309 of file reader_mps.c.

References SCIP_VARTYPE_CONTINUOUS, SCIPvarGetImplType(), and SCIPvarGetType().

Referenced by SCIP_DECL_SORTPTRCOMP(), and SCIPwriteMps().

◆ SCIP_DECL_SORTPTRCOMP()

◆ printRhsSection()

static void printRhsSection ( SCIP scip,
FILE *  file,
int  nconss,
const char **  consnames,
SCIP_Real rhss,
unsigned int  maxnamelen,
SCIP_Real  objoffset 
)
static

outputs the right hand side section

Parameters
scipSCIP data structure
fileoutput file, or NULL if standard output should be used
nconssnumber of constraints
consnamesconstraint names
rhssright hand side array
maxnamelenmaximum name length
objoffsetobjective offset

Definition at line 4461 of file reader_mps.c.

References NULL, printEntry(), SCIPdebugMsg, SCIPinfoMessage(), SCIPisInfinity(), and SCIPisZero().

Referenced by SCIPwriteMps().

◆ printRangeSection()

static void printRangeSection ( SCIP scip,
FILE *  file,
SCIP_CONS **  conss,
int  nconss,
const char **  consnames,
SCIP_Bool  transformed,
unsigned int  maxnamelen 
)
static

outputs the range section

Parameters
scipSCIP data structure
fileoutput file, or NULL if standard output should be used
conssconstraint array
nconssnumber of constraints
consnamesconstraint names
transformedTRUE iff problem is the transformed problem
maxnamelenmaximum name length

Definition at line 4503 of file reader_mps.c.

References NULL, printEntry(), SCIP_Real, SCIPconsGetHdlr(), SCIPconshdlrGetName(), SCIPconsIsEnabled(), SCIPdebugMsg, SCIPgetLhsLinear(), SCIPgetLhsVarbound(), SCIPgetRhsLinear(), SCIPgetRhsVarbound(), SCIPinfoMessage(), SCIPisEQ(), SCIPisGT(), and SCIPisInfinity().

Referenced by SCIPwriteMps().

◆ printBoundSectionName()

static void printBoundSectionName ( SCIP scip,
FILE *  file 
)
static

print bound section name

Parameters
scipSCIP data structure
fileoutput file, or NULL if standard output should be used

Definition at line 4568 of file reader_mps.c.

References SCIPdebugMsg, and SCIPinfoMessage().

Referenced by printBoundSection().

◆ printBoundSection()

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 
)
static

output bound section

Parameters
scipSCIP data structure
fileoutput file, or NULL if standard output should be used
varsactive variables
nvarsnumber of active variables
aggvarsneeded aggregated variables
naggvarsnumber of aggregated variables
fixvarsall fixed variables (or NULL if nfixvars is 0)
nfixvarsnumber of fixed variables
transformedTRUE iff problem is the transformed problem
varnamesarray with variable names
indicatorSlackHashhashtable containing slack variables from indicators (or NULL)
maxnamelenmaximum name length

Definition at line 4579 of file reader_mps.c.

References FALSE, MPS_MAX_VALUELEN, NULL, printBoundSectionName(), printRecord(), printStart(), SCIP_Bool, SCIP_Real, SCIP_VARSTATUS_FIXED, SCIP_VARTYPE_BINARY, SCIPhashtableExists(), SCIPinfoMessage(), SCIPisEQ(), SCIPisFeasEQ(), SCIPisFeasZero(), SCIPisInfinity(), SCIPisZero(), SCIPsnprintf(), SCIPvarGetLbLocal(), SCIPvarGetLbOriginal(), SCIPvarGetName(), SCIPvarGetStatus(), SCIPvarGetType(), SCIPvarGetUbLocal(), SCIPvarGetUbOriginal(), and TRUE.

Referenced by SCIPwriteMps().

◆ SCIP_DECL_READERCOPY()

static SCIP_DECL_READERCOPY ( readerCopyMps  )
static

copy method for reader plugins (called when SCIP copies plugins) ! [SnippetReaderCopyMps]

Definition at line 4841 of file reader_mps.c.

References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPincludeReaderMps(), and SCIPreaderGetName().

◆ SCIP_DECL_READERFREE()

static SCIP_DECL_READERFREE ( readerFreeMps  )
static

! [SnippetReaderCopyMps] destructor of reader to free user data (called when SCIP is exiting) ! [SnippetReaderFreeMps]

Definition at line 4857 of file reader_mps.c.

References NULL, READER_NAME, SCIP_OKAY, SCIPfreeBlockMemory, SCIPreaderGetData(), and SCIPreaderGetName().

◆ SCIP_DECL_READERREAD()

static SCIP_DECL_READERREAD ( readerReadMps  )
static

! [SnippetReaderFreeMps] problem reading method of reader

Definition at line 4872 of file reader_mps.c.

References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPreaderGetName(), and SCIPreadMps().

◆ SCIP_DECL_READERWRITE()

static SCIP_DECL_READERWRITE ( readerWriteMps  )
static

problem writing method of reader

Definition at line 4885 of file reader_mps.c.

References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIP_WRITEERROR, SCIPerrorMessage, SCIPisExact(), SCIPreaderGetName(), and SCIPwriteMps().