I understand that you want to select the samples from population in the multiple of 0.29. These samples are then passed to the optimization algorithms provided by MATLAB.
For this you can write a custom constraint function and pass it in the optimization algorithm itself.
The custom constraint function could be as follows:
% Define the custom constraint function
function [c, ceq] = customConstraint(x)
% Calculate the remainder of each element in x divided by 0.29
c = mod(x, 0.29);
% No nonlinear equality constraints, so ceq is empty
ceq = [];
end
You can then pass the objective function and the constraint function to the optimization algorithm.
You can refer to the example shown in the documentation :
You can also refer to the following :
Hope this helps!!
