Skip to content

Commit

Permalink
make boltzmann-wealth-model-network standards-compliant
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed May 14, 2018
1 parent 8ddf2cb commit dec865b
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ def compute_gini(model):
return 1 + (1 / N) - 2 * B


class MoneyModel(Model):
class BoltzmannWealthModelNetwork(Model):
"""A model with some number of agents."""

def __init__(self, num_agents, num_nodes):
def __init__(self, num_agents=7, num_nodes=10):

self.num_agents = num_agents
self.num_nodes = num_nodes if num_nodes >= self.num_agents else self.num_agents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from mesa.visualization.UserParam import UserSettableParameter
from mesa.visualization.modules import ChartModule
from mesa.visualization.modules import NetworkModule
from .model import MoneyModel
from .model import BoltzmannWealthModelNetwork


def network_portrayal(G):
Expand Down Expand Up @@ -41,5 +41,5 @@ def network_portrayal(G):
"least the same number of agents")
}

server = ModularServer(MoneyModel, [grid, chart], "Money Model", model_params)
server = ModularServer(BoltzmannWealthModelNetwork, [grid, chart], "Money Model", model_params)
server.port = 8521
2 changes: 1 addition & 1 deletion examples/boltzmann_wealth_model_network/run.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from wealth_model.server import server
from boltzmann_wealth_model_network.server import server

server.launch()
6 changes: 0 additions & 6 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ def test_examples(self):
model = Model()
(model.step() for _ in range(100))

def test_boltzmann_wealth_model_network(self):
with self.active_example_dir('boltzmann_wealth_model_network'):
from wealth_model.model import MoneyModel
model = MoneyModel(100, 100)
(model.step() for _ in range(100))

def test_color_patches(self):
with self.active_example_dir('color_patches'):
from color_patches.model import ColorPatchModel
Expand Down

0 comments on commit dec865b

Please sign in to comment.