SGSolve
|
Main window for SGViewer. More...
#include <sgmainwindow.hpp>
Signals | |
void | startIteration () |
Signal for SGSolverThread to start next iteration. | |
Public Member Functions | |
SGMainWindow () | |
Constructor. More... | |
~SGMainWindow () | |
Destructor. More... | |
Protected Member Functions | |
virtual void | keyPressEvent (QKeyEvent *event) |
Handles keyboard shortcuts. | |
Private Slots | |
void | loadSolution () |
Triggers a solution load. | |
void | saveSolution () |
Triggers a solution save. | |
void | loadGame () |
Triggers a game load. | |
void | saveGame () |
Triggers a game save. | |
void | quitProgram () |
Quits the program. | |
void | changeSettings () |
Changes settings for the SGEnv object. | |
void | settingsHandlerClosed () |
Changes settings for the SGEnv object. | |
void | changePlotSettings () |
Changes plot settings. | |
void | plotSettingsHandlerClosed () |
Changes plot settings. | |
void | screenShot () |
Triggers a new screen shot. | |
void | cancelSolve () |
Throws the cancel solution flag. | |
void | solveGame () |
Initializes solve routine for ABS 2018. | |
void | iterationFinished (bool) |
Slot when iteration finishes. More... | |
void | solverException () |
Triggers error message in log. More... | |
void | displayAbout () |
Displays an about message. | |
void | displayLegend () |
Displays a legend. | |
void | generateRSG () |
Generate risk sharing game. | |
void | generatePD () |
Generate prisoner's dilemma game. | |
void | generateBoS () |
Generate a Battle of the Sexes. | |
void | generateRandom () |
Generates a random game. | |
Private Member Functions | |
void | settingsLoader () |
Loads saved settings. | |
void | settingsSaver () |
Saves settings. | |
Private Attributes | |
QTabWidget * | tabWidget |
Widget containing game, solution, and log tabs. | |
SGEnv * | env |
Environment for computations. | |
SGSolverWorker * | solverWorker |
Worker that handles solution. | |
QThread | solverThread |
Separate thread for running solve routines, so gui doesn't hang. | |
SGSolutionHandler * | solutionHandler |
The object for interfacing with the solution. | |
SGGameHandler * | gameHandler |
The object for interfacing with the game. | |
SGSettingsHandler * | settingsHandler |
The object for controling environment settings. | |
SGPlotSettingsHandler * | plotSettingsHandler |
The object for controling plot settings. | |
QTextEdit * | logTextEdit |
Text edit containing the log output. | |
QTime | timer |
Times progress of the algorithm. | |
bool | cancelSolveFlag |
Flag for canceling solve next time an iteration finishes. | |
QString | path |
Most recent path for saves/loads. | |
QSettings * | settings |
Program settings. | |
Main window for SGViewer.
This class constructs the tabs and layouts. It also contains signals and slots for handling certain high level functions, such as solving, saving, and loading saved content.
Note that rather than using SGSolver, this class essentially replicates the behavior of the SGSolver class in its solveGame routine. The reason is that SGSolver runs straight through. We want to provide updates in the log window as the solver proceeds, which is facilitated by running SGSolverWorker one iteration at a time, printing the output when each revolution finishes, and then restarting the solve routine. Also allows the user to cancel a computation when the next iteration finishes.
SGMainWindow::SGMainWindow | ( | ) |
Constructor.
Initializes member objects and connects signals and slots.
|
inline |
Destructor.
Just closes down the solver thread. Should other objects be destroyed?
|
privateslot |
Slot when iteration finishes.
Checks if the algorithm has converged or if maximum number of iterations has finished. If the algorithm has finished, plots the solution. If the algorithm has not converged and the cancel flag is false, the next iteration is started. If the cancel flag is thrown, will not trigger the next iteration.
|
privateslot |
Triggers error message in log.
When the algorithm throws an exception, triggers an error message report.