|
Therefore:
|
|
max: c1x1 + c2x2 + ... + + cnxn s.t.: a11x1 + a12x2 + ... + + a1nxn ≤ b1 a21x1 + a22x2 + ... + + a2nxn ≤ b2 ... am1x1 + am2x2 + ... + + amnxn ≤ bm |
|
|
xij = amount of flow from i → j |
|
|
|
x01 ≤ 3 x02 ≤ 2 x03 ≤ 2 x14 ≤ 5 x15 ≤ 1 x24 ≤ 1 x25 ≤ 3 x26 ≤ 1 x35 ≤ 1 x47 ≤ 4 x57 ≤ 2 x67 ≤ 4 |
|
node 1: x01 = x14 + x15 node 2: x02 = x24 + x25 + x26 node 3: x03 = x35 node 4: x14 + x24 = x47 node 5: x15 + x25 + x35 = x57 node 6: x26 = x67 |
|
Example:
Objective function:
max: x01 + x02 + x03 |
How to run the program:
|
Output:
Value of objective function: 6.00000000 Actual values of the variables: x01 3 x02 2 x03 1 x14 3 x15 0 x24 1 x25 1 x26 0 x35 1 x47 4 x57 2 x67 0 |
Corresponding max flow:
|
max: x70 s.t.: x01 - x14 - x15 = 0 x02 - x24 - x25 - x26 = 0 x03 - x35 = 0 x14 + x24 - x47 = 0 x15 + x25 + x35 - x57 = 0 x26 - x67 = 0 x70 - x01 - x02 - x03 = 0 x47 + x57 + x67 - x70 = 0 x01 ≤ 3 x02 ≤ 2 x03 ≤ 2 x14 ≤ 5 x15 ≤ 1 x24 ≤ 1 x25 ≤ 3 x26 ≤ 1 x35 ≤ 1 x47 ≤ 4 x57 ≤ 2 x67 ≤ 4 |
How to run the program:
|
>> lp_solve lp1 Value of objective function: 6.00000000 Actual values of the variables: x70 6 x01 3 x14 3 x15 0 x02 2 x24 1 x25 1 x26 0 x03 1 x35 1 x47 4 x57 2 x67 0 |