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
93324eb0
Commit
93324eb0
authored
5 years ago
by
markn92
Browse files
Options
Downloads
Patches
Plain Diff
remove mental overhead by removing special functions
parent
8d5ac7e5
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/T.py
+6
-21
6 additions, 21 deletions
evrouting/charge/T.py
evrouting/charge/utils.py
+3
-3
3 additions, 3 deletions
evrouting/charge/utils.py
with
9 additions
and
24 deletions
evrouting/charge/T.py
+
6
−
21
View file @
93324eb0
...
...
@@ -134,14 +134,6 @@ class ChargingFunction:
return
cf_inverse
def
__lt__
(
self
,
other
)
->
bool
:
"""
Comparison for dominance check.
"""
return
self
.
c
<
other
.
c
def
__gt__
(
self
,
other
):
"""
Comparison for dominance check.
"""
return
self
.
c
>
other
.
c
class
Label
(
NamedTuple
):
"""
...
...
@@ -238,7 +230,7 @@ class SoCFunction:
t_charge
=
None
if
cs
>
self
.
cf_cs
:
if
cs
.
c
>
self
.
cf_cs
.
c
:
# Faster charging station -> charge as soon as possible
t_charge
=
self
.
breakpoints
[
0
].
t
-
self
.
t_trip
elif
self
.
breakpoints
[
-
1
].
soc
<
capacity
:
...
...
@@ -249,20 +241,13 @@ class SoCFunction:
return
t_charge
def
__lt__
(
self
,
other
:
'
SoCFunction
'
)
->
bool
:
"""
Comparison for dominance check.
"""
for
t_i
,
soc_i
in
self
.
breakpoints
:
if
other
(
t_i
)
<
soc_i
:
return
False
for
t_i
,
soc_i
in
other
.
breakpoints
:
if
soc_i
<
self
(
t_i
):
return
False
def
dominates
(
self
,
other
:
'
SoCFunction
'
)
->
bool
:
"""
Check if self dominates other function by evaluating all breakpoints.
return
True
f dominates f
'
if f(t) >= f
'
(t) for all t
def
__gt__
(
self
,
other
:
'
SoCFunction
'
)
->
bool
:
"""
Comparison for dominance check.
"""
"""
for
t_i
,
soc_i
in
self
.
breakpoints
:
if
other
(
t_i
)
>
soc_i
:
return
False
...
...
This diff is collapsed.
Click to expand it.
evrouting/charge/utils.py
+
3
−
3
View file @
93324eb0
...
...
@@ -30,10 +30,10 @@ class LabelPriorityQueue(PriorityQueue):
except
KeyError
:
return
soc
=
self
.
f_soc_factory
(
label
)
soc
:
SoCFunction
=
self
.
f_soc_factory
(
label
)
# Remove item if it gets domina
n
ted by any label in l_set
if
any
(
self
.
f_soc_factory
(
label
)
>
soc
for
label
in
self
.
l_set
):
# Remove item if it gets dominated by any label in l_set
if
any
(
self
.
f_soc_factory
(
label
)
.
dominates
(
soc
)
for
label
in
self
.
l_set
):
self
.
remove_item
(
label
)
...
...
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