Generated on Thu Jan 16 2025 00:00:00 for Gecode by doxygen 1.14.0
qtgist.hh
Go to the documentation of this file.
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main authors:
4 * Guido Tack <tack@gecode.org>
5 *
6 * Copyright:
7 * Guido Tack, 2006
8 *
9 * This file is part of Gecode, the generic constraint
10 * development environment:
11 * http://www.gecode.org
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining
14 * a copy of this software and associated documentation files (the
15 * "Software"), to deal in the Software without restriction, including
16 * without limitation the rights to use, copy, modify, merge, publish,
17 * distribute, sublicense, and/or sell copies of the Software, and to
18 * permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be
22 * included in all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 *
32 */
33
34#ifndef GECODE_GIST_QTGIST_HH
35#define GECODE_GIST_QTGIST_HH
36
39
40/*
41 * Configure linking
42 *
43 */
44
45#if !defined(GIST_STATIC_LIBS) && \
46 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
47
48#ifdef GECODE_BUILD_GIST
49#define GECODE_GIST_EXPORT __declspec( dllexport )
50#else
51#define GECODE_GIST_EXPORT __declspec( dllimport )
52#endif
53
54#else
55
56#ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
57#define GECODE_GIST_EXPORT __attribute__ ((visibility("default")))
58#else
59#define GECODE_GIST_EXPORT
60#endif
61
62#endif
63
64// Configure auto-linking
65#ifndef GECODE_BUILD_GIST
66#define GECODE_LIBRARY_NAME "Gist"
68#endif
69
70namespace Gecode { namespace Gist {
71
81 class GECODE_GIST_EXPORT Gist : public QWidget {
82 Q_OBJECT
83 private:
85 TreeCanvas* canvas;
87 QSlider* timeBar;
89 QMenu* contextMenu;
91 QAction* nullSolutionInspector;
93 QMenu* solutionInspectorMenu;
95 QAction* nullDoubleClickInspector;
97 QMenu* doubleClickInspectorMenu;
99 QAction* nullMoveInspector;
101 QMenu* moveInspectorMenu;
103 QAction* nullComparator;
105 QMenu* comparatorMenu;
107 QAction* nullBookmark;
109 QMenu* bookmarksMenu;
111 QMenu* inspectNodeMenu;
113 QMenu* inspectNodeBeforeFPMenu;
115 NodeStatInspector* nodeStatInspector;
116 public:
118 QAction* inspect;
122 QAction* stop;
124 QAction* reset;
126 QAction* navUp;
128 QAction* navDown;
130 QAction* navLeft;
132 QAction* navRight;
134 QAction* navRoot;
136 QAction* navNextSol;
138 QAction* navPrevSol;
140 QAction* searchNext;
142 QAction* searchAll;
144 QAction* toggleHidden;
146 QAction* hideFailed;
148 QAction* unhideAll;
152 QAction* labelPath;
154 QAction* zoomToFit;
156 QAction* center;
158 QAction* exportPDF;
162 QAction* print;
163
165 QAction* bookmarkNode;
167 QAction* compareNode;
171 QAction* setPath;
173 QAction* inspectPath;
177 QAction* toggleStop;
179 QAction* unstopAll;
180
186 QActionGroup* moveInspectorGroup;
188 QActionGroup* comparatorGroup;
190 QActionGroup* bookmarksGroup;
192 QActionGroup* inspectGroup;
194 QActionGroup* inspectBeforeFPGroup;
195 public:
197 Gist(Space* root, bool bab, QWidget* parent, const Options& opt);
199 ~Gist(void);
200
206 void addMoveInspector(Inspector* i0);
208 void addComparator(Comparator* c0);
209
211 void setAutoHideFailed(bool b);
213 void setAutoZoom(bool b);
215 bool getAutoHideFailed(void);
217 bool getAutoZoom(void);
219 void setShowCopies(bool b);
221 bool getShowCopies(void);
222
224 void setRefresh(int i);
226 void setRefreshPause(int i);
228 bool getSmoothScrollAndZoom(void);
230 void setSmoothScrollAndZoom(bool b);
232 bool getMoveDuringSearch(void);
234 void setMoveDuringSearch(bool b);
235
237 void setRecompDistances(int c_d, int a_d);
239 int getCd(void);
241 int getAd(void);
242
244 bool finish(void);
245
247 void resizeEvent(QResizeEvent*);
248
249 Q_SIGNALS:
251 void statusChanged(const Statistics&, bool);
252
254 void solution(const Space*);
255
257 void searchFinished(void);
258
259 private Q_SLOTS:
261 void on_canvas_contextMenu(QContextMenuEvent*);
263 void on_canvas_statusChanged(VisualNode*, const Statistics&, bool);
265 void selectDoubleClickInspector(QAction*);
267 void selectSolutionInspector(QAction*);
269 void selectMoveInspector(QAction*);
271 void selectComparator(QAction*);
273 void selectBookmark(QAction*);
275 void addBookmark(const QString& id);
277 void removeBookmark(int idx);
279 void populateInspectors(void);
281 void populateBookmarksMenu(void);
283 void showStats(void);
285 void inspectWithAction(QAction* a);
287 void inspectBeforeFPWithAction(QAction* a);
288 protected:
290 void addInspector(Inspector* i, QAction*& nas, QAction*& nad,
291 QAction*& nam);
292 };
293
294}}
295
296#endif
297
298// STATISTICS: gist-any
Abstract base class for comparators.
Definition gist.hh:119
int getAd(void)
Return adaptive recomputation distance.
Definition qtgist.cpp:811
QAction * toggleStop
Bookmark current node.
Definition qtgist.hh:177
QAction * hideFailed
Hide failed subtrees under current node.
Definition qtgist.hh:146
void setRefresh(int i)
Set refresh rate.
Definition qtgist.cpp:782
QAction * navUp
Navigate to parent node.
Definition qtgist.hh:126
void setShowCopies(bool b)
Set preference whether to show copies in the tree.
Definition qtgist.cpp:816
bool getMoveDuringSearch(void)
Return preference whether to move cursor during search.
Definition qtgist.cpp:794
QAction * compareNodeBeforeFP
Compare current node to other node before fixpoint.
Definition qtgist.hh:169
void addDoubleClickInspector(Inspector *i0)
Add double click inspector i0.
Definition qtgist.cpp:492
QAction * inspectPath
Inspect all nodes on selected path.
Definition qtgist.hh:173
QAction * exportPDF
Export PDF of current subtree.
Definition qtgist.hh:158
void resizeEvent(QResizeEvent *)
Handle resize event.
Definition qtgist.cpp:423
QAction * bookmarkNode
Bookmark current node.
Definition qtgist.hh:165
QAction * print
Print tree.
Definition qtgist.hh:162
void addComparator(Comparator *c0)
Add comparator c0.
Definition qtgist.cpp:528
QAction * stop
Stop search.
Definition qtgist.hh:122
QAction * unstopAll
Bookmark current node.
Definition qtgist.hh:179
QAction * zoomToFit
Zoom tree to fit window.
Definition qtgist.hh:154
bool getAutoHideFailed(void)
Return preference whether to automatically hide failed subtrees.
Definition qtgist.cpp:778
QActionGroup * inspectBeforeFPGroup
Group of all actions for direct inspector selection.
Definition qtgist.hh:194
QAction * navRight
Navigate to right sibling.
Definition qtgist.hh:132
void setAutoHideFailed(bool b)
Set preference whether to automatically hide failed subtrees.
Definition qtgist.cpp:774
void setAutoZoom(bool b)
Set preference whether to automatically zoom to fit.
Definition qtgist.cpp:776
QAction * navNextSol
Navigate to next solution (to the left)
Definition qtgist.hh:136
QAction * searchNext
Search next solution in current subtree.
Definition qtgist.hh:140
QAction * setPath
Set path from current node to the root.
Definition qtgist.hh:171
QAction * labelBranches
Label branches under current node.
Definition qtgist.hh:150
bool getShowCopies(void)
Return preference whether to show copies in the tree.
Definition qtgist.cpp:820
QAction * navLeft
Navigate to left sibling.
Definition qtgist.hh:130
void setSmoothScrollAndZoom(bool b)
Set preference whether to use smooth scrolling and zooming.
Definition qtgist.cpp:790
void addMoveInspector(Inspector *i0)
Add move inspector i0.
Definition qtgist.cpp:510
QActionGroup * solutionInspectorGroup
Group of all actions for solution inspectors.
Definition qtgist.hh:182
QAction * navDown
Navigate to leftmost child node.
Definition qtgist.hh:128
QActionGroup * moveInspectorGroup
Group of all actions for move inspectors.
Definition qtgist.hh:186
void setMoveDuringSearch(bool b)
Set preference whether to move cursor during search.
Definition qtgist.cpp:798
bool getSmoothScrollAndZoom(void)
Return preference whether to use smooth scrolling and zooming.
Definition qtgist.cpp:786
void addSolutionInspector(Inspector *i0)
Add solution inspector i0.
Definition qtgist.cpp:474
bool getAutoZoom(void)
Return preference whether to automatically zoom to fit.
Definition qtgist.cpp:780
QAction * navPrevSol
Navigate to previous solution (to the right)
Definition qtgist.hh:138
QAction * center
Center on current node.
Definition qtgist.hh:156
void setRefreshPause(int i)
Set refresh pause in msec.
Definition qtgist.cpp:784
QAction * compareNode
Compare current node to other node.
Definition qtgist.hh:167
QAction * reset
Reset Gist.
Definition qtgist.hh:124
void statusChanged(const Statistics &, bool)
Signals that the tree has changed.
QAction * toggleHidden
Toggle whether current node is hidden.
Definition qtgist.hh:144
void solution(const Space *)
Signals that a solution has been found.
bool finish(void)
Stop search and wait until finished.
Definition qtgist.cpp:699
QAction * searchAll
Search all solutions in current subtree.
Definition qtgist.hh:142
QAction * navRoot
Navigate to root node.
Definition qtgist.hh:134
QActionGroup * inspectGroup
Group of all actions for direct inspector selection.
Definition qtgist.hh:192
QAction * labelPath
Label branches on path to root.
Definition qtgist.hh:152
QAction * showNodeStats
Open node statistics inspector.
Definition qtgist.hh:175
Gist(Space *root, bool bab, QWidget *parent, const Options &opt)
Constructor.
Definition qtgist.cpp:42
QActionGroup * doubleClickInspectorGroup
Group of all actions for double click inspectors.
Definition qtgist.hh:184
QAction * exportWholeTreePDF
Export PDF of whole tree.
Definition qtgist.hh:160
QActionGroup * comparatorGroup
Group of all actions for comparators.
Definition qtgist.hh:188
QAction * inspect
Inspect current node.
Definition qtgist.hh:118
void setRecompDistances(int c_d, int a_d)
Set recomputation parameters c_d and a_d.
Definition qtgist.cpp:802
void searchFinished(void)
Signals that Gist is ready to be closed.
void addInspector(Inspector *i, QAction *&nas, QAction *&nad, QAction *&nam)
Add inspector i0.
Definition qtgist.cpp:428
QAction * unhideAll
Unhide all hidden subtrees under current node.
Definition qtgist.hh:148
QActionGroup * bookmarksGroup
Group of all actions for bookmarks.
Definition qtgist.hh:190
QAction * inspectBeforeFP
Inspect current node before fixpoint.
Definition qtgist.hh:120
int getCd(void)
Return recomputation distance.
Definition qtgist.cpp:807
Abstract base class for inspectors.
Definition gist.hh:99
Display information about nodes.
Definition nodestats.hh:49
Options for Gist
Definition gist.hh:234
Statistics about the search tree
Definition spacenode.hh:59
A canvas that displays the search tree.
Definition treecanvas.hh:87
Node class that supports visual layout
Computation spaces.
Definition core.hpp:1744
#define GECODE_GIST_EXPORT
Definition gist.hh:65
int bab(Space *root, const Gist::Options &opt=Gist::Options::def)
Create a new stand-alone Gist for branch-and-bound search of root.
Definition gist.hpp:208
Gecode toplevel namespace