qtgist.hh
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Guido Tack <tack@gecode.org>
*
* Copyright:
* Guido Tack, 2006
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifndef GECODE_GIST_QTGIST_HH
#define GECODE_GIST_QTGIST_HH
#include <gecode/gist/treecanvas.hh>
#include <gecode/gist/nodestats.hh>
/*
* Configure linking
*
*/
#if !defined(GIST_STATIC_LIBS) && \
(defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
#ifdef GECODE_BUILD_GIST
#define GECODE_GIST_EXPORT __declspec( dllexport )
#else
#define GECODE_GIST_EXPORT __declspec( dllimport )
#endif
#else
#ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
#define GECODE_GIST_EXPORT __attribute__ ((visibility("default")))
#else
#define GECODE_GIST_EXPORT
#endif
#endif
// Configure auto-linking
#ifndef GECODE_BUILD_GIST
#define GECODE_LIBRARY_NAME "Gist"
#include <gecode/support/auto-link.hpp>
#endif
namespace Gecode { namespace Gist {
class GECODE_GIST_EXPORT Gist : public QWidget {
Q_OBJECT
private:
TreeCanvas* canvas;
QSlider* timeBar;
QMenu* contextMenu;
QAction* nullSolutionInspector;
QMenu* solutionInspectorMenu;
QAction* nullDoubleClickInspector;
QMenu* doubleClickInspectorMenu;
QAction* nullMoveInspector;
QMenu* moveInspectorMenu;
QAction* nullComparator;
QMenu* comparatorMenu;
QAction* nullBookmark;
QMenu* bookmarksMenu;
QMenu* inspectNodeMenu;
QMenu* inspectNodeBeforeFPMenu;
NodeStatInspector* nodeStatInspector;
public:
QAction* inspect;
QAction* inspectBeforeFP;
QAction* stop;
QAction* reset;
QAction* navUp;
QAction* navDown;
QAction* navLeft;
QAction* navRight;
QAction* navRoot;
QAction* navNextSol;
QAction* navPrevSol;
QAction* searchNext;
QAction* searchAll;
QAction* toggleHidden;
QAction* hideFailed;
QAction* unhideAll;
QAction* labelBranches;
QAction* labelPath;
QAction* zoomToFit;
QAction* center;
QAction* exportPDF;
QAction* exportWholeTreePDF;
QAction* print;
QAction* bookmarkNode;
QAction* compareNode;
QAction* compareNodeBeforeFP;
QAction* setPath;
QAction* inspectPath;
QAction* showNodeStats;
QAction* toggleStop;
QAction* unstopAll;
QActionGroup* solutionInspectorGroup;
QActionGroup* doubleClickInspectorGroup;
QActionGroup* moveInspectorGroup;
QActionGroup* comparatorGroup;
QActionGroup* bookmarksGroup;
QActionGroup* inspectGroup;
QActionGroup* inspectBeforeFPGroup;
public:
Gist(Space* root, bool bab, QWidget* parent, const Options& opt);
~Gist(void);
void addDoubleClickInspector(Inspector* i0);
void addSolutionInspector(Inspector* i0);
void addMoveInspector(Inspector* i0);
void addComparator(Comparator* c0);
void setAutoHideFailed(bool b);
void setAutoZoom(bool b);
bool getAutoHideFailed(void);
bool getAutoZoom(void);
void setShowCopies(bool b);
bool getShowCopies(void);
void setRefresh(int i);
void setRefreshPause(int i);
bool getSmoothScrollAndZoom(void);
void setSmoothScrollAndZoom(bool b);
bool getMoveDuringSearch(void);
void setMoveDuringSearch(bool b);
void setRecompDistances(int c_d, int a_d);
int getCd(void);
int getAd(void);
bool finish(void);
void resizeEvent(QResizeEvent*);
Q_SIGNALS:
void statusChanged(const Statistics&, bool);
void solution(const Space*);
void searchFinished(void);
private Q_SLOTS:
void on_canvas_contextMenu(QContextMenuEvent*);
void on_canvas_statusChanged(VisualNode*, const Statistics&, bool);
void selectDoubleClickInspector(QAction*);
void selectSolutionInspector(QAction*);
void selectMoveInspector(QAction*);
void selectComparator(QAction*);
void selectBookmark(QAction*);
void addBookmark(const QString& id);
void removeBookmark(int idx);
void populateInspectors(void);
void populateBookmarksMenu(void);
void showStats(void);
void inspectWithAction(QAction* a);
void inspectBeforeFPWithAction(QAction* a);
protected:
void addInspector(Inspector* i, QAction*& nas, QAction*& nad,
QAction*& nam);
};
}}
#endif
// STATISTICS: gist-any
auto-link.hpp
Gecode::Gist::Comparator
Abstract base class for comparators.
Definition gist.hh:119
Gecode::Gist::Gist::getAd
int getAd(void)
Return adaptive recomputation distance.
Definition qtgist.cpp:811
Gecode::Gist::Gist::toggleStop
QAction * toggleStop
Bookmark current node.
Definition qtgist.hh:177
Gecode::Gist::Gist::hideFailed
QAction * hideFailed
Hide failed subtrees under current node.
Definition qtgist.hh:146
Gecode::Gist::Gist::setRefresh
void setRefresh(int i)
Set refresh rate.
Definition qtgist.cpp:782
Gecode::Gist::Gist::navUp
QAction * navUp
Navigate to parent node.
Definition qtgist.hh:126
Gecode::Gist::Gist::setShowCopies
void setShowCopies(bool b)
Set preference whether to show copies in the tree.
Definition qtgist.cpp:816
Gecode::Gist::Gist::getMoveDuringSearch
bool getMoveDuringSearch(void)
Return preference whether to move cursor during search.
Definition qtgist.cpp:794
Gecode::Gist::Gist::compareNodeBeforeFP
QAction * compareNodeBeforeFP
Compare current node to other node before fixpoint.
Definition qtgist.hh:169
Gecode::Gist::Gist::addDoubleClickInspector
void addDoubleClickInspector(Inspector *i0)
Add double click inspector i0.
Definition qtgist.cpp:492
Gecode::Gist::Gist::inspectPath
QAction * inspectPath
Inspect all nodes on selected path.
Definition qtgist.hh:173
Gecode::Gist::Gist::exportPDF
QAction * exportPDF
Export PDF of current subtree.
Definition qtgist.hh:158
Gecode::Gist::Gist::resizeEvent
void resizeEvent(QResizeEvent *)
Handle resize event.
Definition qtgist.cpp:423
Gecode::Gist::Gist::bookmarkNode
QAction * bookmarkNode
Bookmark current node.
Definition qtgist.hh:165
Gecode::Gist::Gist::print
QAction * print
Print tree.
Definition qtgist.hh:162
Gecode::Gist::Gist::addComparator
void addComparator(Comparator *c0)
Add comparator c0.
Definition qtgist.cpp:528
Gecode::Gist::Gist::stop
QAction * stop
Stop search.
Definition qtgist.hh:122
Gecode::Gist::Gist::unstopAll
QAction * unstopAll
Bookmark current node.
Definition qtgist.hh:179
Gecode::Gist::Gist::zoomToFit
QAction * zoomToFit
Zoom tree to fit window.
Definition qtgist.hh:154
Gecode::Gist::Gist::getAutoHideFailed
bool getAutoHideFailed(void)
Return preference whether to automatically hide failed subtrees.
Definition qtgist.cpp:778
Gecode::Gist::Gist::inspectBeforeFPGroup
QActionGroup * inspectBeforeFPGroup
Group of all actions for direct inspector selection.
Definition qtgist.hh:194
Gecode::Gist::Gist::navRight
QAction * navRight
Navigate to right sibling.
Definition qtgist.hh:132
Gecode::Gist::Gist::setAutoHideFailed
void setAutoHideFailed(bool b)
Set preference whether to automatically hide failed subtrees.
Definition qtgist.cpp:774
Gecode::Gist::Gist::setAutoZoom
void setAutoZoom(bool b)
Set preference whether to automatically zoom to fit.
Definition qtgist.cpp:776
Gecode::Gist::Gist::navNextSol
QAction * navNextSol
Navigate to next solution (to the left).
Definition qtgist.hh:136
Gecode::Gist::Gist::searchNext
QAction * searchNext
Search next solution in current subtree.
Definition qtgist.hh:140
Gecode::Gist::Gist::setPath
QAction * setPath
Set path from current node to the root.
Definition qtgist.hh:171
Gecode::Gist::Gist::labelBranches
QAction * labelBranches
Label branches under current node.
Definition qtgist.hh:150
Gecode::Gist::Gist::getShowCopies
bool getShowCopies(void)
Return preference whether to show copies in the tree.
Definition qtgist.cpp:820
Gecode::Gist::Gist::navLeft
QAction * navLeft
Navigate to left sibling.
Definition qtgist.hh:130
Gecode::Gist::Gist::setSmoothScrollAndZoom
void setSmoothScrollAndZoom(bool b)
Set preference whether to use smooth scrolling and zooming.
Definition qtgist.cpp:790
Gecode::Gist::Gist::addMoveInspector
void addMoveInspector(Inspector *i0)
Add move inspector i0.
Definition qtgist.cpp:510
Gecode::Gist::Gist::solutionInspectorGroup
QActionGroup * solutionInspectorGroup
Group of all actions for solution inspectors.
Definition qtgist.hh:182
Gecode::Gist::Gist::navDown
QAction * navDown
Navigate to leftmost child node.
Definition qtgist.hh:128
Gecode::Gist::Gist::moveInspectorGroup
QActionGroup * moveInspectorGroup
Group of all actions for move inspectors.
Definition qtgist.hh:186
Gecode::Gist::Gist::setMoveDuringSearch
void setMoveDuringSearch(bool b)
Set preference whether to move cursor during search.
Definition qtgist.cpp:798
Gecode::Gist::Gist::getSmoothScrollAndZoom
bool getSmoothScrollAndZoom(void)
Return preference whether to use smooth scrolling and zooming.
Definition qtgist.cpp:786
Gecode::Gist::Gist::addSolutionInspector
void addSolutionInspector(Inspector *i0)
Add solution inspector i0.
Definition qtgist.cpp:474
Gecode::Gist::Gist::getAutoZoom
bool getAutoZoom(void)
Return preference whether to automatically zoom to fit.
Definition qtgist.cpp:780
Gecode::Gist::Gist::navPrevSol
QAction * navPrevSol
Navigate to previous solution (to the right).
Definition qtgist.hh:138
Gecode::Gist::Gist::center
QAction * center
Center on current node.
Definition qtgist.hh:156
Gecode::Gist::Gist::setRefreshPause
void setRefreshPause(int i)
Set refresh pause in msec.
Definition qtgist.cpp:784
Gecode::Gist::Gist::compareNode
QAction * compareNode
Compare current node to other node.
Definition qtgist.hh:167
Gecode::Gist::Gist::reset
QAction * reset
Reset Gist.
Definition qtgist.hh:124
Gecode::Gist::Gist::statusChanged
void statusChanged(const Statistics &, bool)
Signals that the tree has changed.
Gecode::Gist::Gist::toggleHidden
QAction * toggleHidden
Toggle whether current node is hidden.
Definition qtgist.hh:144
Gecode::Gist::Gist::solution
void solution(const Space *)
Signals that a solution has been found.
Gecode::Gist::Gist::finish
bool finish(void)
Stop search and wait until finished.
Definition qtgist.cpp:699
Gecode::Gist::Gist::searchAll
QAction * searchAll
Search all solutions in current subtree.
Definition qtgist.hh:142
Gecode::Gist::Gist::navRoot
QAction * navRoot
Navigate to root node.
Definition qtgist.hh:134
Gecode::Gist::Gist::inspectGroup
QActionGroup * inspectGroup
Group of all actions for direct inspector selection.
Definition qtgist.hh:192
Gecode::Gist::Gist::labelPath
QAction * labelPath
Label branches on path to root.
Definition qtgist.hh:152
Gecode::Gist::Gist::showNodeStats
QAction * showNodeStats
Open node statistics inspector.
Definition qtgist.hh:175
Gecode::Gist::Gist::Gist
Gist(Space *root, bool bab, QWidget *parent, const Options &opt)
Constructor.
Definition qtgist.cpp:42
Gecode::Gist::Gist::doubleClickInspectorGroup
QActionGroup * doubleClickInspectorGroup
Group of all actions for double click inspectors.
Definition qtgist.hh:184
Gecode::Gist::Gist::exportWholeTreePDF
QAction * exportWholeTreePDF
Export PDF of whole tree.
Definition qtgist.hh:160
Gecode::Gist::Gist::comparatorGroup
QActionGroup * comparatorGroup
Group of all actions for comparators.
Definition qtgist.hh:188
Gecode::Gist::Gist::inspect
QAction * inspect
Inspect current node.
Definition qtgist.hh:118
Gecode::Gist::Gist::setRecompDistances
void setRecompDistances(int c_d, int a_d)
Set recomputation parameters c_d and a_d.
Definition qtgist.cpp:802
Gecode::Gist::Gist::searchFinished
void searchFinished(void)
Signals that Gist is ready to be closed.
Gecode::Gist::Gist::addInspector
void addInspector(Inspector *i, QAction *&nas, QAction *&nad, QAction *&nam)
Add inspector i0.
Definition qtgist.cpp:428
Gecode::Gist::Gist::unhideAll
QAction * unhideAll
Unhide all hidden subtrees under current node.
Definition qtgist.hh:148
Gecode::Gist::Gist::bookmarksGroup
QActionGroup * bookmarksGroup
Group of all actions for bookmarks.
Definition qtgist.hh:190
Gecode::Gist::Gist::inspectBeforeFP
QAction * inspectBeforeFP
Inspect current node before fixpoint.
Definition qtgist.hh:120
Gecode::Gist::Gist::getCd
int getCd(void)
Return recomputation distance.
Definition qtgist.cpp:807
Gecode::Gist::Inspector
Abstract base class for inspectors.
Definition gist.hh:99
Gecode::Gist::NodeStatInspector
Display information about nodes.
Definition nodestats.hh:49
Gecode::Gist::Options
Options for Gist
Definition gist.hh:234
Gecode::Gist::Statistics
Statistics about the search tree
Definition spacenode.hh:59
Gecode::Gist::TreeCanvas
A canvas that displays the search tree.
Definition treecanvas.hh:87
Gecode::Gist::VisualNode
Node class that supports visual layout
Definition visualnode.hh:125
Gecode::Space
Computation spaces.
Definition core.hpp:1742
GECODE_GIST_EXPORT
#define GECODE_GIST_EXPORT
Definition gist.hh:65
Gecode::Gist::bab
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
Gecode toplevel namespace
nodestats.hh
treecanvas.hh