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
7a1758d0
Commit
7a1758d0
authored
5 years ago
by
markn92
Browse files
Options
Downloads
Patches
Plain Diff
little refactor
parent
eb7f67b3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
evrouting/charge/routing.py
+4
-4
4 additions, 4 deletions
evrouting/charge/routing.py
evrouting/utils.py
+1
-1
1 addition, 1 deletion
evrouting/utils.py
with
5 additions
and
5 deletions
evrouting/charge/routing.py
+
4
−
4
View file @
7a1758d0
...
@@ -4,7 +4,7 @@ from math import inf
...
@@ -4,7 +4,7 @@ from math import inf
import
networkx
as
nx
import
networkx
as
nx
from
evrouting.T
import
Node
,
SoC
,
Time
from
evrouting.T
import
Node
,
SoC
,
Time
from
evrouting.utils
import
PriorityQueue
from
evrouting.utils
import
PriorityQueue
from
evrouting.charge
import
factories
as
factor
ies
from
evrouting.charge
.factories
import
soc_profile
as
soc_profile_
factor
y
from
..graph_tools
import
distance
from
..graph_tools
import
distance
from
.T
import
SoCFunction
,
Label
from
.T
import
SoCFunction
,
Label
...
@@ -42,7 +42,7 @@ def shortest_path(G: nx.Graph, charging_stations: set, s: Node, t: Node,
...
@@ -42,7 +42,7 @@ def shortest_path(G: nx.Graph, charging_stations: set, s: Node, t: Node,
t_trip
=
0
,
t_trip
=
0
,
soc_last_cs
=
initial_soc
,
soc_last_cs
=
initial_soc
,
last_cs
=
dummy_node
,
last_cs
=
dummy_node
,
soc_profile_cs_v
=
factories
.
soc_profile
(
G
,
capacity
,
s
)
soc_profile_cs_v
=
soc_profile
_factory
(
G
,
capacity
,
s
)
)
)
l_uns
[
s
].
insert
(
l_uns
[
s
].
insert
(
...
@@ -87,7 +87,7 @@ def shortest_path(G: nx.Graph, charging_stations: set, s: Node, t: Node,
...
@@ -87,7 +87,7 @@ def shortest_path(G: nx.Graph, charging_stations: set, s: Node, t: Node,
t_trip
=
t_trip_old
+
t_charge
,
t_trip
=
t_trip_old
+
t_charge
,
soc_last_cs
=
old_soc_function
(
t_trip_old
+
t_charge
),
soc_last_cs
=
old_soc_function
(
t_trip_old
+
t_charge
),
last_cs
=
minimum_node
,
last_cs
=
minimum_node
,
soc_profile_cs_v
=
factories
.
soc_profile
(
soc_profile_cs_v
=
soc_profile
_factory
(
G
,
capacity
,
minimum_node
G
,
capacity
,
minimum_node
)
)
)
)
...
@@ -109,7 +109,7 @@ def shortest_path(G: nx.Graph, charging_stations: set, s: Node, t: Node,
...
@@ -109,7 +109,7 @@ def shortest_path(G: nx.Graph, charging_stations: set, s: Node, t: Node,
for
n
in
G
.
neighbors
(
minimum_node
):
for
n
in
G
.
neighbors
(
minimum_node
):
# Create SoC Profile for getting from minimum_node to n
# Create SoC Profile for getting from minimum_node to n
soc_profile
=
label_minimum_node
.
soc_profile_cs_v
+
\
soc_profile
=
label_minimum_node
.
soc_profile_cs_v
+
\
factories
.
soc_profile
(
G
,
capacity
,
minimum_node
,
n
)
soc_profile
_factory
(
G
,
capacity
,
minimum_node
,
n
)
if
not
soc_profile
(
capacity
)
==
-
inf
:
if
not
soc_profile
(
capacity
)
==
-
inf
:
# It is possible to get from minimum_node to n
# It is possible to get from minimum_node to n
l_new
=
Label
(
l_new
=
Label
(
...
...
This diff is collapsed.
Click to expand it.
evrouting/utils.py
+
1
−
1
View file @
7a1758d0
import
itertools
import
itertools
from
typing
import
Any
from
typing
import
Any
from
heapq
import
*
from
heapq
import
heappush
,
heappop
class
PriorityQueue
:
class
PriorityQueue
:
...
...
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