RNFS-A-robust-nature-inspired-feature-selection-for-remote-sensing-image-classification / code / initialization.m
initialization.m
Raw
% Cite as: Mohammed, H., Rashid, T. FOX: a FOX-inspired optimization algorithm.
% Appl Intell (2022). https://doi.org/10.1007/s10489-022-03533-0

% This initialization function is adapted from Mirjalili's website
% to initialize the population in the Whale Optimization Algorithm (WOA).
% Source: https://seyedalimirjalili.com/woa

% Function to initialize the first population of search agents
% Inputs:
%   - SearchAgents_no: Number of search agents (population size)
%   - dim: Number of dimensions (features)
%   - ub: Upper bound(s) for feature values
%   - lb: Lower bound(s) for feature values
% Output:
%   - X: Initialized population matrix (SearchAgents_no x dim)
function X = initialization(SearchAgents_no, dim, ub, lb)

    Boundary_no = size(ub, 2); % Number of boundaries (upper bound dimensions)

    % If all variables share the same upper and lower bounds
    if Boundary_no == 1
        X = rand(SearchAgents_no, dim) .* (ub - lb) + lb;
    end
    
    % If each variable has a different lower and upper bound
    % (This section is commented out as it contains incomplete logic)
    % if Boundary_no > 1
    %     for i = 1:dim
    %         ub_i = ub(i);
    %         lb_i = lb(i);
    %         X(:, i) = rand(SearchAgents_no, 1) .* (ub_i - lb_i) + lb_i;
    %         for i = 1:dim
    %             SearchAgents_no(i + 1) = cos(i * acos(SearchAgents_no(i)));
    %             G(i) = ((x(i) + 1) * Value) / 2;
    %         end
    %     end
    % end
    
end