forked from Grufoony/SIR_Project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
76 lines (70 loc) · 2.2 KB
/
Copy pathmain.cpp
File metadata and controls
76 lines (70 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//*******************************************************************************************
//
// Simulation of an epidemic disease
// Authors : Francesco Pivi , Gregorio Berselli, Matteo Fusconi.
//
//*******************************************************************************************
#include "board.hpp"
#include "disease.hpp"
constexpr int NUM_INITIAL_INFECTED = 5;
constexpr int DIM = 200;
constexpr double BETA = 0.4;
constexpr double GAMMA = 0.05;
int main() {
try {
std::string name;
int option;
double q_prob = 0;
Mode adv_opt;
Quarantine_parameters Quarantine;
Quarantine.first_day = 0;
Quarantine.last_day = 0;
std::cout << "Welcome to the simulation of an epidemic disease!\n";
std::cout << "The name of the disease is:";
std::cin >> name;
std::cout << "Choose the mode:\n1) Still \n2) Move\n3) Move Plus\n4) "
"Quarantine 1\n5) Quarantine 2\n"
"6) Quarantine 1 and 2\nYour choice: ";
std::cin >> option;
switch (option) {
case 1:
adv_opt = Mode::Still;
break;
case 2:
adv_opt = Mode::Move;
break;
case 3:
adv_opt = Mode::Move_Plus;
break;
case 4:
adv_opt = Mode::Quarantine_1;
q_prob = 0.09;
break;
case 5:
adv_opt = Mode::Quarantine_2;
Quarantine.first_day = 10;
Quarantine.last_day = 150;
break;
case 6:
adv_opt = Mode::Quarantine_1_and_2;
q_prob = 0.09;
Quarantine.first_day = 10;
Quarantine.last_day = 150;
break;
default:
throw std::runtime_error{ "Invalid selected mode" };
}
sir::Board b(name, DIM, BETA, GAMMA, NUM_INITIAL_INFECTED, adv_opt, q_prob,
Quarantine);
int refresh_rate = 10; // ms
b.draw(refresh_rate);
int days = 1600;
disease::Disease d(name, DIM * DIM, BETA, GAMMA);
d.evolve(days);
d.f_print();
d.draw(700, 500, 'A');
}
catch (std::runtime_error& e) {
std::cerr << e.what();
}
}