Skip to content

Commit

Permalink
ZLT: Fix bug when no input value is possible
Browse files Browse the repository at this point in the history
  • Loading branch information
tbarbette committed Nov 5, 2024
1 parent 17a63ae commit 91493fd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion npf/expdesign/zltexp.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def __next__(self):
# get all outputs for all inputs
vals_for_current = {}
acceptable_rates = []

# max_r is the maximal rate (tried or not) that we tried but still dropped some packets
max_r = max(self.executable_values)
for r, vals in self.results.items():
if Run(self.current).inside(r):
Expand Down Expand Up @@ -115,7 +117,12 @@ def __next__(self):

#Step 2 : go for the rate below the output of the max input
maybe_achievable_inputs = list(filter(lambda x : x <= max_r, self.executable_values))
next_val = max(maybe_achievable_inputs)
if len(maybe_achievable_inputs) == 0:
print(f"WARNING: No achievable for {self.input}! Tried {max_r} and it did not work.")
self.current = None
return self.__next__()
else:
next_val = max(maybe_achievable_inputs)
else:

maybe_achievable_inputs = list(filter(lambda x : x <= max_r*self.margin, self.executable_values))
Expand Down

0 comments on commit 91493fd

Please sign in to comment.