|
| 1 | +# Mesa Migration guide |
| 2 | +This guide contains breaking changes between major Mesa versions and how to resolve them. |
| 3 | + |
| 4 | +Non-breaking changes aren't included, for those see our [Release history](https://github.com/projectmesa/mesa/releases). |
| 5 | + |
| 6 | +## Mesa 3.0 |
| 7 | +<!-- TODO small introduction--> |
| 8 | + |
| 9 | +_This guide is a work in progress. The development of it is tracked in [Issue #2233](https://github.com/projectmesa/mesa/issues/2233)._ |
| 10 | + |
| 11 | +### Reserved and private variables |
| 12 | +<!-- TODO: Update this section based on https://github.com/projectmesa/mesa/discussions/2230 --> |
| 13 | + |
| 14 | +#### Reserved variables |
| 15 | +Currently, we have reserved the following variables: |
| 16 | + - Model: `agents`, `current_id`, `random`, `running`, `steps`, `time`. |
| 17 | + - Agent: `unique_id`, `model`. |
| 18 | + |
| 19 | +You can use (read) any reserved variable, but Mesa may update them automatically and rely on them, so modify/update at your own risk. |
| 20 | +#### Private variables |
| 21 | +Any variables starting with an underscore (`_`) are considered private and for Mesa's internal use. We might use any of those. Modifying or overwriting any private variable is at your own risk. |
| 22 | + |
| 23 | +- Ref: [Discussion #2230](https://github.com/projectmesa/mesa/discussions/2230), [PR #2225](https://github.com/projectmesa/mesa/pull/2225) |
| 24 | + |
| 25 | + |
| 26 | +### Removal of `mesa.flat` namespace |
| 27 | +The `mesa.flat` namespace is removed. Use the full namespace for your imports. |
| 28 | + |
| 29 | +- Ref: [PR #2091](https://github.com/projectmesa/mesa/pull/2091) |
| 30 | + |
| 31 | + |
| 32 | +### Automatic assignment of `unique_id` to Agents |
| 33 | +<!-- TODO --> |
| 34 | + |
| 35 | +- Ref: [PR #2226](https://github.com/projectmesa/mesa/pull/2226) |
| 36 | + |
| 37 | + |
| 38 | +### AgentSet and `Model.agents` |
| 39 | +#### AgentSet |
| 40 | +<!-- TODO --> |
| 41 | + |
| 42 | +#### `Model.agents` |
| 43 | +<!-- TODO --> |
| 44 | + |
| 45 | + |
| 46 | +### Time and schedulers |
| 47 | +<!-- TODO general explanation--> |
| 48 | + |
| 49 | +#### Automatic increase of the `steps` counter |
| 50 | +The `steps` counter is now automatically increased. With each call to `Model.steps()` it's increased by 1, at the beginning of the step. |
| 51 | + |
| 52 | +You can access it by `Model.steps`, and it's internally in the datacollector, batchrunner and the visualisation. |
| 53 | + |
| 54 | +- Ref: [PR #2223](https://github.com/projectmesa/mesa/pull/2223), Mesa-examples [PR #161](https://github.com/projectmesa/mesa-examples/pull/161) |
| 55 | + |
| 56 | +#### Removal of `Model._time` and rename `._steps` |
| 57 | +- `Model._time` is removed. You can define your own time variable if needed. |
| 58 | +- `Model._steps` steps is renamed to `Model.steps`. |
| 59 | + |
| 60 | +#### Removal of `Model._advance_time()` |
| 61 | +- The `Model._advance_time()` method is removed. This now happens automatically. |
| 62 | + |
| 63 | +<!-- TODO deprecate all schedulers? --> |
| 64 | + |
| 65 | + |
| 66 | +### Visualisation |
| 67 | +<!-- TODO --> |
0 commit comments