Generated on Tue Oct 22 2013 00:49:02 for Gecode by doxygen 1.8.4
nodecursor.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_NODECURSOR_HH
39 #define GECODE_GIST_NODECURSOR_HH
40 
42 
43 namespace Gecode { namespace Gist {
44 
46  template<class Node>
47  class NodeCursor {
48  private:
50  Node* _startNode;
52  Node* _node;
54  unsigned int _alternative;
55  protected:
57  const typename Node::NodeAllocator& na;
59  void node(Node* n);
61  Node* startNode(void);
62  public:
64  NodeCursor(Node* theNode, const typename Node::NodeAllocator& na);
66  Node* node(void);
68  unsigned int alternative(void);
70  void alternative(unsigned int a);
71 
73 
74  bool mayMoveUpwards(void);
77  void moveUpwards(void);
79  bool mayMoveDownwards(void);
81  void moveDownwards(void);
83  bool mayMoveSidewards(void);
85  void moveSidewards(void);
87  };
88 
90  class HideFailedCursor : public NodeCursor<VisualNode> {
91  private:
92  bool onlyDirty;
93  public:
97  bool onlyDirtyNodes);
99 
100  bool mayMoveDownwards(void);
103  void processCurrentNode(void);
105  };
106 
108  class UnhideAllCursor : public NodeCursor<VisualNode> {
109  public:
111  UnhideAllCursor(VisualNode* theNode,
114 
115  void processCurrentNode(void);
118  };
119 
121  class UnstopAllCursor : public NodeCursor<VisualNode> {
122  public:
124  UnstopAllCursor(VisualNode* theNode,
127 
128  void processCurrentNode(void);
131  };
132 
134  class NextSolCursor : public NodeCursor<VisualNode> {
135  private:
137  bool back;
139  bool notOnSol(void);
140  public:
142  NextSolCursor(VisualNode* theNode, bool backwards,
145 
146  void processCurrentNode(void);
149  bool mayMoveUpwards(void);
151  bool mayMoveDownwards(void);
153  void moveDownwards(void);
155  bool mayMoveSidewards(void);
157  void moveSidewards(void);
159  };
160 
162  class StatCursor : public NodeCursor<VisualNode> {
163  private:
165  int curDepth;
166  public:
168  int depth;
170  int failed;
172  int solved;
174  int choice;
176  int open;
177 
179  StatCursor(VisualNode* theNode,
181 
183 
184  void processCurrentNode(void);
187  void moveDownwards(void);
189  void moveUpwards(void);
191 
192  };
193 
195  class BranchLabelCursor : public NodeCursor<VisualNode> {
196  private:
200  BestNode* _curBest;
202  int _c_d;
204  int _a_d;
206  bool _clear;
207  public:
209  BranchLabelCursor(VisualNode* theNode, BestNode* curBest,
210  int c_d, int a_d, bool clear,
213 
214  void processCurrentNode(void);
216  };
217 
219  class DisposeCursor : public NodeCursor<VisualNode> {
220  public:
222  DisposeCursor(VisualNode* theNode,
224 
226 
227  void processCurrentNode(void);
230 
231  };
232 
233 }}
234 
236 
237 #endif
238 
239 // STATISTICS: gist-any