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
docs: Add space and time advancement sections to overview
Expand the Mesa overview documentation to fully cover all core features:
- Add comprehensive section on spaces including grid-based, network, and
Voronoi spaces, with code examples
- Add section on property layers and continuous space functionality
- Add new section on time advancement covering basic steps, agent
activation patterns, and event-based scheduling
- Include practical code examples demonstrating each feature
- Maintain consistency with existing documentation style and structure
This update brings the overview in line with Mesa's paper, ensuring all
major features are properly documented in one place.
high_ground = grid.elevation.select_cells(lambdax: x >50)
84
+
```
85
+
86
+
#### Continuous Space
87
+
For models requiring continuous movement:
88
+
89
+
```python
90
+
# Create a continuous space
91
+
space = mesa.space.ContinuousSpace(x_max, y_max, torus=True)
92
+
93
+
# Move an agent to specific coordinates
94
+
space.move_agent(agent, (new_x, new_y))
51
95
```
52
96
53
-
You should see agents 1-5, activated in random order. See the [tutorial](tutorials/intro_tutorial) or API documentation for more detail on how to add model functionality.
97
+
### Time Advancement and Agent Activation
98
+
99
+
Mesa supports multiple approaches to advancing time and activating agents:
100
+
101
+
#### Basic Time Steps
102
+
The simplest approach runs the model for a specified number of steps:
54
103
104
+
```python
105
+
model = MyModel(seed=42)
106
+
for _ inrange(100):
107
+
model.step()
108
+
```
109
+
110
+
#### Agent Activation Patterns
111
+
Mesa 3.0 provides flexible agent activation through the AgentSet API:
112
+
113
+
```python
114
+
# Sequential activation
115
+
model.agents.do("step")
116
+
117
+
# Random activation
118
+
model.agents.shuffle_do("step")
119
+
120
+
# Multi-stage activation
121
+
for stage in ["move", "eat", "reproduce"]:
122
+
model.agents.do(stage)
123
+
124
+
# Activation by agent type
125
+
for klass in model.agent_types:
126
+
model.agents_by_type[klass].do("step")
127
+
```
128
+
129
+
#### Event-Based Scheduling
130
+
Mesa also supports event-based time progression (experimental):
0 commit comments