Particle swarm optimization solving an equation system
9 ビュー (過去 30 日間)
I want to use particle swarm optimization to solve 4 complex valued nonlinear equations just to compare the results I got from other optimizers. It is working but I'm getting a single value for each variable not in the form of "a+bi" or "a-bi" because of the norm I guess. When I remove the "norm" I am getting an error message. How can I fix the poroblem? Thanks for the help.
ObjFnc = @(x) [...]; % Equations
nVars = 4;
LB = [-1,-1,-1,-1];
UB = [1,1,1,1];
PS_Opts = optimoptions('particleswarm','HybridFcn',@fmincon);
[x,fval,exitflag,output] = particleswarm(@(x)norm(ObjFnc(x)),nVars,LB,UB,PS_Opts)
Dana 2020 年 8 月 18 日
As far as I know, you cannot directly optimize using complex variables as your optimizing variables, and of course your objective function must be a real scalar so you can't have a comlex variable there either.
All is not lost, however. Instead of having 4 complex variables x1, x2, x3, x4 as your optimizers, have 8 real variables a1, b1, a2, b2, a3, b3, a4, b4, and then in your objective function convert these to complex variables via x1=a1+b1*i, x2=a2+b2*i, etc.