Genetic algorithm - changing only few arguments - errors

2 ビュー (過去 30 日間)
Siva
Siva 2018 年 1 月 28 日
編集済み: Walter Roberson 2018 年 1 月 29 日
I have to run the genetic algorithm by changing only C1,C2,C7 input arguments of the following function DL_Main_DPDPSCM
The remaining arguments are loaded through the file
data = load ('dpdpscm_data.mat');
function [ rho ] = DL_Main_DPDPSCM(x,C1,C2,C3,C4,C5,C6,C7,capae,capai,capaf,rti,rtp )
C1 = x(1);
C2 = x(2);
C7 = x(3);
I have written the fitness function as
fit = @(x) DL_Main_DPDPSCM(x);
[y,fval] = ga(fit,3);
It is showing errors in the user supplied fitness function.
where did i made the mistake and how to correct it
  1 件のコメント
John D'Errico
John D'Errico 2018 年 1 月 28 日
Please don't use the answers as a thread, so adding an answer for every comment made. I've moved your answer into a comment for you.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2018 年 1 月 28 日
  5 件のコメント
Walter Roberson
Walter Roberson 2018 年 1 月 29 日
We need the code for the function where the error message is generated and a copy of the complete error message.
Walter Roberson
Walter Roberson 2018 年 1 月 29 日
編集済み: Walter Roberson 2018 年 1 月 29 日
Hold on.... Your C1 C2 C7 are all 3d arrays but in your objective function you replace all of those arrays with the scalar value x(1) or x(2) or x(3). You know the x values are individually scalar? If you want to tune the entire array C2 at one time you need to tell ga that the number of variables is at least as high as the number of elements needed to fill the matrix

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGenetic Algorithm についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by