summaryrefslogtreecommitdiff
path: root/ero1/src/demo/demo_final_report.py
blob: 59baddac8ca880355075e89cd5d78ead22183e69 (plain)
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
104
105
106
107
108
109
110
from src.demo.print_demo import print_demo
from src.demo.ask_variable import ask_variable
from src.helper.color_suburbs import display_suburbs_with_colors
from src.demo.demo_cost import export_deneigeuse, export_drone, get_edge_length
from src.demo.demo_stats import stats_deneigeuses, stats_drone

# IMPORT FOR GENERATION
from src.generation.graph_generation import generate_graph
from src.generation.suburb_snowplow_generation import generate_quartiers_from_path

# IMPORT FOR DRONE:
from src.drone.postier_chinoisV2 import final_path, postier_chinois_process_v2, connect_circuits
from src.drone.postier_chinoisV1 import postier_chinois_process_v1
from src.drone.postier_chinoisV3 import postier_chinois_process_v3

# IMPORT FOR DENEIGEUSE:
from src.helper.partitions import partition
from src.deneigeuses.hangar_to_deneigeuse import path_hangar_to_deneigeuse, path_deneigeuse_to_hangar

# IMPORT FOR YAML & KML
from src.helper.export_to_kml import export_to_kml
from src.helper.export_import_yaml import load_paths_from_yaml
import os
import time


def line():
    print("----------------------------------")


def print_cost_from_list(lst, base_indent=0):
    """
        affiche la distance et le temps approximatif de chaque déneigeuses
    """

    # print_demo(f"Récap avec {len(lst)} déneigeuses:", base_indent)
    print("")
    print_demo("Récapitulatif des déneigeuses:", base_indent)

    for i, o in enumerate(lst):
        print_demo(f"Déneigeuse numéro {i+1} :", base_indent + 1)
        print_demo(f"Distance = {(o['dist']/1000):.2f} km", base_indent + 2)
        print_demo(f"Durée approximative = {o['time']['format']}", base_indent + 2)


def print_recap_stat_target(stat_deneigeuses, nb_deneigeuse, most_opti=False, base_indent=0):
    """
        Affiche dans le terminal sous un format organisé les statistiques
        avec nb_deneigeuse déneigueses
    """
    if (nb_deneigeuse not in stat_deneigeuses):
        raise ValueError(f'Données pour {nb_deneigeuse} non calculées')

    data = stat_deneigeuses[nb_deneigeuse]

    if most_opti:
        print_demo(f"Récapitulatif global (solution opti): {data['number']} déneigeuses", base_indent)
    else:
        print_demo(f"Récapitulatif global: {data['number']} déneigeuses", base_indent)

    # print_demo(f"nombre de déneigeuses = {data['number']}", base_indent + 1)

    print_demo("Distance parcourue par les déneigeuses :", base_indent + 1)
    print_demo(f"Maximale = {data['dist']['max']:.2f} km", base_indent + 2)
    print_demo(f"Minimale = {data['dist']['min']:.2f} km", base_indent + 2)
    print_demo(f"Totale = {data['dist']['total']:.2f} km", base_indent + 2)
    print_demo(f"Moyenne = {data['dist']['avg']:.2f} km", base_indent + 2)

    print_demo("Temps réel de parcours pour les déneigeuses:", base_indent + 1)
    print_demo("Type 1 : ", base_indent+2)
    print_demo(f"Maximale = {data['time']['real']['t1']['max']:.2f} heures", base_indent + 3)
    print_demo(f"Moyenne = {data['time']['real']['t1']['avg']:.2f} heures", base_indent + 3)
    print_demo("Type 2 : ", base_indent+2)
    print_demo(f"Maximale = {data['time']['real']['t2']['max']:.2f} heures", base_indent + 3)
    print_demo(f"Moyenne = {data['time']['real']['t2']['avg']:.2f} heures", base_indent + 3)

    print_demo("Coût total :", base_indent + 1)
    print_demo(f"Type 1 = {data['cost']['t1']:.2f} euros", base_indent + 2)
    print_demo(f"Type 2 = {data['cost']['t2']:.2f} euros", base_indent + 2)

    print_cost_from_list(data['list'], base_indent)


def print_recap_stat_drone(stat_drone, base_indent=0):
    print("##################")
    print("# Recap du drone #")
    print("##################")
    # dist en km plus bas print_demo(f"distance parcourue par le drone: {stat_drone["dist"]}", base_indent+1)
    print_demo("Temps écoulé :", base_indent)
    print_demo(f"Durée de l'exécution du programme : {stat_drone['time']['format']}", base_indent+1)
    print_demo(f"Durée réelle du parcours :", base_indent+1)
    print_demo(f"{stat_drone['time']['real']:.2f} minutes", base_indent+2)
    print_demo(f"{(stat_drone['time']['real'] / 60):.2f} heures", base_indent+2)
    print_demo(f"Distance parcourue : {stat_drone['distKM']:.2f} km", base_indent)
    print_demo(f"Coût : {stat_drone['cost']:.2f} euros", base_indent)


def print_all_stat(stat_list, base_indent):
    print("#########################")
    print("# Recap des déneigeuses #")
    print("#########################")
    # line()

    best = True
    for elem in stat_list:
        print("")
        line()
        print("")
        print_recap_stat_target(stat_list, elem, best, base_indent)
        best = False