Commit 8739099
model: Move random seed and random to __init__ (#1940)
* model: Move random seed and random to __init__
Given that `super().__init__()` is now necessary for user's model class `__init__()`, this simplifies the `Model` construct.
And `model.random` can be initialized with other RNG objects (`np.random.default_rng(...)`, or any other RNG).
Prior discussion #1938 Please enter the commit message for your changes. Lines starting
* model: Set seed as keyword argument
* make_model: Set seed after model initialization
This is because the seed param is no longer always passed by the user to
mesa.Model.__init__.
* add super call in model.__init__
* attempted debug
* Update test_time.py
* Update test_time.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Ensure object.__init__ has no other argument
* fix: Remove need of __new__ in ModelCreator
* Remove obsolete attributes
* Remove superfluous code
---------
Co-authored-by: Jan Kwakkel <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>1 parent ead9cd1 commit 8739099
File tree
4 files changed
+13
-19
lines changed- mesa
- visualization
- tests
4 files changed
+13
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 57 | + | |
69 | 58 | | |
70 | 59 | | |
71 | 60 | | |
72 | 61 | | |
73 | | - | |
74 | 62 | | |
75 | 63 | | |
76 | 64 | | |
77 | 65 | | |
78 | 66 | | |
79 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
80 | 75 | | |
81 | 76 | | |
82 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
| 263 | + | |
| 264 | + | |
267 | 265 | | |
268 | 266 | | |
269 | 267 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | 92 | | |
94 | 93 | | |
95 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
111 | 112 | | |
112 | 113 | | |
113 | 114 | | |
| 115 | + | |
114 | 116 | | |
115 | 117 | | |
116 | 118 | | |
| |||
0 commit comments