projectmesa / mesa-examples

Seminal agent-based models developed using Mesa
Other
105 stars 123 forks source link

Improve Caching and Replay Example #102

Closed coderbeta1 closed 4 months ago

coderbeta1 commented 4 months ago

Changes Made:

  1. Links Update: The previous link did not work. I updated it to make it work
  2. Run Method: Added a new run method
  3. General Cleaning: Made the code a bit more readable for beginners
  4. Custom Playback: Added a feature to allow user to choose which file they want to playback when replay is true. (Note user cannot choose the save file name, but they can choose what file to playback by changing the model parameter)
  5. Unique_id: Added a unique id to each agent
  6. Doc String: Added details of the model class

Discussion Topic:

While it is possible to now replay models, I feel there are still some things that can be improved,

  1. It is currently not easy to set custom save name for the checkpoint
  2. It is kinda inconvenient to make a new class just to save a file. I think the code could be optimised to make it as simple as something like "pickle.dump". This way it would be easy to save multiple conditional checkpoints in one run. (EDIT: I just noticed it is already under plans in GSOC idea list)
coderbeta1 commented 4 months ago

pre-commit.ci autofix

rht commented 4 months ago

Other than the comments, everything else LGTM.