how to pass multidimensional population matrix to gaoptimset() function??..
1 view (last 30 days)
Show older comments
I need to pass the multidimensional population matrix to the gaoptimset() in the following way:
[[2 3 4 5; 1 3 5 2; 8 1 4 2],
[1 5 7 6; 1 3 5 2; 8 1 4 2],
[2 3 4 5; 1 3 5 2; 8 1 4 2],
.
.
.
.;]
How can I do that??.. and how can I access it??
if I need to
0 Comments
Answers (1)
Matt J
on 8 Jul 2013
You can use gaoptimset to set the InitialPopulation and PopulationSize options
You can access the current population in any time by using the OutputFcns option
which will return a state structure containing a Population field.
2 Comments
Matt J
on 8 Jul 2013
Edited: Matt J
on 8 Jul 2013
You must organize your initial population as a standard MxN matrix where M is the population size (or less) and N is the number of unknown variables. GA will then pass population members in vector form to the fitness function. However, inside the fitness function, you can reshape() the vector of unknowns into whatever array shape you see fit.
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!