Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
topupopt
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pmag
topupopt
Merge requests
!6
Stats
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
Stats
stats
into
master
Overview
0
Commits
14
Pipelines
0
Changes
5
Merged
Stats
pmag
requested to merge
stats
into
master
May 30, 2024
Overview
0
Commits
14
Pipelines
0
Changes
5
Problem statistics
Profile generation
Graph simplification
Tests for the above
0
0
Merge request reports
Viewing commit
d83c6f96
Prev
Next
Show latest version
5 files
+
130
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
d83c6f96
Started revising analysis methods.
· d83c6f96
Pedro L. Magalhães
authored
Apr 25, 2024
src/topupopt/problems/esipp/network.py
+
25
−
0
View file @ d83c6f96
Edit in single-file editor
Open in Web IDE
Show full file
@@ -1256,6 +1256,31 @@ class Network(nx.MultiDiGraph):
return
nx
.
is_tree
(
network_view
)
# *************************************************************************
# *************************************************************************
def
has_selected_antiparallel_arcs
(
self
)
->
bool
:
"
Returns True if any two nodes have selected arcs in both directions.
"
return
len
(
self
.
find_selected_antiparallel_arcs
())
!=
0
# *************************************************************************
# *************************************************************************
def
find_selected_antiparallel_arcs
(
self
)
->
list
:
"""
Returns True if any two nodes have (selected) forward and reverse arcs.
"""
# check the existence of forward and reverse arcs in the same segment
arcs
=
[
# get the arcs selected
arc_key
[
0
:
2
]
for
arc_key
in
self
.
edges
(
keys
=
True
)
if
True
in
self
.
edges
[
arc_key
][
Network
.
KEY_ARC_TECH
].
options_selected
]
arcs
=
[
# get the selected arcs that exist both ways
arc_key
for
arc_key
in
arcs
if
(
arc_key
[
1
],
arc_key
[
0
])
in
arcs
]
return
arcs
# *****************************************************************************
# *****************************************************************************
Loading