AB-CE / examples

Repos for examples of abcEconomics simulations that can be extended from
Apache License 2.0
29 stars 23 forks source link

Update one_household_one_firm_with_logic #10

Open rht opened 4 years ago

rht commented 4 years ago

This still have a remaining error

Traceback (most recent call last):
  File "start.py", line 48, in <module>
    main(parameters)
  File "start.py", line 23, in main
    households = simulation.build_agents(
  File "/home/rht/code/venv/lib/python3.8/site-packages/abcEconomics/__init__.py", line 311, in build_agents
    group.create_agents(AgentClass, agent_parameters=agent_parameters, **parameters)
  File "/home/rht/code/venv/lib/python3.8/site-packages/abcEconomics/group.py", line 209, in create_agents
    new_names = self._scheduler.add_agents(Agent, common_parameters, agent_parameters, self._agent_arguments, self.num_agents)
  File "/home/rht/code/venv/lib/python3.8/site-packages/abcEconomics/scheduler/singleprocess.py", line 38, in add_agents
    agent.init(**ChainMap(simulation_parameters, ap))
TypeError: init() got an unexpected keyword argument 'parameters'

@DavoudTaghawiNejad ?

shaaanya commented 2 years ago

This issue still exists. More specifically in example with one firm and one household, when we create household in main() function it calls simulation.build_agents(), which, according to declaration of class Simulation (link) declared as following: def build_agents(self, AgentClass, group_name, number=None, agent_parameters=None, **parameters):

In example, it's called as: households = simulation.build_agents( Household, 'household', number=1, parameters=parameters).

rht commented 2 years ago

I think I will re-implement the examples with Mesa's StagedActivation. abcEconomics' scheduler is too complex.