41 namespace 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) {
80 c =
new Gist(root,bab,
this,opt);
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();
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.
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.