Skip to main content
. 2024 Mar 28;9(4):204. doi: 10.3390/biomimetics9040204
Algorithm 1. Random Contrastive Interaction (RCI)
Input:
t: global optimum position
T: Matrix of population information
N: population size
fit: Matrix of objective function valuesx: Position of the population
Output:
X*: Matrix of newly generated stock information
The number of individuals TS to be selected for this iteration is calculated according to Equation (4);
1.      rs = randperm(N, TS); %Generate non-repeating individual subscripts based on TS.
2.      [af, bf] = sort(fit); % af is the result of the ascending order of the fitness values and bf is the corresponding subscript position.
3.      db = find(bf == rs(1));Find the location of the optimal individual in rs.
4.      dw = find(bf == rs(TS));Find the worst individual position in rs.
5.      dbest = pos(bbb(db),:);
6.      dworst = pos(bbb(dw),:);
7.      For i = 1:size(rs,2)
8.          For j = 1:size(x,2)
9.              Calculate the corresponding new position in rs according to Equation (3).
10.          End
11.      End
Return X*