Exemple #1
0
if __name__ == "__main__":
    max_agent_count = 50
    max_victim_count = 50

    info = {
        "env": {"Ny": 5,
                "Nx": 5},
        "agent": {"policy_mode": "epsgreedy",  # "epsgreedy", "softmax"
                  "eps": 1.0,
                  "eps_decay": 2.0 * np.log(10.0) / TOTAL_EPISODES},
        "brain": {"discount": 0.99,
                  "learning_rate": 0.9},
        "memory": {}
    }

    env = Env(max_agent_count, max_victim_count, info)

    agent_count = 2
    victim_count = 2

    distribution = Distribution()

    volunteer_distribution = distribution.get_distribution_of_volunteers()
    agent_count = len(volunteer_distribution)

    for i in range(agent_count):
        agent = DQNAgent(actions=list(range(env.n_actions)), agent_id=i, env=env, options={'distributed': False})
        row_col = volunteer_distribution[i]
        if len(row_col) != 2:
            raise Exception('Invalid volunteer position')