Format of a Binary Solution File

A Binary solution file is created in the Concert Technology Library with the member function IloCplex::exportModel(), in the Callable Library with the CPXwritesol() routine, or in the Interactive Optimizer via the write command. In all cases the file type "BIN" should be specified. If a file name with a .bin extension is specified, the file type may be omitted. The file is called binary because all the numbers in the file are in their internal, binary representations and the records are not text-type records. Consequently, a binary file cannot be read by a text editor; nor can it be printed.

Binary files are used as an efficient and accurate means to provide data to another program, for example, a report writer. Binary representation of real numbers is more precise than the corresponding ASCII representation. Binary representation retains more significant places. In addition, reading the file is faster since there is no ASCII-to-binary conversion needed.

The binary solution file consists of variable-length records divided into sections. The format for each record is an integer-length entry giving the length of the record in bytes, the data, and another integer-length entry giving the length. The length of the record excludes the two length entries. The format is:

  | (length) |   ------data------   |   (length) |

The first record in a binary solution file is:

  Data bytes  1 -  8:  'NAME    '
                          9 - 16:  (first 8 characters of problem name)

The last record in a binary solution file is:

  Data bytes  1 -  8:  'ENDATA  '
                          9 - 16:  '        '

Three sections are written between the first and last records. Each section starts with three description records:

  1. Header record

    Data Bytes 
    1 - 8 
    section name 

     
    9 - 12 
    number of data items 

     
    13 - 16 
    zero 

  2. Field names record

    Data Bytes 
    1 - 8 
    first field name 

     
    9 - 16 
    second field name 

     
    17 - 24 
    third field name 

     
    etc. 

     

  3. Field types/sizes record

    Data Bytes 
    1 - 4 
    first field type 

     
    5 - 8 
    first field size 

     
    9 - 12 
    second field type 

     
    13 - 16 
    second field size 

     
    17 - 20 
    third field type 

     
    21 - 24 
    third field size 

     
    etc. 

     

The field types are represented by integer codes:

1 
integer 
2 
character 
3 
floating point 

The field sizes are the number of bytes for the data item.

The final record of each section contains the string $ENDSEC$. This record is the same length as the other data records within that section, but only the first eight characters are used.

In summary, each of the three sections starts with three description records followed by any number of data records. The $ENDSEC$ string marks the end of a section. A summary of the information specified on the three description records for each of the three sections follows.

Solution Header Section 
Section Name: SOLUTION 
Number of Data Items: 21 
Field Name 
Type 
Size 
Data Value 
DATANAME 
Name from NAME image of MPS read 
PROBNAME 
Problem name 
OBJ 
Objective name 
RHS 
Right hand side name 
PARAMROW 

 
CHROW 

 
PARAMCOL 

 
CHCOL 

 
BOUNDS 
Bound name 
RANGES 
Range name 
FUNCTION 
Objective value 
PARAMVAL 
0.0 
PERTUBN 
0.0 
ITERNO 
Iteration count 
ROWS 
Row count (including free and objective) 
COLUMNS 
Columns count (excluding range columns) 
METHOD 
LP 
TARGET 
MIN or MAX 
STATUS 
OPIM or NOPT or NFES 
FLAGS 
NONE 
TITLE 
80 

 

Row Section 
Section Name: RSECTION 
Number of Data Items: 8 
Field Name 
Type 
Size 
Data Value 
ACTIVITY 
Row value 
SLACK 
Slack value 
LLIMIT 
Row lower limit 
ULIMIT 
Row upper limit 
DUALACT 
Dual value 
NUMBER 
Sequence number 
STATUS 
One of BS, LL, UL, EQ, FR, or ** 
NAME 
Row name 

Column Section 
Section Name: CSECTION 
Number of Data Items: 8 
Field Name 
Type 
Size 
Data Value 
ACTIVITY 
Value 
ICOST 
Objective coefficient 
LLIMIT 
Lower bound 
ULIMIT 
Upper bound 
RCOST 
Reduced cost 
NUMBER 
Sequence number 
STATUS 
One of BS, LL, UL, EQ, FR, or ** 
NAME 
Column name 


Previous Page: Format of an ASCII-Text Solution File  Return to Top Next Page: Index