Generated on Sat Jun 2 2018 07:17:44 for Gecode by doxygen 1.8.13
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 
38 #include <gecode/gist/nodestats.hh>
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 
70 namespace 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;
120  QAction* inspectBeforeFP;
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;
150  QAction* labelBranches;
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;
175  QAction* showNodeStats;
177  QAction* toggleStop;
179  QAction* unstopAll;
180 
182  QActionGroup* solutionInspectorGroup;
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 
202  void addDoubleClickInspector(Inspector* i0);
204  void addSolutionInspector(Inspector* i0);
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
QAction * navNextSol
Navigate to next solution (to the left)
Definition: qtgist.hh:136
QActionGroup * doubleClickInspectorGroup
Group of all actions for double click inspectors.
Definition: qtgist.hh:184
QAction * toggleHidden
Toggle whether current node is hidden.
Definition: qtgist.hh:144
QAction * navDown
Navigate to leftmost child node.
Definition: qtgist.hh:128
QAction * navRoot
Navigate to root node.
Definition: qtgist.hh:134
QAction * bookmarkNode
Bookmark current node.
Definition: qtgist.hh:165
QAction * navUp
Navigate to parent node.
Definition: qtgist.hh:126
QAction * setPath
Set path from current node to the root.
Definition: qtgist.hh:171
QAction * inspect
Inspect current node.
Definition: qtgist.hh:118
Abstract base class for comparators.
Definition: gist.hh:119
QAction * compareNode
Compare current node to other node.
Definition: qtgist.hh:167
QAction * unstopAll
Bookmark current node.
Definition: qtgist.hh:179
QActionGroup * inspectBeforeFPGroup
Group of all actions for direct inspector selection.
Definition: qtgist.hh:194
QAction * hideFailed
Hide failed subtrees under current node.
Definition: qtgist.hh:146
QAction * navPrevSol
Navigate to previous solution (to the right)
Definition: qtgist.hh:138
QAction * navLeft
Navigate to left sibling.
Definition: qtgist.hh:130
Computation spaces.
Definition: core.hpp:1701
QAction * toggleStop
Bookmark current node.
Definition: qtgist.hh:177
Abstract base class for inspectors.
Definition: gist.hh:99
QAction * navRight
Navigate to right sibling.
Definition: qtgist.hh:132
QActionGroup * bookmarksGroup
Group of all actions for bookmarks.
Definition: qtgist.hh:190
QAction * inspectBeforeFP
Inspect current node before fixpoint.
Definition: qtgist.hh:120
QAction * unhideAll
Unhide all hidden subtrees under current node.
Definition: qtgist.hh:148
Gecode::IntArgs i(4, 1, 2, 3, 4)
Options opt
The options.
Definition: test.cpp:97
QAction * center
Center on current node.
Definition: qtgist.hh:156
const unsigned int a_d
Create a clone during recomputation if distance is greater than a_d (adaptive distance) ...
Definition: search.hh:113
QAction * exportPDF
Export PDF of current subtree.
Definition: qtgist.hh:158
Display information about nodes.
Definition: nodestats.hh:49
Gecode Interactive Search Tool
Definition: qtgist.hh:81
struct Gecode::@585::NNF::@62::@63 b
For binary nodes (and, or, eqv)
#define GECODE_GIST_EXPORT
Definition: qtgist.hh:59
QActionGroup * moveInspectorGroup
Group of all actions for move inspectors.
Definition: qtgist.hh:186
QAction * labelPath
Label branches on path to root.
Definition: qtgist.hh:152
QAction * stop
Stop search.
Definition: qtgist.hh:122
QAction * compareNodeBeforeFP
Compare current node to other node before fixpoint.
Definition: qtgist.hh:169
struct Gecode::@585::NNF::@62::@64 a
For atomic nodes.
QAction * showNodeStats
Open node statistics inspector.
Definition: qtgist.hh:175
Node class that supports visual layout
Definition: visualnode.hh:125
QActionGroup * solutionInspectorGroup
Group of all actions for solution inspectors.
Definition: qtgist.hh:182
int bab(Space *root, const Gist::Options &opt)
Create a new stand-alone Gist for branch-and-bound search of root.
Definition: gist.hpp:208
QAction * searchNext
Search next solution in current subtree.
Definition: qtgist.hh:140
const unsigned int c_d
Create a clone after every c_d commits (commit distance)
Definition: search.hh:111
QActionGroup * inspectGroup
Group of all actions for direct inspector selection.
Definition: qtgist.hh:192
Gecode toplevel namespace
QAction * searchAll
Search all solutions in current subtree.
Definition: qtgist.hh:142
QAction * print
Print tree.
Definition: qtgist.hh:162
QAction * labelBranches
Label branches under current node.
Definition: qtgist.hh:150
QAction * reset
Reset Gist.
Definition: qtgist.hh:124
QAction * zoomToFit
Zoom tree to fit window.
Definition: qtgist.hh:154
QAction * exportWholeTreePDF
Export PDF of whole tree.
Definition: qtgist.hh:160
QAction * inspectPath
Inspect all nodes on selected path.
Definition: qtgist.hh:173
Options for Gist
Definition: gist.hh:234
QActionGroup * comparatorGroup
Group of all actions for comparators.
Definition: qtgist.hh:188
Statistics about the search tree
Definition: spacenode.hh:59
A canvas that displays the search tree.
Definition: treecanvas.hh:87