summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2013-03-20 18:35:18 -0400
committerEugeniy Mikhailov <evgmik@gmail.com>2013-03-20 18:35:18 -0400
commit5c83224f3a938c19eb8fbfd47ae5367da210cc22 (patch)
tree0037e8fea47815c32eb6db5384a74c9d46fd63d8
parentbd1e0f7cb84bf9b41e459c5f1d8a3b458b79fb09 (diff)
downloadmode_match-5c83224f3a938c19eb8fbfd47ae5367da210cc22.tar.gz
mode_match-5c83224f3a938c19eb8fbfd47ae5367da210cc22.zip
proper penalty calculation for final waist size
-rw-r--r--fitness.m9
1 files changed, 5 insertions, 4 deletions
diff --git a/fitness.m b/fitness.m
index 22699fd..3dac363 100644
--- a/fitness.m
+++ b/fitness.m
@@ -33,7 +33,7 @@ function [Energy, Waist, Penalty] = fitness( q_0, q_final, x_final, optics_posit
d = cat(2, d_from_start, d_from_end);
- coef = 1e-2;
+ coef = 1;
distance_scaling=100;
penalty_lenses_outside_optical_path = coef * sum(1 + tanh(distance_scaling*d));
@@ -55,15 +55,16 @@ function [Energy, Waist, Penalty] = fitness( q_0, q_final, x_final, optics_posit
coef = 10;
[waist_desired, r_desired] = q2wr(q_final, lambda);
- penalty_waist = coef *((waist_desired-w(end))^2);
+ penalty_waist = coef *((( waist_desired-w(end) )/waist_desired)^2);
Energy = Energy + penalty_waist;
+ coef=10;
dist_between_desired_and_final_waist_location =w_pos(end) - x_final;
- penalty_final_waist_position = dist_between_desired_and_final_waist_location^2;
+ penalty_final_waist_position = coef*dist_between_desired_and_final_waist_location^2;
Energy = Energy + penalty_final_waist_position;
- Penalty = [ penalty_lenses_too_closely_spaced; penalty_lenses_outside_optical_path; penalty_not_collimated_beam; penalty_waist];
+ Penalty = [ penalty_lenses_too_closely_spaced; penalty_lenses_outside_optical_path; penalty_not_collimated_beam; penalty_waist; penalty_final_waist_position];
end