Quantcast
Viewing all articles
Browse latest Browse all 130

MATLAB ga is not sending any arguments to nonlcon

I use genetic algorithm based optimization to run a software in the loop simulation for an electromagnetic simulation of an electric motor with the following command

[x,fval,exitflag,output] = ga(@vbrunner,5,[],[],[],[],lb,ub,[],options);

I wanted to include some non linear constraints in the ga directly using

[x,fval,exitflag,output] = ga(@vbrunner,5,[],[],[],[],lb,ub,nonlcon,options);

with the nonlcon function header as

function [c,ceq] = nonlcon(x)

but when I run this and set a breakpoint within nonlcon, I find no variable called x implying that nothing was passed to the function by ga. Does anyone know what is going on?

Viewing all articles
Browse latest Browse all 130

Trending Articles