Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
incorporate feedback
  • Loading branch information
Logende committed Dec 27, 2022
commit fcdddc0e8d4a07de07724c77a45f993bab967152
6 changes: 4 additions & 2 deletions examples/caching_and_replay/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ To run the model interactively, run ``mesa runserver`` in this directory. e.g.

Then open your browser to [http://127.0.0.1:8521/](http://127.0.0.1:8521/) and press Reset, then Run.

After running a regular simulation, you can **replay** your latest cached simulation run by first enabling the Replay switch and then pressing Reset.
Note that this **requires the previous simulation run to have finished** (e.g. all agents are happy, no more new steps are simulated).
First, run the **simulation** with the 'Replay' switch disabled.
When the simulation run is finished (e.g. all agents are happy, no more new steps are simulated), the run will automatically be stored in a cache file.

Next, **replay** your latest cached simulation run by enabling the Replay switch and then pressing Reset.

## Files

Expand Down
6 changes: 2 additions & 4 deletions examples/caching_and_replay/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ def get_cache_file_status(_):
Display an informational text about caching and the status of the cache file (existing versus not existing)
"""
return (
f"This example writes every simulation run into a cache file. Cached runs can be replayed later. "
f"Activate the 'Replay cached run?' toggle to replay the latest cached run. "
f"Only activate the replay when a cache file already exists, otherwise it will fail. Cache file existing: "
f"'{os.path.exists('my_cache_file_path.cache')}'."
f"Only activate the 'Replay cached run?' switch when a cache file already exists, otherwise it will fail. "
f"Cache file existing: '{os.path.exists('my_cache_file_path.cache')}'."
)


Expand Down