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

5 visualizaciones (últimos 30 días)
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

Respuestas (1)

Matt J
Matt J el 8 de Jul. de 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 comentarios
sani ars
sani ars el 8 de Jul. de 2013
Editada: sani ars el 8 de Jul. de 2013
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 el 8 de Jul. de 2013
Editada: Matt J el 8 de Jul. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Genetic Algorithm en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by