Generated on Sat Feb 7 2015 02:01:18 for Gecode by doxygen 1.8.9.1
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  * Last modified:
10  * $Date: 2013-05-06 09:02:17 +0200 (Mon, 06 May 2013) $ by $Author: tack $
11  * $Revision: 13613 $
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
38 #ifndef GECODE_GIST_QTGIST_HH
39 #define GECODE_GIST_QTGIST_HH
40 
42 #include <gecode/gist/nodestats.hh>
43 
44 /*
45  * Configure linking
46  *
47  */
48 
49 #if !defined(GIST_STATIC_LIBS) && \
50  (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
51 
52 #ifdef GECODE_BUILD_GIST
53 #define GECODE_GIST_EXPORT __declspec( dllexport )
54 #else
55 #define GECODE_GIST_EXPORT __declspec( dllimport )
56 #endif
57 
58 #else
59 
60 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
61 #define GECODE_GIST_EXPORT __attribute__ ((visibility("default")))
62 #else
63 #define GECODE_GIST_EXPORT
64 #endif
65 
66 #endif
67 
68 // Configure auto-linking
69 #ifndef GECODE_BUILD_GIST
70 #define GECODE_LIBRARY_NAME "Gist"
72 #endif
73 
74 namespace Gecode { namespace Gist {
75 
85  class GECODE_GIST_EXPORT Gist : public QWidget {
86  Q_OBJECT
87  private:
89  TreeCanvas* canvas;
91  QSlider* timeBar;
93  QMenu* contextMenu;
95  QAction* nullSolutionInspector;
97  QMenu* solutionInspectorMenu;
99  QAction* nullDoubleClickInspector;
101  QMenu* doubleClickInspectorMenu;
103  QAction* nullMoveInspector;
105  QMenu* moveInspectorMenu;
107  QAction* nullComparator;
109  QMenu* comparatorMenu;
111  QAction* nullBookmark;
113  QMenu* bookmarksMenu;
115  QMenu* inspectNodeMenu;
117  QMenu* inspectNodeBeforeFPMenu;
119  NodeStatInspector* nodeStatInspector;
120  public:
122  QAction* inspect;
124  QAction* inspectBeforeFP;
126  QAction* stop;
128  QAction* reset;
130  QAction* navUp;
132  QAction* navDown;
134  QAction* navLeft;
136  QAction* navRight;
138  QAction* navRoot;
140  QAction* navNextSol;
142  QAction* navPrevSol;
144  QAction* searchNext;
146  QAction* searchAll;
148  QAction* toggleHidden;
150  QAction* hideFailed;
152  QAction* unhideAll;
154  QAction* labelBranches;
156  QAction* labelPath;
158  QAction* zoomToFit;
160  QAction* center;
162  QAction* exportPDF;
166  QAction* print;
167 
169  QAction* bookmarkNode;
171  QAction* compareNode;
175  QAction* setPath;
177  QAction* inspectPath;
179  QAction* showNodeStats;
181  QAction* toggleStop;
183  QAction* unstopAll;
184 
186  QActionGroup* solutionInspectorGroup;
190  QActionGroup* moveInspectorGroup;
192  QActionGroup* comparatorGroup;
194  QActionGroup* bookmarksGroup;
196  QActionGroup* inspectGroup;
198  QActionGroup* inspectBeforeFPGroup;
199  public:
201  Gist(Space* root, bool bab, QWidget* parent, const Options& opt);
203  ~Gist(void);
204 
206  void addDoubleClickInspector(Inspector* i0);
208  void addSolutionInspector(Inspector* i0);
210  void addMoveInspector(Inspector* i0);
212  void addComparator(Comparator* c0);
213 
215  void setAutoHideFailed(bool b);
217  void setAutoZoom(bool b);
219  bool getAutoHideFailed(void);
221  bool getAutoZoom(void);
223  void setShowCopies(bool b);
225  bool getShowCopies(void);
226 
228  void setRefresh(int i);
230  void setRefreshPause(int i);
232  bool getSmoothScrollAndZoom(void);
234  void setSmoothScrollAndZoom(bool b);
236  bool getMoveDuringSearch(void);
238  void setMoveDuringSearch(bool b);
239 
241  void setRecompDistances(int c_d, int a_d);
243  int getCd(void);
245  int getAd(void);
246 
248  bool finish(void);
249 
251  void resizeEvent(QResizeEvent*);
252 
253  Q_SIGNALS:
255  void statusChanged(const Statistics&, bool);
256 
258  void solution(const Space*);
259 
261  void searchFinished(void);
262 
263  private Q_SLOTS:
265  void on_canvas_contextMenu(QContextMenuEvent*);
267  void on_canvas_statusChanged(VisualNode*, const Statistics&, bool);
269  void selectDoubleClickInspector(QAction*);
271  void selectSolutionInspector(QAction*);
273  void selectMoveInspector(QAction*);
275  void selectComparator(QAction*);
277  void selectBookmark(QAction*);
279  void addBookmark(const QString& id);
281  void removeBookmark(int idx);
283  void populateInspectors(void);
285  void populateBookmarksMenu(void);
287  void showStats(void);
289  void inspectWithAction(QAction* a);
291  void inspectBeforeFPWithAction(QAction* a);
292  protected:
294  void addInspector(Inspector* i, QAction*& nas, QAction*& nad,
295  QAction*& nam);
296  };
297 
298 }}
299 
300 #endif
301 
302 // STATISTICS: gist-any
QAction * navNextSol
Navigate to next solution (to the left)
Definition: qtgist.hh:140
QActionGroup * doubleClickInspectorGroup
Group of all actions for double click inspectors.
Definition: qtgist.hh:188
QAction * toggleHidden
Toggle whether current node is hidden.
Definition: qtgist.hh:148
QAction * navDown
Navigate to leftmost child node.
Definition: qtgist.hh:132
QAction * navRoot
Navigate to root node.
Definition: qtgist.hh:138
QAction * bookmarkNode
Bookmark current node.
Definition: qtgist.hh:169
QAction * navUp
Navigate to parent node.
Definition: qtgist.hh:130
QAction * setPath
Set path from current node to the root.
Definition: qtgist.hh:175
QAction * inspect
Inspect current node.
Definition: qtgist.hh:122
Abstract base class for comparators.
Definition: gist.hh:123
QAction * compareNode
Compare current node to other node.
Definition: qtgist.hh:171
QAction * unstopAll
Bookmark current node.
Definition: qtgist.hh:183
QActionGroup * inspectBeforeFPGroup
Group of all actions for direct inspector selection.
Definition: qtgist.hh:198
QAction * hideFailed
Hide failed subtrees under current node.
Definition: qtgist.hh:150
QAction * navPrevSol
Navigate to previous solution (to the right)
Definition: qtgist.hh:142
QAction * navLeft
Navigate to left sibling.
Definition: qtgist.hh:134
Computation spaces.
Definition: core.hpp:1362
QAction * toggleStop
Bookmark current node.
Definition: qtgist.hh:181
Abstract base class for inspectors.
Definition: gist.hh:103
QAction * navRight
Navigate to right sibling.
Definition: qtgist.hh:136
QActionGroup * bookmarksGroup
Group of all actions for bookmarks.
Definition: qtgist.hh:194
QAction * inspectBeforeFP
Inspect current node before fixpoint.
Definition: qtgist.hh:124
QAction * unhideAll
Unhide all hidden subtrees under current node.
Definition: qtgist.hh:152
Gecode::IntArgs i(4, 1, 2, 3, 4)
Options opt
The options.
Definition: test.cpp:101
QAction * center
Center on current node.
Definition: qtgist.hh:160
const unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance) ...
Definition: search.hh:99
QAction * exportPDF
Export PDF of current subtree.
Definition: qtgist.hh:162
Display information about nodes.
Definition: nodestats.hh:53
Gecode Interactive Search Tool
Definition: qtgist.hh:85
#define GECODE_GIST_EXPORT
Definition: qtgist.hh:63
QActionGroup * moveInspectorGroup
Group of all actions for move inspectors.
Definition: qtgist.hh:190
QAction * labelPath
Label branches on path to root.
Definition: qtgist.hh:156
QAction * stop
Stop search.
Definition: qtgist.hh:126
QAction * compareNodeBeforeFP
Compare current node to other node before fixpoint.
Definition: qtgist.hh:173
QAction * showNodeStats
Open node statistics inspector.
Definition: qtgist.hh:179
Node class that supports visual layout
Definition: visualnode.hh:129
QActionGroup * solutionInspectorGroup
Group of all actions for solution inspectors.
Definition: qtgist.hh:186
int bab(Space *root, const Gist::Options &opt)
Create a new stand-alone Gist for branch-and-bound search of root.
Definition: gist.hpp:212
QAction * searchNext
Search next solution in current subtree.
Definition: qtgist.hh:144
const unsigned int c_d
Create a clone after every c_d commits (commit distance)
Definition: search.hh:97
QActionGroup * inspectGroup
Group of all actions for direct inspector selection.
Definition: qtgist.hh:196
struct Gecode::@518::NNF::@57::@58 b
For binary nodes (and, or, eqv)
Gecode toplevel namespace
QAction * searchAll
Search all solutions in current subtree.
Definition: qtgist.hh:146
QAction * print
Print tree.
Definition: qtgist.hh:166
QAction * labelBranches
Label branches under current node.
Definition: qtgist.hh:154
QAction * reset
Reset Gist.
Definition: qtgist.hh:128
QAction * zoomToFit
Zoom tree to fit window.
Definition: qtgist.hh:158
QAction * exportWholeTreePDF
Export PDF of whole tree.
Definition: qtgist.hh:164
QAction * inspectPath
Inspect all nodes on selected path.
Definition: qtgist.hh:177
Options for Gist
Definition: gist.hh:238
QActionGroup * comparatorGroup
Group of all actions for comparators.
Definition: qtgist.hh:192
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
Statistics about the search tree
Definition: spacenode.hh:63
A canvas that displays the search tree.
Definition: treecanvas.hh:91