Пример #1
0
def test_can_update_mata_game(RPS_task):
    psro = PSRONashResponse(task=RPS_task, benchmarking_episodes=2)
    psro.menagerie = [rockAgent, paperAgent, scissorsAgent]
    psro.meta_game = np.array([[0.5, 0], [1, 0.5]])

    expected_meta_game = np.array([[0.5, 0, 1], [1, 0.5, 0], [0, 1, 0.5]])

    actual_meta_game = psro.update_meta_game()

    np.testing.assert_array_equal(expected_meta_game, actual_meta_game)
Пример #2
0
def test_can_fill_missing_game_entries_upon_adding_new_policy(RPS_task):
    psro = PSRONashResponse(task=RPS_task, benchmarking_episodes=2)
    psro.menagerie = [rockAgent, paperAgent, scissorsAgent]
    meta_game = np.array([[0.5, 0, np.nan], [1, 0.5, np.nan],
                          [np.nan, np.nan, np.nan]])
    expected_updated_metagame = np.array([[0.5, 0, 1], [1, 0.5, 0],
                                          [0, 1, 0.5]])
    actual_updated_metagame = psro.fill_meta_game_missing_entries(
        policies=psro.menagerie,
        updated_meta_game=meta_game,
        benchmarking_episodes=psro.benchmarking_episodes,
        task=RPS_task)
    np.testing.assert_array_equal(expected_updated_metagame,
                                  actual_updated_metagame)