-
-
Notifications
You must be signed in to change notification settings - Fork 245
Expand file tree
/
Copy pathapp.py
More file actions
46 lines (40 loc) · 1.17 KB
/
app.py
File metadata and controls
46 lines (40 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from mesa.visualization import SolaraViz, make_plot_component
# Use relative import consistent with model.py
from .model import HierarchicalOrganizationModel
model_params = {
"num_departments": {
"type": "SliderInt",
"value": 3,
"min": 1,
"max": 8,
"step": 1,
"label": "Number of Departments",
},
"employees_per_department": {
"type": "SliderInt",
"value": 5,
"min": 1,
"max": 15,
"step": 1,
"label": "Employees per Department",
},
"shock_probability": {
"type": "SliderFloat",
"value": 0.05,
"min": 0.0,
"max": 0.5,
"step": 0.01,
"label": "Shock Probability",
},
}
# NOTE: SolaraViz instantiates the model itself using model_params.
# Do NOT instantiate the model here manually — pass the class instead.
model = HierarchicalOrganizationModel()
main_plot = make_plot_component(["Total Output", "Avg Department Performance"])
shock_plot = make_plot_component(["Shock Event"])
page = SolaraViz(
model,
components=[main_plot, shock_plot],
model_params=model_params,
name="Hierarchical Organization Model",
)