45 namespace Gecode {
namespace Gist {
55 setWindowIcon(myPic2);
58 setMinimumSize(300, 240);
59 setMaximumSize(300, 240);
60 QVBoxLayout* layout =
new QVBoxLayout();
61 QLabel* logo =
new QLabel();
62 logo->setPixmap(myPic);
63 layout->addWidget(logo, 0, Qt::AlignCenter);
65 new QLabel(tr(
"<h2>Gist</h2>"
66 "<p><b>The Gecode Interactive Search Tool</b</p> "
67 "<p>You can find more information about Gecode and Gist "
69 "<p><a href='http://www.gecode.org'>www.gecode.org</a>"
71 aboutLabel->setOpenExternalLinks(
true);
72 aboutLabel->setWordWrap(
true);
73 aboutLabel->setAlignment(Qt::AlignCenter);
74 layout->addWidget(aboutLabel);
76 setWindowTitle(tr(
"About Gist"));
77 setAttribute(Qt::WA_QuitOnClose,
false);
78 setAttribute(Qt::WA_DeleteOnClose,
false);
83 :
opt(opt0), aboutGist(this) {
84 c =
new Gist(root,bab,
this,opt);
86 setWindowTitle(tr(
"Gist"));
94 setMinimumSize(400, 200);
98 QMenu* fileMenu =
menuBar->addMenu(tr(
"&File"));
99 fileMenu->addAction(
c->
print);
100 #if QT_VERSION >= 0x040400
103 QAction* quitAction = fileMenu->addAction(tr(
"Quit"));
104 quitAction->setShortcut(QKeySequence(
"Ctrl+Q"));
105 connect(quitAction, SIGNAL(triggered()),
106 this, SLOT(close()));
107 prefAction = fileMenu->addAction(tr(
"Preferences"));
108 connect(prefAction, SIGNAL(triggered()),
this, SLOT(
preferences()));
110 QMenu* nodeMenu =
menuBar->addMenu(tr(
"&Node"));
112 inspectNodeMenu =
new QMenu(
"Inspect");
113 inspectNodeMenu->addAction(
c->
inspect);
114 connect(inspectNodeMenu, SIGNAL(aboutToShow()),
117 inspectNodeBeforeFPMenu =
new QMenu(
"Inspect before fixpoint");
119 connect(inspectNodeBeforeFPMenu, SIGNAL(aboutToShow()),
123 nodeMenu->addMenu(inspectNodeMenu);
124 nodeMenu->addMenu(inspectNodeBeforeFPMenu);
130 bookmarksMenu =
new QMenu(
"Bookmarks");
132 connect(bookmarksMenu, SIGNAL(aboutToShow()),
134 nodeMenu->addMenu(bookmarksMenu);
135 nodeMenu->addSeparator();
136 nodeMenu->addAction(
c->
navUp);
143 nodeMenu->addSeparator();
151 nodeMenu->addSeparator();
153 nodeMenu->addAction(
c->
center);
154 #if QT_VERSION >= 0x040400
158 QMenu* searchMenu =
menuBar->addMenu(tr(
"&Search"));
161 searchMenu->addSeparator();
162 searchMenu->addAction(
c->
stop);
163 searchMenu->addSeparator();
164 searchMenu->addAction(
c->
reset);
166 QMenu* toolsMenu =
menuBar->addMenu(tr(
"&Tools"));
167 doubleClickInspectorsMenu =
new QMenu(
"Double click Inspectors");
168 connect(doubleClickInspectorsMenu, SIGNAL(aboutToShow()),
170 toolsMenu->addMenu(doubleClickInspectorsMenu);
171 solutionInspectorsMenu =
new QMenu(
"Solution inspectors");
172 connect(solutionInspectorsMenu, SIGNAL(aboutToShow()),
174 toolsMenu->addMenu(solutionInspectorsMenu);
175 moveInspectorsMenu =
new QMenu(
"Move inspectors");
176 connect(moveInspectorsMenu, SIGNAL(aboutToShow()),
178 toolsMenu->addMenu(moveInspectorsMenu);
179 comparatorsMenu =
new QMenu(
"Comparators");
180 connect(comparatorsMenu, SIGNAL(aboutToShow()),
182 toolsMenu->addMenu(comparatorsMenu);
184 QMenu* helpMenu =
menuBar->addMenu(tr(
"&Help"));
185 QAction* aboutAction = helpMenu->addAction(tr(
"About"));
186 connect(aboutAction, SIGNAL(triggered()),
187 this, SLOT(
about()));
195 QWidget* stw =
new QWidget();
196 QHBoxLayout* hbl =
new QHBoxLayout();
197 hbl->setContentsMargins(0,0,0,0);
198 wmpLabel =
new QLabel(
"");
199 hbl->addWidget(wmpLabel);
200 hbl->addWidget(
new QLabel(
"Depth:"));
201 depthLabel =
new QLabel(
"0");
202 hbl->addWidget(depthLabel);
204 solvedLabel =
new QLabel(
"0");
205 hbl->addWidget(solvedLabel);
207 failedLabel =
new QLabel(
"0");
208 hbl->addWidget(failedLabel);
210 choicesLabel =
new QLabel(
"0");
211 hbl->addWidget(choicesLabel);
213 openLabel =
new QLabel(
" 0");
214 hbl->addWidget(openLabel);
216 statusBar()->addPermanentWidget(stw);
219 statusBar()->showMessage(
"Ready");
224 connect(
c,SIGNAL(searchFinished(
void)),
this,SLOT(close(
void)));
243 statusBar()->showMessage(
"Ready");
244 prefAction->setEnabled(
true);
245 }
else if (isSearching && finished) {
247 double ms = searchTimer.
stop();
248 double s = std::floor(ms / 1000.0);
250 double m = std::floor(s / 60.0);
252 double h = std::floor(m / 60.0);
266 statusBar()->showMessage(
"Ready");
267 prefAction->setEnabled(
true);
268 }
else if (!isSearching && !finished) {
269 prefAction->setEnabled(
false);
270 statusBar()->showMessage(
"Searching");
276 failedLabel->setNum(stats.
failures);
277 choicesLabel->setNum(stats.
choices);
280 wmpLabel->setText(
"WMP");
282 wmpLabel->setText(
"");
296 if (setup || pd.exec() == QDialog::Accepted) {
311 doubleClickInspectorsMenu->clear();
312 doubleClickInspectorsMenu->addActions(
314 solutionInspectorsMenu->clear();
316 moveInspectorsMenu->clear();
318 comparatorsMenu->clear();
324 bookmarksMenu->clear();
326 bookmarksMenu->addSeparator();
332 inspectNodeMenu->clear();
333 inspectNodeMenu->addAction(
c->
inspect);
334 inspectNodeMenu->addSeparator();
336 inspectNodeBeforeFPMenu->clear();
338 inspectNodeBeforeFPMenu->addSeparator();
unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance) ...
QAction * navNextSol
Navigate to next solution (to the left)
QActionGroup * doubleClickInspectorGroup
Group of all actions for double click inspectors.
void populateInspectors(void)
Populate the inspector menus from the actions found in Gist.
bool zoom
Whether to automatically zoom during search.
QAction * toggleHidden
Toggle whether current node is hidden.
void setAutoHideFailed(bool b)
Set preference whether to automatically hide failed subtrees.
int solutions
Number of solutions.
QAction * navDown
Navigate to leftmost child node.
QAction * navRoot
Navigate to root node.
QAction * bookmarkNode
Bookmark current node.
QAction * navUp
Navigate to parent node.
QAction * setPath
Set path from current node to the root.
Gist * c
The contained Gist object.
Node representing a branch.
QAction * inspect
Inspect current node.
unsigned int c_d
Create a clone after every c_d commits (commit distance)
void populateBookmarks(void)
Populate the bookmarks menus from the actions found in Gist.
GistMainWindow(Space *root, bool bab, const Options &opt)
Constructor.
QAction * compareNode
Compare current node to other node.
QAction * unstopAll
Bookmark current node.
QActionGroup * inspectBeforeFPGroup
Group of all actions for direct inspector selection.
int choices
Number of choice nodes.
QAction * hideFailed
Hide failed subtrees under current node.
Node representing failure.
void closeEvent(QCloseEvent *event)
Close Gist.
void setShowCopies(bool b)
Set preference whether to show copies in the tree.
bool wmp
Whether a weakly monotonic propagator might have been executed.
const unsigned char * logo
The Gecode logo.
QAction * navPrevSol
Navigate to previous solution (to the right)
QAction * navLeft
Navigate to left sibling.
bool finish(void)
Stop search and wait until finished.
void setSmoothScrollAndZoom(bool b)
Set preference whether to use smooth scrolling and zooming.
void statusChanged(const Statistics &stats, bool finished)
The status has changed (e.g., new solutions have been found)
bool hideFailed
Whether to automatically hide failed subtrees during search.
void about(void)
Open the about dialog.
QAction * toggleStop
Bookmark current node.
Node that has not been explored yet.
QAction * navRight
Navigate to right sibling.
void start(void)
Start timer.
QActionGroup * bookmarksGroup
Group of all actions for bookmarks.
QAction * inspectBeforeFP
Inspect current node before fixpoint.
QAction * unhideAll
Unhide all hidden subtrees under current node.
bool copies
Whether to show where copies are in the tree.
QAction * center
Center on current node.
Node representing a solution.
QAction * exportPDF
Export PDF of current subtree.
Class holding Gecode and Gist logo icons.
int undetermined
Number of open, undetermined nodes.
Gecode Interactive Search Tool
void populateInspectorSelection(void)
Populate the inspector menus from the actions found in Gist.
AboutGist(QWidget *parent=0)
Constructor.
const unsigned char * gistLogo
A smaller logo used as a window icon.
void preferences(bool setup=false)
Open the preferences dialog.
double stop(void)
Get time since start of timer.
int c_d
The copying distance.
void setAutoZoom(bool b)
Set preference whether to automatically zoom to fit.
Preferences dialog for Gist.
const unsigned int logoSize
Size of the Gecode logo.
QActionGroup * moveInspectorGroup
Group of all actions for move inspectors.
QAction * labelPath
Label branches on path to root.
void setRecompDistances(int c_d, int a_d)
Set recomputation parameters c_d and a_d.
QAction * stop
Stop search.
QAction * compareNodeBeforeFP
Compare current node to other node before fixpoint.
QMenuBar * menuBar
A menu bar.
QAction * showNodeStats
Open node statistics inspector.
void setMoveDuringSearch(bool b)
Set preference whether to move cursor during search.
int maxDepth
Maximum depth of the tree.
void setRefresh(int i)
Set refresh rate.
bool smoothScrollAndZoom
Whether to use smooth scrolling and zooming.
QActionGroup * solutionInspectorGroup
Group of all actions for solution inspectors.
int bab(Space *root, const Gist::Options &opt)
Create a new stand-alone Gist for branch-and-bound search of root.
QAction * searchNext
Search next solution in current subtree.
int refresh
How often to refresh the display during search.
AboutGist aboutGist
About dialog.
int refreshPause
Milliseconds to wait after each refresh (to slow down search)
QActionGroup * inspectGroup
Group of all actions for direct inspector selection.
Gecode toplevel namespace
QAction * searchAll
Search all solutions in current subtree.
QAction * print
Print tree.
QAction * labelBranches
Label branches under current node.
QAction * reset
Reset Gist.
QAction * zoomToFit
Zoom tree to fit window.
QAction * exportWholeTreePDF
Export PDF of whole tree.
QAction * inspectPath
Inspect all nodes on selected path.
bool moveDuringSearch
Whether to move cursor during search.
int failures
Number of failures.
const unsigned int gistLogoSize
Size of the smaller logo.
QActionGroup * comparatorGroup
Group of all actions for comparators.
Statistics about the search tree
void setRefreshPause(int i)
Set refresh pause in msec.
int a_d
The adaptive recomputation distance.