#18496: Parsing output from Gambit as a string
-------------------------------------+-------------------------------------
   Reporter:  ptigwe                 |            Owner:
       Type:  defect                 |           Status:  new
   Priority:  minor                  |        Milestone:  sage-6.8
  Component:  game theory            |         Keywords:  Game Theory,
  Merged in:                         |  Gambit, Normal Form Games
  Reviewers:                         |          Authors:  Tobenna P. Igwe
Work issues:                         |  Report Upstream:  N/A
     Commit:                         |           Branch:
  32e8ae8fb850fc5bf906a58cf4da56d3ba28f57f|  u/ptigwe/game_theory_parser
   Stopgaps:                         |     Dependencies:
-------------------------------------+-------------------------------------
 There's no need to parse the solution gotten from gambit as a string,
 because it returns a list of strategy profiles (which itself is kind of a
 list). Also, parsing the output as a string causes errors when the solver
 returns a Rational output.
 {{{
 #!python
 sage: import gambit
 sage: from sage.game_theory.parser import Parser
 sage: g = gambit.Game.new_table([2,2])
 sage: solver = gambit.nash.ExternalLCPSolver()
 sage: p = Parser(solver.solve(g, rational=True))
 sage: s = p.format_LCP(g)
 }}}
 {{{
     309         nice_stuff = []
     310         for gambitstrategy in self.raw_string:
 --> 311             gambitstrategy =
 eval(str(gambitstrategy)[str(gambitstrategy).index("["):
 str(gambitstrategy).index("]") + 1])
     312             profile =
 [tuple(gambitstrategy[:len(gambit_game.players[int(0)].strategies)])]
     313             for player in list(gambit_game.players)[1:]:

 NameError: name 'Fraction' is not defined
 }}}

 Also, all output generated by the gambit python interface uses the same
 format, so a general name 'format_gambit' fits more than 'format_LCP'.

--
Ticket URL: <http://trac.sagemath.org/ticket/18496>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to