University of Florida Homepage

LP_Solve format

===============================================================
Description of the LP-format as accepted by LP_SOLVE and LP2MPS
===============================================================

The default input syntax is a set of algebraic expressions
and “int” declarations in the following order:


+
*

where:

is a linear combination of vari-
ables, ending with a semicolon, optionally preceded by
“max: ” or “min: ” to indicate whether you want it to be
minimized or maximized. The case is not important,
“Max:” or “MAX:” will work as well. Maximization is the
default.

is an optional constraint name followed by
a colon plus a linear combination of variables and con-
stants, followed by a relational operator, followed
again by a linear combination of variables and con-
stants, ending with a semicolon. The relational operator
can be any of the following: “<" "<=" "=" ">” “>=”.
There is no semantic difference between “<" and "<=" nor between ">” and “>=” (even for integer variables!).

is of the form: “int” + “;” Commas
are allowed between variables.

So, the simplest linear problem consists of an objective
function and 1 constraint.

The simple problem:

x1 >= 1
x2 >= 1
x1 + x2 >= 2
minimize x1 + x2 (= maximize -(x1 + x2)), with x1 integer

can be written as follows:

-x1 + -x2;
(or min: x1 + x2;)
x1 > 1;
x2 > 1;
x1 + x2 > 2;
int x1;

The correct result for (x1, x2) is of course (1, 1).