gambitproject / gambit

Gambit: The package for computation in game theory
http://www.gambit-project.org
GNU General Public License v2.0
406 stars 151 forks source link

Different results in gambit and GTE #222

Closed amandaccsantos closed 5 years ago

amandaccsantos commented 7 years ago

We are trying to find the equilibrium for a given case, but the result found by gambit-enummixed using lrslib is different from that found in Game Theory Explorer (GTE).

Input in GTE:

`

#FF0000 #0000FF Times 1 5 5 1 2 { "A" "B" "C" "D" "E" "F" } { "a" "b" "c" "d" "e" "f" } 0 0 -4237/50000 0 7353/125000 5597/125000 0 0 -4237/50000 0 7353/125000 5597/125000 42373/500000 42373/500000 0 42373/500000 142857/1000000 16129/125000 0 0 -4237/50000 0 7353/125000 5597/125000 -6569/100000 -6569/100000 -187/1250 -6569/100000 -689/100000 -209/10000 -229/10000 -229/10000 -10743/100000 -229/10000 3597/100000 2189/100000 0 0 4237/50000 0 -7353/125000 -5597/125000 0 0 4237/50000 0 -7353/125000 -5597/125000 -1900053747/945734957 -1900053747/945734957 0 -1900053747/945734957 -142857/1000000 -16129/125000 0 0 4237/50000 0 -7353/125000 -5597/125000 6569/100000 6569/100000 187/1250 6569/100000 689/100000 209/10000 229/10000 229/10000 10743/100000 229/10000 -3597/100000 -2189/100000

`

Input in gambit-enummixed:

NFG 1 R "state" {"Player0" "Player1"} {6 6} 0.000000 -0.000000 0.000000 -0.000000 0.084746 -0.084746 0.000000 -0.000000 -0.065693 0.065693 -0.022901 0.022901 0.000000 -0.000000 0.000000 -0.000000 0.084746 -0.084746 0.000000 -0.000000 -0.065693 0.065693 -0.022901 0.022901 -0.084746 0.084746 -0.084746 0.084746 0.000000 -0.000000 -0.084746 0.084746 -0.149606 0.149606 -0.107438 0.107438 0.000000 -0.000000 0.000000 -0.000000 0.084746 -0.084746 0.000000 -0.000000 -0.065693 0.065693 -0.022901 0.022901 0.058824 -0.058824 0.058824 -0.058824 0.142857 -0.142857 0.058824 -0.058824 -0.006897 0.006897 0.035971 -0.035971 0.044776 -0.044776 0.044776 -0.044776 0.129032 -0.129032 0.044776 -0.044776 -0.020979 0.020979 0.021898 -0.021898

The results obtained in the GTE are:

gte

The one obtained in the gambit-enummixed with the -L parameter are:

Compute Nash equilibria by enumerating extreme points Gambit version 16.0.1, Copyright (C) 1994-2016, The Gambit Project Enumeration code based on lrslib 6.2, Copyright (C) 1995-2016 by David Avis (avis@cs.mcgill.ca) This is free software, distributed under the GNU GPL

0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 V#0 R#0 B#1 h=0 facets 9 10 11 12 I#12 det= 30 in_det=-3/72737995964704359 z=-0/0

Could anyone please help us understand why the results are different?

Thanks

tturocy commented 7 years ago

