BCESolve
|
Solves a BCEAbstractGame using gurobi. More...
#include <bcesolver.hpp>
Public Types | |
enum | DoubleParameter { MinAngleIncrement } |
Double parameters. More... | |
enum | IntParameter { CurrentObjective , DisplayLevel , BoundaryObjective1 , BoundaryObjective2 } |
Integer parameters. More... | |
enum | BoolParameter |
Bool parameters. More... | |
Public Member Functions | |
void | setMinAngleIncr (double incr) |
Used to set the minimum angle increment. Called by bcesolverworker.hpp. | |
BCESolver () | |
Default constructor. More... | |
BCESolver (BCEAbstractGame &_game) | |
Constructor. More... | |
~BCESolver () | |
Destructor. | |
void | populate () |
Main populate routine. More... | |
void | solve (vector< double > &objectiveWeights) |
Solve method. More... | |
void | mapBoundary (const char *fname) |
Maps the frontier. More... | |
void | mapBoundary () |
Maps the frontier. More... | |
void | mapBoundary (const char *fname, const vector< vector< double > > &weights) |
Maps the frontier. More... | |
void | mapBoundary (const vector< vector< double > > &weights) |
Maps the frontier. More... | |
void | getSolution (BCESolution &output) |
Returns the data object. More... | |
void | bceToMap (map< int, double > &distribution) |
Copies the BCE to a map. More... | |
GRBModel & | getModel () |
Returns the BCESolver::model object. | |
const GRBLinExpr & | getObjectiveFunction (int n) const |
Returns the th objective function. | |
GRBLinExpr & | getObjective () |
Returns the objective for BCESolver::model. | |
void | clear () |
Clears the BCESolver. | |
void | setParameter (BCESolver::DoubleParameter, double arg) |
Set double parameter. | |
void | setParameter (BCESolver::IntParameter, int arg) |
Set integer parameter. | |
void | setParameter (BCESolver::BoolParameter, bool arg) |
Set bool parameter. | |
void | setObfun (int n) |
Set objective function. | |
double | getParameter (BCESolver::DoubleParameter) |
Get double parameter. | |
int | getParameter (BCESolver::IntParameter) |
Get integer parameter. | |
bool | getParameter (BCESolver::BoolParameter) |
Get bool parameter. | |
Static Public Member Functions | |
static int | pow (int base, int exponent) |
returns . | |
Public Attributes | |
GRBModel | model |
The GUROBI model. | |
Protected Member Functions | |
void | countActionsTypes () |
void | indexToTypeActionDeviation (int index, int player, int &type, int &action, int &deviation) |
Protected Attributes | |
BCEAbstractGame * | game |
Pointer to the BCEAbstractGame object that is being solved. | |
long int | numColumns |
Number of columns in the constraint matrix. | |
long int | numRows |
Number of rows in the constraint matrix. | |
long int | numNonBasicVariables |
Number of non-basic variables? | |
long int | numActions_total |
Total number of action profiles for the players. | |
long int | numTypes_total |
Total number of types for the players. | |
long int | numActionsTypesPerPlayer_total |
Total number of of actions and types for each player. Used? | |
long int | numActionsTypes_total |
Total number of actions and types. | |
vector< int > | numICConstraints |
The number of IC constraints for each player. | |
long int | numICConstraints_total |
The total number of IC constraints. | |
long int | numProbabilityVariables |
The number of probability variables. | |
long int | numProbabilityConstraints |
The total number of constraints on probabilities. | |
GRBEnv | env |
GRBLinExpr | gurobiObjective |
The objective for BCESolver::model. | |
GRBVar * | variables |
The variables for BCESolver::model. | |
vector< GRBLinExpr > | constraints |
The constraints for BCESolver::model. | |
vector< GRBLinExpr > | objectiveFunctions |
Objectives. More... | |
bool | isPopulated |
Indicates if solver has been populated yet. | |
list< int > | nonZeroVariableLocations |
List of indices of non-zero variables. More... | |
vector< int > | probabilityConstraintLocations |
Locations of probability constraints. More... | |
map< int, int > | variableLocationsMap |
Map from variable indices to non-zero variable locations. More... | |
double | minAngleIncrement |
Minimum angle increment when mapping boundary. More... | |
int | currentObjective |
Index of the current objective. Not currently being used. | |
int | displayLevel |
The display level. More... | |
list< double > | boundaryXs |
X coordinates of frontier. More... | |
list< double > | boundaryYs |
Y coordinates of frontier. More... | |
BCESolution | soln |
BCESolution object for serializing output of the algorithm. | |
Solves a BCEAbstractGame using gurobi.
This class contains routines for solving a BCEAbstractGame object using GUROBI. The main method is BCESolver::populate, which initializes a GUROBI model with the incentive constraints for the BCEAbstractGame, and also creates objectives corresponding to the number of objectives in the BCEAbstractGame object. The class also contains the method BCESolver::mapBoundary, which solves linear programs to trace out the frontier for the objectives in BCESolver::BoundaryObjective1 and BCESolver::BoundaryObjective2.
Bool parameters.
An enumeration type for parameters of type bool. Pass to BCESolver::setParam and BCESolver::getParam to set or retrieve a double parameter value. Will be replaced by new BCEAbstractGame architecture with a constraint checker.
Integer parameters.
An enumeration type for parameters of type int. Pass to BCESolver::setParam and BCESolver::getParam to set or retrieve a double parameter value.
Enumerator | |
---|---|
CurrentObjective | The index of the current objective. Not currently used? |
DisplayLevel | Control algorithm output. Controls the frequency and detail with which progress of the algorithm is reported. 0 corresponds to no output, 1 is some output. Is also passed to the BCESolver::model solver, so it controls the level of output of Gurobi. |
BoundaryObjective1 | The first objective used when mapping the boundary. |
BoundaryObjective2 | The second objective used when mapping the boundary. |
BCESolver::BCESolver | ( | ) |
Default constructor.
Creates a new BCESolver object.
BCESolver::BCESolver | ( | BCEAbstractGame & | _game | ) |
Constructor.
Creates a new BCESolver object and initializes it with the given game.
void BCESolver::bceToMap | ( | map< int, double > & | distribution | ) |
Copies the BCE to a map.
This method copies the BCE, which is a vector of doubles, to a map from standard indices to probabilities. Mainly for saving space in data files.
|
protected |
Initializes the properties that count the number of actions and types.
void BCESolver::getSolution | ( | BCESolution & | output | ) |
Returns the data object.
Copies the data object to output.
void BCESolver::mapBoundary | ( | ) |
Maps the frontier.
Calls BCESolver::mapBoundary(const char*) with a default file name.
void BCESolver::mapBoundary | ( | const char * | fname | ) |
Maps the frontier.
Maps the frontier for the boundary objectives indicated in BCESolver::boundaryObjective1 and BCESolver::boundaryObjective2, and stores the calculated frontier in a file created at fname.
void BCESolver::mapBoundary | ( | const char * | fname, |
const vector< vector< double > > & | weights | ||
) |
Maps the frontier.
Maps the boundary for specified objectives, not necessarily the same as BCESolver::boundaryObjective1 and BCESOlver::boundaryObjective2
void BCESolver::mapBoundary | ( | const vector< vector< double > > & | weights | ) |
Maps the frontier.
Maps the boundary for specified objectives, not necessarily the same as BCESolver::boundaryObjective1 and BCESOlver::boundaryObjective2. Saves to a default file name.
void BCESolver::populate | ( | ) |
Main populate routine.
Populates the Gurobi model with constraints and initializes the objectives.
void BCESolver::solve | ( | vector< double > & | objectiveWeights | ) |
Solve method.
Sets Gurobi solver parameters and calls Gurobi::optimize().
|
protected |
X coordinates of frontier.
List of x-coordinates of boundary points traced out by the BCESolver::mapBoundary routine.
|
protected |
Y coordinates of frontier.
List of y-coordinates of boundary points traced out by the BCESolver::mapBoundary routine.
|
protected |
The display level.
0 is no output, 1 is some output. Also passed to Gurobi, so 2+ controls Gurobi output.
|
protected |
Minimum angle increment when mapping boundary.
The minimum increment of the angle for BCESolver::mapBoundary.
|
protected |
List of indices of non-zero variables.
The solver only creates variables for events that could occur with positive probability under the prior in the BCEAbstractGame object. This property stores the locations of the non-zero probability outcomes.
|
protected |
Objectives.
An array of objective functions, corresponding to the objectives in the BCEAbstractGame object.
|
protected |
Locations of probability constraints.
Stores locations of the probability constraints in the constraints array.
|
protected |
Map from variable indices to non-zero variable locations.
A map from standard indices to the corresponding non-zero variable location. (See BCECounter.)