Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
quaquel authored Feb 5, 2025
2 parents 7bdbc18 + 061de7a commit a380bc6
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ci:
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.8.6
rev: v0.9.4
hooks:
# Run the linter.
- id: ruff
Expand All @@ -25,7 +25,7 @@ repos:
- id: check-toml
- id: check-yaml
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.1
hooks:
- id: codespell
args: [
Expand Down
2 changes: 1 addition & 1 deletion binder/environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: example-environment
name: mesa-tutorials
channels:
- conda-forge
dependencies:
Expand Down
3 changes: 2 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ For help getting started with Mesa, check out these resources:
- [Getting started] - Learn about Mesa's core concepts and components
- [Migration Guide] - Upgrade to Mesa 3.0
- [Mesa Examples] - Browse user-contributed models and implementations
- [Mesa Extensions] - Overview of mesa's Extensions
- [GitHub Discussions] - Ask questions and discuss Mesa
- [Matrix Chat Room] - Real-time chat with the Mesa community

Expand Down Expand Up @@ -96,4 +97,4 @@ API Documentation <apis/api_main>
[mesa visualization tutorial]: tutorials/visualization_tutorial
[migration guide]: migration_guide
[Getting started]: getting_started

[Mesa Extensions]: mesa_extension.md
97 changes: 97 additions & 0 deletions docs/mesa_extension.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Mesa Extensions Overview

This contains an overview of Mesa Extensions. Mesa's extensibility is a key feature that allows users to enhance functionality, improve scalability, and foster innovation in agent-based modeling.


## Mesa-Geo 🌍

**Field:** Geographic Information Systems (GIS)

---
**Description:**
Mesa-Geo is an extension of the Mesa framework designed to facilitate working with geographic data in agent-based modeling. It introduces a **GeoSpace** to host **GeoAgents**, which are enhanced agents that include a `geometry` attribute ([a Shapely object](https://shapely.readthedocs.io/en/latest/manual.html)) and a `crs` attribute (Coordinate Reference System). These attributes enable the integration of geographic and spatial data into simulations. Geometries can be defined manually using Shapely or imported from various sources, such as vector data files (e.g., shapefiles), GeoJSON objects, or GeoPandas GeoDataFrames.

---
**Key Features:**
- **Spatial Reference Systems Support:** Mesa-Geo handles coordinate reference systems (CRS), which is essential for working with geographic data in various projections.
- **Geometric Operations Support:** Mesa-Geo utilizes Shapely, which provides robust tools for creating and manipulating geometric shapes like points, polygons, and lines.
- **Topological Operations Support:** Functions for analyzing spatial relationships between geometries.

---
**Author(s):** Wang Boyu

---
**Additional Resources:**
For more information, visit the official [Mesa-Geo repository](https://github.com/projectmesa/mesa-geo?tab=readme-ov-file).

---

## Mesa Examples 📊

**Description:**
Mesa Examples provide a collection of models and use cases demonstrating the features and capabilities of the Mesa framework for agent-based modeling. These examples include core and user-submitted models covering a variety of domains like grid spaces, networks, visualization, and GIS.

---

**Key Features:**
- **Core Examples:** Fully tested and updated models included directly with the Mesa framework.
- **User Examples:** Community-contributed models showcasing advanced and diverse use cases.
- **Extensive Coverage:** Examples for grid spaces, GIS integration, networks, visualization, and more.
- **Easy Access:** Available directly from the Mesa package or via installation from the repository.

---

**Author(s):** Contributions from the Mesa developer community.

---

**Examples Include:**
- **Grid Space:** Models like Bank Reserves, Conway’s Game of Life, and Forest Fire.
- **GIS:** GeoSchelling Models, Urban Growth, and Population Models.
- **Network:** Boltzmann Wealth Model and Ant System for the Traveling Salesman Problem.
- **Visualization:** Charting tools and grid displays.

---

**For More Information:**
For more Detail, Visit the [Mesa Examples Repository](https://github.com/projectmesa/mesa/tree/main/mesa/examples).

---

## **Mesa-Frames** 🚀

**Description:**
Mesa-Frames is an extension of the Mesa framework designed to handle complex simulations with thousands of agents. By utilizing DataFrames (pandas or Polars), it enhances scalability and performance while maintaining a syntax similar to Mesa.

---

**Key Features:**
- **Enhanced Performance:** Uses DataFrames for SIMD processing and vectorized functions to speed up simulations.
- **Backend Support:** Supports `pandas` (ease of use) and `Polars` (performance innovations with Rust-based backend).
- **Seamless Integration:** Maintains a similar API and functionality as the base Mesa framework for easier adoption.
- **In-Place Operations:** Functional programming and fast memory-efficient copy methods.
- **Future Plans:** GPU functionality, automatic model vectorization, and backend-independent AgentSet class.

---

**Usage:**
- Define agents using `AgentSetPandas` or `AgentSetPolars`.
- Implement models by subclassing `ModelDF`.
- Perform vectorized operations to enhance simulation performance.

---

**Author(s):**
Developed and maintained by the Mesa development community.

---

**License:**
Distributed under the MIT License.

---

**More Information:**
Visit the [GitHub Repository](https://github.com/projectmesa/mesa-frames).

---
1 change: 1 addition & 0 deletions mesa/visualization/mpl_space_drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ def draw_property_layers(
rgba_colors[:, 3] = normalized_colors * alpha
else:
rgba_colors = cmap(norm(colors))
rgba_colors[..., 3] *= alpha

# Draw hexagons
collection = PolyCollection(hexagons, facecolors=rgba_colors, zorder=-1)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,9 @@ def test_method(self):
original_order = list(agentset)
shuffled_order = []
agentset.shuffle_do(lambda agent: shuffled_order.append(agent))
assert (
original_order != shuffled_order
), "The order should be different after shuffle_do"
assert original_order != shuffled_order, (
"The order should be different after shuffle_do"
)

class AgentWithRemove(Agent):
def __init__(self, model):
Expand Down

0 comments on commit a380bc6

Please sign in to comment.