function TRI_Introduction_Figure_SIM(SIM)
% Call: lambda_scope = [0.1, 3];
% T_scope = [24, 72];
% slots = [0, 3; 3, 12; 12, 24];
% d_mu_scope = [1, 3];
% d_var_scope = [0.1, 0.2];
% prob_list = [0.05; 0.6; 0.35];
% SIM = TRI_CY_run_the_sim(lambda_scope, 30, T_scope, 3, slots, d_mu_scope, 3, d_var_scope, 2, prob_list);

Figure_1 = SIM(SIM(:, 2) == 24 & SIM(:, 4) == 0 & SIM(:,3) == 1, :);
Figure_2 = SIM(SIM(:, 2) == 24 & SIM(:, 4) == 0 & SIM(:,3) == 2, :);
Figure_3 = SIM(SIM(:, 2) == 24 & SIM(:, 4) == 0 & SIM(:,3) == 3, :);

lambda = Figure_1(:, 1);
U_SORT_min_delay_per_1 = Figure_1(:, 5);
U_SORT_fair_delay_per_1 = Figure_1(:, 6);
FCFS_delay_per_1 = Figure_1(:, 7);

U_SORT_min_delay_per_2 = Figure_2(:, 5);
U_SORT_fair_delay_per_2 = Figure_2(:, 6);
FCFS_delay_per_2 = Figure_2(:, 7);

U_SORT_min_delay_per_3 = Figure_3(:, 5);
U_SORT_fair_delay_per_3 = Figure_3(:, 6);
FCFS_delay_per_3 = Figure_3(:, 7);

figure;
h1 = plot(lambda, U_SORT_min_delay_per_1, 'LineStyle', '-');
hold on
h2 = plot(lambda, U_SORT_fair_delay_per_1, 'LineStyle', '--');
h3 = plot(lambda, FCFS_delay_per_1, 'LineStyle', '-.');
xlabel('Arrivals per hour(\lambda)','FontSize', 14);
ylabel('Percentage of delayed patients', 'FontSize', 14);
title('Comparison of Delayed Patients: U-SORT vs 1C1S Method.');
legend([h1, h2, h3], {'U-SORT-min', 'U-SORT-fair', 'FCFS'}, 'Location', 'Best');
set(gcf, 'Position', [100, 100, 600, 500]); 
saveas(figure(1), 'introduction_figure_1.png');


figure;
h1 = plot(lambda, U_SORT_min_delay_per_2, 'LineStyle', '-');
hold on
h2 = plot(lambda, U_SORT_fair_delay_per_2, 'LineStyle', '--');
h3 = plot(lambda, FCFS_delay_per_2, 'LineStyle', '-.');
xlabel('Arrivals per hour(\lambda)', 'FontSize', 14);
ylabel('Percentage of delayed patients', 'FontSize', 14);
title('Comparison of Delayed Patients: U-SORT vs 1C1S Method.');
legend([h1, h2, h3], {'U-SORT-min', 'U-SORT-fair', 'FCFS'}, 'Location', 'Best');
set(gcf, 'Position', [100, 100, 600, 500]); 
saveas(figure(2), 'introduction_figure_2.png');


figure;
h1 = plot(lambda, U_SORT_min_delay_per_3, 'LineStyle', '-');
hold on
h2 = plot(lambda, U_SORT_fair_delay_per_3, 'LineStyle', '--');
h3 = plot(lambda, FCFS_delay_per_3, 'LineStyle', '-.');
xlabel('Arrivals per hour(\lambda)', 'FontSize', 14);
ylabel('Percentage of delayed patients', 'FontSize', 14);
title('Comparison of Delayed Patients: U-SORT vs 1C1S Method.');
legend([h1, h2, h3], {'U-SORT-min', 'U-SORT-fair', 'FCFS'}, 'Location', 'Best');
set(gcf, 'Position', [100, 100, 600, 500]); 
saveas(figure(3), 'introduction_figure_3.png');
