BCESolve
BCEDataState Class Reference

Class for storing and manipulating solution data used by the plot handler. More...

#include <bcedatastate.hpp>

Inheritance diagram for BCEDataState:
Collaboration diagram for BCEDataState:

Public Slots

void setSliderValue (int value, BCESliderType st, int player)
 Changes stored slider data. More...
 
void resetManipulatedData (BCESliderType st, int player)
 Manipulates data after user interaction with controls or new load action. More...
 
void resetManipulatedData ()
 Calls all "set" data functions. More...
 
void modifyEqmFocus (double x, double y)
 Changes current equilibrium index for stored BCEData. More...
 

Signals

void selectedEqmChanged ()
 Signal that data for the set of BCE plot has been changed. More...
 
void newDataLoaded ()
 Signal that new data has been loaded. More...
 
void valueChanged (int val, BCESliderType st, int player)
 Signal for a changed slider value. More...
 
void devPlotTitleChange (int player, int aciton, int type, double payoff)
 Signals data for changing deviation bar plots' titles. More...
 
void devPlotPrChange (int player, double probability)
 Signals data for changing deviation bar plots' titles. More...
 
void eqmCoordSignal (double xCoord, double yCoord)
 Signals coordinates of the current equilibrium. More...
 
void newStateSignal (int value0, int value1, int state, bool privateVals)
 Signals changed state information and type of state (common or private). More...
 
void sliderLabelsChanged (bool privateVals, int player)
 Signals that a slider control has been moved by the user. More...
 
void objectiveValuesChanged (int player)
 Signals to the solution tab that objectiveValues have been manipulated. More...
 
void equilibriumMatrixChanged ()
 Signals to the solution tab that equilibriumMatrix has been manipulated. More...
 
void sendException (QString message)
 Sends an exception message to BCEWindow to be displayed.
 

Public Member Functions

 BCEDataState ()
 Default constructor. More...
 
void setSolutionData (const BCESolution &solution, const bool isBoundaryMapped)
 Loads new data into the GUI. More...
 
const vector< vector< double > > & getMapBWeights () const
 Sends map boundary weights to the plot handler.
 
const int getNumObjs () const
 Sends the number of objectives to the plot handler.
 
int shareDataProperties (BCESliderType st, int player)
 Shares basic game data (e.g. numActions) with BCEWindow. More...
 
const int getCurrentEqmIndex () const
 Returns the current eqm index stored in BCEDataState.
 
const int getCurrentSliderVal (BCESliderType st, int player) const
 Returns current integer value of a slider. More...
 
const vector< vector< double > > & getEqmMatrix () const
 Shares memory location of equilibriumMatrix with BCEPlotHandler. More...
 
const vector< vector< double > > & getObjectiveValues () const
 Shares memory location of objectiveValues with BCEPlotHandler. More...
 
const vector< vector< double > > & getAllEqm () const
 Shares memory location of allEqm with BCEPlotHandler. More...
 
const BCESolutiongetSolution () const
 Shares the current BCESolution by reference. More...
 
const string getGUITitle () const
 Shares file name of currently loaded file with BCEWindow.
 
void setConditionOnState (bool conditioned)
 Alters whether data in equilibriumMatrix is conditional on state.
 

Public Attributes

QWidget * controlsLayout
 Layout Holding Sliders and Other Data Controls.
 

Private Member Functions

void setEqmMatrix ()
 Resets heatmap data. More...
 
void setObjectiveVals (int player)
 Resets deviation bar plot data. More...
 
void setAllEqm ()
 Resets BCE Value Set Plot data. More...
 
double euclidianDistance (double x1, double x2, double y1, double y2)
 Helper function for modifyEqmFocus. More...
 
void setupControlsLayout ()
 Builds the controls layout in the solution tab.
 

Private Attributes

bool isDataLoaded
 Notes if data is currently loaded into the GUI. More...
 
bool isMapped
 Gives if boundary was mapped in the solution object.
 
vector< int > actions
 A 2 element vector holding the current action for each player.
 
vector< int > types
 A 2 element vector holding the current type for each player.
 
vector< int > values
 A 2 element vector holding the current state for each player.
 
int state
 Holds the current state of a common-states game.
 
bool isPrivateVals
 If true, GUI is displaying solution of a private-states game.
 
BCESolution solutionData
 Currently active BCESolution in the GUI.
 
BCEGame gameData
 Currently active BCEGame in the GUI.
 
string guiTitle
 File name of example currently displayed in the GUI.
 
bool margS0
 If true, GUI displays marginal distribution for player's state.
 
bool margS1
 
vector< bool > margA
 If true, GUI displays marginal distribution for player's action/type. More...
 
vector< bool > margT
 
int currentEqmIndex
 Index of equilibrium currently displayed in the GUI.
 
vector< vector< double > > equilibriumMatrix
 Data displayed in the GUI's heatmap.
 
vector< vector< double > > objectiveValues
 Data displayed in the GUI's bar plots.
 
vector< vector< double > > allEqm
 Data displayed in the GUI's BCE Value Set Plot. More...
 
QVector< BCESlider * > sliderGroup
 Vector of Slider Controls. More...
 
QVector< BCELineEdit * > lineEditGroup
 Vector of Line Edits. More...
 
bool conditionedOnState
 Tells whether equilibriumMatrix is conditioned on State.
 

Detailed Description

Class for storing and manipulating solution data used by the plot handler.

Continuously manipulated as user interacts with solution tab controls. Holds all data for plotting. Also holds parameters the user supplies through solutions tab controls, such as the currently selected equilibrium. Contains private "set" methods for changing private data. Contains public "get" methods that make minor integer or string copies or supply a const reference to the memory location of larger data structures. These get methods are called primarily by BCEPlothandler.

Constructor & Destructor Documentation

◆ BCEDataState()

BCEDataState::BCEDataState ( )

Default constructor.

Provides initial conditions for several private properties: actions, types, values, state, margS0, margS1, margA, margT, currentEqmIndex, isPrivateVals. Further connects signals and slots when both are contained within this class.

Member Function Documentation

◆ devPlotPrChange

void BCEDataState::devPlotPrChange ( int  player,
double  probability 
)
signal

Signals data for changing deviation bar plots' titles.

Connected to BCELabel. Slot changes QLabel info displayed about the probability of a player's action.

◆ devPlotTitleChange

void BCEDataState::devPlotTitleChange ( int  player,
int  aciton,
int  type,
double  payoff 
)
signal

Signals data for changing deviation bar plots' titles.

Connected to BCELabel. Slot serves to change QLabel information displayed about players' actions and types in the GUI's deviation plot titles.

◆ eqmCoordSignal

void BCEDataState::eqmCoordSignal ( double  xCoord,
double  yCoord 
)
signal

Signals coordinates of the current equilibrium.

Connected to BCELabel. Slot changes coordinates of equilibrium displayed in the GUI's Set of BCE plot title (top left plot in the solution tab).

◆ equilibriumMatrixChanged

void BCEDataState::equilibriumMatrixChanged ( )
signal

Signals to the solution tab that equilibriumMatrix has been manipulated.

Connected to a slot handling plotting of the equilibria player payoffs in the solution tab (top left plot). This is emitted when the equilibrium matrix is changed by this class, and the data is then plotted in the solution tab.

◆ euclidianDistance()

double BCEDataState::euclidianDistance ( double  x1,
double  x2,
double  y1,
double  y2 
)
inlineprivate

Helper function for modifyEqmFocus.

Calculates distance between two points.

◆ getAllEqm()

const vector< vector< double > > & BCEDataState::getAllEqm ( ) const
inline

Shares memory location of allEqm with BCEPlotHandler.

BCEPlotHandler cannot edit BCEDataState's private member allEqm but needs read access to plot the set of equilibria.

◆ getCurrentSliderVal()

const int BCEDataState::getCurrentSliderVal ( BCESliderType  st,
int  player 
) const
inline

Returns current integer value of a slider.

Given whether a slider controls Action, Type, or State, returns the integer value at the current position of the slider for the given player.

◆ getEqmMatrix()

const vector< vector< double > > & BCEDataState::getEqmMatrix ( ) const
inline

Shares memory location of equilibriumMatrix with BCEPlotHandler.

BCEPlotHandler cannot edit BCEDataState's private member equilibriumMatrix but needs read access to plot the GUI's heatmap.

◆ getObjectiveValues()

const vector< vector< double > > & BCEDataState::getObjectiveValues ( ) const
inline

Shares memory location of objectiveValues with BCEPlotHandler.

BCEPlotHandler cannot edit BCEDataState's private member objectiveValues but needs read access to plot the GUI's bar plots of player's deviation objectives.

◆ getSolution()

const BCESolution & BCEDataState::getSolution ( ) const
inline

Shares the current BCESolution by reference.

Used to save the current solution. saveGame() in BCEWindow calls this function to serialize and save a BCESolution.

◆ modifyEqmFocus

void BCEDataState::modifyEqmFocus ( double  x,
double  y 
)
slot

Changes current equilibrium index for stored BCEData.

Switches equilibrium indices. Takes in coordinates of a click on the plot, minimizes Euclidian distance to find the closest equilibrium, and sets the index of that equilibrium as the current equilibrium index.

◆ newDataLoaded

void BCEDataState::newDataLoaded ( )
signal

Signal that new data has been loaded.

Connected to changing the title of the graphical user interface. The GUI gets the file name from the path and displays it in the GUI's title bar.

Also connected to a slot notifying the program that data has been loaded. Certain functions in the program will become activated and functional. If these functions were used before data was loaded, the program would crash.

These functions include toggleLinearScale(_) and toggleColorfulTheme(_) in the BCEPlothandler.

◆ newStateSignal

void BCEDataState::newStateSignal ( int  value0,
int  value1,
int  state,
bool  privateVals 
)
signal

Signals changed state information and type of state (common or private).

