|
EPEC solve
Solving Equilibrium Problems with Equilibrium Constraints (EPECs)
|
Class to handle parameterized quadratic programs(QP) More...
#include <games.h>
Public Member Functions | |
| QP_Param (GRBEnv *env=nullptr) | |
| Initialize only the size. Everything else is empty (can be updated later) More... | |
| QP_Param (arma::sp_mat Q, arma::sp_mat C, arma::sp_mat A, arma::sp_mat B, arma::vec c, arma::vec b, GRBEnv *env=nullptr) | |
| Set data at construct time. More... | |
| QP_Param (const QP_Param &Qu) | |
| Copy constructor. More... | |
| QP_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) final |
| Setting the data, while keeping the input objects intact. More... | |
| QP_Param & | set (arma::sp_mat &&Q, arma::sp_mat &&C, arma::sp_mat &&A, arma::sp_mat &&B, arma::vec &&c, arma::vec &&b) final |
| Faster means to set data. But the input objects might be corrupted now. More... | |
| QP_Param & | set (const QP_objective &obj, const QP_constraints &cons) final |
| QP_Param & | set (QP_objective &&obj, QP_constraints &&cons) final |
| bool | operator== (const QP_Param &Q2) const |
| unsigned int | KKT (arma::sp_mat &M, arma::sp_mat &N, arma::vec &q) const |
| Compute the KKT conditions for the given QP. More... | |
| std::unique_ptr< GRBModel > | solveFixed (arma::vec x) |
| double | computeObjective (const arma::vec &y, const arma::vec &x, bool checkFeas=true, double tol=1e-6) const |
| bool | is_Playable (const QP_Param &P) const |
| QP_Param & | addDummy (unsigned int pars, unsigned int vars=0, int position=-1) override |
| void | write (std::string filename, bool append) const |
| Writes a given parameterized Mathematical program to a set of files. More... | |
| void | save (std::string filename, bool erase=true) const |
Saves the Game::QP_Param object in a loadable file. More... | |
| long int | load (std::string filename, long int pos=0) |
Loads the Game::QP_Param object stored in a file. More... | |
| 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_Param & | setQ (const arma::sp_mat &Q) |
| Set the private variable Q. More... | |
| MP_Param & | setC (const arma::sp_mat &C) |
| Set the private variable C. More... | |
| MP_Param & | setA (const arma::sp_mat &A) |
| Set the private variable A. More... | |
| MP_Param & | setB (const arma::sp_mat &B) |
| Set the private variable B. More... | |
| MP_Param & | setc (const arma::vec &c) |
| Set the private variable c. More... | |
| MP_Param & | setb (const arma::vec &b) |
| Set the private variable b. More... | |
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 |
Private Member Functions | |
| int | make_yQy () |
Adds the Gurobi Quadratic objective to the Gurobi model QuadModel. More... | |
Private Attributes | |
| GRBEnv * | env |
| GRBModel | QuadModel |
| bool | made_yQy |
Class to handle parameterized quadratic programs(QP)
Represents a Parameterized QP as
Subject to
|
inline |
|
inline |
|
inline |
|
overridevirtual |
Reimplemented from Game::MP_Param.
|
inherited |
| double Game::QP_Param::computeObjective | ( | const arma::vec & | y, |
| const arma::vec & | x, | ||
| bool | checkFeas = true, |
||
| double | tol = 1e-6 |
||
| ) | const |
|
protectedinherited |
Check that the data for the MP_Param class is valid Always works after calls to MP_Param::size() Checks that are done:
Q is same as Ny (Q should be square)A should be Nx B should be Ny C should be Ny c should be Ny A and B should have the same number of rows, equal to Ncons forcesymm is true, then Q should be symmetric
|
staticinherited |
|
inlineprotectedvirtualinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inline |
Checks if the current object can play a game with another Game::QP_Param object P.
| unsigned int Game::QP_Param::KKT | ( | arma::sp_mat & | M, |
| arma::sp_mat & | N, | ||
| arma::vec & | q | ||
| ) | const |
| long int Game::QP_Param::load | ( | std::string | filename, |
| long int | pos = 0 |
||
| ) |
Loads the Game::QP_Param object stored in a file.
Before calling this function, use the constructor QP_Param::QP_Param(GRBEnv *env) to initialize.
Example usage:
|
private |
| bool Game::QP_Param::operator== | ( | const QP_Param & | Q2 | ) | const |
| void Game::QP_Param::save | ( | std::string | filename, |
| bool | erase = true |
||
| ) | const |
Saves the Game::QP_Param object in a loadable file.
The Game::QP_Param object hence stored can be loaded back using Game::QP_Param::load
|
finalvirtual |
Setting the data, while keeping the input objects intact.
Reimplemented from Game::MP_Param.
|
finalvirtual |
Faster means to set data. But the input objects might be corrupted now.
Reimplemented from Game::MP_Param.
|
finalvirtual |
Reimplemented from Game::MP_Param.
|
finalvirtual |
Setting the data with the inputs being a struct Game::QP_objective and struct Game::QP_constraints
Reimplemented from Game::MP_Param.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
protectedinherited |
Calculates Nx, Ny and Ncons Computes parameters in MP_Param:
Ny as number of rows in MP_Param::QNx as number of columns in MP_Param::CNcons 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
| unique_ptr< GRBModel > Game::QP_Param::solveFixed | ( | arma::vec | x | ) |
Given a value for the parameters
in the definition of QP_Param, solve the parameterized quadratic program to optimality.
In terms of game theory, this can be viewed as the best response for a set of decisions by other players.
| GRBException | if argument vector size is not |
compatible with the Game::QP_Param definition.
| x | Other players' decisions |
| void Game::QP_Param::write | ( | std::string | filename, |
| bool | append | ||
| ) | const |
1.8.13