clc; clear all;
varMin = -5;
varMax = 5;
D = 3;
VarSize = [1 D];
NP1 = 10;
NP2 = 3;
empty_individual.Position = [];
empty_individual.Cost = [];
P = repmat(empty_individual, NP1, 1);
A = repmat(empty_individual, NP2, 1);
CostFunction = @(x) sphere(x);
for i = 1:NP1
P(i).Position = unifrnd(varMin, varMax, VarSize);
P(i).Cost = CostFunction(P(i).Position);
end
for i = 1:NP2
A(i).Position = unifrnd(varMin, varMax, VarSize);
A(i).Cost = CostFunction(A(i).Position);
end