-
Notifications
You must be signed in to change notification settings - Fork 0
/
fitness_Car6.m
46 lines (42 loc) · 1.15 KB
/
fitness_Car6.m
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
function [F, PI] = fitness( x )
%Car6(8*9)
Car6 = [
887,799,999,666,663,333,222,114;
447,779,999,666,25,558,886,541;
234,567,852,140,222,558,965,412;
159,267,483,753,420,159,25,863;
201,478,520,145,699,875,633,222;
555,444,120,142,578,965,412,25;
463,123,456,789,876,543,210,123;
456,789,630,258,741,36,985,214;
753,21,427,520,142,534,157,896
];
P = Car6'; %Car6问题
N = 8; %工件数
M = 9; %机器数
%ROV就是工件的加工顺序
[~, IX] = sort(x);
[~, ROV] = sort(IX);
%C(j,k)表示工件j在机器k上的加工完毕时间
C = zeros(N, M); %初始化
%公式(6-1)
C(ROV(1), 1) = P(ROV(1), 1);
%公式(6-2)
for i = 2:N
C(ROV(i), 1) = C(ROV(i-1), 1) + P(ROV(i), 1);
end
%公式(6-3)
for k = 2:M
C(ROV(1), k) = C(ROV(1), k-1) + P(ROV(1), k);
end
%公式(6-4)
for i = 2:N
for k = 2:M
C(ROV(i), k) = max(C(ROV(i-1), k), C(ROV(i), k-1)) + P(ROV(i), k);
end
end
%公式(6-5)
F = C(ROV(N), M);
%公式(6-6)
PI = ROV;
end