EPEC solve
Solving Equilibrium Problems with Equilibrium Constraints (EPECs)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
Game::MP_Param Class Reference

class to handle parameterized mathematical programs(MP) More...

#include <games.h>

Inheritance diagram for Game::MP_Param:
Game::QP_Param

Public Member Functions

 MP_Param ()=default
 
 MP_Param (const MP_Param &M)=default
 
void bound (double bigM, unsigned int primals)
 
arma::sp_mat getQ () const
 Read-only access to the private variable Q. More...
 
arma::sp_mat getC () const
 Read-only access to the private variable C. More...
 
arma::sp_mat getA () const
 Read-only access to the private variable A. More...
 
arma::sp_mat getB () const
 Read-only access to the private variable B. More...
 
arma::vec getc () const
 Read-only access to the private variable c. More...
 
arma::vec getb () const
 Read-only access to the private variable b. More...
 
unsigned int getNx () const
 Read-only access to the private variable Nx. More...
 
unsigned int getNy () const
 Read-only access to the private variable Ny. More...
 
MP_ParamsetQ (const arma::sp_mat &Q)
 Set the private variable Q. More...
 
MP_ParamsetC (const arma::sp_mat &C)
 Set the private variable C. More...
 
MP_ParamsetA (const arma::sp_mat &A)
 Set the private variable A. More...
 
MP_ParamsetB (const arma::sp_mat &B)
 Set the private variable B. More...
 
MP_Paramsetc (const arma::vec &c)
 Set the private variable c. More...
 
MP_Paramsetb (const arma::vec &b)
 Set the private variable b. More...
 
virtual MP_Paramset (const arma::sp_mat &Q, const arma::sp_mat &C, const arma::sp_mat &A, const arma::sp_mat &B, const arma::vec &c, const arma::vec &b)
 Setting the data, while keeping the input objects intact. More...
 
virtual MP_Paramset (arma::sp_mat &&Q, arma::sp_mat &&C, arma::sp_mat &&A, arma::sp_mat &&B, arma::vec &&c, arma::vec &&b)
 Faster means to set data. But the input objects might be corrupted now. More...
 
virtual MP_Paramset (const QP_objective &obj, const QP_constraints &cons)
 
virtual MP_Paramset (QP_objective &&obj, QP_constraints &&cons)
 
virtual MP_ParamaddDummy (unsigned int pars, unsigned int vars=0, int position=-1)
 
void write (std::string filename, bool append=true) const
 

Static Public Member Functions

static bool dataCheck (const QP_objective &obj, const QP_constraints &cons, bool checkObj=true, bool checkCons=true)
 

Protected Member Functions

unsigned int size ()
 Calculates Nx, Ny and Ncons Computes parameters in MP_Param: More...
 
bool dataCheck (bool forcesymm=true) const
 Check that the data for the MP_Param class is valid Always works after calls to MP_Param::size() Checks that are done: More...
 
virtual bool finalize ()
 Finalize the MP_Param object. More...
 

Protected Attributes

arma::sp_mat Q
 
arma::sp_mat A
 
arma::sp_mat B
 
arma::sp_mat C
 
arma::vec c
 
arma::vec b
 
unsigned int Nx
 
unsigned int Ny
 
unsigned int Ncons
 

Detailed Description

class to handle parameterized mathematical programs(MP)

Definition at line 52 of file games.h.

Constructor & Destructor Documentation

◆ MP_Param() [1/2]

Game::MP_Param::MP_Param ( )
default

◆ MP_Param() [2/2]

Game::MP_Param::MP_Param ( const MP_Param M)
default

Member Function Documentation

◆ addDummy()

Game::MP_Param & Game::MP_Param::addDummy ( unsigned int  pars,
unsigned int  vars = 0,
int  position = -1 
)
virtual

Adds dummy variables to a parameterized mathematical program position dictates the position at which the parameters can be added. -1 for adding at the end.

Warning
position cannot be set for vars. vars always added at the end.

Reimplemented in Game::QP_Param.

Definition at line 101 of file Games.cpp.

◆ bound()

void Game::MP_Param::bound ( double  bigM,
unsigned int  primals 
)

◆ dataCheck() [1/2]

bool Game::MP_Param::dataCheck ( bool  forcesymm = true) const
protected

Check that the data for the MP_Param class is valid Always works after calls to MP_Param::size() Checks that are done:

  • Number of columns in Q is same as Ny (Q should be square)
  • Number of columns of A should be Nx
  • Number of columns of B should be Ny
  • Number of rows in C should be Ny
  • Size of c should be Ny
  • A and B should have the same number of rows, equal to Ncons
  • if forcesymm is true, then Q should be symmetric
Returns
true if all above checks are cleared. false otherwise.

Definition at line 219 of file Games.cpp.

◆ dataCheck() [2/2]

bool Game::MP_Param::dataCheck ( const QP_objective obj,
const QP_constraints cons,
bool  checkObj = true,
bool  checkCons = true 
)
static

Definition at line 262 of file Games.cpp.

◆ finalize()

virtual bool Game::MP_Param::finalize ( )
inlineprotectedvirtual

Finalize the MP_Param object.

Definition at line 61 of file games.h.

◆ getA()

arma::sp_mat Game::MP_Param::getA ( ) const
inline

Read-only access to the private variable A.

Definition at line 80 of file games.h.

◆ getB()

arma::sp_mat Game::MP_Param::getB ( ) const
inline

Read-only access to the private variable B.

