TCS / Studies / T-79.4201 / Home Assignments / Thispage
Helsinki University of Technology, 
     Laboratory for Theoretical Computer Science

Linear Program Format

Structure

The linear program file consists of optional objective function, constraints, and variable declarations.

Variables

Variables are case sensitive and can have letters [A-Z],[a-z], numbers and underscore '_'. A variable must start with an underscore or a letter.

Constant Numbers

Constant can be integers or real numbers. Real numbers must be of form 123.45 .

Expressions

Allowed operators are +, -, *, /. Also parentheses ( ) can be used Expressions must be a linear combination of variables. For example (2*x + 3*y)/3 + (2*4 + 5)*z is legal, but x*(y+2) is not.

Objective function

Objective function is of the form "maximize <expression>;" or "minimize <expression>;"

Constraints

A constraint is of the form "<expression> <operator> <expression>;", where operator can be one of <=, >=, =.

Declarations

A declaration of the form "int <var1>,<var>;" states that variable should be an unsigned integer. A declaration of the form "signed int <var1>,<var>;" states that variable should be an integer.

Example file

minimize x + 2*y + 3*(z + 2*w);
x + 2 >= y;
y <= z*3+w;
w = x+z;
int x,y;
signed int w;

[TCS main] [Contact Info] [Personnel] [Research] [Publications] [Software] [Studies] [News Archive] [Links]
Latest update: 25 March 2006.