Creating an Partial Initial Population of Matrices for a Genetic Algorithm
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello,
I'm running a genetic algortithm that seachers for the minumum value created by a 7x7 matrix of variables.
I want to create an partial initial population where each "point" is actually a 7x7 matrix of values. I want a total population of 100 but I want the partial initial population to consist of 26 matrices each 7x7. From the documentation it seems like each point needs to be a double value, rather than a matrix. Is there a way to trick the GA into accepting these matrices?
Many thanks in advanced!
댓글 수: 0
답변 (2개)
Alan Weiss
2020년 6월 19일
ga accepts only row vectors as population members. However, it is easy for you to call reshape in your fitness function to turn a row vector into a matrix. Your population members should be of size 1-by-49. Your initial population matrix should be of size 26-by-49. OK?
Alan Weiss
MATLAB mathematical toolbox documentation
댓글 수: 0
Mahesh Taparia
2020년 6월 16일
Hi
Double is the variable datatype. If A is the matrix, you can check the variable class of the matrix by
whos A
If it is not in double, you can convert the matrix A into double as
A=double(A);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Genetic Algorithm에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!