Master python #20

wants to merge 68 commits into


None yet
3 participants

I have made the necessary changes to include the is_constant_sum property.

tturocy and others added some commits Mar 22, 2010

Create Cython wrapper framework.
Create basic Cython wrapper framework for game representation
library.  Proof of concept: can import the extension module,
create a trivial extensive game, and see that it has one node.
Wrap std::string and create title property of game.
- Create wrapper for std::string with interface to char *
- Implement title property of game in Cython with getter/setter.
Implement game.read_game() to load game from savefile.
- Create convenience wrapper function ReadGame(char *) to handle
  creating the std::ifstream for reading a game
- Implement game.read_game() as wrapper of ReadGame()
- game.read_game() raises an IOError on any C++ exception.
  The current error message is not that informative, since the same
  error occurs on nonexistent files versus ones which have syntax errors.
Implement writing of files, __str__ and __repr__ for games
Implement the following:
- is_tree property for games
- write() member for games, returning a string containing the
  .efg or .nfg format savefile
- __str__ for games returns game title
- __repr__ for games returns the .efg or .nfg format savefile,
  based on whether the game is natively a tree or table.
Implement support for player representation in Python.
Implement rudimentary types for representing players in Python.

In class Game:
- property players returns a collection object for interfacing with the
  collection of players

Class Players:
- operates as collection object for interfacing with list of players
- implement __getitem__ (zero-based indices)
- implement __len__ for number of personal players
- implement property chance for chance player

Class Player:
- wraps Gambit::GamePlayer
- implement property label
- implement property is_chance
Implement support for outcome representation in Python.
Implement rudimentary types for representing outcomes in Python.

In class Game:
- property outcomes returns a collection object for interfacing with the
  collection of outcomes

Class Outcomes:
- operates as a collection object for interfacing with list of outcomes
- implement __getitem__ (zero-based indices)
- implement __len__ for number of outcomes

Class Outcome:
- wraps Gambit::GameOutcome
- implement property label
Implement access to strategic game payoffs from Python.
Adds ability to access outcomes in strategic games:
- __getitem__ on a game returns the outcome associated with
  a strategy profile
- __getitem__ and __setitem__ on an outcome gets/sets payoffs
  for each player
Implement mixed profile representation.
Implements interaction with mixed strategy profiles in Python.
- Introduces mixed_profile() factory method on games
- Indexing on profiles supports int, Player, Strategy
- payoff() returns the expected payoff to a player
- strategy_value() returns the expected payoff to a strategy
- liap_value() returns the Lyapunov value.
Implement strategy pattern access to external Nash solvers.
- Update existing nash module code to use strategy pattern
- Migrate to recommended subprocess module (instead of os.popen2)
  for interfacing with external programs
- Create basic interfaces to all external Nash command-line programs.
- Create basic interface to extended features of QRE path-following via
  command-line programs.
Implement pure strategy profile collection and iterator for games.
- Add property `contingency` for games, representing the collection
  of pure strategy profiles.
- iter(game.contingencies) iterates over all contingencies.
- len(game.contingencies) reports the total number of contingencies.
- cont[strategy] creates a "restricted" iterator over the game, iterating
  only over pure strategy profiles containing `strategy`.
Implement basic elements of number protocol for gambit.Number
- All six comparison operators
- Arithmetic operations + - * /

Exposes the Number class as gambit.Number.

These should be enough to start using Numbers more or less interchangeably
with Python numerical objects.
Extensions to Tullock contest model and order-statistic games.
* Allow arbitrary cost functions (default is still linear).
* Allow arbitrary strategy sets, with the only restriction being
  the entries are equally spaced in the integers.
Usability refinements to symmetric QRE tracing package.
* Implement __getattr__ on LogitQRE, so that all members supported
  by the underlying profile are available directly on the profile.
* Added a callback parameter to QRE path and compute_at_lambda
  tracers, following the convention used in SciPy's optimization
* Support graceful termination of QRE path tracing via KeyboardInterrupt,
  returning the list of profiles computed so far.
Integrate outcome payoffs with Python numeric tower.
Python's numeric tower offers (from Python 2.6) classes
fractions.Fraction and decimal.Decimal, which allow us to
represent payoffs exactly.  Payoffs for outcomes now
use these classes:
* If a payoff's text representation has a decimal point,
  the payoff is returned to Python as a decimal.Decimal.
* If a payoff's text representation does not have a decimal point,
  the payoff is returned to Python as a fractions.Fraction.
