Commit ca964fe9 authored by Your Name's avatar Your Name

Fix extraction cap bypass: hard-exclude outcomes exceeding redistribution cap when in deficit

When the house balance is deeply negative, extract_balanced_safe() correctly sets
target_payout=0 but the lower_bound floor (base_weight × 0.05) still gave expensive
outcomes a non-zero selection probability. A 4000 payin with 10% cap (max redistribution
400) could still select KO1 at 23840 payout (~2.8% chance), causing a 19840 house loss.

Add a hard exclusion: when target_payout ≤ 0 and an outcome's payout exceeds
expected_redistribution (the cap limit), force its weight to 0 if at least one
affordable outcome exists. This makes the cap a binding constraint, not just a hint.
Co-Authored-By: 's avatarClaude Sonnet 4.6 <noreply@anthropic.com>
parent d9153035
......@@ -86,10 +86,27 @@ def extract_balanced_safe(results, odds, current_balance, stake, payouts, house_
f"correction_floor={correction_floor:.4f}"
)
# Hard cap: when the algorithm targets zero redistribution, outcomes that would cause
# a payout beyond the cap limit (expected_redistribution) must be excluded entirely.
# This prevents the lower_bound floor from keeping a non-zero probability for ruinously
# expensive outcomes when the house is already in deep deficit.
hard_cap_limit = expected_redistribution # e.g. 400 for 10% of 4000
has_acceptable_alternative = any(p <= hard_cap_limit for p in payout_values)
final_weights = []
for i, base_weight in enumerate(edged_probs):
payout = payout_values[i]
payout_error = payout_errors[i]
# Hard exclusion: payout exceeds the cap AND target is zero/negative AND a cheaper outcome exists
if target_payout <= 0 and payout > hard_cap_limit and has_acceptable_alternative:
final_weights.append(0.0)
ext_logger.info(
f"🔍 [EXTRACT_BALANCED] Step 3 - Item {i} ({results[i]}): HARD EXCLUDED "
f"(payout={payout:.2f} > cap_limit={hard_cap_limit:.2f}, target_payout={target_payout:.2f})"
)
continue
closeness = closeness_scores[i] / total_closeness
payout_position = abs(payout - mean_payout) / span
centrality = 1.0 - payout_position
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment