how to pass multidimensional population matrix to gaoptimset() function??..

1 次查看(过去 30 天)
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

回答(1 个)

Matt J
Matt J 2013-7-8
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 个评论
sani ars
sani ars 2013-7-8
编辑:sani ars 2013-7-8
But I need to have population whose size is say 20... and its each row is actually a 3x3 or 4x4 matrix itself....as I told before...Now, in this form, my population size is 20 in actual but each row is a cell.....
Now, how to specify this type of population, having matrix within a matrix or cells within a matrix or array, in gaoptimset()??..and how we will do crossover, mutation etc of it,,, and how a new population will generate having the same structure as that of initial population???
Do you get that??? actually, the problem is only the change in structure of population... each row is actually a cell of 3x3 of 4x4 etc. it is not just simple a population having e.g. 20 rows and 5 columns... It is actually the population having 20 cells in 20 rows i.e. one cell in each row....
Matt J
Matt J 2013-7-8
编辑:Matt J 2013-7-8
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Genetic Algorithm 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by