Game theory using Sage
Game Theory | Sage Reference Manual
integer_function = {(): 0,
(1,): 1,
(2,): 1,
(3,): 1,
(1, 2,): 3,
(1, 3,): 4,
(2, 3,): 5,
(1, 2, 3,): 5}
integer_game = CooperativeGame(integer_function)
integer_game.is_superadditive()
False
integer_function = {(): 0,
(1,): 1,
(2,): 1,
(3,): 1,
(1, 2,): 3,
(1, 3,): 4,
(2, 3,): 5,
(1, 2, 3,): 7}
integer_game = CooperativeGame(integer_function)
integer_game.is_superadditive()
True
integer_function = {(): 0,
(1,): 0,
(2,): 2,
(1, 2,): 2}
integer_game = CooperativeGame(integer_function)
integer_game.is_superadditive()
True
integer_function = {(): 0,
(1,): 0,
(2,): 2,
(1, 2,): 2}
integer_game = CooperativeGame(integer_function)
integer_game.shapley_value()
{1: 0, 2: 2}
letter_function = {(): 0,
('C',): 0,
('W1',): 0,
('W2',): 0,
('C', 'W1',): 3,
('C', 'W2',): 3,
('W1', 'W2',): 0,
('C', 'W1', 'W2',): 4}
letter_game = CooperativeGame(letter_function)
letter_game.shapley_value()
{'C': 7/3, 'W1': 5/6, 'W2': 5/6}