def it_can_add_observations_to_existing_profiles(self): matrix = ObservationMatrix([{'All': [PayoffData('A', 2, [12, 11])]}, {'All': [PayoffData('A', 1, [23]), PayoffData('B', 1, [11])]}, {'All': [PayoffData('B', 2, [13.3])]}]) matrix.addObservations(Profile({'All': {'A': 1, 'B': 1}}), {'All': [PayoffData('A', 1, [12, 11]), PayoffData('B', 1, [21, 17])]}) assert matrix.getPayoffData(Profile({'All': {'A': 1, 'B': 1}}), 'All', 'B') == [11, 21, 17]
def it_can_return_requested_profile_observations(self): matrix = ObservationMatrix([{'All': [PayoffData('A', 2, [12, 11])]}, {'All': [PayoffData('A', 1, [23]), PayoffData('B', 1, [11])]}, {'All': [PayoffData('B', 2, [13.3])]}]) assert matrix.getPayoffData(Profile({'All': {'A': 2}}), 'All', 'A') == [12, 11] assert matrix.getPayoffData(Profile({'All': {'A': 1, 'B': 1}}), 'All', 'B') == [11]
def it_can_add_observations_for_previously_unobserved_profiles(self): matrix = ObservationMatrix() matrix.addObservations(Profile({'All': {'A': 1, 'B': 1}}), {'All': [PayoffData('A', 1, [12, 11]), PayoffData('B', 1, [21, 17])]}) assert matrix.getPayoffData(Profile({'All': {'A': 1, 'B': 1}}), 'All', 'B') == [21, 17]