Hello - just by inspecting the files, the payoff matrices in the two files are not the same. That may or may not be enough to explain the difference (especially as you are getting a PSNE) but it could be. Could you try using the same payoff matrix for both (and more importantly establish which is the one that's "correct" for your application!) and report back on that?

andertavares commented 7 years ago

Hi, I'm co-working with Amanda on this. I'm observing an unexpected behavior of GTE. The steps to reproduce it are as follows:

Could this be 'confusing' the online solver?

tturocy commented 7 years ago

Is this last item GTE-specific? If so, please post it on the GTE issue tracker so it can get looked at there.

amandaccsantos commented 7 years ago

I posted an issue on the GTE, but the result found in gambit still differs from another solver we tested.

The result from solver https://www.math.ucla.edu/~tom/gamesolve.html is shown in the image below:

image

The solver found as equilibrium the fifth strategy, different from the result found in gambit.

tturocy commented 7 years ago

The game you sent to that online solver is very different from the one in the .nfg file posted earlier. In the Gambit file, the fifth strategy is actually the worst response for Player 1 to Player 2 choosing the fifth strategy.

The output returned by Gambit is definitely correct for that game - it can be cross-checked by gambit-lp, gambit-lcp, and gambit-logit as well.

Basically, the game in your GTE file, the game in the Gambit .nfg file, and the game you sent to that other online server, all have different payoff matrices, from what I can see.

The output returned by Gambit is definitely correct for that game - it can be cross-checked by gambit-lp, gambit-lcp, and gambit-logit as well.

Basically, the game in your GTE file, the game in the Gambit .nfg file, and the game you sent to that other online server, all have different payoff matrices, from what I can see.

andertavares commented 7 years ago

Maybe we misunderstood the NFG file format... I'll paste it again to try verify whether we got it right (line breaks manually added for easier read):

NFG 1 R "state" 
{"Player0" "Player1"}{6 6} 
0.000000 -0.000000 0.000000 -0.000000 0.084746 -0.084746 0.000000 -0.000000 -0.065693 0.065693 -0.022901 0.022901 
0.000000 -0.000000 0.000000 -0.000000 0.084746 -0.084746 0.000000 -0.000000 -0.065693 0.065693 -0.022901 0.022901 
-0.084746 0.084746 -0.084746 0.084746 0.000000 -0.000000 -0.084746 0.084746 -0.149606 0.149606 -0.107438 0.107438 
0.000000 -0.000000 0.000000 -0.000000 0.084746 -0.084746 0.000000 -0.000000 -0.065693 0.065693 -0.022901 0.022901 
0.058824 -0.058824 0.058824 -0.058824 0.142857 -0.142857 0.058824 -0.058824 -0.006897 0.006897 0.035971 -0.035971 
0.044776 -0.044776 0.044776 -0.044776 0.129032 -0.129032 0.044776 -0.044776 -0.020979 0.020979 0.021898 -0.021898

As it is a 6x6 game, we have 6 rows and 12 columns in the file, right?

Isn't the 5th action for player 1 (player 0 in the file) the best response for the 5th action of player 2 (player 1 in the file)? In the 5th action of player 2 (5th pair of columns), the highest payoff for player1 is -0.006897 (5th row), right?

All gambit-lp, gambit-enummixed and gambit-lcp all give NE,0,0,1,0,0,0,0,0,1,0,0,0, which means the 3rd action is in equilibrium for both players. The payoff profile in this case is (0, 0), right? But, if player 2 plays 3rd action, isn't it useful for player1 to deviate from the 5th action, gaining 0.142857 instead of 0?

Thanks for the help so far :)

tturocy commented 7 years ago

The file formats are documented in the documentation: http://gambitproject.readthedocs.io/en/v15.1.1/formats.html, although it would of course always be preferable to use existing tools to manipulate games whenever possible rather than "rolling your own".

andertavares commented 7 years ago

It seems that we have indeed misunderstood the NFG file format. The game I was trying to portray was: intended_game

When generating the file, I was incrementing player 2's action per pair of columns instead of player 1's. The notion that player 1 was the 'row' player and player 2 was the 'column' player confused me.

Being able to generate the game from existing tools would be great. However, I'm calling the command-line tools from a Java application, as per this old thread: https://sourceforge.net/p/gambit/discussion/191782/thread/40d98c15/. Is there a way to instantiate Gambit directly from Java code?

Thanks again for the help.

[EDIT] By the way, the .nfg that represents the game in the figure would be like the one below, right?:

NFG 1 R "state" 
{"Player0" "Player1"}{6 6} 
       0         0        0         0 -0.08474  0.08474        0         0  0.058824 -0.058824 0.044776 -0.044776
       0         0        0         0 -0.08474  0.08474        0         0  0.058824 -0.058824 0.044776 -0.044776
0.084746 -0.084746 0.084746 -0.084746        0        0 0.084746 -0.084746  0.142857 -0.142857 0.129032 -0.129032
       0         0        0         0 -0.08474  0.08474        0         0  0.058824 -0.058824 0.044776 -0.044776
-0.06569   0.06569 -0.06569   0.06569  -0.1496   0.1496 -0.06569   0.06569  -0.00689   0.00689  -0.0209    0.0209 
 0.0209    -0.0209  0.0209    -0.0209 -0.10743   0.10743  -0.0229    0.0229  0.03597  -0.03597  0.02189  -0.02189
tturocy commented 7 years ago

Ahh, Java. Now the root cause of your problem is clear. :)

We offer C++ and Python bindings. There aren't Java bindings because that seems like too much of a niche use case, so when it's down to the use of scarce resources, that's not high on the priority list.

andertavares commented 7 years ago

Yeah, I have to apply game theory on an existing platform, which is in Java...

Amanda has posted that GTE issue (automatically changing the payoffs) on their issue tracker.

Feel free to close this one, as it is not actually an issue :)

Thanks!