File Exchange

image thumbnail


version 1.7 (2.06 MB) by Holger I. Meinhardt
A game theoretical Matlab toolbox to compute solution schemes and properties from TU-games.


Updated 24 Apr 2018

View License

The game theoretical Matlab toolbox MatTuGames provides about 230 functions for modeling, and calculating some solutions as well as properties of cooperative games with transferable utilities. In contrast to existing Matlab toolboxes to investigate TU-games, which are written in a C/C++ programming style with the consequence
that these functions are executed relatively slowly, we heavily relied on vectorized constructs in order to write more efficient Matlab functions. In particular, the toolbox provides functions to compute the (pre-)kernel, (pre-)nucleolus, and anti (pre-)kernel as well as game values like the Banzhaf, Myerson, Owen, position, Shapley, solidarity, and coalition solidarity value and much more. In addition, we will discuss how one can use Matlab's Parallel Computing Toolbox in connection with this toolbox to benefit from a gain in performance by launching supplementary Matlab workers. Some information are provided how to call our Mathematica package TuGames within a running Matlab session.
Getting started:
In order to get some insight how to analyze a cooperative game,
a so-called transferable utility game with the Game Theory Toolbox
MatTuGames, we discuss a small example to demonstrate how one can
compute some game properties or solution concepts, like convexity,
the Shapley value, the (pre-)nucleolus or a pre-kernel element.
For this purpose, consider a situation where an estate is insufficient
to meet simultaneously all of the debts/claims of a set of claimants,
such a situation is known in game theory as a bankruptcy problem.
The problem is now to find a fair/stable distribution in the sense that
no claimant/creditor can find an argument to obstruct the proposed division
to satisfy at least partly the mutual inconsistent claims of the creditors.
In a first step, we define a bankruptcy situation while specifying
the debts vector and the estate that can be distributed to the
creditors. We restrict our example to a six-person bankruptcy problem
with a debts vector given by

>> d = [40.0000 32.0000 11.0000 73.3000 54.9500 81.1000];

and an estate value which is equal to

>> E = 176;

We observe immediately that the estate E is insufficient to meet all
of the claims simultaneously. It should be obvious that with these values
we do not have defined a cooperative game, however, these information
are enough to compute a proposal how to divide the estate between the
creditors. A fair division rule which is proposed by the Babylonian Talmud,
is given by

>> tlm_rl=Talmudic_Rule(E,d)
tlm_rl =

20.0000 16.0000 5.5000 48.3500 30.0000 56.1500

However, this distribution rule does not incorporate the coalition formation
process. Thus, we might get a different outcome when we consider the
possibility that agents can form coalitions to better enforce their claims.
This means, we have to study the corresponding cooperative game. This can
be constructed while calling the following function

>> bv=bankruptcy_game(E,d);

Having generated a game, we can check some game properties like convexity

>> cvQ=convex_gameQ(bv)
cvQ =


The returned logical value indicates that this game is indeed convex. This must
be the case for bankruptcy games. In addition, we can also verify if the
core of the game is non-empty or empty. To see this one needs just to invoke

>> crQ=coreQ(bv)
>> Optimization terminated.

crQ =


which is answered by affirmation. This result confirms our expectation, since each
convex game has a non-empty core.

After this short introduction of game properties, we turn our attention now
to some well known solution concepts from game theory. We start with the
Shapley value, which can be computed by

>> sh_v=ShapleyValue(bv)
sh_v =

23.5175 18.7483 6.4950 44.3008 33.3317 49.6067

A pre-kernel element can be computed with the function

>> prk_v=PreKernel(bv)
prk_v =

20.0000 16.0000 5.5000 48.3500 30.0000 56.1500

which must be identical to the distributional law of justice proposed by the Talmudic
rule. Moreover, it must also coincides with the nucleolus due to the convexity
of the game. To see this, let us compute first the nucleolus and in the next
step the pre-nucleolus

>> nc_bv=nucl(bv)

