Commit bf5848d
Persist sim options before StartSimul so the seed is honored (AB#2742) (#2)
* 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>
* Update sim-controller tests for the SetSimulOptions-first sequence (AB#2742)
The seed-persist fix inserts VoseSetSimulOptions12 before
VoseStartSimulCustom12, so run_simulation now issues 3 Run() calls
(persist, start, save) instead of 2. Update the order/index assertions
accordingly and add an invariant that the persist call receives the same
options payload as the start call.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Timour Koupeev <timour.koupeev@vosesoftware.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 9b01c48 commit bf5848d
2 files changed
Lines changed: 31 additions & 11 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 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
9 | 13 | | |
10 | | - | |
| 14 | + | |
11 | 15 | | |
12 | 16 | | |
13 | 17 | | |
| |||
158 | 162 | | |
159 | 163 | | |
160 | 164 | | |
| 165 | + | |
161 | 166 | | |
162 | 167 | | |
163 | 168 | | |
164 | | - | |
165 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
166 | 172 | | |
167 | 173 | | |
168 | 174 | | |
169 | 175 | | |
170 | | - | |
171 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
172 | 179 | | |
173 | 180 | | |
174 | 181 | | |
| |||
205 | 212 | | |
206 | 213 | | |
207 | 214 | | |
208 | | - | |
| 215 | + | |
| 216 | + | |
209 | 217 | | |
210 | 218 | | |
211 | 219 | | |
| |||
234 | 242 | | |
235 | 243 | | |
236 | 244 | | |
237 | | - | |
238 | | - | |
| 245 | + | |
| 246 | + | |
239 | 247 | | |
240 | 248 | | |
241 | 249 | | |
| |||
0 commit comments