-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparse_results.py
65 lines (46 loc) · 2.17 KB
/
parse_results.py
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
# coding: utf-8
# # Experimental Results
# This script parses experimental logs to obtain performance metrics.
# Please note that log_analyzer.py is used from the tools directory.
# Documentation of the usage for the LogAnalyzer class is provided on log_analyzer.py
# Import LogAnalyzer objects
from tools.log_analyzer import *
from config.settings import DEFAULT_LOG_DIR
# and other relevant stuff...
import matplotlib.pyplot as plt
# #### !IMPORTANT: Specify directory and log filenames here
# Note that the provided names (below) are default names. They do not have to be changes unless you decided to rename files from multiple experiments.
vehicle_log_file = "/sim/vehicle.log"
customer_log_file = "/sim/customer.log"
score_log_file = "/sim/score.log"
summary_log_file = "/sim/summary.log"
# Invoke LogAnalyzer Object
l = LogAnalyzer()
# #### Exploring dataframes of each of the logs
# Loading all the different logs as pandas dataframes
summary_df = l.load_summary_log(DEFAULT_LOG_DIR)
vehicle_df = l.load_vehicle_log(DEFAULT_LOG_DIR)
customer_df = l.load_customer_log(DEFAULT_LOG_DIR)
score_df = l.load_score_log(DEFAULT_LOG_DIR)
print(summary_df.describe())
print(vehicle_df.describe())
print(customer_df["waiting_time"].describe())
print(score_df.describe())
# #### Exploring the get_customer_status
df = l.get_customer_status(customer_df)
print(df.head())
df = l.get_customer_waiting_time(customer_df)
print(df.head())
##### Generating plots of summary logs
## You can have more than one experiment that you want to compare, you can pass their relevant paths here to the first
## list argument
summary_plots = l.plot_summary([DEFAULT_LOG_DIR], ["Number of Accepted Requests", "Average Travel Distance",
"Occupancy Rate of Vehicles"], plt)
summary_plots.savefig(DEFAULT_LOG_DIR+"/Summary.pdf", bbox_inches = 'tight')
summary_plots.show()
##### Generating plots of relevant experiment metrics
plt, df = l.plot_metrics([DEFAULT_LOG_DIR], ["Profit", "Cruising Time", "Occupancy Rate","Waiting Time", "Travel Distance"],plt)
plt.savefig(DEFAULT_LOG_DIR+"/Metrics.pdf", bbox_inches = 'tight')
# plt.show()
# #### We may also look at the metrics as a pandas dataframe
print(df.head())