X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FMLRsearch%2Ftrimmed_stat.py;fp=resources%2Flibraries%2Fpython%2FMLRsearch%2Ftrimmed_stat.py;h=088e8beaf8649b30711d6fc3d79fbd30938c5ce3;hb=7a27faf661cf54a84ef4ee0984e12879a223ce32;hp=0076644aa32cc3719e2b6fb4f4ba08d4d1f4673e;hpb=351c5e1e92f31465e1a4523d3fe9b7701457a503;p=csit.git diff --git a/resources/libraries/python/MLRsearch/trimmed_stat.py b/resources/libraries/python/MLRsearch/trimmed_stat.py index 0076644aa3..088e8beaf8 100644 --- a/resources/libraries/python/MLRsearch/trimmed_stat.py +++ b/resources/libraries/python/MLRsearch/trimmed_stat.py @@ -57,22 +57,21 @@ class TrimmedStat(LoadStats): def conditional_throughput(self) -> Optional[DiscreteLoad]: """Compute conditional throughput from the load. - Target stat has dur_rat_sum and good_long. - The code here adds intended load and handles the case min load is hit. - If min load is not a lower bound, None is returned. + The conditional throughput has the same semantics as load, + so if load is unicirectional and user wants bidirectional + throughput, the manager has to compensate. + + This only works correctly if the self load is a lower bound + for the self target, but this method does not check that. + Its should not matter, as MLRsearch controller only returns + the relevant lower bounds to the manager. :return: Conditional throughput assuming self is a relevant lower bound. :rtype: Optional[DiscreteLoad] :raises RuntimeError: If target is unclear or load is spurious. """ target = list(self.target_to_stat.keys())[0] - _, pes = self.estimates(target) - if not pes: - if int(self): - raise RuntimeError(f"Not a lower bound: {self}") - return None - # TODO: Verify self is really the clo? stat = self.target_to_stat[target] - loss_ratio = stat.dur_rat_sum / stat.good_long + loss_ratio = stat.pessimistic_loss_ratio() ret = self * (1.0 - loss_ratio) return ret