SGSolve
SGSolutionHandler Class Reference

Handles the widgets for displaying the solution. More...

#include <sgsolutionhandler.hpp>

Inheritance diagram for SGSolutionHandler:
Collaboration diagram for SGSolutionHandler:

Public Slots

void inspectPoint (SGPoint point, int state, bool isDetailPlot)
 Inspect point slot.
 
void simulateEquilibrium (SGPoint point, int state, bool isDetailPlot)
 Simulate equilibrium slot.
 
void replotSlot ()
 Replot slot.
 

Signals

void nextActionSignal ()
 
void prevActionSignal ()
 

Public Member Functions

 SGSolutionHandler (QWidget *parent=0)
 Constructor. More...
 
void setSolution (const SGSolution_MaxMinMax &newSoln)
 Sets the solution to newSoln.
 
const SGSolution_MaxMinMaxgetSolution () const
 Returns a const reference to the solution.
 
QVBoxLayout * getLayout () const
 Returns the layout.
 
QAction * getDetailedTitlesAction () const
 Returns the detailed titles action.
 
SGPlotSettingsgetPlotSettingsPtr ()
 
QAction * getEqualizeAxesAction () const
 Returns the equalize axes action.
 
void moveBackwards ()
 Decrements the iteration through the SGPlotController.
 
void moveForwards ()
 Increments the iteration through the SGPlotController.
 
void prevAction ()
 Decrements the action profile through the SGPlotController.
 
void nextAction ()
 Increments the action profile through the SGPlotController.
 

Private Member Functions

void plotSolution ()
 Plots the solution from start to end.
 
void plotSolution (SGCustomPlot *plot, int state, bool addSquares)
 Plots the solution for a particular state.
 
void configureGridLines (SGCustomPlot *plot)
 Turns on or off grid lines and zero lines.
 
QString generatePlotTitle (int state, int action, bool addIterRev)
 Generates title for the detail plot.
 
QCPRange getBounds (const QVector< double > &x) const
 Gets bounds for the plots.
 
void addPoint (const SGPoint &point, QCustomPlot *plot, const QCPScatterStyle &style)
 Adds a point to the indicated graph in the indicated scatter style.
 
QCPCurve * vectorToQCPCurve (SGCustomPlot *plot, const SGPoint &point, const SGPoint &dir)
 Converts point,dir into a QCPCurve associated with the given plot.
 
QCPItemLine * sgToQCPItemLine (SGCustomPlot *plot, const SGPoint &point, const SGPoint &dir)
 Converts point,dir into a QCPItemLine associated with the given plot.
 

Private Attributes

SGSolution_MaxMinMax soln
 Solution. More...
 
SGPlotControllercontroller
 A pointer to the associated plot controller.
 
QWidget * parent
 The parent widget, which is an SGMainWindow object.
 
double payoffBound
 A bound on the size of payoffs.
 
bool solnLoaded
 True if a solution has been loaded.
 
SGCustomPlotdetailPlot
 Left hand plot that shows construction of a point.
 
vector< SGCustomPlot * > statePlots
 Vector of state plots. More...
 
SGPlotSettings plotSettings
 Plot settings.
 
QVBoxLayout * layout
 Master layout for the solution handler.
 
QGridLayout * statePlotsLayout
 Layout holding the state plots.
 
QAction * detailedTitlesAction
 Action to toggle detailed titles.
 
QAction * equalizeAxesAction
 Action for equalizing axes.
 
SGSimulationHandlersimHandler
 Pointer to simulation handler.
 
QPen defaultGridLinePen
 Default pen for grid lines.
 
QPen defaultZeroLinePen
 Default pen for zero lines.
 

Detailed Description

Handles the widgets for displaying the solution.

This class contains all of the widgets on the solution tab for displaying the SGSolution generated by the SGSolver. This class sets up the widgets for viewing and controlling the view of the solution, and it directly implements the plotting routines. The specification of what to plot is controlled by a member SGPlotController.

Specifically, SGSolutionHandler_V2 constructs plots for the trajectory of the pivot in each state, which are the statePlots, and it constructs a detailPlot which shows the behavior of the algorithm at a particular iteration or a particular equilibrium.

There are two modes for the solution. In "Progress" mode, the program will display the progress of the algorithm from a starting iteration to a final iteration, and the detail plot will show how the next direction is selected at the last iteration. The start and end are controlled by QScrollBars. By default, detailPlot will show the test directions for the best action, but the user can display test directions for other actions using QComboBoxes.

In "Final" mode, the program just shows the pivots on the last revolution, which is basically the true equilibrium payoff correspondence.

The sliders and combo boxes communicate with and are controlled by a member SGPlotController object, which aggregates all of the user-provided specifications into a compact set of parameters that are used by SGSolutionHandler_V2::plotSolution() to construct the plots.

See also viewersolutionsec.

Constructor & Destructor Documentation

◆ SGSolutionHandler()

SGSolutionHandler::SGSolutionHandler ( QWidget *  parent = 0)

Constructor.

Constructs the widgets and the layout, connects signals and slots.

Member Data Documentation

◆ soln

SGSolution_MaxMinMax SGSolutionHandler::soln
private

Solution.

Stores all of the information related to the result of the computation.

◆ statePlots

vector<SGCustomPlot *> SGSolutionHandler::statePlots
private

Vector of state plots.

One plot for each state, shows the trajectory of the pivot for that state.


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