Esempio n. 1
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()
Esempio n. 2
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()
Esempio n. 3
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()
Esempio n. 4
0
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()
Esempio n. 5
0
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()
Esempio n. 6
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()
Esempio n. 7
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()
Esempio n. 8
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()
Esempio n. 9
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()
Esempio n. 10
0
from __future__ import division
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')