예제 #1
0
파일: start.py 프로젝트: agoundan/abce
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()
예제 #2
0
def main():
    for simulation_parameters in read_parameters('simulation_parameters.csv'):
        w = Simulation(simulation_parameters)
        action_list = [
        ('household', 'sell_labor'),
        ('firm', 'buy_inputs'),
        ('firm', 'production'),
        ('firm', 'panel'),
        ('firm', 'sell_intermediary_goods'),
        ('household', 'buy_intermediary_goods'),
        ('household', 'panel'),
        ('household', 'consumption')
        ]
        w.add_action_list(action_list)

        w.declare_round_endowment(resource='labor_endowment', units=5, product='labor')
        w.declare_perishable(good='labor')

        w.panel('household')
        w.panel('firm')

        w.build_agents_from_file(Firm, parameters_file='agent_parameters.csv')
        w.build_agents_from_file(Household)

        w.run()
예제 #3
0
파일: start.py 프로젝트: agoundan/abce
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()
예제 #4
0
파일: start.py 프로젝트: agoundan/abce
def main(simulation_parameters):
        simulation = Simulation(rounds=simulation_parameters['rounds'])
        action_list = [('firm', 'one'),
                       ('household', 'two'),
                       ('all', 'three')
                       ('household', '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.panel('household', possessions=['good1', 'good2'],  # put a list of household possessions to track here
                                      variables=['utility']) # put a list of household possessions to track here

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


        simulation.run()
        simulation.graphs()
예제 #5
0
파일: start.py 프로젝트: chathika/abce
def main():
    for parameters in read_parameters():
        w = Simulation(parameters)
        action_list = [
            ('household', 'sell_labor'),
            ('firm', 'buy_labor'),
            ('firm', 'production'),
            ('firm', 'panel'),
            ('firm', 'sell_goods'),
            ('household', 'buy_goods'),
            ('household', 'panel'),
            ('household', 'consumption')
        ]
        w.add_action_list(action_list)

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

        w.panel('household')
        w.panel('firm')

        w.build_agents(Firm, 1)
        w.build_agents(Household, 1)

        w.run()
예제 #6
0
def main():
    all = ['buy',
           'sell']

    for parameters in simulation_parameters:
        s = Simulation(parameters)
        action_list = [
            repeat([
                (all, 'one'),
                (all, 'two'),
                (all, 'three'),
                (all, 'clean_up')
                ], 20000),

            ('all', 'all_tests_completed')]
        s.add_action_list(action_list)

        s.declare_round_endowment(resource='labor_endowment', units=5, product='labor')
        s.declare_round_endowment(resource='cow', units=10, product='milk')
        s.declare_perishable(good='labor')
        #s.panel('buy', variables=['price'])
        #s.declare_expiring('xcapital', 5)

        s.build_agents(Buy, 2)
        s.build_agents(Sell, 2)

        s.run()
예제 #7
0
파일: start.py 프로젝트: x0range/abce
def main(simulation_parameters):
    simulation = Simulation(rounds=simulation_parameters['rounds'])
    action_list = [
        ('firm', 'one'), ('household', 'two'), ('all', 'three')('household',
                                                                '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.panel(
        'household',
        possessions=['good1', 'good2'
                     ],  # put a list of household possessions to track here
        variables=['utility'
                   ])  # put a list of household possessions to track here

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

    simulation.run()
    simulation.graphs()
예제 #8
0
파일: start.py 프로젝트: chathika/abce
def main():
    for simulation_parameters in read_parameters('simulation_parameters.csv'):
        s = Simulation(simulation_parameters)
        action_list = [
        repeat([
            ('firm', 'one'),
            ('household', 'two'),
            ], simulation_parameters['trade_repetitions']),
            ('all', 'three')
        ]
        s.add_action_list(action_list)

        s.build_agents(Firm, 5)
        s.build_agents(Household, 5)

        s.declare_round_endowment(
                    resource='labor_endowment',
                    productivity=1,
                    product='labor'
        )
        s.declare_perishable(good='labor')

        s.panel_data('household')
        s.panel_data('firm')

        s.run()
예제 #9
0
파일: start.py 프로젝트: agoundan/abce
def main(parameters):
    w = Simulation(rounds=parameters['rounds'])
    action_list = [
        ('household', 'sell_labor'),
        ('firm', 'buy_labor'),
        ('firm', 'production'),
        ('firm', 'panel'),
        ('firm', 'sell_goods'),
        ('household', 'buy_goods'),
        ('household', 'panel'),
        ('household', 'consumption')
    ]
    w.add_action_list(action_list)

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

    w.panel('household', possessions=['money', 'GOOD'],
                         variables=['current_utiliy'])
    w.panel('firm', possessions=['money', 'GOOD'])

    w.build_agents(Firm, 'firm', 1)
    w.build_agents(Household, 'household', 1)

    w.run()
예제 #10
0
def main():
    all = [
        'buy', 'sell', 'give', 'endowment', 'loggertest',
        'productionmultifirm', 'productionfirm', 'utilityhousehold'
    ]

    for parameters in read_parameters('simulation_parameters.csv'):
        s = Simulation(parameters)
        action_list = [
            repeat([(all, 'one'), (all, 'two'), (all, 'three'),
                    (all, 'clean_up')], 60),
            #('buy', 'panel'),
            ('endowment', 'Iconsume'),
            ('productionmultifirm', 'production'),
            ('productionfirm', 'production'),
            ('utilityhousehold', 'consumption'),

            #('contractseller', 'make_offer'),
            #('contractseller', 'accept_offer'),
            #('contractseller', 'deliver_or_pay'),
            #('contractseller', 'control'),

            #('contractbuyer', 'request_offer'),
            #('contractbuyer', 'accept_offer'),
            #('contractbuyer', 'deliver_or_pay'),
            #('contractbuyer', 'control'),
            #('expiringcapital', 'go'),
            ('all', 'all_tests_completed')
        ]
        s.add_action_list(action_list)

        s.declare_round_endowment(resource='labor_endowment',
                                  units=5,
                                  product='labor')
        s.declare_round_endowment(resource='cow', units=10, product='milk')
        s.declare_perishable(good='labor')
        #s.panel('buy', variables=['price'])
        #s.declare_expiring('xcapital', 5)

        s.build_agents(Buy, 2)
        #s.build_agents(QuoteBuy, 2)
        s.build_agents(Sell, 2)
        s.build_agents(Give, 2)  # tests give and messaging
        s.build_agents(
            Endowment,
            2)  # tests declare_round_endowment and declare_perishable
        s.build_agents(LoggerTest, 1)
        s.build_agents(ProductionMultifirm, 1)
        s.build_agents(ProductionFirm, 5)
        s.build_agents(UtilityHousehold, 5)
        #s.build_agents(ContractSeller, 2)
        #s.build_agents(ContractBuyer, 2)
        #s.build_agents(ExpiringCapital, 1)
        #s.build_agents(GiveExpiringCapital, 2)
        s.build_agents(BuyExpiringCapital, 2)

        s.run()
예제 #11
0
def main():
    parameters = {'name': 'name', 'rounds': 300}

    s = Simulation(rounds=parameters['rounds'], cores=8)
    action_list = [  # (('myagent', 'youragent'), 'compute'),
        ('youragent', 's'), ('myagent', 'g')
    ]
    s.add_action_list(action_list)

    s.build_agents(MyAgent, 50000)
    s.build_agents(YourAgent, 50000)

    s.run()
예제 #12
0
파일: start.py 프로젝트: chathika/abce
def main():
    for simulation_parameters in read_parameters("simulation_parameters.csv"):
        s = Simulation(simulation_parameters)
        action_list = [
            repeat([("firm", "selling", "parallel"), ("household", "buying"), ("household", "checking")], 60)
        ]
        s.add_action_list(action_list)

        s.declare_round_endowment("field", 60, "corn")
        s.declare_round_endowment("shares", 60, "money")

        s.build_agents(Firm, 1)
        s.build_agents(Household, 1)

        s.run()
예제 #13
0
파일: start.py 프로젝트: chathika/abce
def main():
    for simulation_parameters in read_parameters('simulation_parameters.csv'):
        s = Simulation(simulation_parameters)
        action_list = [('firm', 'my_production'), ('firm', 'selling'),
                       ('market', 'buying'),
                       ('firm', 'adjust_price', 'serial'),
                       ('firm', 'adjust_quantity', 'serial'),
                       ('market', 'consumption')]

        s.add_action_list(action_list)

        s.build_agents(Firm, 1)
        s.build_agents(Market, 1)

        s.run()
예제 #14
0
파일: start.py 프로젝트: agoundan/abce
def main():
    parameters = {
    'name': 'name',
    'rounds': 300
    }

    s = Simulation(rounds=parameters['rounds'], cores=8)
    action_list = [#(('myagent', 'youragent'), 'compute'),
                   ('youragent', 's'),
                   ('myagent', 'g')]
    s.add_action_list(action_list)

    s.build_agents(MyAgent, 'myagent', 50000)
    s.build_agents(YourAgent, 'youragent', 50000)

    s.run()
예제 #15
0
def main():
    parameters = {
        'name': 'name',
        'num_rounds': 10
    }

    s = Simulation(parameters)
    action_list = [  # (('myagent', 'youragent'), 'compute'),
        ('youragent', 's'),
        ('myagent', 'g')]
    s.add_action_list(action_list)

    s.build_agents(MyAgent, 50000)
    s.build_agents(YourAgent, 50000)

    s.run(parallel=True)
예제 #16
0
파일: start.py 프로젝트: agoundan/abce
def main(simulation_parameters):
    s = Simulation(rounds=simulation_parameters['rounds'])
    action_list = [
        ('firm', 'my_production'),
        ('firm', 'selling'),
        ('market', 'buying'),
        ('firm', 'adjust_price'),
        ('firm', 'adjust_quantity'),
        ('market', 'consumption')
    ]

    s.add_action_list(action_list)

    s.build_agents(Firm, 'firm', parameters=simulation_parameters, number=1)
    s.build_agents(Market, 'market', parameters=simulation_parameters, number=1)

    s.run()
예제 #17
0
파일: start.py 프로젝트: chathika/abce
def main():
    for simulation_parameters in read_parameters('simulation_parameters.csv'):
        s = Simulation(simulation_parameters)
        action_list = [('firm', 'quote_hire'), ('labormarket', 'accepting'),
                       ('firm', 'hire'), ('firm', 'my_production'),
                       ('firm', 'selling'), ('market', 'buying'),
                       ('firm', 'adjust_price'), ('firm', 'adjust_quantity'),
                       ('market', 'consumption')]

        s.add_action_list(action_list)
        s.declare_perishable('labor')

        s.build_agents(Firm, 1)
        s.build_agents(Market, 1)
        s.build_agents(LaborMarket, 1)

        s.run()
예제 #18
0
파일: start.py 프로젝트: chathika/abce
def main():
    for simulation_parameters in read_parameters('simulation_parameters.csv'):
        s = Simulation(simulation_parameters)
        action_list = [
            ('firm', 'my_production'),
            ('firm', 'selling'),
            ('market', 'buying'),
            ('firm', 'adjust_price', 'serial'),
            ('firm', 'adjust_quantity', 'serial'),
            ('market', 'consumption')
        ]

        s.add_action_list(action_list)

        s.build_agents(Firm, 1)
        s.build_agents(Market, 1)

        s.run()
예제 #19
0
파일: start.py 프로젝트: chathika/abce
def main():
    for simulation_parameters in read_parameters('simulation_parameters.csv'):
        s = Simulation(simulation_parameters)
        action_list = [
            repeat([
                       ('firm', 'selling', 'parallel'),
                       ('household', 'buying'),
                       ('household', 'checking')
                       ], 60)]
        s.add_action_list(action_list)

        s.declare_round_endowment('field', 60, 'corn')
        s.declare_round_endowment('shares', 60, 'money')

        s.build_agents(Firm, 1)
        s.build_agents(Household, 1)

        s.run()
예제 #20
0
def main():
    for parameters in read_parameters():
        w = Simulation(parameters)
        action_list = [('household', 'sell_labor'), ('firm', 'buy_labor'),
                       ('firm', 'production'), ('firm', 'panel'),
                       ('firm', 'sell_goods'), ('household', 'buy_goods'),
                       ('household', 'panel'), ('household', 'consumption')]
        w.add_action_list(action_list)

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

        w.panel('household')
        w.panel('firm')

        w.build_agents(Firm, 1)
        w.build_agents(Household, 1)

        w.run()
예제 #21
0
파일: start.py 프로젝트: agoundan/abce
def main(simulation_parameters):
    s = Simulation(rounds=simulation_parameters['rounds'])
    action_list = [

        ('firm', 'production'),
        ('firm', 'panel'),
        ('firm', 'quote'),
        ('household', 'buying'),
        ('firm', 'selling'),
        ('household', 'panel'),
        ('household', 'consumption')
    ]

    s.add_action_list(action_list)

    s.panel('household', possessions=['cookies'])
    s.panel('firm', possessions=['cookies'])

    s.build_agents(Firm, 'firm', 1)
    s.build_agents(Household, 'household', 10)

    s.run()
예제 #22
0
def main():
    for simulation_parameters in read_parameters('simulation_parameters.csv'):
        s = Simulation(simulation_parameters)
        action_list = [
            repeat([
                ('firm', 'one'),
                ('household', 'two'),
            ], simulation_parameters['trade_repetitions']), ('all', 'three')
        ]
        s.add_action_list(action_list)

        s.build_agents(Firm, 5)
        s.build_agents(Household, 5)

        s.declare_round_endowment(resource='labor_endowment',
                                  productivity=1,
                                  product='labor')
        s.declare_perishable(good='labor')

        s.panel_data('household')
        s.panel_data('firm')

        s.run()
예제 #23
0
파일: start.py 프로젝트: chathika/abce
def main():
    for simulation_parameters in read_parameters('simulation_parameters.csv'):
        s = Simulation(simulation_parameters)
        action_list = [
            ('firm', 'quote_hire'),
            ('labormarket', 'accepting'),
            ('firm', 'hire'),
            ('firm', 'my_production'),
            ('firm', 'selling'),
            ('market', 'buying'),
            ('firm', 'adjust_price'),
            ('firm', 'adjust_quantity'),
            ('market', 'consumption')
        ]

        s.add_action_list(action_list)
        s.declare_perishable('labor')

        s.build_agents(Firm, 1)
        s.build_agents(Market, 1)
        s.build_agents(LaborMarket, 1)

        s.run()
예제 #24
0
파일: start.py 프로젝트: chathika/abce
def main():
    for simulation_parameters in read_parameters('simulation_parameters.csv'):
        s = Simulation(simulation_parameters)
        action_list = [

            ('firm', 'production'),
            ('firm', 'panel'),
            ('firm', 'quote'),
            ('household', 'buying'),
            ('firm', 'selling'),
            ('household', 'panel'),
            ('household', 'consumption')
        ]

        s.add_action_list(action_list)

        s.panel('household')
        s.panel('firm')

        s.build_agents(Firm, 1)
        s.build_agents(Household, 10)

        s.run()
예제 #25
0
파일: start.py 프로젝트: x0range/abce
def main():
    all = ['buy', 'sell']

    for parameters in simulation_parameters:
        s = Simulation(parameters)
        action_list = [
            repeat([(all, 'one'), (all, 'two'), (all, 'three'),
                    (all, 'clean_up')], 20000), ('all', 'all_tests_completed')
        ]
        s.add_action_list(action_list)

        s.declare_round_endowment(resource='labor_endowment',
                                  units=5,
                                  product='labor')
        s.declare_round_endowment(resource='cow', units=10, product='milk')
        s.declare_perishable(good='labor')
        #s.panel('buy', variables=['price'])
        #s.declare_expiring('xcapital', 5)

        s.build_agents(Buy, 2)
        s.build_agents(Sell, 2)

        s.run()
예제 #26
0
파일: start.py 프로젝트: agoundan/abce
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()
예제 #27
0
파일: start.py 프로젝트: agoundan/abce
def main(simulation_parameters):
    w = Simulation(rounds=simulation_parameters['rounds'])
    action_list = [
    ('household', 'sell_labor'),
    ('firm', 'buy_inputs'),
    ('firm', 'production'),
    ('firm', 'panel'),
    ('firm', 'sell_intermediary_goods'),
    ('household', 'buy_intermediary_goods'),
    ('household', 'panel'),
    ('household', 'consumption')
    ]
    w.add_action_list(action_list)

    w.declare_round_endowment(resource='labor_endowment', units=5, product='labor')
    w.declare_perishable(good='labor')

    w.panel('household', possessions=['consumption_good'])
    w.panel('firm', possessions=['consumption_good', 'intermediate_good'])

    w.build_agents(Firm, 'firm', 2)
    w.build_agents(Household, 'household', 2)

    w.run()
예제 #28
0
def main(processes, rounds):
    all = ['buy',
           'sell',
           'give',
           'loggertest',
           'utilityhousehold']

    contractagents = ['contractbuyer', 'contractseller',
                      'contractbuyerstop', 'contractsellerstop']

    s = Simulation(rounds=rounds, processes=processes)
    action_list = [
        repeat([
            (all, 'one'),
            (all, 'two'),
            (all, 'three'),
            (all, 'clean_up')
            ], 20),
        #('buy', 'panel'),
        ('endowment', 'Iconsume'),
        ('productionmultifirm', 'production'),
        ('productionfirm', 'production'),
        ('utilityhousehold', 'consumption'),
        (('messagea', 'messageb'), 'sendmsg'),
        (('messageb', 'messagea'), 'recvmsg'),

        (('contractbuyer','contractbuyerstop'), 'request_offer'),
        (('contractseller', 'contractsellerstop'), 'make_offer'),
        (contractagents, 'accept_offer'),
        (contractagents, 'deliver'),
        (contractagents, 'pay'),
        (contractagents, 'control'),
        ('killer', 'kill'),
        ('killer', 'send_message'),
        ('victim', 'am_I_dead'),

        #('expiringcapital', 'go'),

        (all, 'all_tests_completed'),
        ('addagent', 'add_agent')]
    s.add_action_list(action_list)

    s.declare_round_endowment(resource='labor_endowment', units=5, product='labor')
    s.declare_round_endowment(resource='cow', units=10, product='milk')
    s.declare_perishable(good='labor')
    #s.panel('buy', variables=['price'])
    #s.declare_expiring('xcapital', 5)
    print('build Buy')
    s.build_agents(Buy, 'buy', 1000, parameters={'rounds': rounds})
    print('build Sell')
    #s.build_agents(QuoteBuy, 2)
    s.build_agents(Sell, 'sell', 1000, parameters={'rounds': rounds})
    print('build Give')
    s.build_agents(Give, 'give', 2, parameters={'rounds': rounds}) # tests give and messaging
    print('build Endowment')
    s.build_agents(Endowment, 'endowment', 2, parameters={'rounds': rounds, 'creation': 0})  # tests declare_round_endowment and declare_perishable
    print('build LoggerTest')
    s.build_agents(LoggerTest, 'loggertest', 1, parameters={'rounds': rounds})
    print('build ProductionMultifirm')
    s.build_agents(ProductionMultifirm, 'productionmultifirm', 1, parameters={'rounds': rounds})
    print('build ProductionFirm')
    s.build_agents(ProductionFirm, 'productionfirm', 7, parameters={'rounds': rounds})
    print('UtilityHousehold')
    s.build_agents(UtilityHousehold, 'utilityhousehold', 5, parameters={'rounds': rounds})
    print('build ContractSeller')
    s.build_agents(ContractSeller, 'contractseller', 2, parameters={'rounds': rounds})
    print('build ContractBuyer')
    s.build_agents(ContractBuyer, 'contractbuyer', 2, parameters={'rounds': rounds})
    print('build ContractSellerStop')
    s.build_agents(ContractSellerStop, 'contractsellerstop', 2, parameters={'rounds': rounds})
    print('build ContractBuyerStop')
    s.build_agents(ContractBuyerStop, 'contractbuyerstop', 2, parameters={'rounds': rounds})
    #s.build_agents(ExpiringCapital, 1)
    #s.build_agents(GiveExpiringCapital, 2)
    print('build BuyExpiringCapital')
    s.build_agents(BuyExpiringCapital, 'buyexpiringcapital', 2, parameters={'rounds': rounds})
    print('build MessageA')
    s.build_agents(MessageA, 'messagea', 20, parameters={'rounds': rounds})
    print('build MessageB')
    s.build_agents(MessageB, 'messageb', 20, parameters={'rounds': rounds})
    print('build AddAgent')
    s.build_agents(AddAgent, 'addagent', 1, parameters={'rounds': rounds})
    print('build Killer')
    s.build_agents(Killer, 'killer', 1, parameters={'rounds': rounds})
    print('build Victim')
    s.build_agents(Victim, 'victim', rounds, parameters={'rounds': rounds})
    print('build Victim loudvictim')
    s.build_agents(Victim, 'loudvictim', rounds, parameters={'rounds': rounds})

    s.run()
예제 #29
0
파일: start.py 프로젝트: SalmaAli/abce
from firm import Firm
from household import Household
from abce import Simulation, read_parameters, repeat


for simulation_parameters in read_parameters('simulation_parameters.csv'):
    s = Simulation(simulation_parameters)
    action_list = [
    repeat([
        ('firm', 'one'),
        ('household', 'two'),
        ], simulation_parameters['trade_repetitions']),
        'buy_log',
        ('all', 'three')
    ]
    s.add_action_list(action_list)

    s.build_agents(Firm, 5)
    s.build_agents(Household, 5)

    s.declare_round_endowment(
                resource='labor_endowment',
                productivity=1,
                product='labor'
    )
    s.declare_perishable(good='labor')

    s.panel_data('household', command='buy_log')
    s.panel_data('firm', command='buy_log')

    s.run()
예제 #30
0
파일: start.py 프로젝트: chathika/abce
def main():
    all = ['buy',
           'sell',
           'give',
           'endowment',
           'loggertest',
           'productionmultifirm',
           'productionfirm',
           'utilityhousehold']

    for parameters in read_parameters('simulation_parameters.csv'):
        s = Simulation(parameters)
        action_list = [
            repeat([
                (all, 'one'),
                (all, 'two'),
                (all, 'three'),
                (all, 'clean_up')
                ], 60),
            #('buy', 'panel'),
            ('endowment', 'Iconsume'),
            ('productionmultifirm', 'production'),
            ('productionfirm', 'production'),
            ('utilityhousehold', 'consumption'),

            #('contractseller', 'make_offer'),
            #('contractseller', 'accept_offer'),
            #('contractseller', 'deliver_or_pay'),
            #('contractseller', 'control'),

            #('contractbuyer', 'request_offer'),
            #('contractbuyer', 'accept_offer'),
            #('contractbuyer', 'deliver_or_pay'),
            #('contractbuyer', 'control'),
            #('expiringcapital', 'go'),

            ('all', 'all_tests_completed')]
        s.add_action_list(action_list)

        s.declare_round_endowment(resource='labor_endowment', units=5, product='labor')
        s.declare_round_endowment(resource='cow', units=10, product='milk')
        s.declare_perishable(good='labor')
        #s.panel('buy', variables=['price'])
        #s.declare_expiring('xcapital', 5)

        s.build_agents(Buy, 2)
        #s.build_agents(QuoteBuy, 2)
        s.build_agents(Sell, 2)
        s.build_agents(Give, 2)  # tests give and messaging
        s.build_agents(Endowment, 2)  # tests declare_round_endowment and declare_perishable
        s.build_agents(LoggerTest, 1)
        s.build_agents(ProductionMultifirm, 1)
        s.build_agents(ProductionFirm, 5)
        s.build_agents(UtilityHousehold, 5)
        #s.build_agents(ContractSeller, 2)
        #s.build_agents(ContractBuyer, 2)
        #s.build_agents(ExpiringCapital, 1)
        #s.build_agents(GiveExpiringCapital, 2)
        s.build_agents(BuyExpiringCapital, 2)

        s.run()