You are on page 1of 6

Referential cost = 66000 rubles

60
worker 1
worker 2
worker 3

50

40

30
Hours per worker

20
X: 75.26
Y: 20

10
X: 73.42
Y: 10

-10

-20

68 70 72 74 76 78 80 82
Total hours
Referential cost = 75.5 Hour

80 worker 1
worker 2
worker 3

60

40
Hours per worker

20

-20

-40

6 6.1 6.2 6.3 6.4 6.5 6.6


Total cost 104
clc
clear
close
A=280;

a=[3.2 4 3.8];
c=[750 900 950];
t=[1 1 1];
%t=[];
tref1=20;
tref2=30;

tx=(A-tref1*a(1)-tref2*a(2))/a(3);
Cref=sum(c.*[tref1 tref2 tx]);
Tref=tref1+tref2+tx;
M=[a;c;t];
R=[A Cref Tref]';
T=M\R;

%% minimizacion de tiempo y costo


%prueba en 10%
c_r=0.1*Cref; %vector de tiempo
l=20;
ct=linspace(floor(Cref-c_r),Cref*1.05,l);

TI=zeros(3,l);
% Costo_ref=floor(Cref-c):500:ceil(Cref+c);%vector de costo

br=1;

for Tref=70:0.1:75.5
% Cref=Cref-1;%menos 10 rublos

for i=1:l
R=[A ct(i) Tref]';
TI(:,i)=M\R;
% if TI(1,i)>5 || TI(1,i)<20 || TI(2,i)>10 ||
TI(2,i)<30 || TI(3,i)>8
% break
% end

end
% if min(T(1,i))>20
% break
% end
%
%grafica 1
% figure(1)
% p1=plot(ct,TI(1,:),'r','linewidth',1.5);
% hold on
% p2=plot(ct,TI(2,:),'b','linewidth',1.5);
% p3=plot(ct,TI(3,:),'k','linewidth',1.5);
% % plot([50 90],[0 0],'--k')
%
%
% plot([min(ct) max(ct)],[5 5],'--r',[min(ct) max(ct)],
[20 20],'--r')
% plot([min(ct) max(ct)],[10 10],'--b',[min(ct)
max(ct)],[30 30],'--b')
% plot([min(ct) max(ct)],[8 8],'--k')
%
% legend([p1 p2 p3],{'worker 1','worker 2','worker 3'})
% hold on
%
% axis([min(ct) Cref min(min(TI)) max(max(TI))])
% grid on
% xlabel('Total cost');ylabel('Hours per worker')
% title(['Referential cost = ',num2str(Tref),' Hour'])
% drawnow
% hold off
end

t1=20;
t2=10:30;
t3=(A-a(1)*t1-a(2)*t2)/a(3);

for i=1:length(t2)
CC(i)=sum(c.*[t1 t2(i) t3(i)]);

end
figure(1)
plot(t2,t3,'b','linewidth',1.5)
xlabel('t2')
ylabel('t3')
grid on
title('t2 vs t3')
figure(2)
plot(t2,CC,'b','linewidth',1.5)
xlabel('t2')
ylabel('Cost')
title('t2 vs Cost')
grid on
%%
t1=5:20;
t2=30;
t3=(A-a(1)*t1-a(2)*t2)/a(3);
CC=[];
for i=1:length(t1)
CC(i)=sum(c.*[t1(i) t2 t3(i)]);

end
figure(3)
plot(t1,t3,'r','linewidth',1.5)
xlabel('t1')
ylabel('t3')
grid on
title('t2 vs t3')
figure(4)
plot(t1,CC,'r','linewidth',1.5)
xlabel('t1')
ylabel('Cost')
title('t1 vs Cost')
grid on

You might also like