Emami, Hojjat. “Seasons Optimization Algorithm.” Engineering with
Computers, vol. 38, no. 2, Springer Science and Business Media LLC, Aug.
2020, pp. 1845–65, doi:10.1007/s00366-020-01133-5.
if numel(ProblemParams.VarMin)==1 ProblemParams.VarMin=repmat(ProblemParams.VarMin,1,ProblemParams.NPar); ProblemParams.VarMax=repmat(ProblemParams.VarMax,1,ProblemParams.NPar); end ProblemParams.SearchSpaceSize = ProblemParams.VarMax - ProblemParams.VarMin;
p=AlgorithmParams.Pmax-(year/AlgorithmParams.NumOfYears)*(AlgorithmParams.Pmax-AlgorithmParams.Pmin); %pr, ps and pw are in the range [0.4, 0.6] AlgorithmParams.RenewRate=p; AlgorithmParams.SeedingRate=p; AlgorithmParams.ColdThreshold=p; AlgorithmParams.CompetitionRate = p;
%% Spring Season if (year==1) InitialTrees = CreateForest(AlgorithmParams, ProblemParams); Forest=InitialTrees; InitialCost = feval(ProblemParams.CostFuncName,InitialTrees); Forest(:,end+1) = InitialCost; else Forest = Renew(Forest, Seeds, AlgorithmParams, ProblemParams); end
case 'F8' % F8- Egg Crate Function lower=[0], upper=[10] gminimum=[0], dim=2 fobj = @F8; l=[0]; u=[10]; g=-18.5547; d=dim; end end
function z = F1(x) % F1- SumSquares lower=[-10], upper=[10], gminimum=[0], dim=30 [m, n] = size(x); x2 = x .^2; I = repmat(1:n, m, 1); z = sum( I .* x2, 2); end
function z = F2(x) % F2- Schwefel 1.2 lower=[-100], upper=[100], gminimum=[0], dim=30 z =0; v1 =0; dim=size(x,2); for i =1:dim v1=0; for j =1: i v1 = v1 + x(:,j); end z = z + v1.^2; end end
function z = F3(x) % F3- Rosenbrock lower=[-30], upper=[30], gminimum=[0], dim=30 z =0; n = size(x, 2); assert(n >=1, 'Given input X cannot be empty'); a =1; b =100; for i =1 : (n-1) z = z + (b * ((x(:, i+1) - (x(:, i).^2)) .^ 2)) + ((a - x(:, i)) .^ 2); end end
function z = F4(x) % F4- Sphere lower=[-100], upper=[100], gminimum=[0], dim=30 z=sum(x'.^2)'; end function z = F5(x) % F5- Zakharov lower=[-5], upper=[10], gminimum=[0], dim=10 n = size(x, 2); comp1 =0; comp2 =0; for i =1:n comp1 = comp1 + (x(:, i) .^ 2); comp2 = comp2 + (0.5 * i * x(:, i)); end z = comp1 + (comp2 .^ 2) + (comp2 .^ 4); end
function z = F6(x) % F6- Griewank lower=[-600], upper=[600] gminimum=[0], dim=30 n = size(x, 2); sumcomp =0; prodcomp =1; for i =1:n sumcomp = sumcomp + (x(:, i) .^ 2); prodcomp = prodcomp .* (cos(x(:, i) / sqrt(i))); end z = (sumcomp / 4000) - prodcomp + 1; end
function z = F7(x) % F7- Rastrigin lower=[-5.12], upper=[5.12] gminimum=[0], dim=30 n = size(x, 2); A =10; z = (A * n) + (sum(x .^2 - A * cos(2 * pi .* x), 2)); end
function z = F8(x) X = x(:, 1); Y = x(:, 2); %z = X.^2 + Y.^2 + (25 * (sin(X).^2 + sin(Y).^2)); z=X.*sin(4.*X)+ 1.1.*Y.*sin(2.*Y); end