Skip to content
Snippets Groups Projects
Commit 02685e8f authored by Paul CACHEUX's avatar Paul CACHEUX
Browse files

Add quarantine to the model

parent ead030bd
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ N = 4*365; ...@@ -4,6 +4,7 @@ N = 4*365;
S = 410000000; S = 410000000;
I = 55595; I = 55595;
Q = 0;
R = 0; R = 0;
coeffs = options; coeffs = options;
...@@ -13,10 +14,11 @@ coeffs.ImmunisationLossRate = 2.7e-4; ...@@ -13,10 +14,11 @@ coeffs.ImmunisationLossRate = 2.7e-4;
coeffs.DeathRate = 1.3e-2; coeffs.DeathRate = 1.3e-2;
coeffs.NaturalDeathRate = 2e-4; coeffs.NaturalDeathRate = 2e-4;
coeffs.NatalityRate = 5.3e-4; coeffs.NatalityRate = 5.3e-4;
coeffs.QuarantineRate = 4.4e-4;
VaccinationVector = build_vacc_rate(0, 4.4e-4, 0, N); VaccinationVector = build_vacc_rate(0, 4.4e-4, 0, N);
% VaccinationVector = build_vacc_rate(0, 0, 50, N); % VaccinationVector = build_vacc_rate(0, 0, 50, N);
m = model(S, I, R, 12, N); m = model(S, I, Q, R, 12, N);
t = 1:N; t = 1:N;
...@@ -30,9 +32,9 @@ end ...@@ -30,9 +32,9 @@ end
% plot(t, Ilist); % plot(t, Ilist);
% plot(t, Rlist); % plot(t, Rlist);
% plot(t, Dlist); % plot(t, Dlist);
area([m.Slist.', m.Wlist.', m.Ilist.', m.Rlist.']); area([m.Slist.', m.Wlist.', m.Ilist.', m.Qlist.', m.Rlist.']);
legend('Susceptible', 'Waiting', 'Infected', 'Immunized'); legend('Susceptible', 'Waiting', 'Infected', 'In quarantine', 'Immunized');
title('Evolution of virus in population'); title('Evolution of virus in population');
xlabel('Time'); xlabel('Time');
ylabel('Population'); ylabel('Population');
......
...@@ -2,43 +2,43 @@ classdef model < handle ...@@ -2,43 +2,43 @@ classdef model < handle
properties properties
vector vector
Slist Slist
Wlist
Ilist Ilist
Qlist
Rlist Rlist
Wlist
end end
methods methods
function obj=model(S, I, R, Waiting, N) function obj=model(S, I, Q, R, Waiting, N)
if nargin > 4 if nargin > 5
repeat = N; repeat = N;
else else
repeat = 100; repeat = 100;
end end
obj.vector = zeros(1, 3 + Waiting); obj.vector = zeros(1, 4 + Waiting);
obj.vector(1) = S; obj.vector(1) = S;
obj.vector(2) = I; obj.vector(2) = I;
obj.vector(3) = R; obj.vector(3) = Q;
obj.vector(4) = R;
for i = 1:Waiting for i = 1:Waiting
obj.vector(3+i) = 0; obj.vector(4+i) = 0;
end end
obj.Slist = zeros(1, repeat); obj.Slist = zeros(1, repeat);
obj.Wlist = zeros(1, repeat);
obj.Ilist = zeros(1, repeat); obj.Ilist = zeros(1, repeat);
obj.Qlist = zeros(1, repeat);
obj.Rlist = zeros(1, repeat); obj.Rlist = zeros(1, repeat);
obj.Wlist = zeros(1, repeat);
end end
function step(obj, i, coeffs, VaccinationVec) function step(obj, i, coeffs, VaccinationVec)
obj.Slist(i) = obj.vector(1); obj.Slist(i) = obj.vector(1);
obj.Ilist(i) = obj.vector(2); obj.Ilist(i) = obj.vector(2);
obj.Rlist(i) = obj.vector(3); obj.Qlist(i) = obj.vector(3);
obj.Wlist(i) = sum(obj.vector(4:length(obj.vector))); obj.Rlist(i) = obj.vector(4);
obj.Wlist(i) = sum(obj.vector(5:length(obj.vector)));
obj.vector = step(obj.vector, coeffs, VaccinationVec(i)); obj.vector = step(obj.vector, coeffs, VaccinationVec(i));
end end
function goto(obj, other)
end
end end
end end
\ No newline at end of file
...@@ -6,6 +6,7 @@ classdef options ...@@ -6,6 +6,7 @@ classdef options
DeathRate DeathRate
NaturalDeathRate NaturalDeathRate
NatalityRate NatalityRate
QuarantineRate
end end
end end
function res = step(X, options, VaccinationRate) function res = step(X, options, VaccinationRate)
S = X(1); S = X(1);
I = X(2); I = X(2);
R = X(3); Q = X(3);
R = X(4);
N = sum(X); N = sum(X);
new_waiting = zeros(1, length(X) - 3); new_waiting = zeros(1, length(X) - 4);
for i=5:length(X) for i=6:length(X)
new_waiting(i - 3) = X(i - 1) * (1 - options.NaturalDeathRate); new_waiting(i - 4) = X(i - 1) * (1 - options.NaturalDeathRate);
end end
if length(X) > 3 if length(X) > 4
% infection = S * (1 - 25 * options.InfectionRate / N) ^ I; % infection = S * (1 - 25 * options.InfectionRate / N) ^ I;
infecter = sum(X(4:length(X)) + I); infecter = sum(X(5:length(X)) + I);
infection = options.InfectionRate * S * infecter/N; infection = options.InfectionRate * S * infecter/N;
new_waiting(1) = infection; new_waiting(1) = infection;
dS = -infection; dS = -infection;
...@@ -23,8 +24,9 @@ else ...@@ -23,8 +24,9 @@ else
end end
dS = dS - VaccinationRate * S + options.ImmunisationLossRate * R + options.NatalityRate * N - options.NaturalDeathRate * S; dS = dS - VaccinationRate * S + options.ImmunisationLossRate * R + options.NatalityRate * N - options.NaturalDeathRate * S;
dI = dI - options.ImmunisationRate * I - options.DeathRate * I; dI = dI - options.ImmunisationRate * I - options.DeathRate * I - options.QuarantineRate * I;
dR = options.ImmunisationRate * I + VaccinationRate * S - options.ImmunisationLossRate * R - options.NaturalDeathRate * R; dQ = -options.ImmunisationRate * Q - options.DeathRate * Q + options.QuarantineRate * I;
dR = options.ImmunisationRate * (I + Q) + VaccinationRate * S - options.ImmunisationLossRate * R - options.NaturalDeathRate * R;
res = [max(S + dS, 0), max(I + dI, 0), max(R + dR, 0), new_waiting]; res = [max(S + dS, 0), max(I + dI, 0), max(Q + dQ, 0), max(R + dR, 0), new_waiting];
end end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment