Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ba
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
markn92
ba
Commits
e4bd0c82
Commit
e4bd0c82
authored
4 years ago
by
markn92
Browse files
Options
Downloads
Patches
Plain Diff
debugging
parent
4d5e4167
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
debug/debug.py
+53
-16
53 additions, 16 deletions
debug/debug.py
evaluation/configs/rank.yaml
+2
-2
2 additions, 2 deletions
evaluation/configs/rank.yaml
evrouting/charge/routing.py
+9
-2
9 additions, 2 deletions
evrouting/charge/routing.py
with
65 additions
and
20 deletions
.gitignore
+
1
−
0
View file @
e4bd0c82
...
...
@@ -8,3 +8,4 @@ dist
*.osm
mapcache
evaluation/results
stats*.csv
This diff is collapsed.
Click to expand it.
debug/debug.py
+
53
−
16
View file @
e4bd0c82
import
json
import
logging.config
import
pickle
import
os
from
time
import
perf_counter
from
evrouting.osm.imports
import
OSMGraph
from
evrouting
import
charge
...
...
@@ -29,23 +31,58 @@ def main():
mu_s
=
40000
mu_t
=
0
capacity
=
40000
s
=
'
274939401
'
t
=
'
299642186
'
print
(
f
'
Solving
{
s
}
to
{
t
}
..
'
)
start
=
perf_counter
()
charge
.
routing
.
shortest_path
(
G
=
G
,
charging_stations
=
G
.
charging_stations
,
s
=
s
,
t
=
t
,
initial_soc
=
mu_s
,
final_soc
=
mu_t
,
capacity
=
capacity
,
c
=
c
)
runtime
=
perf_counter
()
-
start
tasks
=
[
(
'
2600400888
'
,
'
2364151130
'
),
(
'
274939401
'
,
'
299642186
'
)
]
for
i
,
(
s
,
t
)
in
enumerate
(
tasks
):
print
(
f
'
Solving
{
s
}
to
{
t
}
..
'
)
start
=
perf_counter
()
charge
.
routing
.
shortest_path
(
G
=
G
,
charging_stations
=
G
.
charging_stations
,
s
=
s
,
t
=
t
,
initial_soc
=
mu_s
,
final_soc
=
mu_t
,
capacity
=
capacity
,
c
=
c
)
runtime
=
perf_counter
()
-
start
try
:
os
.
rename
(
'
stats.csv
'
,
f
'
stats
{
i
}
.csv
'
)
except
FileExistsError
:
os
.
remove
(
'
fstats{i}.csv
'
)
os
.
rename
(
'
stats.csv
'
,
f
'
stats
{
i
}
.csv
'
)
def
get_logging_config
():
return
{
'
version
'
:
1
,
'
formatters
'
:
{
'
plain
'
:
{
'
fmt
'
:
'
%(message)s
'
}
},
'
handlers
'
:
{
'
file
'
:
{
'
class
'
:
'
logging.handlers.RotatingFileHandler
'
,
'
formatter
'
:
'
plain
'
,
'
mode
'
:
'
w
'
,
'
filename
'
:
'
stats.csv
'
}
},
'
loggers
'
:
{
'
stats
'
:
{
'
level
'
:
'
DEBUG
'
,
'
propagate
'
:
0
,
'
handlers
'
:
[
'
file
'
]
}
}
}
if
__name__
==
'
__main__
'
:
logging
.
config
.
dictConfig
(
get_logging_config
())
main
()
This diff is collapsed.
Click to expand it.
evaluation/configs/rank.yaml
+
2
−
2
View file @
e4bd0c82
...
...
@@ -5,8 +5,8 @@ description: >
paths
:
charging_stations
:
charging_stations.json
map
:
medium_nurnberg.osm
queries_per_rank
:
20
ranks
:
[
6
,
8
,
10
,
12
,
14
,
18
]
queries_per_rank
:
1
ranks
:
[
6
,
8
,
10
,
12
,
14
,
18
,
20
,
22
]
algorithms
:
[
charge
]
mu_s
:
40
# Start and Target Soc
mu_t
:
0
...
...
This diff is collapsed.
Click to expand it.
evrouting/charge/routing.py
+
9
−
2
View file @
e4bd0c82
...
...
@@ -7,6 +7,7 @@ Implementation of the CHArge algorithm [0] with two further constraints:
[0] https://dl.acm.org/doi/10.1145/2820783.2820826
"""
import
logging
from
typing
import
Dict
,
List
,
Tuple
,
Set
from
math
import
inf
...
...
@@ -22,6 +23,8 @@ from evrouting.charge.factories import (
SoCProfileFactory
)
logger
=
logging
.
getLogger
(
'
stats
'
)
def
shortest_path
(
G
:
nx
.
DiGraph
,
charging_stations
:
Set
[
Node
],
s
:
Node
,
t
:
Node
,
initial_soc
:
SoC
,
final_soc
:
SoC
,
capacity
:
SoC
,
c
=
consumption
)
->
Result
:
...
...
@@ -60,11 +63,13 @@ def shortest_path(G: nx.DiGraph, charging_stations: Set[Node], s: Node, t: Node,
# Shortcut for key function
keys
=
LabelPriorityQueue
.
keys
logger
.
debug
(
'
t_min,soc_min
'
)
while
prio_queue
:
node_min
:
Node
=
prio_queue
.
peak_min
()
label_node_min
:
Label
=
l_uns
[
node_min
].
delete_min
()
logger
.
debug
(
'
{priority},{count}
'
.
format
(
**
keys
(
f_soc_factory
(
label_node_min
))))
l_set
[
node_min
].
append
(
label_node_min
)
if
node_min
==
t
:
...
...
@@ -131,6 +136,8 @@ def shortest_path(G: nx.DiGraph, charging_stations: Set[Node], s: Node, t: Node,
try
:
is_new_min
:
bool
=
label_neighbour
==
l_uns
[
n
].
peak_min
()
except
KeyError
:
# Hasn't been inserted into l_uns because it was dominated
# by a label in l_set
continue
if
is_new_min
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment