How to use the nashpy.learning.fictitious_play.get_best_response_to_play_count function in nashpy

To help you get started, we’ve selected a few nashpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github drvinceknight / Nashpy / tests / unit / test_fictitious_play.py View on Github external
def test_find_best_response_to_play_count():
    M = np.array([[3, 2, 3], [4, 1, 1], [2, 3, 1]])
    play_counts = (
        np.array([1, 0, 0]),
        np.array([2, 1, 0]),
        np.array([0, 0, 2]),
    )
    best_responses = (1, 1, 0)
    for play_count, expected_best_response in zip(play_counts, best_responses):
        best_response = get_best_response_to_play_count(M, play_count)
        assert best_response == expected_best_response, play_count
github drvinceknight / Nashpy / tests / unit / test_fictitious_play.py View on Github external
def test_property_find_best_response_to_play_count(M):
    play_count = np.zeros(M.shape[1])
    best_response = get_best_response_to_play_count(M, play_count)
    assert best_response >= 0
    assert best_response <= M.shape[1] - 1
    assert (type(best_response) is np.int64) or (
        type(best_response) is np.int32
    )  # For testing purposes on Windows