> > ILOG CPLEX File Formats > SOS File Format

The file format convention for ILOG CPLEX SOS files uses set declaration lines and member declaration lines, both of which begin in column 2 or beyond.

In a set declaration line, columns 2 and 3 specify S1 or S2, and column 5 or beyond sets priority.

In a member declaration line, column 5 or beyond specifies a variable name, followed by one or more spaces, followed by the reference row value.

In the following example, the SOS file specifies that variables x1, x2, x4, and x5 are members of a special ordered set of Type 1, and that the weights for these SOS variables are to be 10000, 20000, 40000, and 50000, respectively. The branching priority for the set as a whole is 10; that priority are compared with the priority assigned to other integer variables in the model.

NAME
 S1                   10
    x1                  10000
    x2                  20000
    x4                  40000
    x5                  50000
ENDATA

SOS files created using ILOG CPLEX Versions 2.1 or earlier used a fixed MPS format in which the various data fields were limited to eight characters in length and restricted to specific columnar positions in each line. The extensions provided in the new ILOG CPLEX SOS file reader allow for more descriptive names and greater overall input flexibility. Most fixed-format SOS files created under earlier versions conform to the new format. Any files that do not conform can be converted to the new format using the convert utility that comes with the standard ILOG CPLEX distribution. Converting File Formats explains how to use that utility.