summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fitness.m6
-rw-r--r--fitter_check.m7
-rw-r--r--mode_match.m8
3 files changed, 14 insertions, 7 deletions
diff --git a/fitness.m b/fitness.m
index 00cbada..752e748 100644
--- a/fitness.m
+++ b/fitness.m
@@ -8,13 +8,11 @@ function [Energy, Waist, Penalty] = fitness( q_0, q_final, x_final, optics_posit
[Waist_trial_forward, Radius_trial_forward] = q2wr(q_f_trial_forward, lambda);
q_f_trial_backward = gbeam_propagation(x,q_final,x_final,optics_placer(optics_positions, optics_focal_length));
[Waist_trial_backward, Radius_trial_backward] = q2wr(q_f_trial_backward, lambda);
-
+
Energy = 0;
Penalty_waist_mismatch = sum(abs((Waist_trial_forward-Waist_trial_backward)./min(Waist_trial_forward, Waist_trial_backward)))/Np;
- Penalty_waist_mismatch = 0*Penalty_waist_mismatch + 1e9*sum(abs((Waist_trial_forward-Waist_trial_backward)))/Np;
- Penalty_radius_mismatch = sum(abs((Radius_trial_forward-Radius_trial_backward)./max(Radius_trial_forward, Radius_trial_backward)))/Np;
- Energy = 0*Penalty_radius_mismatch + Penalty_waist_mismatch;
+ Energy = 1e-2*Penalty_waist_mismatch;
% penalty calculation
% do not put lenses too close to each other and end positions
diff --git a/fitter_check.m b/fitter_check.m
index 20a7e9d..51e1480 100644
--- a/fitter_check.m
+++ b/fitter_check.m
@@ -30,7 +30,12 @@ xf=Ltot;
for n_graph = 1:n_possible_lens_placement
figure(n_graph)
w_final_trial = solution_visualization(q0,x0, qf, xf, optics_placer(possible_lens_placement(index(n_graph),:), possible_lens_set(index(n_graph),:)), lambda);
- title('Other Solutions');
+
+ str1=sprintf('\n f_1 = %0.4f, x_1 = %0.4f\n',possible_lens_set(index(n_graph),1),possible_lens_placement(index(n_graph),1));
+ str2=sprintf('f_2 = %0.4f, x_2 = %0.4f\n',possible_lens_set(index(n_graph),2),possible_lens_placement(index(n_graph),2));
+ str3=sprintf('f_3 = %0.4f, x_3 = %0.4f\n',possible_lens_set(index(n_graph),3),possible_lens_placement(index(n_graph),3));
+ tstr='Other Solutions';
+ title([tstr, str1, str2, str3]);
end
possible_lens_placement(index(1:n_graph),:)
diff --git a/mode_match.m b/mode_match.m
index 596cff1..27affcb 100644
--- a/mode_match.m
+++ b/mode_match.m
@@ -1,9 +1,9 @@
-function [ possible_lens_placement, possible_lens_set, possible_sample_energy, n_possible_lens_placement, index ] = mode_match( q0, qf, Ltot, lambda, lens_permutations )
+function [ possible_lens_placement, possible_lens_set, possible_sample_energy, pick_of_n_best_lens_placements, index ] = mode_match( q0, qf, Ltot, lambda, lens_permutations )
%MODE_MATCH Summary of this function goes here
% Detailed explanation goes here
n_perms = size(lens_permutations,1);
-n_shuffles=1; %number of random placements of lenses
+n_shuffles=20; %number of random placements of lenses
%Initialize sample arrays
N = n_perms * n_shuffles;
@@ -45,6 +45,10 @@ n=4;
possible_lens_placement_trunc = round(possible_lens_placement*10^n)./10^n;
[possible_lens_placement_uniq, index] = unique(possible_lens_placement_trunc,'rows','stable'); %Unique solutions only
+<<<<<<< HEAD
n_possible_lens_placement = min(5,size(possible_lens_placement_uniq,1));
+=======
+pick_of_n_best_lens_placements = min(5,size(possible_lens_placement_uniq,1));
+>>>>>>> exper
end