nc_bv =

20.0000 16.0000 5.5000 48.3500 30.0000 56.1500

>> pn_bv=PreNucl(bv)

pn_bv =

20.0000 16.0000 5.5000 48.3500 30.0000 56.1500

We observe that both solutions coincide, which must be the case for zero-monotonic games.
To check that these solutions are indeed the pre-nucleolus can be verified by Kohlberg's

>> balancedCollectionQ(bv,pn_bv)

ans =


>> balancedCollectionQ(bv,nc_bv)

ans =


Finally, to verify that the solution found is really a pre-kernel element can be done while typing

>> prkQ=PrekernelQ(bv,prk_v)
prkQ =


For a deeper discussion of the function set provided by the toolbox consult the Manual
or type help mat_tug to get a short overview.

Comments and Ratings (27)

Which version of Matlab are you using? Moreover, do you have followed the instructions given by

Alternatively, you can download the zip-archive file, unzip it, and then follow the instruction given in the ReadMe.txt file, which is located in the "doc" folder.

If you still have trouble, then contact me directly by the e-mail that is given at the end of the ReadMe.txt file.

Dear ,
First thank you for your toolbox
I am trying to install it but the following error eccors:

Error using matlab.addons.toolbox.installToolbox
Java exception occurred:
java.util.concurrent.ExecutionException: java.nio.file.NoSuchFileException:


