Continue to Site

# GA optimization problem of evanecant waves

Status
Not open for further replies.

#### yefj

##### Advanced Member level 4
Hello , I got this article which is attached.
i am trying to recreate its result where basicly i have incident wave ,anomal reflection waves and evanesant waves.
I have built the code using the mathematical logic shown in the photo bellow.
In the article they dont say how they got the optimised expression so i have built the full expression for E tangential and H tangential and tried to find the complex coeeficients of the evanecant waves.
unfortunetly my GA matlab mechanism the i am trying to use in the end is not runningas shown in the error bellow.
I just said to it to find parameters so my S bunction will be between some values.
Where did i go wriong implementing this GA optimization?
Is the some alternative optimization function i could use?
Error in optim2 (line 46)
[sol,fval] = solve(prob);

Caused by:
Failure in user-supplied fitness function evaluation. GA cannot continue.

Code:
clc
clear all
f=6;
lambda=300/6;
x=linspace(-0.5*lambda,0.5*lambda,50);
y=0*linspace(-0.5*lambda,0.5*lambda,50);
[xx,yy]=meshgrid(x,y);
k=2*pi/lambda;
E_i=1;
eta=377;
D_x=1.064*lambda;
k_y=sqrt(k^2-k_x.^2);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
n=[2,3,4,5,6,7,8];
k_y_n=sqrt(k^2-k_x_n.^2);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%E_t_evanesent=E_opt(1).*exp(-j*k_x_n(1)*xx-j*k_y_n(1)*yy)+E_opt(2).*exp(-j*k_x_n(2)*xx-j*k_y_n(2)*yy)+...

E_opt = optimvar('E_opt',7,'Lower',0,'Upper',1);

cam=fcn2optimexpr( S,E_opt);
camMax=fcn2optimexpr( S_max,E_opt);
camMin=fcn2optimexpr( S_min,E_opt);
prob = optimproblem("Objective",cam);
prob.Constraints.camUpper=camMax<=0.5;
prob.Constraints.camLower=camMin>=0;
[sol,fval] = solve(prob);
sol.E_opt
fval
--- Updated ---

Hello, i forgot that the coefficents of the evanecant waves are complex.
updated code shown bellow.
But still the GA algorithms gives me a bug when i try to run it.
Is there some wat to make the optimization work?
Infeasible individuals are present in the final population.
Optimization terminated: average change in the spread of Pareto solutions less than options.FunctionTolerance.
Constraints are not satisfied within constraint tolerance.
Error using optim.problemdef.OptimizationProblem/solve
Unable to perform assignment because the size of the left side is 1-by-100 and the size of the right side
is 10-by-10.

Error in optim2 (line 46)
[sol,fval] = solve(prob);

Caused by:
Failure in user-supplied fitness function evaluation. GA cannot continue.
:
Code:
clc
clear all
f=6;
lambda=300/6;
x=linspace(-0.5*lambda,0.5*lambda,10);
y=0*linspace(-0.5*lambda,0.5*lambda,10);
[xx,yy]=meshgrid(x,y);
k=2*pi/lambda;
E_i=1;
eta=377;
D_x=1.064*lambda;
k_y=sqrt(k^2-k_x.^2);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
n=[2,3,4,5,6,7,8];
k_y_n=sqrt(k^2-k_x_n.^2);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%E_t_evanesent=E_opt(1).*exp(-j*k_x_n(1)*xx-j*k_y_n(1)*yy)+E_opt(2).*exp(-j*k_x_n(2)*xx-j*k_y_n(2)*yy)+...

E_opt_amp = optimvar('E_opt_amp',7,'Lower',0,'Upper',1);
E_opt_ph = optimvar('E_opt_ph',7,'Lower',0,'Upper',360);

cam=fcn2optimexpr( S,E_opt_amp,E_opt_ph);
camMax=fcn2optimexpr( S_max,E_opt_amp,E_opt_ph);
camMin=fcn2optimexpr( S_min,E_opt_amp,E_opt_ph);
prob = optimproblem("Objective",cam);
prob.Constraints.camUpper=camMax<=0.5;
prob.Constraints.camLower=camMin>=0;
[sol,fval] = solve(prob);
sol.E_opt_amp
fval

#### Attachments

• Lossless-Scalar-Metasurfaces-for-Anomalous-Reflection-Based-on-Efficient-Surface-Field-Optimiz...pdf
620.5 KB · Views: 117
Last edited:

Status
Not open for further replies.