Add relative tolerance to the rtp limit comparison - #114
Open
soulrap wants to merge 1 commit into
Open
Conversation
The optimizer targets the rtp limit exactly, so its result can land a few ulps above it - 0_0_scatter/bonus and 0_0_expwilds/superspin both reported VIOLATED at 0.967 + 1e-12. Compare with a relative tolerance for rtp only; the other limits keep the strict comparison. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
verify_mode_volatilitycompares each statistic against its limit with a strictval > limit. The optimizer targets the rtp limit exactly, so its result canland a few ulps on either side of it. When it lands above, the run is reported as
failing a limit it actually hit.
Two of the sample games reproduce this on a clean full run
(
run_sims+run_optimization+run_analysis+run_format_checks, 1e4 sims per mode):The printed value is
round(val, 4), which hides the cause. The exact values,recomputed from the published lookup tables:
0_0_expwildssuperspin0_0_scatterbonus0_0_expwildsbase0_0_scatterbaseWhich side of the limit a mode lands on is incidental to the optimizer's weight
search, so the failure is not reproducible in any meaningful sense.
Change
Compare against the limit with a relative tolerance, applied to
rtponly:Three decisions behind it:
rtponly. Limits absent fromlimit_rel_tolgetrel_tol=0.0, and sinceval > limitalready excludes equality, that is exactly the previous strictbehaviour. Only rtp is a value the optimizer deliberately drives onto the
boundary, so only rtp has a reason to be loosened.
rescales on its own if the limit is ever retargeted (0.97, 0.95, ...).
headroom, while the smallest meaningful rtp regression (0.9671) sits five
orders of magnitude away. The tolerance cannot mask a real deviation.
Verification
Six cases through
verify_mode_volatility:0_0_expwilds/superspinactual0_0_scatter/bonusactualOther metrics keep the strict comparison:
cvar = 800.0000000001against a limitof 800 is still reported as violated.
execute_all_testswas then re-run against the existing publish files for bothaffected games. All five modes report
SHA-256 OK, payout hash OKwith noVIOLATEDline.All six sample games were run end to end with optimization enabled (13 modes
total, every one landing on rtp 0.967) to confirm nothing else regressed.