at java.util.concurrent.FutureTask.get(


Caused by: java.nio.file.NoSuchFileException: C:\Users\USER\Documents\MATLAB\Add-Ons

at sun.nio.fs.WindowsException.translateToIOException(

at sun.nio.fs.WindowsException.rethrowAsIOException(

at sun.nio.fs.WindowsException.rethrowAsIOException(

at sun.nio.fs.WindowsFileSystemProvider.createDirectory(

at java.nio.file.Files.createDirectory(

at java.nio.file.Files.createAndCheckIsDirectory(

at java.nio.file.Files.createDirectories(





at com.mathworks.toolboxmanagement.installer.Installer.extract(

at com.mathworks.toolboxmanagement.installer.Installer$

at com.mathworks.toolboxmanagement.installer.Installer$


at java.util.concurrent.ThreadPoolExecutor.runWorker(

at java.util.concurrent.ThreadPoolExecutor$


Could you help me
NB: I am using Windows 10

Will be grateful if you could send me this treatise. E-mail is

Since Matlab R2015a the PreNucl() function uses the dual-simplex method implemented in the Optimization toolbox. Implementing an interior-point algorithm imposes numerical stability issues. If you want while letting me know your e-mail address, I can send you a short treatise that provides more information.

to the previous question: just which method, of course

Thank you for you toolbox! I've got one question: which simplex method do you use for computing prenucleolus in PreNucl() function? Thank you!

Thank you very much for your comments and suggestions, I have reviewed the definition of Myerson 1977 pg 446 and I do not see that i, j have to be in S. In any case, wonderful toolbox and very useful. Thank you very much for your assistance and your patient.

It seems to me that we have two different definitions in mind. The function PartitionLS is referring to the definition provided by Myerson (1977,p.446), and there it is is requested that i,j must be in S. Hence, based on this definition the toolbox routine returns the correct result, namely a trivial partition of the player set N. Moreover, if the function does not fit your needs, you can easily extend and adjust this functions or to use it a as template to incorporate your needs. Exactly, for these reasons the toolbox ships with code. Good luck!

Exactly, these are the parameters . The result is empty when I think it should be one {1}.

Do we speak about the same parameters? Case1: S={1}, cs={{2,3},{3,4}}, n=4. Case2: S={4}, cs={{1,2},{2 3}}, n=4. Whereas the coalitions and communication situations are not represented in unique integers.

Thak you for this excellent Toolbox! It's interesting and very usefull for me. I have a comment regarding the file PartitionSL.m. I think it does not work correctly. In the following cases, S = 1, cs = [6 12], n = 4 or S = 8, cs = [3 6], n = 4 the in the empty set [], when it should give, respectively, 1 and 4. Could you help me with this problem?

A new version of my toolbox is now available that should also solve any inconveniences related to an incompatible folder name under Windows 10. For a short overview of the imposed changes, see the Updates section below.


I got this error while trying to install the toolbox:
Error using matlab.addons.toolbox.installToolbox
Toolbox cannot be installed. Installation path is not accessible.

Also, I could not extract the .zip folder. what should I do?

I'll leave my email in case:

Thanks in advance,

I received the information that the "aux" folder within the Zip archive might produce problems under Windows 10. If so, I recommend to change the name of the folder from "aux" to "aux2", for instance.

According to problems encountered with the provided Zip-file, in particular, by Chinese users under Windows, I recommend to apply the following step as a workaround: Update your file (de)compressor program like WinZip to the latest stable release 22.0.12663. Alternatively, follow the custom installation procedure that can be found at

for installing the second provided file mat_tugV08b.mltbx. If this does not help you out, then contact me with a short report in ASCII or UTF code (please do not provide screen shots) where you have encountered problems to trace the failure down.


dear sir
I cannot open the Zip file. can you send me a new zip-file? thank you very much, my email address is

I am looking forward to your reply!

Daniel Zipf

You have to take into account that the coalitional values are ordered in accordance with the unique integer representations of coalitions. See, for instance, the manual in the doc-folder. Thus, your coalitional values are lexicographical ordered, and you have to convert them into an unique integer representations. This is easily done up to 16 players by w=gameToMatlab(v); then execute sh_w=ShapleyValue(w), to get [161.67,161.67,176.67]. That is what you want. For n>16, this approach is not possible, caused by a basis change, which leaves the order not invariant.

Thak you for this excellent Toolbox! But I have some concerns regarding the Shapley Value. For example for the Game
v=[100 125 50 270 375 350 500] it should be [161.67, 161.67, 176.67] but I compute [88.33, 88.33, 323.33] with all your functions. Do you have any idea, what I am doing wrong?

Xinhai Wang

Dear sir,would you like to send the zip file to my you.

john ed

Hi sir, would you please send the file to my email
thank you very much in advance.


Thanks for your hard work. It's interesting and usefull for me, but it seem the zip is corrupted. some files cannot be released.
Would you pls kindly send the complete file to me Thanks very much.

The aux file is recommend to be renamed in windows, it lead to the following file canot be released correctly

Hi sir, kindly send the file to my email

Many thanks in advance.

It is every time possible that a zip-file can be get corrupted during a download. Alternatively, you can also download the file


to impose a custom installation, or let me know your e-mail address to send you a new zip-file.

It is difficult to open the zip file.
the zip is corrupted. request to upload the zip file again.




The functions to compute the (pre-)nucleolus/kernel, and the associated function set of third party solvers like CPLEX, GUROBI and MOSEK have been modified. Some minor bug fixes.

Revision and extension of the graphical features. Some minor bug fixes.

All functions based on linprog command from the Optimization Toolbox apply now a dual-simplex method. These functions are not anymore backward compatible. The ShapleyValue function is in average ten times faster, but needs more memory.

Some code optimization for the Shapley value functions. A set of new functions were added to compute fairness or related values. Some functions to replicate the Shapley value for related games are incorporated as well as some bugs have been fixed.

Pre-kernel evaluation is in average 30 times faster. New functions to compute the pre-nucleolus, nucleolus and kernel. Class object TuGame with several subclasses was designed.
Some bugs were fixed.

Code optimization for serial as well as
parallel computing The manual has been
revised and extended. Some new functions have been added and some bugs have been fixed.

Updated installation instruction
Revised documentation
A boundary value corrected in CddPreKernel.m

MATLAB Release Compatibility
Created with R2018a
Compatible with any release
Platform Compatibility
Windows macOS Linux