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

2 次查看(过去 30 天)
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)

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by