diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2018-06-06 16:51:08 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2018-06-06 16:57:00 +0200 |
commit | a921631ca9cd9b06cc6af2f9d8ba1c80dd890f5c (patch) | |
tree | 52c0d59c4a12027dae39cf851c28e337dbd53557 | |
parent | ffb6be1dae7bebf4596336acdefccbfe885bc8a9 (diff) | |
download | rumba-a921631ca9cd9b06cc6af2f9d8ba1c80dd890f5c.tar.gz rumba-a921631ca9cd9b06cc6af2f9d8ba1c80dd890f5c.zip |
elements: Rename dt_connected to edges covered
This addresses the comments by Vincenzo on MR 160. Also adds an extra
check to avoid duplicate DT or enrollment flows when using full mesh.
Fixes #57
-rw-r--r-- | rumba/elements/experimentation.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/rumba/elements/experimentation.py b/rumba/elements/experimentation.py index 0f734f8..1c27dff 100644 --- a/rumba/elements/experimentation.py +++ b/rumba/elements/experimentation.py @@ -326,7 +326,7 @@ class Experiment(object): # breadth-first traversal. enrolled = {first} frontier = {first} - dt_connected = set() + edges_covered = set() while len(frontier): cur = frontier.pop() for edge in dif_graphs[dif][cur]: @@ -336,16 +336,15 @@ class Experiment(object): assert(enrollee is not None) enroller = cur.get_ipcp_by_dif(dif) assert(enroller is not None) - if self.enrollment_strategy == 'minimal': - self.enrollments[-1].append({'dif': dif, - 'enrollee': enrollee, - 'enroller': enroller, - 'lower_dif': edge[1]}) + edges_covered.add((enrollee, enroller)) + self.enrollments[-1].append({'dif': dif, + 'enrollee': enrollee, + 'enroller': enroller, + 'lower_dif': edge[1]}) self.mgmt_flows[-1].append({'src': enrollee, 'dst': enroller}) self.dt_flows[-1].append({'src': enrollee, 'dst': enroller}) - dt_connected.add((enrollee, enroller)) frontier.add(edge[0]) if len(dif.members) != len(enrolled): raise Exception("Disconnected DIF found: %s" % (dif,)) @@ -358,16 +357,17 @@ class Experiment(object): assert(enrollee is not None) enroller = edge[0].get_ipcp_by_dif(dif) assert(enroller is not None) - if self.enrollment_strategy == 'full-mesh': - self.enrollments[-1].append({'dif': dif, - 'enrollee': enrollee, - 'enroller': enroller, - 'lower_dif': edge[1]}) - if self.dt_strategy == 'full-mesh': - if ((enrollee, enroller) not in dt_connected and - (enroller, enrollee) not in dt_connected): + if ((enrollee, enroller) not in edges_covered and + (enroller, enrollee) not in edges_covered): + if self.enrollment_strategy == 'full-mesh': + self.enrollments[-1].append({'dif': dif, + 'enrollee': enrollee, + 'enroller': enroller, + 'lower_dif': edge[1]}) + if self.dt_strategy == 'full-mesh': self.dt_flows[-1].append({'src': enrollee, 'dst': enroller}) + edges_covered.add((enrollee, enroller)) if not (self.dt_strategy == 'minimal' or self.dt_strategy == 'full-mesh') \ |