Repository navigation
Conversation
Fixes a TypeError where the O(1) `forbidden` boolean array was incorrectly reassigned to a Python `set` object inside the inner hot loop of the Monte Carlo simulator, preventing index assignments. Co-authored-by: wavehs <156133648+wavehs@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
💡 What:
Fixed a TypeError inside
compute_range_vs_range_equitywhere theforbiddenboolean array (pre-allocated as[False] * 52) was being mistakenly reassigned to a standard Pythonset(). The fix correctly modifies the boolean array indices (forbidden[v0] = True, etc.) rather than overwriting the variable reference.🎯 Why:
The code was throwing
TypeError: 'set' object does not support item assignmentbecause it attempted to unset flags via array indices (forbidden[v0] = False) on an object that had been reassigned as aset. This broke thetest_compute_range_vs_range_equitytest and blocked the Monte Carlo solver from working in range-vs-range scenarios.📊 Impact:
Fixes a crash in the Monte Carlo solver while preserving the ~4x speedup intended by tracking used cards via an O(1) pre-allocated array instead of repeatedly performing list/tuple membership lookups or re-creating sets in the inner loop.
🔬 Measurement:
test_compute_range_vs_range_equityintests/test_solver.pynow passes.test_benchmark_solver.pydemonstrating the range solver properly executes iterations rapidly (~150ms for 1000 range-vs-range sims on a broad range) with no errors.PR created automatically by Jules for task 533730411520239684 started by @wavehs