i'm getting followig errors when options are used in ga solver

2 views (last 30 days)
main function
clear all
clc
nvars=3;
lb=[6 2 2];
ub=[100 4 4];
options = gaoptimset('PlotFcns',{@gaplotbestf,@gaplotmaxconstr},'Display','iter');
[x, fval,exitflag,output,population]=ga(@my_fun,nvars,[],[],[],[],lb,ub,options)
error when using options
Error using functionHandleOrCell (line 13)
The constraint function must be a function handle.
Error in validate (line 156)
[nonlcon,NonconFcnArgs] = functionHandleOrCell('NonconFcn',nonlcon);
Error in gacommon (line 72)
[options,nvars,FitnessFcn,NonconFcn] =
validate(options,type,nvars,fun,nonlcon,user_options);
Error in ga (line 319)
[x,fval,exitFlag,output,population,scores,FitnessFcn,nvars,Aineq,bineq,Aeq,beq,lb,ub, ...
Error in start (line 7)
[x, fval,exitflag,output,population]=ga(@my_fun,nvars,[],[],[],[],lb,ub,options)

Accepted Answer

Jan
Jan on 5 Apr 2015
Is "The constraint function must be a function handle." a valuable hint?

More Answers (0)

Community Treasure Hunt

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

Start Hunting!