mirror of
https://github.com/gsi-upm/soil
synced 2025-08-24 03:52:20 +00:00
Big refactor v0.30
All test pass, except for the TestConfig suite, which is not too critical as the plan for this version onwards is to avoid configuration as much as possible.
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
---
|
||||
name: mesa_sim
|
||||
group: tests
|
||||
dir_path: "/tmp"
|
||||
num_trials: 3
|
||||
max_steps: 100
|
||||
interval: 1
|
||||
seed: '1'
|
||||
model_class: social_wealth.MoneyEnv
|
||||
model_params:
|
||||
generator: social_wealth.graph_generator
|
||||
agents:
|
||||
topology: true
|
||||
distribution:
|
||||
- agent_class: social_wealth.SocialMoneyAgent
|
||||
weight: 1
|
||||
N: 10
|
||||
width: 50
|
||||
height: 50
|
7
examples/mesa/mesa_sim.py
Normal file
7
examples/mesa/mesa_sim.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from soil import Simulation
|
||||
from social_wealth import MoneyEnv, graph_generator
|
||||
|
||||
sim = Simulation(name="mesa_sim", dry_run=True, max_steps=10, interval=2, model=MoneyEnv, model_params=dict(generator=graph_generator, N=10, width=50, height=50))
|
||||
|
||||
if __name__ == "__main__":
|
||||
sim.run()
|
@@ -1,5 +1,5 @@
|
||||
from mesa.visualization.ModularVisualization import ModularServer
|
||||
from soil.visualization import UserSettableParameter
|
||||
from mesa.visualization.UserParam import Slider, Choice
|
||||
from mesa.visualization.modules import ChartModule, NetworkModule, CanvasGrid
|
||||
from social_wealth import MoneyEnv, graph_generator, SocialMoneyAgent
|
||||
import networkx as nx
|
||||
@@ -64,8 +64,7 @@ chart = ChartModule(
|
||||
)
|
||||
|
||||
model_params = {
|
||||
"N": UserSettableParameter(
|
||||
"slider",
|
||||
"N": Slider(
|
||||
"N",
|
||||
5,
|
||||
1,
|
||||
@@ -73,8 +72,7 @@ model_params = {
|
||||
1,
|
||||
description="Choose how many agents to include in the model",
|
||||
),
|
||||
"height": UserSettableParameter(
|
||||
"slider",
|
||||
"height": Slider(
|
||||
"height",
|
||||
5,
|
||||
5,
|
||||
@@ -82,8 +80,7 @@ model_params = {
|
||||
1,
|
||||
description="Grid height",
|
||||
),
|
||||
"width": UserSettableParameter(
|
||||
"slider",
|
||||
"width": Slider(
|
||||
"width",
|
||||
5,
|
||||
5,
|
||||
@@ -91,8 +88,7 @@ model_params = {
|
||||
1,
|
||||
description="Grid width",
|
||||
),
|
||||
"agent_class": UserSettableParameter(
|
||||
"choice",
|
||||
"agent_class": Choice(
|
||||
"Agent class",
|
||||
value="MoneyAgent",
|
||||
choices=["MoneyAgent", "SocialMoneyAgent"],
|
||||
|
Reference in New Issue
Block a user