diff options
-rw-r--r-- | fitness.m | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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
|