From 9306970c62771c6c9393ce14f00ff9490ad3239c Mon Sep 17 00:00:00 2001 From: Matt Argao Date: Tue, 13 Nov 2012 16:48:48 -0500 Subject: Optimized test point selection in fitness --- fitness.m | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'fitness.m') diff --git a/fitness.m b/fitness.m index 752e748..55f9d76 100644 --- a/fitness.m +++ b/fitness.m @@ -1,9 +1,17 @@ function [Energy, Waist, Penalty] = fitness( q_0, q_final, x_final, optics_positions, optics_focal_length, lambda ) -%FITNESS Summary of this function goes here -% Detailed explanation goes here +%Outputs fitness of suggested solution x0 = 0; - Np=20; - x=linspace(x0,x_final,Np); + Np=20; % # of pts between start position and second lens + N_collimated = 10; % # of pts between second lens and third lens to be collimated region + + x1=optics_positions(1); + x2=optics_positions(2); + x3=optics_positions(3); + + x_array1=linspace(x0,x2,Np); + x_array2=linspace(x2, x3, N_collimated); + x = cat(2,x_array1,x_array2); + q_f_trial_forward = gbeam_propagation(x,q_0,x0,optics_placer(optics_positions, optics_focal_length)); [Waist_trial_forward, Radius_trial_forward] = q2wr(q_f_trial_forward, lambda); q_f_trial_backward = gbeam_propagation(x,q_final,x_final,optics_placer(optics_positions, optics_focal_length)); @@ -18,9 +26,7 @@ function [Energy, Waist, Penalty] = fitness( q_0, q_final, x_final, optics_posit % do not put lenses too close to each other and end positions lens_size=0.03; - x1=optics_positions(1); - x2=optics_positions(2); - x3=optics_positions(3); + d(1)=abs(x1-x2); d(2)=abs(x2-x3); @@ -53,9 +59,7 @@ function [Energy, Waist, Penalty] = fitness( q_0, q_final, x_final, optics_posit % make collimated region between 2nd and 3rd lens %intialize intermediate points between lenses - intermediate_positions = linspace(optics_positions(2), optics_positions(3),10); - f_q_x = @(x) gbeam_propagation(x,q_0,x0,optics_placer(optics_positions, optics_focal_length)); - q_intermediate = arrayfun(f_q_x,intermediate_positions); + q_intermediate = q_f_trial_forward((x2