-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProject_trial.m
More file actions
175 lines (125 loc) · 4.28 KB
/
Project_trial.m
File metadata and controls
175 lines (125 loc) · 4.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
clc;
clear;
close all;
%Call_resolution = [];
%Call_res_eff = [];
%j = [];
Department1 = {};
Department2 = {};
Department3 = {};
Department4 = {};
Department5 = {};
for i = 1:54
call_per_week = poissrnd(394); %Avg for 12 weeks
call_dept = [round(0.2*call_per_week), round(0.21*call_per_week), round(0.18*call_per_week), round(0.19*call_per_week), round(0.22*call_per_week)];
for i1 = 1:call_dept(1)
x1 = {Martha, Dan,Stewart,Greg, Joe, Becky, Diane, Jim};
idx = randi(numel(x1));
Emp = x1(idx);
%Employee = cellfun(@(x) zeros(1,4),cell(i1,1),'un',0)
Department1 = [Department1 ; Emp];
end
for i2 = 1:call_dept(2)
x1 = {Martha,Dan,Stewart,Greg, Joe, Becky, Diane, Jim};
idx = randi(numel(x1));
Emp = x1(idx);
Department2 = [Department2 ; Emp];
end
for i3 = 1:call_dept(3)
x1 = {Martha, Dan, Stewart,Greg, Joe, Becky, Diane, Jim};
idx = randi(numel(x1));
Emp = x1(idx);
Department3 = [Department3 ; Emp];
end
for i4 = 1:call_dept(4)
x1 = {Martha,Dan,Stewart,Greg, Joe, Becky, Diane, Jim};
idx = randi(numel(x1));
Emp = x1(idx);
Department4 = [Department4 ; Emp];
end
for i5 = 1:call_dept(5)
x1 = {Martha,Dan,Stewart,Greg, Joe, Becky, Diane, Jim};
idx = randi(numel(x1));
Emp = x1(idx);
Department5 = [Department5 ; Emp];
end
end
%%
%Waitime
W1 = cellfun(@(x) x(1,2), Department1);
W2 = cellfun(@(x) x(1,2), Department2);
W3 = cellfun(@(x) x(1,2), Department3);
W4 = cellfun(@(x) x(1,2), Department4);
W5 = cellfun(@(x) x(1,2), Department5);
sx = size(W1);
sy = size(W2);
a = max(sx(1),sy(1));
z1 = [[W1;zeros(abs([a 0]-sx))],[W2;zeros(abs([a,0]-sy))]];
sx = size(z1);
sy = size(W3);
a = max(sx(1),sy(1));
z2 = [[z1;zeros(abs([a 0]-sx))],[W3;zeros(abs([a,0]-sy))]];
sx = size(z2);
sy = size(W4);
a = max(sx(1),sy(1));
z3 = [[z2;zeros(abs([a 0]-sx))],[W4;zeros(abs([a,0]-sy))]];
sx = size(z3);
sy = size(W5);
a = max(sx(1),sy(1));
Wait_time = [[z3;zeros(abs([a 0]-sx))],[W5;zeros(abs([a,0]-sy))]];
%--------------------------------------------------------------------
%Call duration
D1 = cellfun(@(x) x(1,3), Department1);
D2 = cellfun(@(x) x(1,3), Department2);
D3 = cellfun(@(x) x(1,3), Department3);
D4 = cellfun(@(x) x(1,3), Department4);
D5 = cellfun(@(x) x(1,3), Department5);
sx = size(D1);
sy = size(D2);
a = max(sx(1),sy(1));
z1 = [[D1;zeros(abs([a 0]-sx))],[D2;zeros(abs([a,0]-sy))]];
sx = size(z1);
sy = size(D3);
a = max(sx(1),sy(1));
z2 = [[z1;zeros(abs([a 0]-sx))],[D3;zeros(abs([a,0]-sy))]];
sx = size(z2);
sy = size(D4);
a = max(sx(1),sy(1));
z3 = [[z2;zeros(abs([a 0]-sx))],[D4;zeros(abs([a,0]-sy))]];
sx = size(z3);
sy = size(D5);
a = max(sx(1),sy(1));
Duration = [[z3;zeros(abs([a 0]-sx))],[D5;zeros(abs([a,0]-sy))]];
%---------------------------------------------------------------------------
Wash_mch_d = sum(Duration(:,1))/3600;
Toast_d = sum(Duration(:,2))/3600;
Fri_d = sum(Duration(:,3))/3600;
AC_d = sum(Duration(:,4))/3600;
TV_d = sum(Duration(:,5))/3600;
D = [Wash_mch_d, Toast_d, Fri_d, AC_d, TV_d];
Dept = categorical({'Washing Machine','Toaster','Fridge','AC' 'TV'});
Dept = reordercats(Dept,{'Washing Machine','Toaster','Fridge','AC' 'TV'});
bar(Dept,D);
Total_D = sum(D)/3600;
%----------------------------------------------------------
%%
Counter_W = [M_c, S_c, Da_c, G_c, Jo_c, B_c, Di_c, Ji_c];
Mar_Washing = sum(Mar_Washing);
Stew_Washing = sum (Stew_Washing);
Da_Washing = sum(Da_Washing);
Gre_Washing = sum(Gre_Washing);
Jo_Washing = sum(Jo_Washing);
Bec_Washing = sum(Bec_Washing);
Dia_Washing = sum(Dia_Washing);
Ji_Washing = sum(Ji_Washing);
Employee_Washing_D = [Mar_Washing, Stew_Washing, Da_Washing, Gre_Washing, Jo_Washing...
, Bec_Washing, Dia_Washing, Ji_Washing];
Employee = categorical({'Martha','Stewart','Dan','Greg' 'Joe', 'Becky', 'Diane', 'Jim'});
Employee = reordercats(Employee,{'Martha','Stewart','Dan','Greg' 'Joe', 'Becky', 'Diane', 'Jim'});
figure;
bar(Employee,Employee_Washing_D);
%%
Duration = [D1,D2,D3,D4,D5];
sizes = cell2mat(cellfun(@size, YourCell(:), 'uniform', 0));
maxcols = max(sizes(:,2));
combined = cell2mat(cellfun(@(M) [M, zeros(size(M,1), maxcols-size(M,2))], YourCell(:), 'uniform', 0));