필터 지우기
필터 지우기

Variable number of variables for each polling point for optimization algorithm

조회 수: 5 (최근 30일)
James506
James506 2015년 9월 24일
편집: Matt J 2015년 9월 24일
The number of variables in my input point vector (x0) to the genetic algorithm changes depending on the integer value of one of the elements in x0 (ranging from 1 to n). This value can vary from one population to another. Therefore, each population may have a different size. Since I am using vectorization my x0 matrix must be square (population size x n), and so there may be differing numbers of redundant elements in each population.
Is there a way to tell the genetic algorithm to ignore/account for these redundant elements, so that the algorithm may potentially run more efficiently?
Currently, my objective function sets the redundant elements to zero, which seems to work but is not the most elegant approach.

답변 (1개)

Matt J
Matt J 2015년 9월 24일
편집: Matt J 2015년 9월 24일
Your population matrix must have a fixed size, but there's no reason why the redundant elements need to slow down or even participate in the evaluation of the fitness function in any way. Just structure your fitness function like this:
function fvals=myfitness(X0)
n=X0(i); %The last non-redundant index
X0(:,n+1:end)=[]; %delete redundant values
.... %continue deriving fitness values from X0
end

카테고리

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