aboutsummaryrefslogtreecommitdiff
path: root/fitness.m
diff options
context:
space:
mode:
authorMatt Argao <mcargao@email.wm.edu>2012-10-18 16:23:40 -0400
committerMatt Argao <mcargao@email.wm.edu>2012-10-18 16:23:40 -0400
commit0564d364c58758dcf61ebe5cad14b47c474ee57c (patch)
treebf6a09bb93211824829b89d77274e223d401d571 /fitness.m
parent9773dd0f1a6f9941a9a3ec5308bd3845d77bcf52 (diff)
downloadmode_match-0564d364c58758dcf61ebe5cad14b47c474ee57c.tar.gz
mode_match-0564d364c58758dcf61ebe5cad14b47c474ee57c.zip
First attempt at automatic optimization.
Diffstat (limited to 'fitness.m')
-rw-r--r--fitness.m21
1 files changed, 16 insertions, 5 deletions
diff --git a/fitness.m b/fitness.m
index 285cf12..6c0026b 100644
--- a/fitness.m
+++ b/fitness.m
@@ -25,9 +25,9 @@ function Energy = fitness( q_0, q_final, x_final, optics_positions )
d=cat(2, d, d_from_start, d_from_end);
- coef = 1e-1;
-
- penalty=coef*sum( exp(-(d/lens_size).^2) );
+ coef = 1;
+
+ penalty=coef*sum( exp(-(d/(lens_size)).^12) );
Energy = Energy + penalty;
@@ -37,11 +37,22 @@ function Energy = fitness( q_0, q_final, x_final, optics_positions )
d = cat(2, d_from_start, d_from_end);
- coef = 1e-1;
+ coef = 1e-2;
- penalty = coef * sum(1 + tanh(d.^2));
+ penalty = coef * sum(1 + tanh(10*d));
Energy = Energy + penalty;
+ % 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));
+ 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;
end