41namespace Gecode {
namespace Gist {
51 setWindowIcon(myPic2);
54 setMinimumSize(300, 240);
55 setMaximumSize(300, 240);
56 QVBoxLayout* layout =
new QVBoxLayout();
57 QLabel* logo =
new QLabel();
58 logo->setPixmap(myPic);
59 layout->addWidget(logo, 0, Qt::AlignCenter);
61 new QLabel(tr(
"<h2>Gist</h2>"
62 "<p><b>The Gecode Interactive Search Tool</b</p> "
63 "<p>You can find more information about Gecode and Gist "
65 "<p><a href='http://www.gecode.org'>www.gecode.org</a>"
67 aboutLabel->setOpenExternalLinks(
true);
68 aboutLabel->setWordWrap(
true);
69 aboutLabel->setAlignment(Qt::AlignCenter);
70 layout->addWidget(aboutLabel);
72 setWindowTitle(tr(
"About Gist"));
73 setAttribute(Qt::WA_QuitOnClose,
false);
74 setAttribute(Qt::WA_DeleteOnClose,
false);
79 : opt(opt0), aboutGist(this) {
82 setWindowTitle(tr(
"Gist"));
90 setMinimumSize(400, 200);
94 QMenu* fileMenu =
menuBar->addMenu(tr(
"&File"));
95 fileMenu->addAction(
c->
print);
96#if QT_VERSION >= 0x040400
99 QAction* quitAction = fileMenu->addAction(tr(
"Quit"));
100 quitAction->setShortcut(QKeySequence(
"Ctrl+Q"));
101 connect(quitAction, SIGNAL(triggered()),
102 this, SLOT(close()));
103 prefAction = fileMenu->addAction(tr(
"Preferences"));
104 connect(prefAction, SIGNAL(triggered()),
this, SLOT(
preferences()));
106 QMenu* nodeMenu =
menuBar->addMenu(tr(
"&Node"));
108 inspectNodeMenu =
new QMenu(
"Inspect");
109 inspectNodeMenu->addAction(
c->
inspect);
110 connect(inspectNodeMenu, SIGNAL(aboutToShow()),
113 inspectNodeBeforeFPMenu =
new QMenu(
"Inspect before fixpoint");
115 connect(inspectNodeBeforeFPMenu, SIGNAL(aboutToShow()),
119 nodeMenu->addMenu(inspectNodeMenu);
120 nodeMenu->addMenu(inspectNodeBeforeFPMenu);
126 bookmarksMenu =
new QMenu(
"Bookmarks");
128 connect(bookmarksMenu, SIGNAL(aboutToShow()),
130 nodeMenu->addMenu(bookmarksMenu);
131 nodeMenu->addSeparator();
132 nodeMenu->addAction(
c->
navUp);
139 nodeMenu->addSeparator();
147 nodeMenu->addSeparator();
149 nodeMenu->addAction(
c->
center);
150#if QT_VERSION >= 0x040400
154 QMenu* searchMenu =
menuBar->addMenu(tr(
"&Search"));
157 searchMenu->addSeparator();
158 searchMenu->addAction(
c->
stop);
159 searchMenu->addSeparator();
160 searchMenu->addAction(
c->
reset);
162 QMenu* toolsMenu =
menuBar->addMenu(tr(
"&Tools"));
163 doubleClickInspectorsMenu =
new QMenu(
"Double click Inspectors");
164 connect(doubleClickInspectorsMenu, SIGNAL(aboutToShow()),
166 toolsMenu->addMenu(doubleClickInspectorsMenu);
167 solutionInspectorsMenu =
new QMenu(
"Solution inspectors");
168 connect(solutionInspectorsMenu, SIGNAL(aboutToShow()),
170 toolsMenu->addMenu(solutionInspectorsMenu);
171 moveInspectorsMenu =
new QMenu(
"Move inspectors");
172 connect(moveInspectorsMenu, SIGNAL(aboutToShow()),
174 toolsMenu->addMenu(moveInspectorsMenu);
175 comparatorsMenu =
new QMenu(
"Comparators");
176 connect(comparatorsMenu, SIGNAL(aboutToShow()),
178 toolsMenu->addMenu(comparatorsMenu);
180 QMenu* helpMenu =
menuBar->addMenu(tr(
"&Help"));
181 QAction* aboutAction = helpMenu->addAction(tr(
"About"));
182 connect(aboutAction, SIGNAL(triggered()),
183 this, SLOT(
about()));
191 QWidget* stw =
new QWidget();
192 QHBoxLayout* hbl =
new QHBoxLayout();
193 hbl->setContentsMargins(0,0,0,0);
194 hbl->addWidget(
new QLabel(
"Depth:"));
195 depthLabel =
new QLabel(
"0");
196 hbl->addWidget(depthLabel);
198 solvedLabel =
new QLabel(
"0");
199 hbl->addWidget(solvedLabel);
201 failedLabel =
new QLabel(
"0");
202 hbl->addWidget(failedLabel);
204 choicesLabel =
new QLabel(
"0");
205 hbl->addWidget(choicesLabel);
207 openLabel =
new QLabel(
" 0");
208 hbl->addWidget(openLabel);
210 statusBar()->addPermanentWidget(stw);
213 statusBar()->showMessage(
"Ready");
218 connect(
c,SIGNAL(searchFinished(
void)),
this,SLOT(close(
void)));
237 statusBar()->showMessage(
"Ready");
238 prefAction->setEnabled(
true);
239 }
else if (isSearching && finished) {
241 double ms = searchTimer.
stop();
242 double s = std::floor(ms / 1000.0);
244 double m = std::floor(s / 60.0);
246 double h = std::floor(m / 60.0);
260 statusBar()->showMessage(
"Ready");
261 prefAction->setEnabled(
true);
262 }
else if (!isSearching && !finished) {
263 prefAction->setEnabled(
false);
264 statusBar()->showMessage(
"Searching");
270 failedLabel->setNum(stats.
failures);
271 choicesLabel->setNum(stats.
choices);
286 if (setup || pd.exec() == QDialog::Accepted) {
301 doubleClickInspectorsMenu->clear();
302 doubleClickInspectorsMenu->addActions(
304 solutionInspectorsMenu->clear();
306 moveInspectorsMenu->clear();
308 comparatorsMenu->clear();
314 bookmarksMenu->clear();
316 bookmarksMenu->addSeparator();
322 inspectNodeMenu->clear();
323 inspectNodeMenu->addAction(
c->
inspect);
324 inspectNodeMenu->addSeparator();
326 inspectNodeBeforeFPMenu->clear();
328 inspectNodeBeforeFPMenu->addSeparator();
AboutGist(QWidget *parent=0)
Constructor.
AboutGist aboutGist
About dialog.
QMenuBar * menuBar
A menu bar.
GistMainWindow(Space *root, bool bab, const Options &opt)
Constructor.
void about(void)
Open the about dialog.
void populateBookmarks(void)
Populate the bookmarks menus from the actions found in Gist.
void populateInspectors(void)
Populate the inspector menus from the actions found in Gist.
void preferences(bool setup=false)
Open the preferences dialog.
void closeEvent(QCloseEvent *event)
Close Gist.
void populateInspectorSelection(void)
Populate the inspector menus from the actions found in Gist.
void statusChanged(const Statistics &stats, bool finished)
The status has changed (e.g., new solutions have been found)
Gist * c
The contained Gist object.
Gecode Interactive Search Tool
QAction * toggleStop
Bookmark current node.
QAction * hideFailed
Hide failed subtrees under current node.
void setRefresh(int i)
Set refresh rate.
QAction * navUp
Navigate to parent node.
void setShowCopies(bool b)
Set preference whether to show copies in the tree.
QAction * compareNodeBeforeFP
Compare current node to other node before fixpoint.
QAction * inspectPath
Inspect all nodes on selected path.
QAction * exportPDF
Export PDF of current subtree.
QAction * bookmarkNode
Bookmark current node.
QAction * print
Print tree.
QAction * stop
Stop search.
QAction * unstopAll
Bookmark current node.
QAction * zoomToFit
Zoom tree to fit window.
QActionGroup * inspectBeforeFPGroup
Group of all actions for direct inspector selection.
QAction * navRight
Navigate to right sibling.
void setAutoHideFailed(bool b)
Set preference whether to automatically hide failed subtrees.
void setAutoZoom(bool b)
Set preference whether to automatically zoom to fit.
QAction * navNextSol
Navigate to next solution (to the left)
QAction * searchNext
Search next solution in current subtree.
QAction * setPath
Set path from current node to the root.
QAction * labelBranches
Label branches under current node.
QAction * navLeft
Navigate to left sibling.
void setSmoothScrollAndZoom(bool b)
Set preference whether to use smooth scrolling and zooming.
QActionGroup * solutionInspectorGroup
Group of all actions for solution inspectors.
QAction * navDown
Navigate to leftmost child node.
QActionGroup * moveInspectorGroup
Group of all actions for move inspectors.
void setMoveDuringSearch(bool b)
Set preference whether to move cursor during search.
QAction * navPrevSol
Navigate to previous solution (to the right)
QAction * center
Center on current node.
void setRefreshPause(int i)
Set refresh pause in msec.
QAction * compareNode
Compare current node to other node.
QAction * reset
Reset Gist.
QAction * toggleHidden
Toggle whether current node is hidden.
bool finish(void)
Stop search and wait until finished.
QAction * searchAll
Search all solutions in current subtree.
QAction * navRoot
Navigate to root node.
QActionGroup * inspectGroup
Group of all actions for direct inspector selection.
QAction * labelPath
Label branches on path to root.
QAction * showNodeStats
Open node statistics inspector.
QActionGroup * doubleClickInspectorGroup
Group of all actions for double click inspectors.
QAction * exportWholeTreePDF
Export PDF of whole tree.
QActionGroup * comparatorGroup
Group of all actions for comparators.
QAction * inspect
Inspect current node.
void setRecompDistances(int c_d, int a_d)
Set recomputation parameters c_d and a_d.
QAction * unhideAll
Unhide all hidden subtrees under current node.
QActionGroup * bookmarksGroup
Group of all actions for bookmarks.
QAction * inspectBeforeFP
Inspect current node before fixpoint.
Class holding Gecode and Gist logo icons.
const unsigned int logoSize
Size of the Gecode logo.
const unsigned char * logo
The Gecode logo.
const unsigned int gistLogoSize
Size of the smaller logo.
const unsigned char * gistLogo
A smaller logo used as a window icon.
Preferences dialog for Gist.
bool hideFailed
Whether to automatically hide failed subtrees during search.
int c_d
The copying distance.
bool moveDuringSearch
Whether to move cursor during search.
int a_d
The adaptive recomputation distance.
bool smoothScrollAndZoom
Whether to use smooth scrolling and zooming.
bool zoom
Whether to automatically zoom during search.
bool copies
Whether to show where copies are in the tree.
int refresh
How often to refresh the display during search.
int refreshPause
Milliseconds to wait after each refresh (to slow down search)
Statistics about the search tree
int choices
Number of choice nodes.
int failures
Number of failures.
int solutions
Number of solutions.
int undetermined
Number of open, undetermined nodes.
int maxDepth
Maximum depth of the tree.
unsigned int c_d
Create a clone after every c_d commits (commit distance)
unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance)
double stop(void)
Get time since start of timer.
void start(void)
Start timer.
int bab(Space *root, const Gist::Options &opt=Gist::Options::def)
Create a new stand-alone Gist for branch-and-bound search of root.
@ UNDETERMINED
Node that has not been explored yet.
@ FAILED
Node representing failure.
@ SOLVED
Node representing a solution.
@ BRANCH
Node representing a branch.
Gecode toplevel namespace