How to set a suitable range for variables in Genetic Algorithm Optimization

6 views (last 30 days)
Hi, I have a optimization problem and its variable x has some limitations as belows:
and for each variables, ,all x(i) is integer.
For my understanding, the ga function will generate 300 random values within the range of x(i) and calculate the fitness fcn. if all constraints are met.
Such as:
rng(0,'twister');
variable_num=300;
LB=zeros(1,variable_num);
UB=100*ones(1,variable_num);
A=ones(1,variable_num);
b=1000;
GASetting = optimoptions(@ga,'PopulationSize',10000,'MaxGenerations',1000);
[x,fval,exitflag,output,population,scores] = ga(@test,variable_num,A,b,[],[],LB,UB,[],1:variable_num,GASetting);
Is there any functions or settings for forcing the software to generate a total number where less than 1000 and distributed to each variables randomly? Because in the code displayed before, GA cannot find a feasible points for calculating the user-defined function.

Answers (0)

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!