Exemplo n.º 1
0
def main(simulation_parameters):
        simulation = Simulation(rounds=simulation_parameters['rounds'])

        simulation.declare_round_endowment(resource={'labor_endowment': 1},
                                           product='labor')

        simulation.declare_perishable(good='labor')

        simulation.aggregate('household', possessions=[],  # put a list of household possessions to track here
                                      variables=['count']) # put a list of household possessions to track here

        simulation.aggregate('firm', possessions=[],  # put a list of household possessions to track here
                                      variables=['count']) # put a list of household possessions to track here

        firms = simulation.build_agents(Firm, 'firm',
                       number=simulation_parameters['firms'],
                       parameters=simulation_parameters)

        households = simulation.build_agents(Household, 'household',
                       number=simulation_parameters['households'],
                       parameters=simulation_parameters)

        messengers = simulation.build_agents(Messenger, 'messenger', 1)

        for r in simulation.next_round():
            messengers.do('messaging')
            (firms+households).do('receive_message')
            firms.do('add_household')
            firms.do('add_firm')
            firms.do('print_id')
            households.do('print_id')
            # this instructs ABCE to save panel data as declared below
            (firms+households).do('aggregate')
        simulation.graphs()
Exemplo n.º 2
0
def main(parameters):
    simulation = Simulation(rounds=parameters['rounds'], processes=1)
    simulation.declare_round_endowment(resource='adult', units=1, product='labor')
    simulation.declare_perishable(good='labor')

    simulation.aggregate('household', possessions=['money', 'GOOD'],
                         variables=['current_utiliy'])
    simulation.panel('firm', possessions=['money', 'GOOD'],
                    variables=['price', 'inventory'])

    firms = simulation.build_agents(Firm, 'firm', number=parameters['num_firms'])
    households = simulation.build_agents(Household, 'household', number=1, parameters=parameters)

    for r in simulation.next_round():
        households.do('sell_labor')
        firms.do('buy_labor')
        firms.do('production')
        firms.do('panel')
        firms.do('quotes')
        households.do('buy_goods')
        firms.do('sell_goods')
        households.do('aggregate')
        households.do('consumption')
        firms.do('adjust_price')

    simulation.graphs()
Exemplo n.º 3
0
def main(simulation_parameters):
        simulation = Simulation(rounds=simulation_parameters['rounds'])
        simulation.declare_calendar(2000, 1, 1)
        simulation.panel('agent', possessions=['money'])
        simulation.aggregate('agent', possessions=['labor'])
        agents = simulation.build_agents(Agent, 'agent', number=1)

        for r in simulation.next_round():
            date = simulation._round
            if date.weekday() == 2:
                agents.do('wednessday')
            if date.day == 1:
                agents.do('first')
            if date.month == 12 and date.day == 31:
                agents.do('newyearseve')
            if date.day <= 7 and date.weekday() == 4:
                agents.do('firstfriday')
            if date.month == 15:
                agents.do('fiveteens')
            if date.toordinal() % 3 == 0:
                agents.do('everythreedays')
            agents.do('panel')
            agents.do('aggregate')

        simulation.graphs()
Exemplo n.º 4
0
def main(parameters):
    simulation = Simulation(rounds=parameters['rounds'], cores=1)
    action_list = [
        ('household', 'sell_labor'),
        ('firm', 'buy_labor'),
        ('firm', 'production'),
        ('firm', 'panel'),
        ('firm', 'quotes'),
        ('household', 'buy_goods'),
        ('firm', 'sell_goods'),
        ('household', 'aggregate'),
        ('household', 'consumption'),
        ('firm', 'adjust_price')]
    simulation.add_action_list(action_list)

    simulation.declare_round_endowment(resource='adult', units=1, product='labor')
    simulation.declare_perishable(good='labor')

    simulation.aggregate('household', possessions=['money', 'GOOD'],
                         variables=['current_utiliy'])
    simulation.panel('firm', possessions=['money', 'GOOD'],
                    variables=['price', 'inventory'])

    simulation.build_agents(Firm, 'firm', number=parameters['num_firms'])
    simulation.build_agents(Household, 'household', number=1, parameters=parameters)

    simulation.run()
    simulation.graphs()
Exemplo n.º 5
0
def main(simulation_parameters):
        simulation = Simulation(rounds=simulation_parameters['rounds'])
        action_list = [('killer', 'kill'),
                       ('agent', 'am_I_dead'),
                       ('killer', 'send_message'),
                       ('agent', 'aggregate'),
                       ('agent', 'panel')]  # this instructs ABCE to save panel data as declared below
        simulation.add_action_list(action_list)

        simulation.declare_round_endowment(resource='labor_endowment',
                                           units=1,
                                           product='labor'
        )
        simulation.declare_perishable(good='labor')

        simulation.aggregate('agent', possessions=[], variables=['count'])
        simulation.panel('agent', possessions=[], variables=['idn'])

        simulation.build_agents(Agent, 'agent',
                       number=simulation_parameters['agents'],
                       parameters=simulation_parameters)
        simulation.build_agents(Killer, 'killer',
                       number=1,
                       parameters=simulation_parameters)


        simulation.run()
        simulation.graphs()
