Template Class AbstractGame

Class Documentation

template<typename DataObjectType>
class AbstractGame

An abstract class for a game.

Template Parameters

DataObjectType – The object type for the data

class aGame : public AbstractGame<Data::aGame::DataObject>{

     //Override AbstractGame methods
    void findNashEq() override;
    bool       isSolved(double tol = 1e-5) const override;
    bool isPureStrategy(double tol = 1e-5) const override;


Public Functions

inline AbstractGame(GRBEnv *env)

Standard constructor with the Gurobi Environment.


env – A pointer to the Gurobi environment

AbstractGame() = default

Default constructor.

AbstractGame(AbstractGame&) = delete

Copy constructor. Not active.

~AbstractGame() = default


virtual void findNashEq() = 0

The main method to start the solving process.

virtual bool isSolved(double tol = 1e-5) const = 0

Return a bool true if the strategies are all pure, for any player.

virtual bool isPureStrategy(double tol = 1e-5) const = 0

Return a bool indicating whether the equilibrium is a pure strategy.

inline ZEROStatistics<DataObjectType> getStatistics() const

Getter for statistics.


Returns the appropriate Data Object Type

inline void setNumThreads(unsigned int t)

Sets the number of threads for Gurobi.


t – The number of threads

inline void setRandomSeed(unsigned int t)

Sets the random seed for pseudo-random operations.


t – The seed

inline void setPureNashEquilibrium(bool val)

Requires the algorithm to find a pure equilibrium.


This field may not be used by all the inheritor algorithms.


val – The boolean requirement

inline void setDeviationTolerance(double val)

Sets the tolerance for profitable deviations.


val – Deviation tolerance

inline void setTimeLimit(double val)

Sets the timelimit.


val – The timelimit

inline int getNumVar() const noexcept

Gets the number of variables.


The number of variable

inline int getNumPlayers() const noexcept

Gets the number of players.


The number of players

Protected Attributes

std::chrono::high_resolution_clock::time_point InitTime
ZEROStatistics<DataObjectType> Stats = ZEROStatistics<DataObjectType>(DataObjectType())
GRBEnv *Env = {}

Store run time information.

The Gurobi environment

unsigned int NumVariables = {0}

The number of variables in the game.

unsigned int NumPlayers = {0}

The number of players in the game.

bool NashEquilibrium = {false}

True if computeNashEq returned an equilibrium. Note that this can be the equilibrium of an approximation, and not to the original game. Refer to isSolved() to get a definitive answer.