How can I fix the "matrix dimensions must agree" errors in ga

1 回表示 (過去 30 日間)
Baris Karakum
Baris Karakum 2019 年 2 月 14 日
コメント済み: Geoff Hayes 2019 年 2 月 14 日
hi,
when I run the optimtool , I see the "matrix dimensions must agree" .
how can I fix it? I think I can't write the fitness funct. correctly.
my fitness funct;
I try to write sum((i,j),x(i,j)*a(i,j))
a=[1000000 1 1 0 1 0; 1 1000000 0 1 0 1;1 0 1000000 1 1 0; 0 1 1 1000000 0 1;1 0 1 0 1000000 1; 0 1 0 1 1 1000000 ] ;
y=(sum(sum(a.*x))) ;
is it true?
and linear eq like this;
T = ones(1,6);
Aeq = blkdiag(T,T,T,T,T,T)
beq = ones(6,1)
  12 件のコメント
Baris Karakum
Baris Karakum 2019 年 2 月 14 日
but the output is 6x6 matrix(for x) and it's true but actually I am new to Matlab. I wrote this problems in GAMS. so,maybe I do something wrong but for now it is true at least.
Geoff Hayes
Geoff Hayes 2019 年 2 月 14 日
Baris - I'm not sure what GAMS is; and I don't know what you mean by the output is 6x6 matrix(for x).

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

回答 (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