-- We want to maximize the Function y = - 1/2x,
-- with the two conditions y ≤ 6 - 3/4x and y ≥ 1 - x and the bounds 0 ≤ x ≤ 6 and 1/3 ≤ y ≤ 4.
-- We prename the input of GLPK.MIPSolve-function.
Use S::=QQ[x,y];
OF := 1/2x + y;
LE := [3/4x + y - 6];
GE := [x + y - 1];
Bounds:=[[0,6], [1/3,4]];
IntNum:=[x,y];
-- Then we compute the solution with
GLPK.MIPSolve(OF, [], LE, GE, Bounds, IntNum, [], "Max");
-- And we achieve:
Solution Status: INTEGER OPTIMAL
Value of objective function: 5
[x - 2, y - 4]
|