Exemplo n.º 6
0
def main(parameters):
    simulation = Simulation(rounds=parameters['rounds'], processes=1)
    simulation.declare_round_endowment(resource='adult',
                                       units=1,
                                       product='labor')
    simulation.declare_perishable(good='labor')

    simulation.aggregate('household',
                         possessions=['money', 'GOOD'],
                         variables=['current_utiliy'])
    simulation.panel('firm',
                     possessions=['money', 'GOOD'],
                     variables=['price', 'inventory'])

    firms = simulation.build_agents(Firm,
                                    'firm',
                                    number=parameters['num_firms'])
    households = simulation.build_agents(Household,
                                         'household',
                                         number=1,
                                         parameters=parameters)

    for r in simulation.next_round():
        households.do('sell_labor')
        firms.do('buy_labor')
        firms.do('production')
        firms.do('panel')
        firms.do('quotes')
        households.do('buy_goods')
        firms.do('sell_goods')
        households.do('aggregate')
        households.do('consumption')
        firms.do('adjust_price')

    simulation.graphs()
Exemplo n.º 7
0
def main(simulation_parameters):
        simulation = Simulation(rounds=simulation_parameters['rounds'])
        simulation.declare_round_endowment(resource='labor_endowment',
                                           units=1,
                                           product='labor')
        simulation.declare_perishable(good='labor')

        simulation.aggregate('agent', possessions=[], variables=['count'])
        simulation.panel('agent', possessions=[], variables=['idn'])

        agents = simulation.build_agents(Agent, 'agent',
                       number=simulation_parameters['agents'],
                       parameters=simulation_parameters)
        killers = simulation.build_agents(Killer, 'killer',
                       number=1,
                       parameters=simulation_parameters)
        for r in simulation.next_round():
            killers.do('kill')
            agents.do('am_I_dead')
            killers.do('send_message')
            agents.do('aggregate')
            agents.do('panel')


        simulation.graphs()
Exemplo n.º 8
0
def main(simulation_parameters):
    simulation = Simulation(rounds=simulation_parameters['rounds'])

    simulation.declare_round_endowment(resource='labor_endowment',
                                       units=1,
                                       product='labor')

    simulation.declare_perishable(good='labor')

    simulation.aggregate(
        'household',
        possessions=[],  # put a list of household possessions to track here
        variables=['count'
                   ])  # put a list of household possessions to track here

    simulation.aggregate(
        'firm',
        possessions=[],  # put a list of household possessions to track here
        variables=['count'
                   ])  # put a list of household possessions to track here

    firms = simulation.build_agents(Firm,
                                    'firm',
                                    number=simulation_parameters['firms'],
                                    parameters=simulation_parameters)

    households = simulation.build_agents(
        Household,
        'household',
        number=simulation_parameters['households'],
        parameters=simulation_parameters)

    messengers = simulation.build_agents(Messenger, 'messenger', 1)

    for r in simulation.next_round():
        messengers.do('messaging')
        (firms + households).do('receive_message')
        firms.do('add_household')
        firms.do('add_firm')
        firms.do('print_id')
        households.do('print_id')
        # this instructs ABCE to save panel data as declared below
        (firms + households).do('aggregate')
    simulation.graphs()
Exemplo n.º 9
0
def main(simulation_parameters):
        simulation = Simulation(rounds=simulation_parameters['rounds'])
        action_list = [('messenger', 'messaging'),
                       (('firm', 'household'), 'receive_message'),
                       ('firm', 'add_household'),
                       ('firm', 'add_firm'),
                       ('firm', 'print_id'),
                       ('household', 'print_id'),
                       (('firm', 'household'), 'aggregate')]  # this instructs ABCE to save panel data as declared below
        simulation.add_action_list(action_list)

        simulation.declare_round_endowment(resource='labor_endowment',
                                           units=1,
                                           product='labor')

        simulation.declare_perishable(good='labor')

        simulation.aggregate('household', possessions=[],  # put a list of household possessions to track here
                                      variables=['count']) # put a list of household possessions to track here

        simulation.aggregate('firm', possessions=[],  # put a list of household possessions to track here
                                      variables=['count']) # put a list of household possessions to track here

        simulation.build_agents(Firm, 'firm',
                       number=simulation_parameters['firms'],
                       parameters=simulation_parameters, expandable=True)

        simulation.build_agents(Household, 'household',
                       number=simulation_parameters['households'],
                       parameters=simulation_parameters, expandable=True)

        simulation.build_agents(Messenger, 'messenger', 1)


        simulation.run()
        simulation.graphs()