what -- The variable in scenario stats to compute with.
"""
assert len(sl) > 0
- wl = [s["sc"][what] for s in sl if "sc" in s and what in s["sc"]]
+ wl = [
+ s["sc"][what] for s in sl
+ if "sc" in s
+ and what in s["sc"]
+ and (
+ "cost" in s["sc"]
+ and s["sc"]["cost"] != 9999
+ )
+ ]
+ el = [
+ 1 for s in sl
+ if "sc" in s
+ and "cost" in s["sc"]
+ and s["sc"]["cost"] != 9999
+ and s["sc"]["cost"] != -1
+ ]
if len(wl) == 0:
wl_mean = inf
wl_std = inf
wl_max = inf
wl_min = -inf
+ wl_med = inf
else:
wl_mean = sum(wl) / len(wl)
wl_tmp = [(x - wl_mean)**2 for x in wl]
wl.sort()
wl_med = wl[round(len(wl) / 2)]
return {
- "err": 100 * (len(sl) - len(wl)) / len(sl),
+ "err": 100 * (len(sl) - len(el)) / len(sl),
"avg": wl_mean,
"std": wl_std,
"med": wl_med,
col = compute_stats(sl, "connecteds-in-path")
nl = compute_stats(sl, "nodes")
print(gos().format(
- tl["err"], sl[0]["dn"], sl[0]["fn"],
+ tl["err"], sl[0]["dn"][:15], sl[0]["fn"],
"-", "-",
tl["avg"], tl["std"], tl["med"], tl["max"], tl["min"],
il["avg"], il["std"], il["med"], il["max"], il["min"],