def main(parameters): simulation = Simulation(processes=1) simulation.declare_round_endowment(resource='adult', units=1, product='labor') simulation.declare_perishable(good='labor') firms = simulation.build_agents(Firm, 'firm', number=parameters['num_firms']) households = simulation.build_agents(Household, 'household', number=1, parameters=parameters) try: for rnd in range(parameters['rounds']): simulation.advance_round(rnd) households.sell_labor() firms.buy_labor() firms.production() firms.panel_log(possessions=['money', 'GOOD'], variables=['price', 'inventory']) firms.quotes() households.buy_goods() firms.sell_goods() households.agg_log(possessions=['money', 'GOOD'], variables=['current_utiliy']) households.consumption() firms.adjust_price() except Exception as e: print(e)
def main(): for params in simulation_parameters: s = Simulation(params) s.declare_round_endowment('field', 60, 'corn') s.declare_round_endowment('shares', 60, 'money') f = s.build_agents(Firm, 'firm', 1) h = s.build_agents(Household, 'household', 1) for r in s.next_round(): for i in range(60): f.do('selling') h.do('buying') h.do('checking') s.run()
def main(): for params in simulation_parameters: s = Simulation(params) s.declare_round_endowment('field', 60, 'corn') s.declare_round_endowment('shares', 60, 'money') f = s.build_agents(Firm, 'firm', 1) h = s.build_agents(Household, 'household', 1) for r in s.next_round(): for i in range(60): f.do('selling') h.do('buying') h.do('checking') s.run()