Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
andyfu27 authored Nov 3, 2023
1 parent 989d347 commit 35c2b1a
Showing 1 changed file with 15 additions and 30 deletions.
45 changes: 15 additions & 30 deletions part_II_fmincom.m
Original file line number Diff line number Diff line change
Expand Up @@ -232,40 +232,19 @@

%graph the results

% Define the quarantine policy
quarantine_percentage = 0.5; % 50%
quarantine_start_date = datetime(2021, 10, 27); % Adjust the start date
quarantine_end_date = datetime(2022, 3, 23); % Adjust the end date

% Calculate the policy indices based on the date range
policy_indices = find(omicron_dates >= quarantine_start_date & omicron_dates <= quarantine_end_date);

% Implement the policy by modifying the transition matrix during the policy period
for i = policy_indices
A_opt(1, 5) = A_opt(1, 5) * (1 - quarantine_percentage);
A_opt(2, 5) = A_opt(2, 5) * (1 - quarantine_percentage);
end


unknowns_Q = [unknowns_opt;0];

x_opt0 = unknowns_Q(5:9);
xtot = zeros(5,length(omicron_dates));
Q = 0.8; % 80% of the population is quarantined
Q = 0.75; % percentage of the population is quarantined

A_opt = [1 - unknowns_opt(1), unknowns_opt(3), unknowns_opt(2), 0, 0;
unknowns_opt(1), 1 - unknowns_opt(3) - unknowns_opt(4), 0, 0, 0;
0, 0, 1 - unknowns_opt(2), 0, 0;
0, unknowns_opt(4), 0, 1, 0;
A_opt = [1 - unknowns_opt(1)*(1-Q), 0, unknowns_opt(2), 0, 0;
unknowns_opt(1)*(1-Q), 1 - unknowns_opt(3) - unknowns_opt(4), 0, 0, 0;
0, unknowns_opt(3), 1 - unknowns_opt(2), 0, 0;
0, unknowns_opt(4)*(1-Q), 0, 1, 0;
0, 0, 0, 0, 1;
];

policy_indices = find(omicron_dates >= quarantine_start_date & omicron_dates <= quarantine_end_date);
%for i = policy_indices
% A_opt(1, 5) = A_opt(1, 5) * (1 - quarantine_percentage);
% A_opt(2, 5) = A_opt(2, 5) * (1 - quarantine_percentage);
%end

xtot(:,1) = x_opt0;

for t = 2:length(omicron_dates)
Expand All @@ -276,6 +255,7 @@
I_opt = xtot(2,:);
R_opt = xtot(3,:);
D_opt = xtot(4,:);
Q = xtot(5,:);
%
%50 of the Susceptible population will be quarantined, assuming that
%quarantined population will not die or be infected
Expand Down Expand Up @@ -322,10 +302,15 @@

%calculate the percentage of death and cases in the quarantine model

diff_cases = omicron_cases(length(omicron_dates)) - cum_cases(length(omicron_dates));
diff_cases_percen = (diff_cases/POP_STL)*100;
diff_deaths = omicron_deaths(length(omicron_dates)) - cum_deaths(length(omicron_dates));
diff_deaths_percen = (diff_deaths/POP_STL)*100;
OMI_deaths = omicron_deaths(length(omicron_dates));
OMI_cases = omicron_cases(length(omicron_dates));

OMI_t = length(omicron_dates); %durantion of omicron

diff_cases = omicron_cases(OMI_t) - cum_cases(OMI_t);
diff_cases_percen = ((diff_cases)/OMI_cases)*100;
diff_deaths = omicron_deaths(OMI_t) - cum_deaths(OMI_t);
diff_deaths_percen = ((diff_deaths)/OMI_deaths)*100;

fprintf('The reduced infected population percentage is: %f\n',diff_cases_percen);
fprintf('The reduced deceased population percentage is: %f\n',diff_deaths_percen);
Expand Down

0 comments on commit 35c2b1a

Please sign in to comment.