Solutions To Assignment 03
Solutions To Assignment 03
QUESTION 2
The octave code to solve the problem is
>C=[6000;5000;4000;5000;5500;6000;9000;8500;8000]
C = 6000
5000
4000
5000
5500
6000
9000
8500
8000
>A = [6000 0 0 5000 0 0 9000 0 0;
0 5000 0 0 5500 0 0 8500 0;
0 0 4000 0 0 6000 0 0 8000]
A = 6000 0 0 5000 0 0 9000 0 0
0 5000 0 0 5500 0 0 8500 0
0 0 4000 0 0 6000 0 0 8000
>b = [22;21;25]
b = 22
21
25
>lb = []
lb = [](0x0)
>ub = [17;17;17;31;31;31;26;26;26]
ub = 17
17
Open Rubric
APM1513/203/1/2012
17
31
31
31
26
26
26
>ctype = "UUU"
ctype = UUU
>vartype = "CCCCCCCCC"
vartype = CCCCCCCCC
>s = 1
s = 1
>[xmax,Lmax]=glpk(C,A,b,lb,ub,ctype,vartype,s)
xmax = 0.0019662
0.0054809
0.0078679
0.0078679
0.0016577
0.0046980
0.0022568
0.0046981
0.0010950
0.0070162
Lmax = 0.31471
Note, we have put s = 1 because we want to minimize the cost. From the so-
lutions above, we see that number of trucks needed are x1 = 2,x(5),x(3)=8,x(4)=8,x(5)=2,x(6)=5
x9 = 7 with the cost of R 315
QUESTION 3
The octave code to solve the problem is
>C = [-3;-4;2]
C = -3
-4
1
3
APM1513/203/1/2012
QUESTION 4
The octave code to solve the problem is
>C = [2;3;4;3]
C = 2
3
4
3
>A = [1.5 2 1.5 1;1 2 1 3;5 4 7 2;6 3 7 4;8 4 8 2]
A = 1.5 2 1.5 1
1 2 1 3
5 4 7 2
4
APM1513/203/1/2012
6 3 7 4
8 4 8 2
>b = [30;45;65;60;70]
b = 30
45
65
60
70
>lb = []
lb = [](0x0)
>ub = []
ub = [](0x0)
>ctype = "UUUUU"
ctype = UUUUU
>vartype = "CCCC"
vartype = CCCC
>s = -1
s = -1
>[xmax,Lmax]=glpk(C,A,b,lb,ub,ctype,vartype,s)
xmax = 7.3519e+223
8.3989e+217
4.2006e+149
5.9310e-310
Lmax = 1.9406e-316