Commit 867929c
authored
Fix: Auto-increment seed across batch_run iterations
When using batch_run() with a single seed value and multiple iterations, all iterations were using the same seed, producing identical results instead of independent replications. This defeats the purpose of running multiple iterations.
This commit modifies _model_run_func to automatically increment the seed for each iteration (seed, seed+1, seed+2, ...) when a numeric seed is provided. This ensures:
- Each iteration produces different random outcomes
- Results remain reproducible (same base seed → same sequence)
- Backward compatibility with seed arrays (no modification if seed is already an iterable passed via parameters)
- Unchanged behavior when no seed is specified (each iteration gets random seed from OS)
The fix only applies when:
1. A 'seed' parameter exists in kwargs
2. The seed value is not None
3. The iteration number is > 0
4. The seed is a single numeric value (int/float, not bool)1 parent e1f9780 commit 867929c
1 file changed
+8
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
173 | 181 | | |
174 | 182 | | |
175 | 183 | | |
| |||
0 commit comments