Skip to content

examples: Sugerscape_g1mt is missing input Model Params (Sliders etc.) #2486

Closed
@EwoutH

Description

@EwoutH

The Sugerscape_g1mt app.py is missing any input Model Params (like Sliders etc.) to play with in the visualisation.

model_params = {
"width": 50,
"height": 50,
}

I tried to add these:

model_params = {
    # Grid parameters
    "width": Slider("Grid Width", value=50, min=20, max=100, step=10),
    "height": Slider("Grid Height", value=50, min=20, max=100, step=10),

    # Population parameters
    "initial_population": Slider("Initial Population", value=200, min=50, max=500, step=10),

    # Agent endowment parameters
    "endowment_min": Slider("Min Initial Endowment", value=25, min=5, max=30, step=1),
    "endowment_max": Slider("Max Initial Endowment", value=50, min=30, max=100, step=1),

    # Metabolism parameters
    "metabolism_min": Slider("Min Metabolism", value=1, min=1, max=3, step=1),
    "metabolism_max": Slider("Max Metabolism", value=5, min=3, max=8, step=1),

    # Vision parameters
    "vision_min": Slider("Min Vision", value=1, min=1, max=3, step=1),
    "vision_max": Slider("Max Vision", value=5, min=3, max=8, step=1),

    # Trade parameter
    "enable_trade": {"type": "Checkbox", "value": True, "label": "Enable Trading"},
}

But modifying things lead to all kinds of error and unexpected behavior. For example, changing the width only did so partially (and apparently the height instead of the width):

image

I suspect that's due to the model first being initialized (with model1 = SugarscapeG1mt()), and then the slider value being modified.

CC @Corvince

Metadata

Metadata

Assignees

No one assigned

    Labels

    exampleChanges the examples or adds to them.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions