Template Class AbstractGame

Class Documentation

template<typename DataObjectType>
class Game::AbstractGame

An abstract class for a game.

Template Parameters

DataObjectType – The object type for the data

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

   public:
     //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.

Parameters

env – A pointer to the Gurobi environment

AbstractGame() = default

Default constructor.

AbstractGame(AbstractGame&) = delete

Copy constructor. Not active.

~AbstractGame() = default

Deconstructor.

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

Returns the appropriate Data Object Type

inline void setNumThreads(unsigned int t)

Sets the number of threads for Gurobi.

Parameters

t – The number of threads

inline void setRandomSeed(unsigned int t)

Sets the random seed for pseudo-random operations.

Parameters

t – The seed

inline void setPureNashEquilibrium(bool val)

Requires the algorithm to find a pure equilibrium.

Warning

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

Parameters

val – The boolean requirement

inline void setDeviationTolerance(double val)

Sets the tolerance for profitable deviations.

Parameters

val – Deviation tolerance

inline void setTimeLimit(double val)

Sets the timelimit.

Parameters

val – The timelimit

inline int getNumVar() const noexcept

Gets the number of variables.

Returns

The number of variable

inline int getNumPlayers() const noexcept

Gets the number of players.

Returns

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.