Too many input arguments error. Matrix variable as input to objective function. Using ga algorithm.

1 回表示 (過去 30 日間)
I have objective function as below, where x(input) is 3 by 9 matrix input, I get single value output from objective function. I am trying to minimize the function using genetic algorithm like below, but i am getting error as "Error using ObjectiveFun Too many input arguments.". Please help me in resolving this issue. And what if I have to use non-linear constraints in this case having matrix variable as input. Thank you for your help in advance.
ObjectiveFunction = @ObjectiveFun X0 = zeros(3,9); options.InitialPopulationMatrix = X0; lb = zeros(3,9); ub = zeros(3,9)+Inf; [x,fval] = ga(ObjectiveFunction,3*9,[],[],[],[],lb(:),ub(:),[],options);
Objective function: function y=ObjectiveFun() global 9 for t=1:1:9 y(t)=integral_function(t, x); end y=-sum(y') end function fun=integral_function(t, x) global alpha a b M c1 c2 beta % these values I have define globally fun=x(1,t)*(x(2,t)-c1)+(x(3,t)-c2)*(M- x(1,t))*(a + b * x(1,t))*(exp(-alpha*x(2,t)-beta*x(3,t))); end
  3 件のコメント
Venugopal Gonela
Venugopal Gonela 2016 年 4 月 27 日
Ohh i missed it, thank you soo much for pointing it :)
Arnab Sen
Arnab Sen 2016 年 4 月 28 日
@ jgg, please post your comment as answer as it seems to be resolved

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

採用された回答

jgg
jgg 2016 年 4 月 28 日
As you've written it, your objective function does not take in any inputs. It needs to take in the point to be evaluated and return the value of the point.

その他の回答 (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