from __future__ import annotations
from dataclasses import dataclass
-from typing import Optional
-from .discrete_load import DiscreteLoad
from .load_stats import LoadStats
from .target_spec import TargetSpec
int_load=stats.int_load,
target_to_stat={target: stats.target_to_stat[target]},
)
-
- @property
- 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.
-
- :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
- ret = self * (1.0 - loss_ratio)
- return ret