projectmesa / mesa

Mesa is an open-source Python library for agent-based modeling, ideal for simulating complex systems and exploring emergent behaviors.
https://mesa.readthedocs.io
Apache License 2.0
2.55k stars 897 forks source link

Issue with slider updating model #922

Open sneha-lodha opened 4 years ago

sneha-lodha commented 4 years ago

I am trying to use a slider in the following way, and my problem is that even if I move the slider, it only updates the value for that variable after I reset the who simulation. Is this suppose to happen or am I making a mistake in my implementation.

flow_slider = UserSettableParameter('slider', "% traffic flow", 15, 1, 100, 5) canvas = CanvasGrid(agent_portrayal, 25, 25, 750, 750) server = ModularServer(Grid, [canvas], 'Traffic Flow Model', model_params= {"flow_percentage":flow_slider})

Corvince commented 4 years ago

Hi there,

yes, you are doing everything correct. Currently there is no way to update the variables without a restart. It's on our agenda and you might be interested to keep an eye on mesa-viz. It's alternative front-end for mesa I am currently working on. One of the features will be to change parameters without a reset. But it is not there yet (actually it doesn't let you change parameters at all at the moment ;) )