You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/migration_guide.md
+103-2Lines changed: 103 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,13 +3,114 @@ This guide contains breaking changes between major Mesa versions and how to reso
3
3
4
4
Non-breaking changes aren't included, for those see our [Release history](https://github.com/projectmesa/mesa/releases).
5
5
6
+
## Mesa 3.3.0
7
+
8
+
Mesa 3.3.0 is a visualization upgrade introducing a new and improved API, full support for both `altair` and `matplotlib` backends, and resolving several recurring issues from previous versions.
9
+
For full details on how to visualize your model, refer to the [Mesa Documentation](https://mesa.readthedocs.io/latest/tutorials/4_visualization_basic.html).
6
10
7
-
## Mesa 3.0
8
-
Mesa 3.0 introduces significant changes to core functionalities, including agent and model initialization, scheduling, and visualization. The guide below outlines these changes and provides instructions for migrating your existing Mesa projects to version 3.0.
9
11
10
12
_This guide is a work in progress. The development of it is tracked in [Issue #2233](https://github.com/projectmesa/mesa/issues/2233)._
11
13
12
14
15
+
### Defining Portrayal Components
16
+
Previously, `agent_portrayal` returned a dictionary. Now, it returns an instance of a dedicated portrayal component called `AgentPortrayalStyle`.
17
+
18
+
```python
19
+
# Old
20
+
defagent_portrayal(agent):
21
+
return {
22
+
"color": "white"if agent.state ==0else"black",
23
+
"marker": "s",
24
+
"size": "30"
25
+
}
26
+
27
+
# New
28
+
defagent_portrayal(agent):
29
+
return AgentPortrayalStyle(
30
+
color="white"if agent.state ==0else"black",
31
+
marker="s",
32
+
size=30,
33
+
)
34
+
```
35
+
36
+
Similarly, `propertylayer_portrayal` has moved from a dictionary-based interface to a function-based one, following the same pattern as `agent_portrayal`. It now returns a `PropertyLayerStyle` instance instead of a dictionary.
While the visualization methods from Mesa versions before 3.3.0 still work, version 3.3.0 introduces `SpaceRenderer`, which changes how space visualizations are rendered. Check out the updated [Mesa documentation](https://mesa.readthedocs.io/latest/tutorials/4_visualization_basic.html) for guidance on upgrading your model’s visualization using `SpaceRenderer`.
62
+
63
+
A basic example of how `SpaceRenderer` works:
64
+
65
+
```python
66
+
# Old
67
+
from mesa.visualization import SolaraViz, make_space_component
Version 3.3.0 adds support for defining pages for different plot components. Learn more in the [Mesa documentation](https://mesa.readthedocs.io/latest/tutorials/6_visualization_rendering_with_space_renderer.html).
92
+
93
+
In short, you can define multiple pages using the following syntax:
94
+
95
+
```python
96
+
from mesa.visualization import SolaraViz, make_plot_component
Mesa 3.0 introduces significant changes to core functionalities, including agent and model initialization, scheduling, and visualization. The guide below outlines these changes and provides instructions for migrating your existing Mesa projects to version 3.0.
112
+
113
+
13
114
### Upgrade strategy
14
115
We recommend the following upgrade strategy:
15
116
- Update to the latest Mesa 2.x release (`mesa<3`).
0 commit comments