Group Abstract Group Abstract

Message Boards Message Boards

Calculate Shapley Values using TuGames package?

Posted 7 years ago

I downloaded the package TuGames from http://library.wolfram.com/infocenter/MathSource/5709/ (for Windows) to calculate Shapley Values in cooperative bargaining games.

I got it to work earlier today but after closing and opening mathematica again, this simple code would not work. When it worked, all I did was paste the content of the package in C:\Program Files\Wolfram Research\Mathematica\11.0\AddOns\Packages\TuGames\, and I manage to run the code below. However, it doesn't run anymore. Any thoughts on what could be causing the problem?

Needs["coopCooperativeGames"] Needs["TuGames`"]

ExpGame := (T = {1, 2, 3, 4}; Clear[v];
  v[{}] = 0;
  v[{1}] = 0;
  v[{2}] = 0;
  v[{3}] = 0;
  v[{4}] = 0;
  v[{1, 2}] = 0;
  v[{1, 3}] = 1/4;
  v[{1, 4}] = 2/4;
  v[{2, 3}] = 1/4;
  v[{2, 4}] = 3/4;
  v[{3, 4}] = 0;
  v[{1, 2, 3}] = 1;
  v[{1, 2, 4}] = 1;
  v[{1, 3, 4}] = 1;
  v[{2, 3, 4}] = 1; v[T] = 2)
ShapleyValue[ExpGame]

This is the error I'd get sometimes. Other times it just crashes.

In[30]:= Needs["coop`CooperativeGames`"]
Needs["TuGames`"]
During evaluation of In[30]:= Get::noopen: Cannot open coop`CooperativeGames`.
During evaluation of In[30]:= Needs::nocont: Context coop`CooperativeGames` was not created when Needs was evaluated.
Out[30]= $Failed
POSTED BY: rodrigo montes
8 Replies

I wanted to note that the installation instructions suggest modifying files in the installation directory of Mathematica. You should never do this without very good reason, and without being aware of the potential consequences. It even suggests modifying your sysinit.m file, for which there is never a good reason, and which can completely break your Mathematica.


The fact that finding such installation instructions is still fairly common illustrates why it is so critical that Wolfram Research should provide guidelines and training materials for package developers.

Some people will inevitably fail to follow instructions precisely. When the installation instructions involve doing serious surgery on Mathematica (as here), the consequences of a mistake can be dire. The end result is that user will learn that "packages are not to be trusted" and "it's better to rely solely on built-in stuff". That attitude of users is damaging the health of the Wolfram Language package ecosystem.


Update: To be clear, the criticism is primarily aimed at Wolfram Research (not the package's author) for not publicizing best practices. It is not that easy to figure out the best way to put together a complex package, especially if one has to work with multiple bits of very old code. The package referenced here clearly contains a lot of useful and non-trivial functionality, and I hope that it will continue to be maintained and these issues will be ironed out.

However, what I said above also stands: modify Mathematica's system files at your own peril! Wolfram would be right to refuse support once you have done that.

POSTED BY: Szabolcs Horvát
Posted 7 years ago

See the Installation and Trouble Shooting sections of the README.

POSTED BY: Rohit Namjoshi

Updated Information for Installing the Package TuGames: 17.05.2020

For those who want to get the most recent version of the Mathematica Package TuGames 2.6.1, we recommend a direct installation from GitHub under Mathematica V11.3 or later while executing in a notebook the command

ResourceFunction["GitHubInstall"]["himeinhardt", "TuGames"]

otherwise one needs to follow one of the alternative custom installation procedure that can be found at project home at GitHub

TuGames

Dear Holger, thank you so much for the update. I'm looking forward to trying the new package shortly. Best regards, Rodrigo

POSTED BY: rodrigo montes

I had the same problem with previous Mathematica versions and after that I decided not to use that package anymore. By the way it is an excellent package for cooperative games because it has many functions.

Posted 7 years ago
POSTED BY: b3m2a1 ​ 

Thank you both for the answers.

POSTED BY: rodrigo montes
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard