1%% Reset everything
2
3clear all;
4clc;
5close all;
6addpath('helpers');
7
8%% Configure the benchmark
9
10% The name of the algorithms in the final plots
11names = { '6pt'; 'ge (8pt)'; '17pt'};
12
13% The main experiment parameters
14min_outlier_fraction = 0.05;
15max_outlier_fraction = 0.45;
16outlier_fraction_step = 0.05;
17
18%% Run the benchmark
19
20%prepare the overall result arrays
21number_outlier_fraction_levels = round((max_outlier_fraction - min_outlier_fraction) / outlier_fraction_step + 1);
22num_algorithms = size(names,1);
23mean_number_iterations = zeros(num_algorithms,number_outlier_fraction_levels);
24mean_execution_times = zeros(num_algorithms,number_outlier_fraction_levels);
25outlier_fraction_levels = zeros(1,number_outlier_fraction_levels);
26
27%Run the experiment
28for n=1:number_outlier_fraction_levels
29
30    outlier_fraction = (n - 1) * outlier_fraction_step + min_outlier_fraction;
31    outlier_fraction_levels(1,n) = outlier_fraction;
32    display(['Analyzing outlier fraction level: ' num2str(outlier_fraction)])
33
34    clear number_iterations
35    clear execution_times
36    temp_file_name1 = ['number_iterations_' num2str(outlier_fraction) '.mat'];
37    temp_file_name2 = ['execution_times_' num2str(outlier_fraction) '.mat'];
38    load(temp_file_name1)
39    load(temp_file_name2)
40
41    %Now compute the mean and median value of the error for each algorithm
42    for a=1:num_algorithms
43        mean_number_iterations(a,n) = mean(number_iterations(a,:));
44        mean_execution_times(a,n) = mean(execution_times(a,:));
45    end
46end
47
48%% Plot the results
49
50figure(1)
51plot(outlier_fraction_levels,mean_number_iterations,'LineWidth',2)
52legend(names,'Location','NorthWest')
53xlabel('outlier fraction')
54ylabel('mean number iterations')
55axis([0.05 0.25 0 1500])
56grid on
57
58figure(2)
59hold on
60plot(outlier_fraction_levels(1,1:6),mean_execution_times(1,1:6),'LineWidth',2)
61plot(outlier_fraction_levels,mean_execution_times(2:3,:),'LineWidth',2)
62legend(names,'Location','NorthWest')
63xlabel('outlier fraction')
64ylabel('mean execution time [s]')
65axis([0.05 0.45 0 40])
66grid on