Algebraic input mode allows the user to work not with the simplex table, but directly with a mathematical formulation of the problem.
To create the model in the algebraic form two steps are required:
1) Create a model of the problem (menu File>> New>> Text Model);
2) Enter the model in algebraic form.
The model should be written according to format LPX, which is a set of algebraic expressions and statements in the following order:
<objective_function>
<constraints>
<declarations>
• | <objective_function> is a linear combination of variables, ending with a semicolon (;), optionally preceded by "max: " or "min: " to indicate whether you want it to be minimized or maximized. Maximization is the default. Example: max: x1 + x2; |
• | <constraints> consists of four parts: 1) the constraint name (optional), followed by a colon; 2) linear combination of variables; 3) type of constraint (> =, =, <=) 4) the values of the right side. The constraint should end with a semicolon (;). Example: row1: 4*x1 - x2 <= 8; |
• | <declarations> - variables can be declared as integer using the “int” specifier, followed by comma separated variable names. Example: int x1, x2; |
A variable must start with a letter (either upper or lower case), and may contain any number of additional letters, numerals, or characters.
Example of the model in LPX format:
max: x1 + x2;
row1: 4*x1 - x2 < 8;
row2: 2*x1 + x2 < 10;
row3: -5*x1 + 2*x2 < 2;
|