GithubHelp home page GithubHelp logo

Comments (3)

HLiuUS avatar HLiuUS commented on July 17, 2024 1

Thanks for the quick feedback VInce, no rush :)

Just want to let you know that the support_enumeration method works just fine.

from nashpy.

drvinceknight avatar drvinceknight commented on July 17, 2024

Thanks for raising this @HLiuUS, I will investigate. The game is pretty degenerate so that might be causing some trouble although the mixup in the dimensions seems to indicate an issue that's fixable. One easy improvement of current behaviour would be to at least raise an error if the dimensions aren't correct (for all algorithms)...

It might be a little while before I look at this (a lot of marking/grading this time of year) but I will. Thanks again for taking the time to open the issue 👍

For my own records:

>>> A = [[-1, -1, -1], [0, 0, 0], [-1, -1, -10000]]
>>> B = A
>>> game = nash.Game(A, B)
>>> list(game.support_enumeration())
[(array([ 0.,  1.,  0.]), array([ 1.,  0.,  0.])),
 (array([ 0.,  1.,  0.]), array([ 0.,  1.,  0.])),
 (array([ 0.,  1.,  0.]), array([ 0.,  0.,  1.]))]
>>> list(game.vertex_enumeration())
[(array([ 0.,  1.,  0.]), array([ 0.,  0.,  1.])),
 (array([ 0.,  1.,  0.]), array([ 0.,  1.,  0.])),
 (array([ 0.,  1.,  0.]), array([ 1.,  0.,  0.]))]
>>> list(game.lemke_howson(0))
[array([ nan,  nan]),
 array([  3.33344446e-01,   3.33344446e-01,   3.33344446e-01,
         -3.33377784e-05])]

from nashpy.

drvinceknight avatar drvinceknight commented on July 17, 2024

Thanks again for raising this @HLiuUS, I'm about to merge #36 which adds a warning when the output is nonsensical (as in the case you've sent here).

So now the output would look like:

/home/vince/src/Nashpy/src/nash/integer_pivoting/integer_pivoting.py:27: RuntimeWarning: invalid value encountered in true_divide
  return np.argmax(tableau[:, column_index] / tableau[:, -1])
/home/vince/src/Nashpy/src/nash/algorithms/lemke_howson.py:54: RuntimeWarning: invalid value encountered in true_divide
  return strategy / sum(strategy)
/home/vince/src/Nashpy/src/nash/algorithms/lemke_howson.py:113: RuntimeWarning: The Lemke Howson algorithm has returned probability vectors of 
incorrect shapes. This indicates an error. Your game could be degenerate.
  warnings.warn(msg, RuntimeWarning)

You can see many errors occur along the way because of the fact that the game is degenerate, the final error is the one I've added.

I am contemplating letting the algorithm fail all together but will just use warning for now.

from nashpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.