Class IPG

Inheritance Relationships

Base Type

Derived Type

Class Documentation

class Game::IPG : public Game::AbstractGame<Data::IPG::DataObject>

This class handles Integer Programming Games (IPG), namely multiple agents solving an integer programming game.

Subclassed by Models::IPG::IPG

Public Functions

void finalize()

This methods finalizes the model by disabling any edits to the number of players. The proper object (for instance, the ones counting players variables) are initialized with the right values.

inline IPG(GRBEnv *env)

Standard initializer.

Parameters

env – A pointer to the Gurobi Environment

IPG(GRBEnv *env, std::vector<std::shared_ptr<MathOpt::IP_Param>> players)

This constructors initializes the integer programming game with the Gurobi environment env and the vector of shared pointers to the IP_Params in players.

Parameters
  • env – A pointer to the Gurobi Environment

  • players – A vector containing the pointers to the IP param for each player

  • env – Pointer to the Gurobi environment

  • players – The MathOpt::IP_Param for the players

virtual void findNashEq() override

The main method to start the solving process.

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

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

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

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

inline std::vector<arma::vec> getX() const

Gets the X in the incumbent solution.

Returns

A const vector copy of X.

inline double getSocialWelfare() const
inline ZEROStatistics<Data::IPG::DataObject> getStatistics() const

Get the EPECStatistics object for the current instance.

inline void setAlgorithm(Data::IPG::Algorithms algorithm)

Sets the Data::IPG::Algorithms for the solution process.

Parameters

algorithm – An enum from Data::IPG::Algorithms

inline void setPresolve(bool value)

Sets the Data::IPG::Presolve for the solution process.

Parameters

value – A boolean for Data::IPG::Presolve

inline void setLCPAlgorithm(const Data::LCP::Algorithms algo)

Sets the Data::LCP::Algorithms for the LCP solution process.

Parameters

algo – An enum from Data::LCP::Algorithms

inline void setGameObjective(const Data::IPG::Objectives obj)

Sets the Data::IPG::Objectives for the LCP objective.

Parameters

obj – An enum from Data::IPG::Objectives

inline void setCutsAggressiveness(const Data::IPG::CutsAggressiveness aggressiveness)

Sets the Data::IPG::CutsAggressiveness for the cut aggressiveness in Algorithms::IPG::CutAndPlay.

Parameters

aggressiveness – An enum from Data::IPG::CutsAggressiveness

Protected Functions

virtual void preFinalize() = 0

Virtual (empty) method. Can be implemented by a derived class.

virtual void postFinalize() = 0

Virtual (empty) method. Can be implemented by a derived class.

Protected Attributes

std::vector<std::shared_ptr<MathOpt::IP_Param>> PlayersIP = {}

The Integer Programs associated to each player.

std::vector<unsigned int> PlayerVariables = {}

The number of variables for each player.

bool Finalized = {false}
std::vector<arma::vec> Solution

Solution variable values, for each player.

double SocialWelfare

SocialWelfare associated to the incumbent solution.

Private Functions

void getXMinusI(const arma::vec &x, const unsigned int &i, arma::vec &xMinusI) const
Parameters
  • x – The vector containing the full solution. It should have the same size of the field NumVariables

  • i – The index of the designed player

  • xMinusI – An output vector containing x^{-i}

void getXofI(const arma::vec &x, const unsigned int &i, arma::vec &xOfI) const
Parameters
  • x – The vector containing the full solution. It should have the same size of the field NumVariables

  • i – The index of the designed player

  • xOfI – An output vector containing x^i

Private Members

std::shared_ptr<Algorithms::IPG::Algorithm> Algorithm = {}

The Algorithm’s instance.

Friends

friend class Algorithms::IPG::Algorithm
friend class Algorithms::IPG::CutAndPlay