-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathParseSolution.m
More file actions
58 lines (45 loc) · 753 Bytes
/
ParseSolution.m
File metadata and controls
58 lines (45 loc) · 753 Bytes
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
function sol=ParseSolution(x,model)
I=model.I;
J=model.J;
p=model.p;
s=model.s;
[~, q]= sort(x);
% Delimiters Position
DelPos=find(q>I);
% Determine Start and End of Machines Job Sequence
From=[0 DelPos]+1;
To=[DelPos I+J]-1;
% Create Jobs List
L=cell(J,1);
for j=1:J
L{j}=q(From(j):To(j));
end
% Time-based Simulation
ST=zeros(I,1);
PT=zeros(I,1);
FT=zeros(I,1);
MCT=zeros(J,1);
for j=1:J
for i=L{j}
k=find(L{j}==i);
if k==1
ST(i)=0;
else
PreviousJob=L{j}(k-1);
ST(i)=FT(PreviousJob)+s(PreviousJob,i,j);
end
PT(i)=p(i,j);
FT(i)=ST(i)+PT(i);
end
if ~isempty(L{j})
MCT(j)=FT(L{j}(end));
end
end
Cmax=max(MCT);
sol.L=L;
sol.ST=ST;
sol.PT=PT;
sol.FT=FT;
sol.MCT=MCT;
sol.Cmax=Cmax;
end