* Payoffs can be set using int, decimal.Decimal, or fractions.Fraction.
  Floating point numbers are not accepted as they may give
  unexpected results (e.g., the rounding error that occurs with
  a number like 1.1); the user must explicitly convert to
  Decimal or Fraction.
Cython build system rationalization:
* Rename Cython include files to .pxi
* Automatically pick up all .pxi files in libgambit wrapper.
* Rename libgambit wrapper file to better reflect scope.
* Include in gambit.lib as per proper style.
Merge pull request #9 from skunath/basic_tests
Added basic tests and created directory for test games
Implement Solution base class for all solution profiles.
* Solution base class provides common features for all strategy
  profiles satisfying some solution concept of a game, most notably
  that the profile raises an exception when attempting to set a
  probability (solutions are intended to be non-mutable).
* Solution classes created for Nash equilibria, logit QRE,
  and cognitive hierarchy solutions.
* Interaction with external Nash solvers simplified to support
  creation of Nash equilibrium solution classes.
Standardize order statistic games to conform to standard game model;
implement conversion from order statistic game to explicit C++ game table.
Implement indexing model for players, outcomes, and strategies.
* Collections can be indexed either by integers or object labels.
* A warning is issued when re-using a label where there is a possibility
  of ambiguity.
* Test suite expanded to exercise these new features.
Standardize implementation of collection classes.
* Create base class Collection for all collections.
* Base class handles lookups by labels.
* Do not need to check indexes for validity, as the Cython interface
  is set up to convert Gambit's index exceptions into IndexError
* Exception messages in Collection.__getitem__ are in a similar style
  to those in Python's builtin classes.
Extensions to cognitive hierarchy modeling.
* Make level-k computation robust to large payoffs, negative tau or lambda.
* Implement maximum-likelihood fitting of cognitive hierarchy.
Added tests to verify add player functionality.
This adds tests for the add() method for the players collection in a game. In the case of a strategic game it will add a player with 1 strategy and in the case of an extensive game it will add a player with no moves.

Additionally, the python api documentation was updated to reflect the add player functionality.
This commit adds functionality that will allow for a new strategy to …
…be added to a player's set of strategies.

The add_strategy functionality is intended for use with games in strategic form. If it is applied to a game in extensive form it will raise a TypeError.

Additional changes have been made to the testing suite to verify the new functionality. Also, the player object documentation has been updated to reflect the new method.
Added additional functionality for the infoset class.
Specifically, this commit adds a function to retrieve the player associated with the infoset as well as a test to see if a particular game node precedes the infoset in the game tree.

The class was added to the documentation and the methods and properties were added. Additionally, tests were created to validate the use of the infoset object. Part of the tests involved including an extensive form game derived form the gambit supplied games.
This commit builds out functionality for the Node object.
The methods implemented here include: is_successor_of, and is_subgame_root

New properties implemented in this commit include: infoset, player, parent, prior_action, prior_sibling, next_sibling, is_terminal, and outcome

One property not implemented was next_action as it did not appear to be in the c++ interface.

Additionally, tests for all new features were implemented and the corresponding documentation was updated.
This commit enhances the features of the action class.
Specifically, this commit adds the prob property to the action class. This can be used to read or set the property. It requires an int, decimal.Decimal, or fractions.Fraction item.

The property was added. Additionally, suitable tests were needed to ensure the funcitonality was working. Because of this a new test game was added that had action probabilities encoded.

Additionally, the python api documentation was updated. Also, this commit includes additional tests for node properties.
Implement mixed strategy profiles.
* Support for both double and rational precision versions, with rational
  precision version interfacing correctly with fractions.Fraction
* Support for computing Nash equilibria using rational precision via
  external solution methods, where appropriate.
* Implement strategy_value_deriv() operation.
* Strategy profile indexing conforms to conventions for games.

tturocy commented Mar 28, 2012

There are several major problems.

(1) This requests a pull into master, which would bring in many changes from master_python. Completely inappropriate.
(2) The commit message is completely uninformative.
(3) It is clear that the committed did not test this code, as it will not even compile. We are not stupid.

@tturocy tturocy closed this Mar 28, 2012

I am extremely Sorry , I was in a hurry , made a small mistake in one module .


tturocy commented Mar 28, 2012

Not compiling the code and running the test is not "a small mistake." It is deception.

i wrote test cases too , while pushing i made a small mistake , apologies again but i am not decepting you.

sry , i dont want to decept you :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment