Newer
Older
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package fr.univ.dblp.simulation;
import java.util.List;
/**
* Résultats d'une simulation de propagation virale.
* Contient l'évolution temporelle des différents groupes.
*/
public class SimulationResult {
private final List<Integer> susceptibleOverTime;
private final List<Integer> infectedOverTime;
private final List<Integer> immuneCount;
private final int totalNodes;
private final int simulationDays;
private final String scenario;
public SimulationResult(List<Integer> susceptibleOverTime,
List<Integer> infectedOverTime,
List<Integer> immuneCount,
int totalNodes,
int simulationDays,
String scenario) {
this.susceptibleOverTime = susceptibleOverTime;
this.infectedOverTime = infectedOverTime;
this.immuneCount = immuneCount;
this.totalNodes = totalNodes;
this.simulationDays = simulationDays;
this.scenario = scenario;
}
/**
* @return Liste du nombre de susceptibles à chaque jour
*/
public List<Integer> getSusceptibleOverTime() {
return susceptibleOverTime;
}
/**
* @return Liste du nombre d'infectés à chaque jour
*/
public List<Integer> getInfectedOverTime() {
return infectedOverTime;
}
/**
* @return Nombre d'immunisés (constant pendant la simulation)
*/
public List<Integer> getImmuneCount() {
return immuneCount;
}
/**
* @return Nombre total de nœuds dans le réseau
*/
public int getTotalNodes() {
return totalNodes;
}
/**
* @return Durée de la simulation en jours
*/
public int getSimulationDays() {
return simulationDays;
}
/**
* @return Nom du scénario simulé
*/
public String getScenario() {
return scenario;
}
/**
* @return Pic d'infection (nombre maximal d'infectés)
*/
public int getPeakInfection() {
return infectedOverTime.stream().mapToInt(Integer::intValue).max().orElse(0);
}
/**
* @return Jour où le pic d'infection est atteint
*/
public int getPeakDay() {
int peak = getPeakInfection();
for (int i = 0; i < infectedOverTime.size(); i++) {
if (infectedOverTime.get(i) == peak) {
return i;
}
}
return -1;
}
/**
* Calcule la fraction d'infectés parmi la population non immunisée à chaque jour
* @return Liste des fractions d'infectés (entre 0 et 1)
*/
public List<Double> getInfectedFractionOverTime() {
int nonImmune = totalNodes - (immuneCount.isEmpty() ? 0 : immuneCount.get(0));
return infectedOverTime.stream()
.map(infected -> nonImmune > 0 ? (double) infected / nonImmune : 0.0)
.toList();
}
}