Skip to content

Commit f6f1341

Browse files
committed
One extra rounding step to avoid duplicating similar prices
1 parent 65afdda commit f6f1341

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/muse/carbon_budget.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ def min_max_bisect(
527527

528528
if ub > threshold and lb < threshold:
529529
# Threshold is between bounds -> perform bisection
530-
midpoint = (low + up) / 2.0
530+
midpoint = round((low + up) / 2.0, 2)
531531
m = bisect_loop(market, sectors, equilibrium, commodities, midpoint)
532532
emissions_cache[midpoint] = m
533533
if m < threshold:
@@ -540,7 +540,7 @@ def min_max_bisect(
540540
# Inverted bounds (i.e. increasing price leads to increasing emissions)
541541
# Unlikely case, but included for completeness
542542
if ub < threshold and lb > threshold:
543-
midpoint = (low + up) / 2.0
543+
midpoint = round((low + up) / 2.0, 2)
544544
m = bisect_loop(market, sectors, equilibrium, commodities, midpoint)
545545
emissions_cache[midpoint] = m
546546
if m > threshold:

0 commit comments

Comments
 (0)