0% found this document useful (0 votes)
21 views4 pages

Solutions To Assignment 03

The document contains 4 questions involving using the glpk function in Octave to solve linear programming problems. Question 2 involves minimizing costs to deliver goods using trucks of different capacities. The optimal solution uses 2, 8, 8, 2, 5, 7 trucks with a minimum cost of R315. Question 3 involves minimizing a linear function subject to constraints. The minimum occurs at x1=5, x2=1, x3=0.003 with an objective value of -55. Question 4 involves maximizing a linear function subject to constraints.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views4 pages

Solutions To Assignment 03

The document contains 4 questions involving using the glpk function in Octave to solve linear programming problems. Question 2 involves minimizing costs to deliver goods using trucks of different capacities. The optimal solution uses 2, 8, 8, 2, 5, 7 trucks with a minimum cost of R315. Question 3 involves minimizing a linear function subject to constraints. The minimum occurs at x1=5, x2=1, x3=0.003 with an objective value of -55. Question 4 involves maximizing a linear function subject to constraints.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Assignment 3

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

>A = [-1 1 2;2 1 1]


A = -1 1 2
2 1 1
>b = [5;20]
b = 5
20
>lb = []
lb = [](0x0)
>ub = []
ub = [](0x0)
>ctype = "UU"
ctype = UU
>vartype = "CCC"
vartype = CCC
>s = 1
s = 1
>[xmax,Lmax]=glpk(C,A,b,lb,ub,ctype,vartype,s)
xmax = 5.0000e+000
1.0000e+000
3.1259e-297
Lmax = -55

Note, we have put s = 1 because we want to minimize the value of L. The


points at which the minimum occurs are x1 = 5, x2 = 1, and x3 = 0.003.

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

Note, we have put s = −1 because we want to maximize the value of L.

You might also like