From 5c83224f3a938c19eb8fbfd47ae5367da210cc22 Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Wed, 20 Mar 2013 18:35:18 -0400 Subject: proper penalty calculation for final waist size --- fitness.m | 9 +++++---- 1 file 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 -- cgit v1.2.3