Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
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)

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by