Repository navigation
Make EnhancedOccupancy seeds reproducible - #191
danielgaskins wants to merge 2 commits into
Conversation
|
@danielgaskins could you please elaborate on the issue that this PR is solving? Also, I would welcome @amcberkes comments and review on this PR. |
|
The issue is that Python's string I reran the 20-person The schedules differ from the old hash-based ones, but restarting Python no longer changes them. I added a test that starts two separate interpreters and compares the worker counts and weekday/weekend profiles. All 13 occupancy tests pass. |
Fixes #190
EnhancedOccupancyused Python's randomized string hashes to seed worker assignments, behavior, daily schedules, and weekend decisions. Starting a new Python process could change the results of the same simulation.This uses stable 32-bit seeds derived from SHA-256. Schedules differ from the old hash-based ones and stay repeatable across restarts. Tests check the seed value and run the same model in separate interpreters with different Python hash seeds.
All 13 occupancy tests pass with
python -m unittest smart_control.simulator.enhanced_occupancy_test -q. Pyink, isort, and whitespace checks pass.