Skip to content
Snippets Groups Projects
Commit b09f376c authored by markn92's avatar markn92
Browse files

bla

parent c58b0012
No related branches found
No related tags found
No related merge requests found
%% Cell type:code id: tags:
``` python
from pathlib import Path
from collections import defaultdict
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
plt.rc('text', usetex=True)
plt.rc('font', family='serif', size=14)
```
%% Cell type:markdown id: tags:
# Random Query Data
%% Cell type:code id: tags:
``` python
query_tag = 'saved/2020-05-25T18:07:55.704835'
query_conf_name ='query_cycles'
algorithms = ['charge']
```
%% Cell type:code id: tags:
``` python
def get_query_data(tag, conf_name, algorithms):
# Paths to Benchmark Results
result_dir = Path('./results').joinpath(tag, conf_name)
data = {}
for alg in algorithms:
path = result_dir.joinpath(f'{alg}.csv')
data[alg] = pd.read_csv(path,dtype={'start_node': str, 'target_node': str})
return data
query_data = get_query_data(query_tag, query_conf_name, algorithms)['charge']
```
%% Cell type:code id: tags:
``` python
query_data.head()
```
%% Output
start_node target_node query_time trip_time nodes edges \
0 1818192324 563891042 4.347978 1516.057241 53509 117187
1 866359483 954303979 0.097798 111.054868 53509 117187
2 672963211 6535929547 22.595656 1706.709976 53509 117187
3 322879733 3143348032 209.955545 6027.668864 53509 117187
4 6254090150 267734888 6.295368 664.992671 53509 117187
charging_stations charging_stops charging_time dominance_checks \
0 40 0 0 134752
1 40 0 0 90
2 40 0 0 612399
3 40 0 0 5732090
4 40 0 0 171115
tweak_on tweak_depth
0 on 0
1 on 0
2 on 0
3 on 0
4 on 0
%% Cell type:code id: tags:
``` python
def plot_query_cycle_alt(query_data):
def rel_diff(x):
return (x[0] - x[1]) / x[0]
query_data = query_data.sort_values(by=['start_node', 'target_node', 'tweak_depth'])
query_data['diff_checks'] = query_data['dominance_checks'].rolling(window=2).apply(rel_diff, raw=True)
query_data['diff_time'] = query_data['query_time'].rolling(window=2).apply(rel_diff, raw=True)
fig, ax = plt.subplots(figsize=(4.5,4))
y = query_data.groupby('tweak_depth').mean()
std = query_data.groupby('tweak_depth').std()
ax.errorbar(x=y.index[1:] + 1,
y=y['diff_checks'].iloc[1:],
yerr=std['diff_checks'].iloc[1:],
marker='o',
capsize=4
)
print(y['diff_checks'].iloc[1:])
print(std['diff_checks'].iloc[1:])
ax.set_xticks(y.index[1:] + 1)
ax.set_yscale('log')
ax.set_xlabel('Maximallänge der ausgschlossenen Kreise')
ax.set_ylabel('$\Delta$ Labelvergleiche')
fig.tight_layout()
fig.savefig('img/kreise.pdf', bbox='tight')
fig, ax = plt.subplots(figsize=(4.5,4))
ax.errorbar(x=y.index[1:] + 1,
y=y['diff_time'].iloc[1:] * 100,
yerr=std['diff_time'].iloc[1:] * 100,
marker='o',
capsize=4
)
ax.set_xticks(y.index[1:] + 1)
#ax.set_yscale('log')
ax.set_xlabel('Maximallänge der ausgschlossenen Kreise')
ax.set_ylabel('$\Delta$ Laufzeit in \%')
fig.tight_layout()
fig.savefig('img/kreise_zeit.pdf', bbox='tight')
```
%% Cell type:code id: tags:
``` python
plot_query_cycle_alt(query_data)
```
%% Output
tweak_depth
1 0.514315
2 0.002519
3 0.001752
4 0.001282
5 0.000426
Name: diff_checks, dtype: float64
tweak_depth
1 0.146701
2 0.001500
3 0.001046
4 0.000972
5 0.000287
Name: diff_checks, dtype: float64
%% Cell type:code id: tags:
``` python
```
start_node,target_node,query_time,trip_time,nodes,edges,charging_stations,charging_stops,charging_time,dominance_checks,tweak_on,tweak_depth
1818192324,563891042,4.34797792500467,1516.0572408010794,53509,117187,40,0,0,134752,on,0
866359483,954303979,0.09779810399777489,111.0548675416733,53509,117187,40,0,0,90,on,0
672963211,6535929547,22.595656324003357,1706.7099762165788,53509,117187,40,0,0,612399,on,0
322879733,3143348032,209.9555447330058,6027.668864131489,53509,117187,40,0,0,5732090,on,0
6254090150,267734888,6.295368361999863,664.9926708182333,53509,117187,40,0,0,171115,on,0
1818192324,563891042,2.827268250002817,1516.0572408010794,53509,117187,40,0,0,76536,on,1
866359483,954303979,0.09801150499697542,111.0548675416733,53509,117187,40,0,0,21,on,1
672963211,6535929547,11.750118348005344,1706.7099762165788,53509,117187,40,0,0,352970,on,1
322879733,3143348032,125.3608258480017,6027.668864131489,53509,117187,40,0,0,3275921,on,1
6254090150,267734888,3.7869395109955803,664.9926708182333,53509,117187,40,0,0,82005,on,1
1818192324,563891042,2.8512904809977044,1516.0572408010794,53509,117187,40,0,0,76242,on,2
866359483,954303979,0.09465720899606822,111.0548675416733,53509,117187,40,0,0,21,on,2
672963211,6535929547,12.317480808000255,1706.7099762165788,53509,117187,40,0,0,351765,on,2
322879733,3143348032,128.14251153200166,6027.668864131489,53509,117187,40,0,0,3266582,on,2
6254090150,267734888,3.7291627480008174,664.9926708182333,53509,117187,40,0,0,81801,on,2
1818192324,563891042,2.7880056200010586,1516.0572408010794,53509,117187,40,0,0,76097,on,3
866359483,954303979,0.09524358599446714,111.0548675416733,53509,117187,40,0,0,21,on,3
672963211,6535929547,11.664137986001151,1706.7099762165788,53509,117187,40,0,0,351081,on,3
322879733,3143348032,127.67275409599824,6027.668864131489,53509,117187,40,0,0,3259716,on,3
6254090150,267734888,3.870156176999444,664.9926708182333,53509,117187,40,0,0,81571,on,3
1818192324,563891042,2.9493768800020916,1516.0572408010794,53509,117187,40,0,0,76003,on,4
866359483,954303979,0.09723945899895625,111.0548675416733,53509,117187,40,0,0,21,on,4
672963211,6535929547,12.100756392996118,1706.7099762165788,53509,117187,40,0,0,350620,on,4
322879733,3143348032,127.23750017300335,6027.668864131489,53509,117187,40,0,0,3256044,on,4
6254090150,267734888,3.9760891659971094,664.9926708182333,53509,117187,40,0,0,81348,on,4
1818192324,563891042,3.0014626030024374,1516.0572408010794,53509,117187,40,0,0,75975,on,5
866359483,954303979,0.11375107200001366,111.0548675416733,53509,117187,40,0,0,21,on,5
672963211,6535929547,12.251272342000448,1706.7099762165788,53509,117187,40,0,0,350348,on,5
322879733,3143348032,126.36792082899774,6027.668864131489,53509,117187,40,0,0,3254715,on,5
6254090150,267734888,3.778053379006451,664.9926708182333,53509,117187,40,0,0,81301,on,5
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment