Skip to content

Commit

Permalink
add seed to all examples (#2496)
Browse files Browse the repository at this point in the history
  • Loading branch information
quaquel authored Nov 13, 2024
1 parent 3ee7813 commit 66d2fee
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 7 deletions.
5 changes: 5 additions & 0 deletions mesa/examples/advanced/epstein_civil_violence/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ def post_process(ax):


model_params = {
"seed": {
"type": "InputText",
"value": 42,
"label": "Random Seed",
},
"height": 40,
"width": 40,
"citizen_density": Slider("Initial Agent Density", 0.7, 0.0, 0.9, 0.1),
Expand Down
5 changes: 5 additions & 0 deletions mesa/examples/advanced/pd_grid/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ def pd_agent_portrayal(agent):

# Model parameters
model_params = {
"seed": {
"type": "InputText",
"value": 42,
"label": "Random Seed",
},
"width": Slider("Grid Width", value=50, min=10, max=100, step=1),
"height": Slider("Grid Height", value=50, min=10, max=100, step=1),
"activation_order": {
Expand Down
9 changes: 7 additions & 2 deletions mesa/examples/advanced/sugarscape_g1mt/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ def portray(g):


model_params = {
"seed": {
"type": "InputText",
"value": 42,
"label": "Random Seed",
},
"width": 50,
"height": 50,
# Population parameters
Expand All @@ -66,10 +71,10 @@ def portray(g):
"enable_trade": {"type": "Checkbox", "value": True, "label": "Enable Trading"},
}

model1 = SugarscapeG1mt()
model = SugarscapeG1mt()

page = SolaraViz(
model1,
model,
components=[SpaceDrawer, make_plot_component(["Trader", "Price"])],
model_params=model_params,
name="Sugarscape {G1, M, T}",
Expand Down
5 changes: 5 additions & 0 deletions mesa/examples/basic/boid_flockers/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ def boid_draw(agent):


model_params = {
"seed": {
"type": "InputText",
"value": 42,
"label": "Random Seed",
},
"population": Slider(
label="Number of boids",
value=100,
Expand Down
10 changes: 5 additions & 5 deletions mesa/examples/basic/boltzmann_wealth_model/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ def agent_portrayal(agent):


model_params = {
"seed": {
"type": "InputText",
"value": 42,
"label": "Random Seed",
},
"n": {
"type": "SliderInt",
"value": 50,
Expand All @@ -20,11 +25,6 @@ def agent_portrayal(agent):
"max": 100,
"step": 1,
},
"seed": {
"type": "InputText",
"value": 42,
"label": "Random Seed",
},
"width": 10,
"height": 10,
}
Expand Down
5 changes: 5 additions & 0 deletions mesa/examples/basic/conways_game_of_life/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ def post_process(ax):


model_params = {
"seed": {
"type": "InputText",
"value": 42,
"label": "Random Seed",
},
"width": {
"type": "SliderInt",
"value": 50,
Expand Down
5 changes: 5 additions & 0 deletions mesa/examples/basic/schelling/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ def agent_portrayal(agent):


model_params = {
"seed": {
"type": "InputText",
"value": 42,
"label": "Random Seed",
},
"density": Slider("Agent density", 0.8, 0.1, 1.0, 0.1),
"minority_pc": Slider("Fraction minority", 0.2, 0.0, 1.0, 0.05),
"homophily": Slider("Homophily", 3, 0, 8, 1),
Expand Down
5 changes: 5 additions & 0 deletions mesa/examples/basic/virus_on_network/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ def get_resistant_susceptible_ratio(model):


model_params = {
"seed": {
"type": "InputText",
"value": 42,
"label": "Random Seed",
},
"num_nodes": Slider(
label="Number of agents",
value=10,
Expand Down

0 comments on commit 66d2fee

Please sign in to comment.