Commit 1c08ea5
Persist sim options before StartSimul so the seed is honored (AB#2742)
run_simulation(seed=N) packed the seed correctly ([SeedFixed]:1 /
[seed0]:N, matching ModelRisk's PackToStringList), and the array
marshalled fine — verified by reading back ModelRisk's own parsed
SimOpt_SeedFixed=1 / SimOpt_Seed0=N after feeding the exact payload to
VoseSetSimulOptions12. But the simulation still ran non-reproducibly.
Root cause: ModelRisk's per-cell-twister Manual-Seed mode sources its
base seed from the WORKBOOK-persisted SimOpt_SeedFixed / SimOpt_Seed0
defined-names (written by SaveOptionsToWorkbook), NOT from the per-call
options passed to VoseStartSimulCustom12. The bridge set the per-call
[seed0] (ignored by the twister) but never persisted it to the workbook,
so Manual Seed stayed OFF -> Random mode -> different stream every run.
Fix: call VoseSetSimulOptions12 with the same options payload before
VoseStartSimulCustom12. That runs SaveOptionsToWorkbook, persisting
SimOpt_SeedFixed=1 / SimOpt_Seed0=N, which the twister then honors.
Verified end-to-end against the engine oracle (single-cell VoseUniform):
- two runs at seed=12345 -> byte-identical streams (was: differing)
- seed=12345 vs seed=555 -> different reproducible streams (seed now drives it)
- the seed=12345 stream matches mrengine's per-cell twister-0 reference
(0.929616, 0.890155, 0.316376, 0.130707, 0.183919, 0.039759, ...) exactly,
validating the byte-identical parity path.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 9b01c48 commit 1c08ea5
1 file changed
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
127 | 135 | | |
128 | 136 | | |
129 | 137 | | |
| |||
346 | 354 | | |
347 | 355 | | |
348 | 356 | | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
349 | 361 | | |
350 | 362 | | |
351 | 363 | | |
| |||
0 commit comments