def generate_experiments():
    exp_list = list()

    obs_config = SimpleObservationConfig(max_depth=2)

    env_config = FlatlandConfig(
        height=35,
        width=35,
        n_agents=1,
        n_cities=3,
        grid_distribution_of_cities=False,
        max_rails_between_cities=2,
        max_rail_in_cities=4,
        observation_builder_config=obs_config,
        random_seed=RANDOM_SEED,
    )

    controller_config = ActorCriticConfig(
        actor_optimizer_config=AdamConfig(lr=1e-4),
        critic_optimizer_config=AdamConfig(lr=1e-4),
        gamma=0.99,
        entropy_coeff=0.01,
        actor_layers_sz=[256, 128],
        critic_layers_sz=[256, 128],
    )

    torch.save(exp_list, "generated/exp_list")
Exemplo n.º 2
0
def HordeOfAgents(random_seed):
    return FlatlandConfig(
        height=120,
        width=80,
        n_agents=50,
        n_cities=10,
        grid_distribution_of_cities=False,
        max_rails_between_cities=2,
        max_rail_in_cities=4,
        observation_builder_config=None,
        reward_config=None,
        malfunction_rate=1. / 1000,
        random_seed=random_seed,
        greedy=True,
    )
Exemplo n.º 3
0
def SeveralAgents(random_seed):
    return FlatlandConfig(
        height=35,
        width=35,
        n_agents=5,
        n_cities=3,
        grid_distribution_of_cities=False,
        max_rails_between_cities=2,
        max_rail_in_cities=4,
        observation_builder_config=None,
        reward_config=None,
        malfunction_rate=1. / 200,
        random_seed=random_seed,
        greedy=True,
    )
Exemplo n.º 4
0
def env6(random_seed):
    return FlatlandConfig(
        height=40,
        width=60,
        n_agents=80,
        n_cities=9,
        grid_distribution_of_cities=False,
        max_rails_between_cities=2,
        max_rail_in_cities=4,
        observation_builder_config=None,
        reward_config=None,
        malfunction_rate=1. / 800,
        random_seed=random_seed,
        greedy=True,
    )
Exemplo n.º 5
0
        n_cities = 2
        x_dim = 25
        y_dim = 25
    else:
        n_agents = n_agents + math.ceil(10**(len(str(n_agents)) - 1) * 0.75)
        n_cities = n_agents // 10 + 2
        x_dim = math.ceil(math.sqrt(150 * n_cities)) + 7
        y_dim = x_dim

    _test_env.append(
        FlatlandConfig(
            height=x_dim,
            width=y_dim,
            n_agents=n_agents,
            n_cities=n_cities,
            grid_distribution_of_cities=False,
            max_rails_between_cities=2,
            max_rail_in_cities=4,
            observation_builder_config=None,
            reward_config=None,
            malfunction_rate=1. / 1500,
            random_seed=None,
            greedy=True,
        ))


def test_env(random_seed, i):
    env = _test_env[i]
    env.random_seed = random_seed
    return env
Exemplo n.º 6
0
def FewAgents(random_seed):
    return FlatlandConfig()