-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParseSolution.m
More file actions
68 lines (51 loc) · 805 Bytes
/
ParseSolution.m
File metadata and controls
68 lines (51 loc) · 805 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
59
60
61
62
63
64
65
66
67
68
function sol=ParseSolution(x,model)
N=model.N;
t=model.t;
PredList=model.PredList;
R=model.R;
[~, q]=sort(x);
q=RepairSchedule(q,model);
ST=zeros(1,N);
FT=zeros(1,N);
T=sum(model.t);
AR=repmat(model.Rmax,T,1);
RR=AR;
UR=zeros(size(RR));
for i=q
if ~isempty(PredList{i})
t1=max(FT(PredList{i}));
else
t1=0;
end
for tt=t1:T
RR_is_enough=true;
for d=1:t(i)
if any(RR(tt+d,:)<R(i,:))
RR_is_enough=false;
break;
end
end
if RR_is_enough
t2=tt;
break;
end
end
ST(i)=t2;
for d=1:t(i)
RR(ST(i)+d,:)=RR(ST(i)+d,:)-R(i,:);
UR(ST(i)+d,:)=UR(ST(i)+d,:)+R(i,:);
end
FT(i)=ST(i)+t(i);
end
Cmax=max(FT);
AR=AR(1:Cmax,:);
RR=RR(1:Cmax,:);
UR=UR(1:Cmax,:);
sol.q=q;
sol.ST=ST;
sol.FT=FT;
sol.Cmax=Cmax;
sol.AR=AR;
sol.RR=RR;
sol.UR=UR;
end