projectmesa / mesa-viz-tornado

Apache License 2.0
2 stars 8 forks source link

Change model parameters dynamically while the model is running #44

Open rajithv opened 10 months ago

rajithv commented 10 months ago

What's the problem this feature will solve? Currently the changing model parameters with UserParams comes into effect when resetting the model. But for some usecases it would be interesting to change the model parameters while the model is in progress. I propose to change model parameters dynamically using UserParams.

Describe the solution you'd like To ModularServer constructor add an is_dynamic argument. If is_dynamic is on, when a submit_params message is received, while updating kwargs, also change the currently running model's parameters as well.

Additional context I do quite a bit a policy modelling, and it's always useful to observe how agent behaviour changes when a policy change comes into effect. I believe this can be easily incorporated by making some simple changes to mesa-viz-tornado code.

I've overridden these for my personal use. If this is something the community would like, I can send through a pull request.