load(simplex)$
load("draw")$

## zadatak

k:18$
l:14$
A:850$
B:540$
m:25$
n:23$
K:50$
maximize_lp(k*x+l*y,[x<=A, y<=B, 1/m*x+1/n*y<=K]), nonegative_lp=true;

wxdraw2d(grid=true, x_voxel=60, y_voxel=60, fill_color=green,
                 xtics={0,100,300,500,700,850}, ytics={0,200,368,540,600},
                 region(x<=A and y<=B and 1/m*x+1/n*y<=K, x,0,A+100, y,0,B+100));

solve(1/m*x+1/n*540=K,x);

solve(1/m*x+1/n*540=K,x), numer;

18*15250/23+14*540,numer;

## zadatak

k:10$
l:12$
A:42$
B:28$
PA:2$
PB:3$
QA:3$
QB:1$
minimize_lp(k*p+l*q,[PA*p+QA*q>=A, PB*p+QB*q>=B]), nonegative_lp=true;

wxdraw2d(grid=true, x_voxel=60, y_voxel=60, fill_color=green,
                 xtics=[0,3,30], ytics={0,5,10,15,20,28,35,40},
                 region(PA*p+QA*q>=A and PB*p+QB*q>=B, p,0,30, q,0,40));