MPSReader Class |
Namespace: Imsl.Math
The MPSReader type exposes the following members.
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetLowerBound |
Returns the lower bound for a variable.
| |
GetLowerRange |
Returns the lower range value for a constraint equation.
| |
GetNameColumn |
Returns the name of a constraint column. Constraint column names are
also variable names.
| |
GetNameRow |
Returns the name of a constraint row.
| |
GetRow |
Returns a row of the constraint matrix or a free row.
| |
GetRowCoefficients |
Returns the coefficients of a row.
| |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GetTypeVariable |
Returns the type of a variable. The variable types are
CONTINUOUS_VARIABLE, BINARY_VARIABLE or
INTEGER_VARIABLE.
| |
GetUpperBound |
Returns the upper bound for a variable.
| |
GetUpperRange |
Returns the upper range value for a constraint equation.
| |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ProcessCommand |
Process a section of the MPS file.
| |
Read |
Reads and parses the MPS file.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
BINARY_VARIABLE | Variable must be either 0 or 1. | |
CONTINUOUS_VARIABLE |
Variable is a real number.
| |
INTEGER_VARIABLE | Variable must be an integer. |
Name | Description | |
---|---|---|
Name |
Returns the name of the MPS problem.
| |
NameBounds |
The name of the BOUNDS set.
| |
NameObjective |
The name of the free row containing the objective.
| |
NameRanges |
The name of the RANGES set.
| |
NameRHS |
The name of the RHS set used.
| |
NumberOfBinaryConstraints |
The number of binary constraints.
| |
NumberOfColumns |
The number of columns in the constraint matrix.
| |
NumberOfIntegerConstraints |
The number of integer constraints.
| |
NumberOfNonZeros |
The number of nonzeros in the constraint matrix.
| |
NumberOfRows |
The number of rows in the constraint matrix.
| |
Objective |
The objective as a Row.
| |
ObjectiveCoefficients |
The coefficents of the objective row.
|
An MPS file defines a linear or quadratic programming problem. Linear programming problems read using this class are assumed to be of the form:
subject to where c is the objective coefficient vector, A is the coefficient matrix, and the vectors , , , and are the lower and upper bounds on the constraints and the variables, respectively.The following table helps map this notation into use of MPSReader.
C | Objective |
---|---|
A | Constraint matrix |
Lower Range | |
Upper Range | |
Lower Bound | |
Upper Bound |
If the MPS file specifies an equality constraint or bound, the corresponding lower and upper values will be exactly equal.
The problem formulation assumes that the constraints and bounds are two-sided. If a particular constraint or bound has no lower limit, then the corresponding entry in the structure is set to negative machine infinity. If the upper limit is missing, then the corresponding entry in the structure is set to positive machine infinity.
MPS File Format
There is some variability in the MPS format. This section describes the MPS format accepted by this reader.
An MPS file consists of a number of sections. Each section begins with a name in column 1. With the exception of the NAME section, the rest of this line is ignored. Lines with a '*' or '$' in column 1 are considered comment lines and are ignored.
The body of each section consists of lines divided into fields, as follows:
Field Number | Columns | Content |
---|---|---|
1 | 2-3 | Indicator |
2 | 5-12 | Name |
3 | 15-22 | Name |
4 | 25-36 | Value |
5 | 40-47 | Name |
6 | 50-61 | Value |
The format limits MPS names to 8 characters and values to 12 characters. The names in fields 2, 3 and 5 are case sensitive. Leading and trailing blanks are ignored, but internal spaces are significant.
The sections in an MPS file are as follows:
NAME
ROWS
COLUMNS
RHS
RANGES (optional)
BOUNDS (optional)
QUADRATIC (optional)
ENDATA
Sections must occur in the above order.
MPS keywords, section names and indicator values, are case insensitive. Row, column and set names are case sensitive.
NAME Section
The NAME section contains the single line. A problem name can occur anywhere on the line after NAME and before columns 62. The problem name is truncated to 8 characters.
ROWS Section
The ROWS section defines the name and type for each row. Field 1 contains the row type and field 2 contains the row name. Row type values are not case sensitive. Row names are case sensitive. The following row types are allowed:
Row Type | Meaning |
---|---|
E | Equality constraint |
L | Less than or equal constraint |
G | Greater than or equal constraint |
N | Objective of a free row |
COLUMNS Section
The COLUMNS section defines the nonzero entries in the objective and the constraint matrix. The row names here must have been defined in the ROWS section.
Field | Contents |
---|---|
2 | Column name |
3 | Row name |
4 | Value for the entry whose row and column are given by fields 2 and 3 |
5 | Row name |
6 | Value for the entry whose row and column are given by fields 2 and 5 |
Note: Fields 5 and 6 are optional.
The COLUMNS section can also contain markers. These are indicated by the name 'MARKER' (with the quotes) in field 3 and the marker type in field 4 or 5.
Marker type 'INTORG' (with the quotes) begins an integer group. The marker type 'INTEND' (with the quotes) ends this group. The variables corresponding to the columns defined within this group are required to be integer.
RHS Section
The RHS section defines the right-hand side of the constraints. An MPS file can contain more than one RHS set, distinguished by the RHS set name. The row names here must be defined in the ROWS section.
Field | Contents |
---|---|
2 | RHS name |
3 | Row name |
4 | Value for the entry whose row and column are given by fields 2 and 3 |
5 | Row name |
6 | Value for the entry whose row and column are given by fields 2 and 5 |
Note: Fields 5 and 6 are optional.
RANGES Section
The optional RANGES section defines two-sided constraints. An MPS file can contain more than one range set, distinguished by the range set name. The row names here must have been defined in the ROWS section.
Field | Contents |
---|---|
2 | Range set name |
3 | Row name |
4 | Value for the entry whose row and column are given by fields 2 and 3 |
5 | Row name |
6 | Value for the entry whose row and column are given by fields 2 and 5 |
Note: Fields 5 and 6 are optional.
Ranges change one-sided constraints, defined in the RHS section, into two-sided constraints. The two-sided constraint for row i depends on the range value, , defined in this section. The right-hand side value, , is defined in the RHS section. The two sided constraints for row i are given in the following table:
Row Type | Lower Constraint | Upper Constraint |
---|---|---|
G | ||
L | ||
E |
BOUNDS Section
The optional BOUNDS section defines bounds on the variables. By default, the bounds are . The bounds can also be used to indicate that a variable must be an integer.
More than one bound can be set for a single variable. For example, to set use a LO bound with value 2 to set and an UP bound with value 6 to add the condition .
An MPS file can contain more than one bounds set, distinguished by the bound set name.
Field | Contents |
---|---|
1 | Bounds type |
2 | Bounds set name |
3 | Column name |
4 | Value for the entry whose set and column are given by fields 2 and 3 |
5 | Column name |
6 | Value for the entry whose set and column are given by fields 2 and 5 |
Note: Fields 5 and 6 are optional.
The bound types are as follows. Here are the bound values defined in this section, the are the variables, and I is the set of integers.
Bound Type | Definintion | Formula |
---|---|---|
LO | Lower bound | |
UP | Upper bound | |
FX | Fixed Variable | |
FR | Free variable | |
MI | Lower bound is minus infinity | |
PL | Upper bound is positive infinity | |
BV | Binary variable (variable must be 0 or 1) | |
UI | Upper bound and integer | and |
LI | Lower bound and integer | and |
SC | Semicontinuous | 0 or |
The bound type names are not case sensitive.
If the bound type is UP or UI and then the lower bound is set to .
ENDATA Section
The ENDATA section ends the MPS file.