InteractiveDynamics.jl icon indicating copy to clipboard operation
InteractiveDynamics.jl copied to clipboard

reinitialize button in Agents.jl interactive apps

Open Datseris opened this issue 3 years ago • 4 comments

It would be nice if we had a button that has functionality similar to reset, but a bit different. Sometimes, you would like to reset a model, but to a different state that the original one. This new initial state would typically depend on the model parameters that are being adjusted by sliders.

I propose that we allow a new keyword, reinit whose value is a function that takes in current model and returns a new one (current model also has current parameter configuration). If the keyword is given, we have one more button that is reinit.

A typical application scenario: I have a simulation of the schelling model set up, and I would like to change the initial agent distribution so that I have 2 groups instead of 3.

Datseris avatar Jun 16 '22 13:06 Datseris

I think this is a good idea, but the naming might need to be given a little more thought.

Basically what you're proposing is that instead of having to hit reset then update, you can just hit this new button, so it saves you a click.

Maybe the naming could be: update -> update in-place reinit -> update and reset

hbsmith avatar Sep 14 '22 01:09 hbsmith

Basically what you're proposing is that instead of having to hit reset then update, you can just hit this new button, so it saves you a click.

No, not at all. Reset allways brings system to default initial state and changing the parameter container. Reinit generates a brand new initial state that is a function of the current parameter status.

Datseris avatar Sep 14 '22 08:09 Datseris

Oh good, this is more in line with the kind of functionality I initially thought would be available when I started looking into the interactivity options. Are you imagining being able to also alter the space, and number of agents, etc?

hbsmith avatar Sep 14 '22 08:09 hbsmith

I propose that we allow a new keyword, reinit whose value is a function that takes in current model and returns a new one (current model also has current parameter configuration). If the keyword is given, we have one more button that is reinit.

You can change the values of anything you want. You can't change types. Space is a type.

Datseris avatar Sep 14 '22 08:09 Datseris