Materi Perkuliahan

Maple Program Linear

Dipublikasikan pada : 2 Agustus 2019.

restart; with(Optimization); with(plots);
Berikut merupakan perintah dalam Maple untuk memaksimalkan fungsi tujuan/objektif, fungsi objektifnya adalah z=350x+300y, dan pembatasannya adalah x+y<=200, 9x+6y<=1566, 12x+16y<=2880
Error, missing operator or `;`
LPSolve(350*x+300*y, {x >= 0, y >= 0, x+y <= 200, 9*x+6*y <= 1566, 12*x+16*y <= 2880}, assume = integer, maximize);
print(`output redirected…`); # input placeholder
[66100, [x = 122, y = 78]]
atau
Maximize(350*x+300*y, {x >= 0, y >= 0, x+y <= 200, 9*x+6*y <= 1566, 12*x+16*y <= 2880}, assume = integer);
print(`output redirected…`); # input placeholder
[66100, [x = 122, y = 78]]
atau
obj := 350*x+300*y;
print(`output redirected…`); # input placeholder
350 x + 300 y
constraints := {x >= 0, y >= 0, x+y <= 200, 9*x+6*y <= 1566, 12*x+16*y <= 2880};
print(`output redirected…`); # input placeholder
{0 <= x, 0 <= y, x + y <= 200, 9 x + 6 y <= 1566,

12 x + 16 y <= 2880}
Optimization[LPSolve](obj, constraints, assume = integer, maximize);
print(`output redirected…`); # input placeholder
[66100, [x = 122, y = 78]]
atau
Metode Grafik
A. Menentukan Daerah Feasible
Berikut merupakan perintah dalam Maple untuk menentukan daerah feasible dari suatu fungsi pembatas
%;
Error, missing operator or `;`
Perintah untuk merestart, membuka fungsi optimasi dan menggambarkan daerah feasible
restart; with(Optimization); with(plots);
Perintah untuk membuat batas pertama

constraint1 := {x+y <= 200};
print(??); # input placeholder
Perintah untuk membuat batas pertama dan kedua

constraint2 := {x+y <= 200, 9*x+6*y <= 1566};
print(??); # input placeholder
Perintah untuk membuat batas pertama, kedua dan ketiga

constraint3 := {x+y <= 200, 9*x+6*y <= 1566, 12*x+16*y <= 2880};
print(??); # input placeholder

%;

Perintah untuk menggambarkan batas pertama kemudian menampilkannya ke layar

p1 := plots[inequal](constraint1, x = 0 .. 250, y = 0 .. 300, thickness = 2, optionsexcluded = (color = “White”), optionsfeasible = (color = “Pink”));

%;
display(p1);
%;

Perintah untuk menggambarkan batas pertama dan kedua kemudian menampilkannya ke layar

p2 := plots[inequal](constraint2, x = 0 .. 250, y = 0 .. 300, thickness = 2, optionsexcluded = (color = “White”), optionsfeasible = (color = “Purple”));
%;
display(p2);
%;

Perintah untuk menggambarkan batas pertama, kedua dan ketiga kemudian menampilkannya ke layar
p3 := plots[inequal](constraint3, x = 0 .. 250, y = 0 .. 300, thickness = 2, optionsexcluded = (color = “White”), optionsfeasible = (color = “Lavender”)); labels := textplot({[50, 50, “Daerah Feasible”]}, color = “Black”);
display(p3, labels);
%;

B. Tahapan Menentukan Solusi Optimum
a. Metode Isoline
print(??); # input placeholder
obj := 350*x+300*y;

z1 := solve(obj = 35000, y);
print(??); # input placeholder
Z1 := plot(z1, x = 0 .. 100, color = blue);
%;
display(p3, Z1);
%;

z2 := solve(obj = 52500, y);
print(??); # input placeholder
Z2 := plot(z2, x = 0 .. 150, color = green);
%;
display(p3, Z1, Z2);
%;

z3 := solve(obj = 66100, y);
print(??); # input placeholder
Z3 := plot(z3, x = 0 .. 189, color = red); p4 := pointplot({[122, 78]}, symbolsize = 20, colour = purple, symbol = solidcircle); labels := textplot({[175, 100, “Solusi Optimum di (122,78)”]}, color = “Black”);
%;
display(p3, p4, labels, Z1, Z2, Z3);
%;

b. Metode Titik Ekstrim
restart; with(geometry); with(Optimization); with(plots);
line(l1, x = 0, [x, y]), line(l2, 12*x+16*y = 2880, [x, y]);
intersection(P, l1, l2);
print(??); # input placeholder
coordinates(P);
print(`output redirected…`); # input placeholder
[0, 180]
line(l2, 12*x+16*y = 2880, [x, y]), line(l3, x+y = 200, [x, y]);
print(??); # input placeholder
intersection(Q, l3, l2);
coordinates(Q);
print(`output redirected…`); # input placeholder
[80, 120]
line(l4, 9*x+6*y = 1566, [x, y]), line(l3, x+y = 200, [x, y]);
intersection(R, l4, l3);
%;
coordinates(R);
print(`output redirected…`); # input placeholder
[122, 78]
line(l4, 9*x+6*y = 1566, [x, y]), line(l5, y = 0, [x, y]);
print(??); # input placeholder
intersection(S, l4, l5);
coordinates(S);
print(`output redirected…`); # input placeholder
[174, 0]
line(l1, x = 0, [x, y]), line(l5, y = 0, [x, y]);
intersection(o, l1, l5);
coordinates(o);
print(`output redirected…`); # input placeholder
[0, 0]
obj := 350*x+300*y;
print(`output redirected…`); # input placeholder
350 x + 300 y
constraints := [x+y <= 200, 9*x+6*y <= 1566, 12*x+16*y <= 2880, x >= 0, y >= 0];
print(`output redirected…`); # input placeholder
[x + y <= 200, 9 x + 6 y <= 1566, 12 x + 16 y <= 2880, 0 <= x,

0 <= y]
p1 := inequal(constraints, x = 0 .. 250, y = 0 .. 300, optionsexcluded = (colour = white), optionsfeasible = (colour = pink));

print(`output redirected…`); # input placeholder
p3 := pointplot({[0, 0], [0, 180], [80, 120], [122, 78], [174, 0]}, symbolsize = 17, colour = red, symbol = solidcircle); labels := textplot({[10, 10, “O(0,0)”], [20, 160, “P(0,180)”], [70, 110, “Q(80,120)”], [100, 75, “R(122,78)”], [150, 10, “S(174,0)”]}, color = “Black”);
%;
display(p1, p3, labels);
%;

Z1 := subs(x = 0, y = 180, obj);
print(`output redirected…`); # input placeholder
54000
Z2 := subs(x = 80, y = 120, obj);
print(`output redirected…`); # input placeholder
64000
Z3 := subs(x = 122, y = 78, obj);
print(`output redirected…`); # input placeholder
66100
Z4 := subs(x = 174, y = 0, obj);
print(`output redirected…`); # input placeholder
60900
Z5 := subs(x = 0, y = 0, obj);
print(`output redirected…`); # input placeholder
0
labels2 := textplot({[10, 10, “Z=0”], [20, 140, “Z=54000”], [70, 110, “Z=64000”], [100, 75, “Z=66100”], [150, 10, “Z=60900”]}, color = “Black”);
print(??); # input placeholder
display(p1, p3, labels2);
%;

id_IDIndonesian