Constraints in LP file format

CPLEX conforms to these rules for the LP file format.

The constraints section of a file in LP format is introduced by the keyword subject to. This expression can also appear as such that, st, S.T., or ST. in any mix of upper- and lowercase characters. One of these expressions must precede the first constraint and be separated from it by at least one space.

Each constraint definition must begin on a new line. A constraint may be named by typing a name and a colon before the constraint. The constraint name and the colon must appear on the same line. Constraint names must adhere to the same guidelines as variable names. (See the rule about Variable names in LP file format.) If no constraint names are specified, CPLEX assigns the names c1, c2, c3, and so forth.

The constraints are entered in the same way as the objective function; however, a constraint must be followed by an indication of its sense and a righthand side coefficient. The righthand side coefficient must be typed on the same line as the sense indicator. Acceptable sense indicators are <, <=, =<, >, >=, =>, and =. These are interpreted as ≤, ≤, ≤, ≥, ≥, ≥, and =, respectively.

For example, here is a named constraint:

time: x1 + x2 <= 10

Quadratic constraints are allowed in this section. Quadratic terms are specified inside square brackets[] as detailed in the rule about Quadratic terms in LP file format. The specification of a quadratic constraint differs from the specification of a quadratic objective in one important way: in a quadratic constraint, the terms are not divided by two; that is, they are not multiplied by 1/2, as they must be in a quadratic objective.

Indicator constraints are also allowed in this section. The rule about indicator constraints in the topic MIP features in LP file format explains how to specify indicator constraints.

Piecewise linear (PWL) constraints are not allowed in this section. For more information about PWL constraints in LP file format, see the topic Piecewise linear (PWL) constraints in LP file format.