Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dynamique-populations
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Martin Lehoux
dynamique-populations
Commits
02685e8f
Commit
02685e8f
authored
7 years ago
by
Paul CACHEUX
Browse files
Options
Downloads
Patches
Plain Diff
Add quarantine to the model
parent
ead030bd
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
SRI_matlab/main.m
+5
-3
5 additions, 3 deletions
SRI_matlab/main.m
SRI_matlab/model.m
+13
-13
13 additions, 13 deletions
SRI_matlab/model.m
SRI_matlab/options.m
+1
-0
1 addition, 0 deletions
SRI_matlab/options.m
SRI_matlab/step.m
+11
-9
11 additions, 9 deletions
SRI_matlab/step.m
with
30 additions
and
25 deletions
SRI_matlab/main.m
+
5
−
3
View file @
02685e8f
...
@@ -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'
);
...
...
This diff is collapsed.
Click to expand it.
SRI_matlab/model.m
+
13
−
13
View file @
02685e8f
...
@@ -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
This diff is collapsed.
Click to expand it.
SRI_matlab/options.m
+
1
−
0
View file @
02685e8f
...
@@ -6,6 +6,7 @@ classdef options
...
@@ -6,6 +6,7 @@ classdef options
DeathRate
DeathRate
NaturalDeathRate
NaturalDeathRate
NatalityRate
NatalityRate
QuarantineRate
end
end
end
end
This diff is collapsed.
Click to expand it.
SRI_matlab/step.m
+
11
−
9
View file @
02685e8f
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment