-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMyTest.m
32 lines (30 loc) · 1.16 KB
/
MyTest.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
function MyTest()
M = 500; %最大迭代次数
c1 = 0.3; %学习因子c1
c2 = 0.5; %学习因子c2
w = 0.1; %惯性权重w
%Car1(11*5, J=7038)
Car1 = [
375 632 12 460 528 796 532 14 257 896 532;
12 452 876 542 101 245 230 124 527 896 302;
142 758 124 523 789 632 543 214 753 214 501;
245 278 534 120 124 375 896 543 210 258 765;
412 398 765 499 999 123 452 785 463 259 988;
];
[PI, F] = BasicPSO_FSP(Car1, M, c1, c2, w);
fprintf('Answer is 7038. Your Cmax of Car1 is %s, order is %s\n', num2str(F), num2str(PI));
%Car6(8*9, J=8505)
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
];
[PI, F] = BasicPSO_FSP(Car6, M, c1, c2, w);
fprintf('Answer is 8505. Your Cmax of Car6 is %s, order is %s\n', num2str(F), num2str(PI));
end