Skip to content

tgquintela/CooperativeGames

Repository files navigation

Build Status Coverage Status

CooperativeGames

Some measure useful for cooperative games. In this first version it contains:

Tutorial

The easy way to use this functions are:

  • Shapley value
from cooperativegames import shapley_value

entities = np.array(range(3))
funct = lambda x: 1 if list(x) in [[0, 2], [1, 2], [0, 1, 2]] else 0
sh_v1 = shapley_value(entities, funct)
  • Shapley-Shubik power index
from cooperativegames import shapley_index

distrib_repr = np.array([3, 2, 1, 1])
win_thr = 0.5
sh_sh_ind = shapley_index(distrib_repr, win_thr)
  • Banzhaf power index
from cooperativegames import banzhaf_index

distrib_repr = np.array([4, 3, 2, 1])
win_thr = 0.5
bzf_ind = banzhaf_index(distrib_repr, win_thr)

Testing the module

It is provide a testing module called test.py. It runs only with the importation.

import cooperativegames
CooperativeGames.test()

or it could be done also with nosetests of nose,

nosetests

TODO

  • plots and visualizations
  • simulations
  • obtain data

About

Some measures useful for cooperative games.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published