Skip to content

Commit

Permalink
aggregate demands with defined mode and spectrum
Browse files Browse the repository at this point in the history
Signed-off-by: EstherLerouzic <[email protected]>
Change-Id: Id9fc2e0fe6f6ff5a3996700f6db7dfa6222dc3ca
  • Loading branch information
EstherLerouzic committed Nov 17, 2023
1 parent 22ee05e commit 73e1485
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions gnpy/topology/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,9 +977,7 @@ def compare_reqs(req1, req2, disjlist):
req1.format == req2.format and \
req1.OSNR == req2.OSNR and \
req1.roll_off == req2.roll_off and \
same_disj and \
getattr(req1, 'N', [None]) == [None] and getattr(req2, 'N', [None]) == [None] and \
getattr(req1, 'M', [None]) == [None] and getattr(req2, 'M', [None]) == [None]:
same_disj:
return True
else:
return False
Expand All @@ -988,17 +986,22 @@ def compare_reqs(req1, req2, disjlist):
def requests_aggregation(pathreqlist, disjlist):
"""this function aggregates requests so that if several requests
exist between same source and destination and with same transponder type
If transponder mode is defined and identical, then also agregates demands.
"""
# todo maybe add conditions on mode ??, spacing ...
# currently if undefined takes the default values
local_list = pathreqlist.copy()
for req in pathreqlist:
for this_r in local_list:
if req.request_id != this_r.request_id and compare_reqs(req, this_r, disjlist):
if req.request_id != this_r.request_id and compare_reqs(req, this_r, disjlist) and\
this_r.tsp_mode is not None:
# aggregate
this_r.path_bandwidth += req.path_bandwidth
this_r.N = this_r.N + req.N
this_r.M = this_r.M + req.M
temp_r_id = this_r.request_id
this_r.request_id = ' | '.join((this_r.request_id, req.request_id))

# remove request from list
local_list.remove(req)
# todo change also disjunction req with new demand
Expand Down

0 comments on commit 73e1485

Please sign in to comment.