Genetic Algorithm Multiple Input Args

15 ビュー (過去 30 日間)
Scott Lowrie
Scott Lowrie 2016 年 8 月 19 日
コメント済み: Alan Weiss 2016 年 8 月 22 日
Okay so say I have the below code. I have a setup code that defines variables that are needed in the main function that is called by the genetic algorithm tool. And this is the method I found to pass these variables in but I continually get errors. Any help would be greatly appreciated. Thanks!
setup.m
B = 15;
D = 100;
%(more complicated in practice but just an example)
main.m
function z = main(A,B,D)
z = A*B*D
end
solver.m
setup
[x,fval] = ga(@(A) main(A,B,D),1,[],[],[],[],0,1)
  1 件のコメント
Alan Weiss
Alan Weiss 2016 年 8 月 22 日
Please show us the exact errors you get (do not paraphrase, copy and paste the errors). Also, show us your exact (copy-pasted) function calls leading to the errors.
Alan Weiss
MATLAB mathematical toolbox documentation

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

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