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

조회 수: 5 (최근 30일)
sani ars
sani ars 2013년 7월 8일
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