Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Voronoi Tesselation based Discrete Space #2084

Open
wants to merge 49 commits into
base: main
Choose a base branch
from

Commits on Mar 20, 2024

  1. Configuration menu
    Copy the full SHA
    fa8c15d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    301a5ff View commit details
    Browse the repository at this point in the history

Commits on Mar 21, 2024

  1. deleted comments

    vitorfrois committed Mar 21, 2024
    Configuration menu
    Copy the full SHA
    a8a17ab View commit details
    Browse the repository at this point in the history

Commits on Mar 23, 2024

  1. incremented docstrings

    vitorfrois committed Mar 23, 2024
    Configuration menu
    Copy the full SHA
    7e4d79e View commit details
    Browse the repository at this point in the history
  2. added voronoi tests

    vitorfrois committed Mar 23, 2024
    Configuration menu
    Copy the full SHA
    8a892ee View commit details
    Browse the repository at this point in the history

Commits on Jul 15, 2024

  1. warn if placing already placed agent

    While it might be desired in a specific model to have the same agent
    be placed in multiple spots simultaneously, the typical use case is
    that one agent has one position at every given moment. This commit
    decorates the place_agent() method in a way that it emits a warning
    when called with an agent which already has a location.
    
    Fixes: projectmesa#1522
    puer-robustus authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    a079b95 View commit details
    Browse the repository at this point in the history
  2. ci: Use uv pip for faster build (projectmesa#2038)

    uv is a fast drop-in pip, pip-compile, virtualenv etc replacement created by the creator of Ruff.
    rht authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    6b8e760 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    63bffa4 View commit details
    Browse the repository at this point in the history
  4. Update Ruff to 0.3.4; apply ruff format . (projectmesa#2088)

    * Update Ruff to 0.3.4; apply ruff format .
    
    * [pre-commit.ci] auto fixes from pre-commit.com hooks
    
    for more information, see https://pre-commit.ci
    
    ---------
    
    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    2 people authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    1e6b37c View commit details
    Browse the repository at this point in the history
  5. docs: Fixes typos and header level error in introductory tutorial (pr…

    …ojectmesa#2087)
    
    This fixes
    - some minor grammatical errors,
    - an incorrect header indentation level,
    puer-robustus authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    c72dbff View commit details
    Browse the repository at this point in the history
  6. [pre-commit.ci] pre-commit autoupdate

    updates:
    - [github.com/astral-sh/ruff-pre-commit: v0.3.4 → v0.3.5](astral-sh/ruff-pre-commit@v0.3.4...v0.3.5)
    - [github.com/asottile/pyupgrade: v3.15.0 → v3.15.2](asottile/pyupgrade@v3.15.0...v3.15.2)
    pre-commit-ci[bot] authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    36adaff View commit details
    Browse the repository at this point in the history
  7. Support discrete event scheduling (projectmesa#2066)

    # Summary
    This PR adds an experiment feature that puts event scheduling at the heart of how MESA works. An earlier draft of this code was shown and discussed in projectmesa#2032. This code generalizes projectmesa#1890 by making discrete event scheduling central to how mesa models are run. This makes it trivial to maintain discrete time progression while allowing for event scheduling, thus making it possible to build hybrid ABM-DEVS models. 
    
    # Motive
    Agent-based models can be quite slow because, typically, they involve the activation of all agents at each tick. However, this can become very expensive if it can be known upfront that the agent is not active. Combining ABM tick-based activation with event scheduling makes it easy to avoid activating dormant agents. 
    
    For example, in Epstein's civil violence model, agents who are in jail need not be activated until they are released from jail. This release from jail can be scheduled as an event, thus avoiding unnecessary agent activations. Likewise, in Wolf-Sheep with grass, the regrowth of grass patches can be scheduled instead of activating all patches for each tick only to decrement a counter. 
    
    # Implementation
    The experimental feature adds three core new classes: Simulator, EventList, and SimulationEvent. 
    
    The simulator is analogous to a numerical solver for ODEs. Theoretically, the idea of a Simulator is rooted in the work of [Zeigler](https://www.sciencedirect.com/book/9780128133705/theory-of-modeling-and-simulation), The Simulator is responsible for controlling and advancing time. The EventList is a heapq sorted list of SimulationEvents. SimulationEvents are sorted based on their time of execution, their priority, and their unique_id. A SimulationEvent is, in essence, a callable that is to be executed at a particular simulation time instant. 
    
    This PR adds two specific simulators: ABMSimulator and DEVSSimulator. ABMSimulator uses integers as the base unit of time and automatically ensures that `model.step` is scheduled for each tick. DEVSSimulator uses float as the base unit of time. It allows for full discrete event scheduling. 
    
    Using these new classes requires a minor modification to a Model instance. It needs a simulator attribute to be able to schedule events. 
    
    # Usage
    The basic usage is straightforward as shown below. We instantiate an ABMSimulator, instantiate the model, and call `simulator.setup`. Next, we can run the model for, e.g., 100 time steps). 
    
    ```python
        simulator = ABMSimulator()
        
        model = WolfSheep(simulator,25, 25, 60, 40, 0.2, 0.1, 20, seed=15,)
    
        simulator.setup(model)
        simulator.run(100)
        print(model.time)  # prints 100
        simulator.run(50)  
        print(model.time)  # prints 150
    ```
    
    The simulator comes with a whole range of methods for scheduling events: `schedule_event_now`, `schedule_event_relative`, `schedule_event_absolute`, and the ABMSimulator also has a `schedule_event_next_tick`. See `experimental/devs/examples/*.*` for more details on how to use these methods.
    quaquel authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    a0de92f View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    6f99202 View commit details
    Browse the repository at this point in the history
  9. HISTORY.md: Update 2.3.0 notes

    EwoutH authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    d399cd1 View commit details
    Browse the repository at this point in the history
  10. Update version number and release notes for 2.3.0 release (projectmes…

    …a#2116)
    
    * Update version number and release notes for 2.3.0 release
    
    * Fix 2.3.0 date
    
    * [pre-commit.ci] auto fixes from pre-commit.com hooks
    
    for more information, see https://pre-commit.ci
    
    ---------
    
    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    2 people authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    e09d26b View commit details
    Browse the repository at this point in the history
  11. Make agent move to actual random closest position (projectmesa#2119)

    This fixes a bug in which move_agent_to_one_of is deterministic when pos has multiple closest choices and selection="closest".
    EwoutH authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    3f61d41 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    2066164 View commit details
    Browse the repository at this point in the history
  13. flocking benchmark: Remove unneeded passing of pos

    pos is not a part of the Boid init, which is causing an error. It can be safely removed, because it's already initialized the line below with `self.space.place_agent(boid, pos)`
    EwoutH authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    2b769c2 View commit details
    Browse the repository at this point in the history
  14. Set version to 3.0.0-dev

    Set the Mesa version to 3.0.0-dev for development towards 3.0!
    EwoutH authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    13633e6 View commit details
    Browse the repository at this point in the history
  15. CI: Add weekly scheduled run to all CI workflows

    Adds a weekly scheduled run to all CI workflows, which run each Monday at 06:00 UTC. A periodically scheduled run can detect errors and warnings appearing in changes in upstream dependencies or the build environment. By having a scheduled run they can be traced back easier to a dependency or environment change, then if they would pop up in a random PR.
    
    Also enabled triggering a run manually (the workflow_dispatch).
    EwoutH authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    ccb793e View commit details
    Browse the repository at this point in the history
  16. Drop support for Python 3.9, require Python >= 3.10 (projectmesa#2132)

    * Drop support for Python 3.9, require Python >= 3.10
    
    Starting development for Mesa 3.0 and following SPEC 0 we can drop Python 3.9 support and require Python 3.10 or higher for future development. This allows adopting more modern Python features and simplifies the testing and CI configurations.
    
    See the Python 3.10 release notes: https://docs.python.org/3/whatsnew/3.10.html
    
    The 2.3.x release series will keep supporting Python 3.9.
    
    * Update type hinting for Python 3.10
    
    `X | Y` can now be used for type annotations, including making a variable optional with `X | None`
    
    * intro_tutorial.ipynb: Require Python 3.10
    
    * typing: Replace Union with pipe (|)
    
    We can do this now in Python 3.10!
    EwoutH authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    c60ef30 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    e4684ac View commit details
    Browse the repository at this point in the history
  18. Set JupyterViz as stable

    rht authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    152b32c View commit details
    Browse the repository at this point in the history
  19. [pre-commit.ci] auto fixes from pre-commit.com hooks

    for more information, see https://pre-commit.ci
    pre-commit-ci[bot] authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    69802b1 View commit details
    Browse the repository at this point in the history
  20. datacollector: store separate snapshots of model data per step (proje…

    …ctmesa#2129)
    
    * datecollector: store separate snapshots of model data per step
    - Ensure `DataCollector` stores unique copies of the data at each model step.
    - Use `deepcopy` in `collect` method to avoid storing references that lead to each step holding the same data.
    - Fixes the issue where PropertyLayer data was stored identically for all steps, preventing accurate visualization and analysis of model progression.
    
    * datacollection: Add deepcopy comment
    EwoutH authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    c5feb55 View commit details
    Browse the repository at this point in the history
  21. [pre-commit.ci] pre-commit autoupdate (projectmesa#2131)

    updates:
    - [github.com/astral-sh/ruff-pre-commit: v0.3.5 → v0.4.3](astral-sh/ruff-pre-commit@v0.3.5...v0.4.3)
    - [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v4.6.0](pre-commit/pre-commit-hooks@v4.5.0...v4.6.0)
    
    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    pre-commit-ci[bot] authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    911c853 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    af59fdd View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    502b256 View commit details
    Browse the repository at this point in the history
  24. Add experimental features to the docs (projectmesa#2154)

    Adding the objects from experimental.cell_space and experimental.devs to the ReadTheDocs documentation.
    stephenfmann authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    1af245a View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    74cec55 View commit details
    Browse the repository at this point in the history
  26. [pre-commit.ci] auto fixes from pre-commit.com hooks

    for more information, see https://pre-commit.ci
    pre-commit-ci[bot] authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    069bfa1 View commit details
    Browse the repository at this point in the history
  27. [pre-commit.ci] pre-commit autoupdate (projectmesa#2151)

    updates:
    - [github.com/astral-sh/ruff-pre-commit: v0.4.3 → v0.5.0](astral-sh/ruff-pre-commit@v0.4.3...v0.5.0)
    - [github.com/asottile/pyupgrade: v3.15.2 → v3.16.0](asottile/pyupgrade@v3.15.2...v3.16.0)
    - [github.com/codespell-project/codespell: v2.2.6 → v2.3.0](codespell-project/codespell@v2.2.6...v2.3.0)
    
    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    pre-commit-ci[bot] authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    32407f1 View commit details
    Browse the repository at this point in the history
  28. Remove mesa.flat namespace (projectmesa#2091)

    This doesn't seem to be used as often as the current simple namespace.
    rht authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    b5d7d96 View commit details
    Browse the repository at this point in the history
  29. Fix pre-commit issues: Codespel and typecheck (projectmesa#2161)

    Fixes two things pre-commit detected:
    - Some codespell errors
    - A case of E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks
    EwoutH authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    5694d54 View commit details
    Browse the repository at this point in the history
  30. Remove visualization_old (mesa-viz-tornado) (projectmesa#2133)

    Removing the old, legacy visualisation. It will still be available in 2.3.x.
    
    Checkout the Visualization Tutorial (https://mesa.readthedocs.io/en/latest/tutorials/visualization_tutorial.html) to migrate to the new visualisation.
    rht authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    6fda3fc View commit details
    Browse the repository at this point in the history
  31. Jupyter_viz: Allow measures to be None (projectmesa#2163)

    Currently measures crashed when it's None (which is the default). The only way to circumvent this is adding [], but that's non-ideal and not obvious.
    
    This PR fixes that, so that measures can actually be the default value of None.
    
    This also proves we need to test Jupyter viz in notebooks, not only in console, since both have different code paths.
    EwoutH authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    27c2ce4 View commit details
    Browse the repository at this point in the history
  32. Extend visualization documentation (projectmesa#2162)

    - Add docstring to Jupyter viz module and functions
    - Render the docstring in Read the Docs: https://mesa.readthedocs.io/en/latest/apis/visualization.html
    EwoutH authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    95e8d81 View commit details
    Browse the repository at this point in the history
  33. Jupyter Viz: Don't avoid interactive backend (projectmesa#2165)

    * Jupyter Viz: Don't avoid interactive backend
    
    We were avoiding the interactive backend, but that isn't recommended anymore and Solara should take care of that itself.
    
    * [pre-commit.ci] auto fixes from pre-commit.com hooks
    
    for more information, see https://pre-commit.ci
    
    ---------
    
    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    2 people authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    0c0fb53 View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    ec4233a View commit details
    Browse the repository at this point in the history
  35. Set version to 3.0.0a0 and update release notes (projectmesa#2167)

    Sets the version to 3.0.0a0 for the first Mesa 3.0 pre-release, and updates the release notes with 2.3.1 and 3.0.0a0 changelog
    EwoutH authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    fb4177c View commit details
    Browse the repository at this point in the history
  36. Add .venv/ to .gitignore (projectmesa#2172)

    Don't track virtual environment files in Git
    EwoutH authored and vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    998965f View commit details
    Browse the repository at this point in the history
  37. Configuration menu
    Copy the full SHA
    a7090fc View commit details
    Browse the repository at this point in the history
  38. Configuration menu
    Copy the full SHA
    909831f View commit details
    Browse the repository at this point in the history
  39. var names

    vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    981473f View commit details
    Browse the repository at this point in the history
  40. voronoi visualization

    vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    5b66f73 View commit details
    Browse the repository at this point in the history
  41. Configuration menu
    Copy the full SHA
    554dc43 View commit details
    Browse the repository at this point in the history
  42. Configuration menu
    Copy the full SHA
    0939e3c View commit details
    Browse the repository at this point in the history
  43. added voronoi tests

    vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    ab1d1b6 View commit details
    Browse the repository at this point in the history
  44. added voronoi tests

    vitorfrois committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    c2d7379 View commit details
    Browse the repository at this point in the history