Can I use the matrix to the variable genetic algorithm?
3 ビュー (過去 30 日間)
古いコメントを表示
I want use matrix to variable.
y=cost(gene)
gene = ones(1,10)
A = [0,find(gene(i,:))];
Pre_Num = numel(A);
S = 0;
up = 0.6;
Dec = 0;
for j = 1:Pre_Num-1
cost1 = exp(-(0.5*(A(j+1)-S)^2))
term = dec_rel_a + (( A(j+1) -A(j))*(1 -up));
Dec = A(j+1) - term;
predict = exp(-(0.5*(A(j+1)- Dec))^2));
if (((1 - RM_a)*0.1) > (predict_rel_a - RM_a))
dec_rel_a = 0;
gene(i,A(j+1)=2;
temp_fit_val(j) = temp_fit_val(j) + 10000
impro_rate = 1;
else
temp_fit_val(j) = temp_fit_val(j) + 10
impro_rate = up;
end
fit_val(i) = fit_val(i) + temp_fit_val(j);
Dec = Dec + (( A(j+1) - A(j))*(1 - impro_rate));
S = A(j+1) - Dec;
end
I would like to know the optimal arrangement of the matrix using a genetic algorithm.
0 件のコメント
回答 (1 件)
Alan Weiss
2015 年 12 月 1 日
Sorry, I do not understand your code or your question. If you are using Global Optimization toolbox, then your individuals must be row vectors for the ga function. If you are trying to optimize individuals that are matrices, then convert each individual to a row vector using the command
xnew = x(:)';
Alan Weiss
MATLAB mathematical toolbox documentation
1 件のコメント
参考
カテゴリ
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!