diff options
author | Matt Argao <mcargao@email.wm.edu> | 2012-10-23 16:49:58 -0400 |
---|---|---|
committer | Matt Argao <mcargao@email.wm.edu> | 2012-10-23 16:49:58 -0400 |
commit | a8c9a7bbeeb09dabc4196d76cf3c9004eb5f65a3 (patch) | |
tree | 2ea15449f2412c0b656f4b4d49b0baafaeb3e465 | |
parent | 29f10e82fcff18e60bdb42cc824b2e18a40887bf (diff) | |
download | mode_match-a8c9a7bbeeb09dabc4196d76cf3c9004eb5f65a3.tar.gz mode_match-a8c9a7bbeeb09dabc4196d76cf3c9004eb5f65a3.zip |
Optimized collimation penalty and returns penalties
-rw-r--r-- | fitness.m | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -1,4 +1,4 @@ -function [Energy, Waist] = fitness( q_0, q_final, x_final, optics_positions, optics_focal_length, lambda )
+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
x0 = 0;
@@ -28,9 +28,9 @@ function [Energy, Waist] = fitness( q_0, q_final, x_final, optics_positions, opt coef = 1;
- penalty=coef*sum( exp(-(d/(lens_size)).^12) );
+ penalty_lenses_too_closely_spaced =coef*sum( exp(-(d/(lens_size)).^12) );
- Energy = Energy + penalty;
+ Energy = Energy + penalty_lenses_too_closely_spaced;
% make sure that lenses are between ends
d_from_start=(x0-optics_positions);
@@ -40,9 +40,9 @@ function [Energy, Waist] = fitness( q_0, q_final, x_final, optics_positions, opt coef = 1e-2;
- penalty = coef * sum(1 + tanh(10*d));
+ penalty_lenses_outside_optical_path = coef * sum(1 + tanh(10*d));
- Energy = Energy + penalty;
+ Energy = Energy + penalty_lenses_outside_optical_path;
% make collimated region between 2nd and 3rd lens
%intialize intermediate points between lenses
@@ -51,9 +51,10 @@ function [Energy, Waist] = fitness( q_0, q_final, x_final, optics_positions, opt q_intermediate = arrayfun(f_q_x,intermediate_positions);
lambda_over_waist_sq = (-imag(1./q_intermediate)); %with numerical factor
-
- coef = 1e-2;
- penalty = coef * sum(exp((std(lambda_over_waist_sq)/mean(lambda_over_waist_sq))));
- Energy = Energy + penalty;
+ coef = 1e-3;
+ penalty_not_collimated_beam = coef * sum(exp((std(lambda_over_waist_sq)/mean(lambda_over_waist_sq)/abs(optics_positions(2) - optics_positions(3)))));
+ Energy = Energy + penalty_not_collimated_beam;
+
+ Penalty = [ penalty_lenses_too_closely_spaced; penalty_lenses_too_closely_spaced; penalty_not_collimated_beam];
end
|