Definition at line 83 of file games.h.

◆ getb()

arma::vec Game::MP_Param::getb ( ) const
inline

Read-only access to the private variable b.

Definition at line 89 of file games.h.

◆ getC()

arma::sp_mat Game::MP_Param::getC ( ) const
inline

Read-only access to the private variable C.

Definition at line 77 of file games.h.

◆ getc()

arma::vec Game::MP_Param::getc ( ) const
inline

Read-only access to the private variable c.

Definition at line 86 of file games.h.

◆ getNx()

unsigned int Game::MP_Param::getNx ( ) const
inline

Read-only access to the private variable Nx.

Definition at line 92 of file games.h.

◆ getNy()

unsigned int Game::MP_Param::getNy ( ) const
inline

Read-only access to the private variable Ny.

Definition at line 95 of file games.h.

◆ getQ()

arma::sp_mat Game::MP_Param::getQ ( ) const
inline

Read-only access to the private variable Q.

Definition at line 74 of file games.h.

◆ set() [1/4]

Game::MP_Param & Game::MP_Param::set ( const arma::sp_mat &  Q,
const arma::sp_mat &  C,
const arma::sp_mat &  A,
const arma::sp_mat &  B,
const arma::vec &  c,
const arma::vec &  b 
)
virtual

Setting the data, while keeping the input objects intact.

Reimplemented in Game::QP_Param.

Definition at line 178 of file Games.cpp.

◆ set() [2/4]

Game::MP_Param & Game::MP_Param::set ( arma::sp_mat &&  Q,
arma::sp_mat &&  C,
arma::sp_mat &&  A,
arma::sp_mat &&  B,
arma::vec &&  c,
arma::vec &&  b 
)
virtual

Faster means to set data. But the input objects might be corrupted now.

Reimplemented in Game::QP_Param.

Definition at line 194 of file Games.cpp.

◆ set() [3/4]

Game::MP_Param & Game::MP_Param::set ( const QP_objective obj,
const QP_constraints cons 
)
virtual

Reimplemented in Game::QP_Param.

Definition at line 210 of file Games.cpp.

◆ set() [4/4]

Game::MP_Param & Game::MP_Param::set ( QP_objective &&  obj,
QP_constraints &&  cons 
)
virtual

Reimplemented in Game::QP_Param.

Definition at line 215 of file Games.cpp.

◆ setA()

MP_Param& Game::MP_Param::setA ( const arma::sp_mat &  A)
inline

Set the private variable A.

Definition at line 107 of file games.h.

◆ setB()

MP_Param& Game::MP_Param::setB ( const arma::sp_mat &  B)
inline

Set the private variable B.

Definition at line 111 of file games.h.

◆ setb()

MP_Param& Game::MP_Param::setb ( const arma::vec &  b)
inline

Set the private variable b.

Definition at line 119 of file games.h.

◆ setC()

MP_Param& Game::MP_Param::setC ( const arma::sp_mat &  C)
inline

Set the private variable C.

Definition at line 103 of file games.h.

◆ setc()

MP_Param& Game::MP_Param::setc ( const arma::vec &  c)
inline

Set the private variable c.

Definition at line 115 of file games.h.

◆ setQ()

MP_Param& Game::MP_Param::setQ ( const arma::sp_mat &  Q)
inline

Set the private variable Q.

Definition at line 99 of file games.h.

◆ size()

unsigned int Game::MP_Param::size ( )
protected

Calculates Nx, Ny and Ncons Computes parameters in MP_Param:

  • Computes Ny as number of rows in MP_Param::Q
  • Computes Nx as number of columns in MP_Param::C
  • Computes Ncons as number of rows in MP_Param::b, i.e., the RHS of the constraints
    For proper working, MP_Param::dataCheck() has to be run after this.
    @returns @p Ny, Number of variables in the quadratic program, QP

Definition at line 159 of file Games.cpp.

◆ write()

void Game::MP_Param::write ( std::string  filename,
bool  append = true 
) const

Writes a given parameterized Mathematical program to a set of files.

Writes a given parameterized Mathematical program to a set of files. One file is written for each attribute namely

  1. Game::MP_Param::Q
  2. Game::MP_Param::C
  3. Game::MP_Param::A
  4. Game::MP_Param::B
  5. Game::MP_Param::c
  6. Game::MP_Param::b

To contrast see, Game::MP_Param::save where all details are written to a single loadable file

Definition at line 60 of file Games.cpp.

Field Documentation

◆ A

arma::sp_mat Game::MP_Param::A
protected

Definition at line 55 of file games.h.

◆ B

arma::sp_mat Game::MP_Param::B
protected

Definition at line 55 of file games.h.

◆ b

arma::vec Game::MP_Param::b
protected

Definition at line 56 of file games.h.

◆ C

arma::sp_mat Game::MP_Param::C
protected

Definition at line 55 of file games.h.

◆ c

arma::vec Game::MP_Param::c
protected

Definition at line 56 of file games.h.

◆ Ncons

unsigned int Game::MP_Param::Ncons
protected

Definition at line 58 of file games.h.

◆ Nx

unsigned int Game::MP_Param::Nx
protected

Definition at line 58 of file games.h.

◆ Ny

unsigned int Game::MP_Param::Ny
protected

Definition at line 58 of file games.h.

◆ Q

arma::sp_mat Game::MP_Param::Q
protected

Definition at line 55 of file games.h.


The documentation for this class was generated from the following files: