Message Boards Message Boards

GROUPS:

Calculate Shapley Values using TuGames package?

Posted 15 days ago
246 Views
|
5 Replies
|
8 Total Likes
|

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
5 Replies
Posted 14 days ago

See the Installation and Trouble Shooting sections of the README.

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 14 days ago

Woah those installation instructions are so crazy... So many steps. So many ill-considered steps.

Thank you both for the answers.

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.

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

Group Abstract Group Abstract