Connected to BCELabel. Slot changes information displayed about each player's state (in the private-states case) or the state of the game (in the common values case) in the GUI's heat map plot title (right plot in the solution tab).

◆ objectiveValuesChanged

void BCEDataState::objectiveValuesChanged ( int  player)
signal

Signals to the solution tab that objectiveValues have been manipulated.

Connected to a slot handling plotting of the deviation plots in the solution tab (lower left bar plots). This signal is emitted when objective values are changed, and data is replotted.

◆ resetManipulatedData [1/2]

void BCEDataState::resetManipulatedData ( )
slot

Calls all "set" data functions.

Called after user interaction with the plot of equilibria player payoffs, this helper function sets new data for every plot in the solution tab.

◆ resetManipulatedData [2/2]

void BCEDataState::resetManipulatedData ( BCESliderType  st,
int  player 
)
slot

Manipulates data after user interaction with controls or new load action.

Sets new data for some plots in the solution tab. If given BCESliderType::Action, sets new deviation objectives for the given player. If given BCESliderType::Type, sets new deviation objectives for the given player. If given BCESliderType::State, sets new data for the heatmap.

◆ selectedEqmChanged

void BCEDataState::selectedEqmChanged ( )
signal

Signal that data for the set of BCE plot has been changed.

Connected to the plotter for the BCE value set plot in BCEWindow (top left plot in the solution tab).

◆ setAllEqm()

void BCEDataState::setAllEqm ( )
private

Resets BCE Value Set Plot data.

Sets payoffs for BCE Value Set Plot. Called after switching equilibrium indices or after a load action.

◆ setEqmMatrix()

void BCEDataState::setEqmMatrix ( )
private

Resets heatmap data.

Replaces data stored in "equilibriumMatrix." Also emits a signal containing data for title of the plot displaying this data.

◆ setObjectiveVals()

void BCEDataState::setObjectiveVals ( int  player)
private

Resets deviation bar plot data.

Replaces data in "objectiveValues." Also, emits that bar plot titles need to be changed and contains relevant data for those changes.

◆ setSliderValue

void BCEDataState::setSliderValue ( int  value,
BCESliderType  st,
int  player 
)
slot

Changes stored slider data.

Called when a slider has been moved or after a load action. Sets data equal to the new slider value and emits information used by read-only line-edits and slider titles.

◆ setSolutionData()

void BCEDataState::setSolutionData ( const BCESolution solution,
const bool  isBoundaryMapped 
)

Loads new data into the GUI.

Receives emitted signal that there is a new data path from BCEWindow. This is called when the user interacts with the loadAction within the GUI's file menu. This function extracts the filename from the path for use in the GUI's title. It also loads data at the path into the class's privately stored "data" member. It then determines if the game has private values and sets initial conditions for a new load (i.e. actions, types, values, and state are reset to 0). Emits that

◆ shareDataProperties()

int BCEDataState::shareDataProperties ( BCESliderType  st,
int  player 
)

Shares basic game data (e.g. numActions) with BCEWindow.

Returns basic properties of currently stored BCEData for setting slider ranges. Given Action, Type, or State, returns number of actions, types, or states for the given player. This is always an integer value.

◆ sliderLabelsChanged

void BCEDataState::sliderLabelsChanged ( bool  privateVals,
int  player 
)
signal

Signals that a slider control has been moved by the user.

Connected to BCELabel. Slot tells state slider labels to display "Player 0's Values" and "Player 1's Values" (in the private-states case) or "Common State" (in the common-state case).

◆ valueChanged

void BCEDataState::valueChanged ( int  val,
BCESliderType  st,
int  player 
)
signal

Signal for a changed slider value.

Connected to BCESlider and BCELineEdit. Slots serve to change read-only line edits when a slider has been moved. Also, for common value/state games, moves both state sliders simultaneously upon user interaction with one.

Member Data Documentation

◆ allEqm

vector< vector<double> > BCEDataState::allEqm
private

Data displayed in the GUI's BCE Value Set Plot.

Holds information about all the equilibria in a saved example file. If allEqm contains more than one equilibrium, BCESolver's mapBoundary function has been called in the example's .cpp file.

◆ isDataLoaded

bool BCEDataState::isDataLoaded
private

Notes if data is currently loaded into the GUI.

Prevents program from crashing if user clicks on GUI controls before any data is loaded.

◆ lineEditGroup

QVector<BCELineEdit*> BCEDataState::lineEditGroup
private

Vector of Line Edits.

Displays value of corresponding slider. Each element is identified by slider type and player. There are 2 players and 3 slider types (Action, Type, State). The size of the vector is 6.

◆ margA

vector<bool> BCEDataState::margA
private

If true, GUI displays marginal distribution for player's action/type.

2 element vectors holding whether marginal distributions for actions or type are displayed. Not currently in use.

◆ sliderGroup

QVector<BCESlider*> BCEDataState::sliderGroup
private

Vector of Slider Controls.

Each element is identified by slider type and player. There are 2 players and 3 slider types (Action, Type, State). The size of the vector is 6.


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