# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# +
import logging
import matplotlib.pyplot as plt
# # %matplotlib notebook
from mpl_toolkits.mplot3d import Axes3D
import matplotlib as mpl
mpl.rcParams['pdf.fonttype'] = 42
mpl.rcParams['ps.fonttype'] = 42
import numpy as np
import random
import seaborn as sns
import pandas as pd
from pandas import DataFrame
import statistics as stat
import os
import yaml
import glob

# WHERE TO SAVE THE FIGURES?
save_loc_iros = "/home/alberndt/Documents/research/bosch/figures/"
save_loc_icaps = "/home/alberndt/Documents/research/bosch/figures/"
# -

# ### 1 Load Data

# +
yaml_list = glob.glob("ICAPS/*.yaml")
data = {"AGVs": [], "randseed": [], "delay": [], "horizon": []}

for file in yaml_list:
    split_filename = file.split("_")
    horizon = str(split_filename[-1].split(".")[0])
    delay = str(split_filename[-3])
    seed = str(split_filename[-5])
    AGVs = str(split_filename[-7])
    
    data["AGVs"].append(int(AGVs))
    data["randseed"].append(int(seed))
    data["delay"].append(int(delay))
    data["horizon"].append(int(horizon))
    
#     with open(file, "r") as stream:
#         try:
#             yaml_data = yaml.safe_load(stream)
#             # cumulative_time = yaml_data["results"]["total time"]
#             data["AGVs"].append(int(AGVs))
#             data["randseed"].append(int(seed))
#             data["delay"].append(int(delay))
#             data["horizon"].append(int(horizon))
#             # data["total_time"].append(int(cumulative_time))
#             # data["improvement"].append(int(cumulative_time))

#         except yaml.YAMLError as exc:
#             print(exc)

df = pd.DataFrame(data, columns=["AGVs", "randseed", "delay", "horizon"])
# -

# ### 2 Plot Data

# +
df_AGV30 = df[df.AGVs == 30]
df_AGV40 = df[df.AGVs == 40]
df_AGV50 = df[df.AGVs == 50]
df_AGV60 = df[df.AGVs == 60]
df_AGV70 = df[df.AGVs == 70]


# f, axes = plt.subplots(5,1)

# i = 0
# for AGVs in [30,40,50,60,70]:
#     df_AGVs = df[df.AGVs == AGVs] 
#     delay = df_AGVs["delay"]
#     horizon = df_AGVs["horizon"]
# #     with sns.axes_style("white"):
#     sns.jointplot(x=delay, y=horizon, kind="kde", color="m", ax=axes[i])
#     i += 1     
# -

# #### 30 AGVs

delay = df_AGV30["delay"]
horizon = df_AGV30["horizon"]
with sns.axes_style("white"):
    sns.jointplot(x=delay, y=horizon, kind="kde", color="m");
plt.show()

# #### 40 AGVs

delay = df_AGV40["delay"]
horizon = df_AGV40["horizon"]
with sns.axes_style("white"):
    sns.jointplot(x=delay, y=horizon, kind="kde", color="m");
plt.show()

# #### 50 AGVs

delay = df_AGV50["delay"]
horizon = df_AGV50["horizon"]
with sns.axes_style("white"):
    sns.jointplot(x=delay, y=horizon, kind="kde", color="m");
plt.show()

# #### 60 AGVs

delay = df_AGV60["delay"]
horizon = df_AGV60["horizon"]
with sns.axes_style("white"):
    sns.jointplot(x=delay, y=horizon, kind="kde", color="m");
plt.show()

# #### 70 AGVs

delay = df_AGV70["delay"]
horizon = df_AGV70["horizon"]
with sns.axes_style("white"):
    sns.jointplot(x=delay, y=horizon, kind="kde", color="m", ratio=5, height=7, space=0, n_levels=5);
plt.show()



StarcoderdataJupyterScriptsDedupFiltered