-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSTA.m
33 lines (27 loc) · 886 Bytes
/
STA.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
function [Best, fBest, history] = STA(funfcn, SE, Dim, Range, Iterations)
% parameter setting
alpha_max = 1;
alpha_min = 1e-4;
alpha = alpha_max;
beta = 1;
gamma = 1;
delta = 1;
fc = 2;
% initialization
State = initialization(SE, Dim, Range);
[Best, fBest] = selection(funfcn, State);
counter = 0;
% iterative process
for iter = 1:Iterations
if alpha < alpha_min
alpha = alpha_max;
end
% flag
oldfBest = fBest;
[Best, fBest] = expand(funfcn, Best, SE, Range, beta, gamma);
[Best, fBest] = rotate(funfcn, Best, SE, Range, alpha, beta);
[Best, fBest] = axesion(funfcn, Best, SE, Range, beta, delta);
fprintf('iter=%d ObjVal=%g\n', iter, fBest);
history(iter) = fBest;
alpha = alpha / fc;
end