Tut 8 Q 7

You might also like

You are on page 1of 1

Tut 8

Q7: code
(Two solutions available)
f1=[30 35 45 35 40 35 30 45 30];
f2=[30 35 30 35 40 45 45 35 30];
Aeq=[1 1 1 0 0 0 0 0 0
0 0 0 1 1 1 0 0 0
0 0 0 0 0 0 1 1 1
1 0 0 1 0 0 1 0 0
0 1 0 0 1 0 0 1 0
0 0 1 0 0 1 0 0 1];
Beq=[1 1 1 1 1 1];
lb(1:9)=0;
ub(1:9)=inf;
i=[1:9];
[X1,Y1]=intlinprog(f1,i,[],[],Aeq,Beq,lb,ub)
[X2,Y2]=intlinprog(f2,i,[],[],Aeq,Beq,lb,ub)

X1= [1;0;0;0;1;0;0;0;1]
Y1= 100

X2= [0;1;0;1;0;0;0;0;1]
Y2= 100

You might also like