-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_speed.py
More file actions
40 lines (31 loc) · 1.56 KB
/
plot_speed.py
File metadata and controls
40 lines (31 loc) · 1.56 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
import matplotlib.pyplot as plt
import numpy as np
# Données
tailles = np.array([10, 20, 40, 60, 80, 100])
# Avec Christofides
temps_cr = np.array([0.00249084, 0.0284689, 0.399835, 2.09249, 6.444, 15.6631])
temps_cnn = np.array([0.00348648, 0.0344883, 0.452101, 2.30574, 6.93661, 16.3953])
ecarts_types_cr = np.array([0.000288738, 0.000848713, 0.00924475, 0.0623714, 0.184656, 1.27154])
ecarts_types_cnn = np.array([0.000954628, 0.00632627, 0.0598401, 0.191839, 0.570596, 1.62617])
# Sans Christofides
#temps_cr = np.array([0.00022378, 0.00136512, 0.00961938, 0.0344805, 0.0903767, 0.172662])
#temps_cnn = np.array([0.00122462, 0.00776766, 0.065531, 0.258764, 0.720863, 1.07373])
#ecarts_types_cr = np.array([0.0000262223, 0.000204138, 0.000720738, 0.00297387, 0.00802789, 0.00968883])
#ecarts_types_cnn = np.array([0.000825117, 0.00668408, 0.0633652, 0.183887, 0.586427, 0.970382])
# Création des subplots
fig, ax = plt.subplots(figsize=(10, 6))
fig.canvas.manager.set_window_title("cr_vs_cnn")
# Courbe CR + zone d'écart-type
ax.plot(tailles, temps_cr, label='cr', marker='o')
ax.fill_between(tailles, temps_cr - ecarts_types_cr, temps_cr + ecarts_types_cr, alpha=0.2)
# Courbe CNN + zone d'écart-type
ax.plot(tailles, temps_cnn, label='cnn', marker='s')
ax.fill_between(tailles, temps_cnn - ecarts_types_cnn, temps_cnn + ecarts_types_cnn, alpha=0.2)
# Titre et légende
ax.set_title("Temps d'exécution moyens avec écart-type")
ax.set_xlabel("Taille du graphe")
ax.set_ylabel("Temps (en secondes)")
ax.legend()
ax.grid(True, linestyle='--', alpha=0.5)
plt.tight_layout()
plt.show()