%CLEAR THE WORKSPACE

clear all;
clc

%

%%%%%%%%%%%%%VARIABLES THAT CHANGE BY SIMULATION%%%%%%%%%%%%%%
str_vr ="0.80";

%Type of Super Spreader (-1=none, 0=one, 1=multiple)
%If computing all three: SS_array = [-1 0 1]; otherwise: SS_array = [-1];
%OR: SS_array = [0]; OR: SS_array = [1]
SS_array = [-1 0 1];


zoom=0;
constant_test=0;
mac_or_pc = 'm';
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%These are the two values of Vr that you want the plots of SIR to be made
    %for. One should be on the left side of where we see the big jump, the
    %other on the right
leftVal = 0;
rightVal = 0;
if str_vr=="0.35"
    leftVal = 0.203;
    rightVal = 0.206;
elseif str_vr=="0.50"
    leftVal = 0.201;
    rightVal = 0.204;
elseif str_vr=="0.65"
    leftVal = 0.159;
    rightVal = 0.162;
else
    leftVal = 0.158;
    rightVal = 0.161;
end


for i=1:length(SS_array)
    min_tester(str_vr,SS_array(i),leftVal,rightVal,zoom,constant_test,mac_or_pc)
end

if mac_or_pc == 'm'
    folder_path = strcat("VR",str_vr,"/Data/");
else
    folder_path = strcat("VR",str_vr,"\Data\");
end
if constant_test==1
    folder_path=strcat(folder_path,"cTest")
end
if zoom==1
    folder_path = strcat(folder_path,"Z");
end
mSS = load(strcat(folder_path,'mSS_vrHigh',str_vr,'.mat'),'fin_vals');
oneSS = load(strcat(folder_path,'oneSS_vrHigh',str_vr,'.mat'),'fin_vals');
noSS = load(strcat(folder_path,'noSS_vrHigh',str_vr,'.mat'),'fin_vals');

f6 = figure(6);
plot(mSS.fin_vals(1,:),mSS.fin_vals(2,:))
hold on
plot(oneSS.fin_vals(1,:),oneSS.fin_vals(2,:))
plot(noSS.fin_vals(1,:),noSS.fin_vals(2,:))


%plot reference lines
max_Tr = 0.9;
if zoom ==1
    max_Tr = max([max(mSS.fin_vals(2,:)) max(oneSS.fin_vals(2,:)) max(noSS.fin_vals(2,:))]);
end
max_Tr =floor(max_Tr*10)/10;
ref_lines = zeros(9,length(mSS.fin_vals));
for i=0.1:0.1:max_Tr
    ref_lines(uint8(i*10),:)=ref_lines(uint8(i*10),:)+i;
end
ref_lines_fin = ref_lines(1:find(ref_lines(:,1),1,'last'),:);
plot(mSS.fin_vals(1,:),ref_lines_fin,'--','color',[0,0,0]+0.8);
hold off


legend("Multiple Super Spreaders","One Super Spreader", "No Super Spreaders",'Location','northwest');
title(strcat("Minimum Testing to Stay Open with VrHigh=",str_vr));
ylabel("Tr");
xlabel("Vr");

%Plot the appropriate figure for the Min_testing plot
if mac_or_pc == 'm'
    plots_path = "/Plots/";
else
    plots_path = "\Plots\";
end

if zoom==1 && constant_test==1
    export_fig(strcat("VR",str_vr,plots_path, "cTestZvrHigh",str_vr,".eps"))
elseif zoom==1 && constant_test==0
    export_fig(strcat("VR",str_vr,plots_path,"ZvrHigh",str_vr,".eps"))
elseif zoom==0 && constant_test==1
    export_fig(strcat("VR",str_vr,plots_path,"cTestvrHigh",str_vr,".eps"))
else
    export_fig(strcat("VR",str_vr,plots_path,"vrHigh",str_vr,".eps"))
end