# MIP features in LP file format

CPLEX conforms to these rules about MIP features in the LP file format.

LP file format supports special features of mixed integer programming (MIP), such as binary variables, integer variables, semi-continuous variables, special ordered sets (SOS), and branching priorities. See also Piecewise linear (PWL) constraints in LP file format for more information about piecewise linear (PWL) constraints in LP file format.

## MIP integer variables

This rule applies to the CPLEX MIP optimizer.

To specify any of the variables as general integer variables,
add a `GENERAL`

section; to specify any of the variables
as binary integer variables, add a `BINARY`

section. The `GENERAL`

and `BINARY`

sections follow the `BOUNDS`

section, if
one is present; otherwise, they follow the constraints section. Either
of the `GENERAL`

or `BINARY`

sections can precede the other. The `GENERAL`

section is preceded by the word `GENERAL`

,
`GENERALS`

, or `GEN`

in
any mix of upper- and lowercase characters which must appear alone
on a line. The following line or lines should list the names of all
variables which are to be restricted to general integer values, separated
by at least one space. The `BINARY`

section
is preceded by the word `BINARY`

, `BINARIES`

,
or `BIN`

in
any mix of upper- and lowercase characters which must appear alone
on a line. The following line or lines should list the names of all
variables which are to be restricted to binary integer values, separated
by at least one space. Binary variables are automatically given bounds
of 0 (zero) and 1 (one), unless alternative bounds are specified in
the `BOUNDS`

section, in which case a warning
message is issued.

Here is an example of a problem
formulation in LP format where `x4`

is a
general integer:

```
Maximize
obj: x1 + 2 x2 + 3 x3 + x4
Subject To
c1: - x1 + x2 + x3 + 10 x4 <= 20
c2: x1 - 3 x2 + x3 <= 30
c3: x2 - 3.5 x4 = 0
Bounds
0 <= x1 <= 40
2 <= x4 <= 3
General
x4
End
```

If branching priorities or branching directions exist, enter this information through ORD files, as documented in ORD file format: priorities and branching orders.

## MIP semi-continuous variables

This rule applies to the CPLEX MIP optimizer.

To specify any of the variables as
semi-continuous variables, that is as variables that may take the value `0`

or values
between the specified lower and upper bounds, use a `SEMI-CONTINUOUS`

section. This
section must follow the `BOUNDS`

, `GENERALS`

, and
`BINARIES`

sections. The `SEMI-CONTINUOUS`

section is preceded by the
keyword `SEMI-CONTINUOUS`

, `SEMI`

, or `SEMIS`

. The
following line or lines should list the names of all the variables which are to be declared
semi-continuous, separated by at least one space.

To specify a semi-integer variable, the name
of the variable must be listed both in the `GENERAL`

and the
`SEMI-CONTINUOUS`

sections.

```
Semi-continuous
x1 x2 x3
```

## MIP special ordered sets

This rule applies to the CPLEX MIP optimizer. To specify
special ordered sets, use an SOS section, which is preceded by the
SOS keyword. The SOS section should follow the Bounds, General, Binaries
and Semi-Continuous sections. Special ordered sets of type 1 require
that, of the variables in the set, one at most may be nonzero. Special
ordered sets of type 2 require that at most two variables in the set
may be nonzero, and if there are two nonzeros, they must be adjacent.
Adjacency is defined by the weights, which must be unique within a
set given to the variables. The sorted weights define the order of
the special ordered set. For MIP branch and cut, the order is used
to decide how the variables are branched upon. See the *CPLEX
User’s Manual* for more information. The set is specified by an
optional set name followed by a colon and then either of the S1 or
S2 keywords (specifying the type) followed by a double colon. The
set member names are listed on this line or lines, with their weights.
Variable names and weights are separated by a colon, for example:

`SOS`

` set1: S1:: x1:10 x2:13`

## MIP indicator constraints

This rule applies to CPLEX MIP optimizer.

To specify an indicator constraint, enter it among any other constraints in the model, like this:

```
[constraintname:] binaryvariable = value -> linear constraint
```

The constraint name, followed by a colon,
is optional. The hyphen followed by the greater-than symbol (`->`

),
separates the indicator variable and its
value from the linear constraint that is controlled. The indicator
variable must be declared as a binary variable, and the value it is
compared to must be either 0 (zero) or 1 (one).

These **limitations** apply to indicator constraints in LP file format:

- The constraint must be linear; a quadratic constraint is not allowed to have an indicator constraint.
- A lazy constraint cannot have an indicator constraint.
- A user-defined cut cannot have an indicator constraint.