# Calculate Shapley Values using TuGames package?

Posted 1 year ago
4580 Views
|
8 Replies
|
13 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["coopCooperativeGames"] Needs["TuGames"] During evaluation of In[30]:= Get::noopen: Cannot open coopCooperativeGames. During evaluation of In[30]:= Needs::nocont: Context coopCooperativeGames was not created when Needs was evaluated. Out[30]= \$Failed 
8 Replies
Sort By:
Posted 1 year ago
 See the Installation and Trouble Shooting sections of the README.
Posted 1 year ago
 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 1 year ago
 Woah those installation instructions are so crazy... So many steps. So many ill-considered steps.
Posted 1 year ago
 Thank you both for the answers.
Posted 1 year ago
 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 1 year ago
 Due to the justified criticism that we have not respected best practice of publicizing a Mathematica package with the consequence that we have provided, in particular, incorrect manual installation instruction for Windows systems, we decided to completely overhaul the package structure.Since version 2.5.1, the package is distributed as a Paclet that allows a custom installation for everyone. The installation of the package requires about 90 MB free hard-disk space, and the Mathematica version should not be smaller than 10. For Mathematica versions smaller than Version 10, a manual installation is requested. In that case one has to respect the guidelines related to the associated operating system that can be found from the Mathematica documentation.Moreover, in order to react more quickly to the needs of the community, we changed the host from Wolfram Library Archive to GitHub. The most recent version 2.5.4 can now be downloaded from the following URLProject Hostas an ordinary Zip file or as a Mathematica Paclet that can be found atURL Paclet: TuGamesWe strongly recommend to rely on a custom installation. Such a installation can be easily accomplished while applying the subsequent steps:Start Mathematica, open a notebook, and execute therein PacletInstall["/full/Path/to/TUG-2.5.4.paclet"] that should return the value Paclet[TUG, 2.5.4, <>] to indicate a successful installation. Notice that /full/Path/to/TUG-2.5.4.paclet indicates the directory where the TUG-2.5.4.paclet is located at your hard-disk. After these steps, the installation procedure is completed, and one can start a session while executing Needs["TUG"] For additional information of how to use the package, and to get a rough overview of the implemented changes we also refer the inclined user to our post attugames-package-does-not-runWe highly appreciated the conducted discussion at this forum while making us aware about some crucial deficiencies of our package, and we hope that the new and revised version fits now better the needs of the community.
 Updated Information for Installing the Package TuGames: 17.05.2020For 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 GitHubTuGames