示例#1
0
def main():

    storing_costs = 0.10, 0.20, 0.24
    u = 1

    parameters = {
        "t_max": 500,
        "agent_parameters": {
            "alpha": 0.1,
            "temp": 0.1,
            "gamma": 0.1,
            "q_values": np.ones((6, 2))
        },
        "repartition_of_roles": np.array([50, 50, 50]),
        "storing_costs": storing_costs,
        "u": u,
        "agent_model": RL2StepsAgent,
    }

    e = Economy(**parameters)

    backup = e.run()

    # backup["last_strategies"] = [agent.strategies for agent in e.agents]

    # save(backup)

    represent_results(backup=backup, parameters=parameters)
示例#2
0
def main():

    storing_costs = 0.01, 0.04, 0.09  # [0.1, 0.20, 0.24]
    u = 1
    beta = 0.9

    agent_parameters = {
        "acceptance_memory_span": 1000,
        "encounter_memory_span": 1000,
        "temp": 0.1,
    }

    parameters = {
        "t_max": 500,
        "agent_parameters": agent_parameters,
        "repartition_of_roles": np.array([50, 50, 50]),
        "storing_costs": storing_costs,
        "u": u,
        "beta": beta,
        "agent_model": FrequentistAgent
    }

    expected_equilibrium = compute_equilibrium(storing_costs=storing_costs,
                                               beta=beta,
                                               u=u)
    print("Expected equilibrium is: {}".format(expected_equilibrium))

    e = Economy(**parameters)

    backup = e.run()

    represent_results(backup=backup, parameters=parameters)
示例#3
0
def main():

    parameters = {
        "t_max": 500,
        "u": 100,
        "b11": 0.025,
        "b12": 0.025,
        "b21": 0.25,
        "b22": 0.25,
        "initial_strength": 0,
        "repartition_of_roles": np.array([50, 50, 50]),
        "storing_costs": np.array([0.1, 1., 20.]),
    }

    e = MarimonEconomy(**parameters)
    backup = e.run()

    parameters["agent_parameters"] = {
        "u": parameters["u"],
        "b11": parameters["b11"],
        "b12": parameters["b12"],
        "b21": parameters["b21"],
        "b22": parameters["b22"],
        "initial_strength": parameters["initial_strength"]
    }

    parameters["agent_model"] = type("", (object, ), {"name": "Marimon"})()

    represent_results(backup=backup, parameters=parameters)
示例#4
0
def main():

    parameters = {
        "t_max": 500,
        "agent_parameters": {"alpha_plus": 0.4, "alpha_minus": 0.05, "temp": 0.01},
        "role_repartition": np.array([500, 500, 500]),
        "storing_costs": np.array([0.1, 0.25, 0.4]),
        "agent_model": RL2Agent,
    }

    backup = \
        launch(
            **parameters
        )

    represent_results(backup=backup, parameters=parameters)
示例#5
0
def main():

    parameters = {
        "t_max": 500,
        "agent_parameters": {"beta": 0.9, "u": 0.2},
        "repartition_of_roles": np.array([500, 500, 500]),
        "storing_costs": np.array([0.01, 0.04, 0.09]),
        "agent_model": StupidAgent,
    }

    backup = \
        launch(
            **parameters
        )

    represent_results(backup=backup, parameters=parameters)
示例#6
0
def main():

    parameters = {
        "t_max": 500,
        "beta": 0.9,
        "u": 100,
        "repartition_of_roles": [500, 500, 500],
        "storing_costs": [1, 4, 9],
        "agent_model": DuffyAgent,
    }

    backup = \
        launch(
            **parameters
        )

    represent_results(backup=backup, parameters=parameters)
示例#7
0
def main():

    parameters = {
        "t_max": 500,
        "agent_parameters": {
            "u": 500,
            "b11": 0.025,
            "b12": 0.025,
            "b21": 0.25,
            "b22": 0.25,
            "initial_strength": 0
        },
        "repartition_of_roles": np.array([50, 50, 50]),
        "storing_costs": np.array([0.1, 1., 20.]),
        "agent_model": MarimonAgent,
    }

    backup = \
        launch(
            **parameters
        )

    represent_results(backup=backup, parameters=parameters)