Generated on Fri Oct 19 11:24:59 2018 for Gecode by doxygen 1.6.3

nodecursor.hh

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Guido Tack <tack@gecode.org>
00005  *
00006  *  Copyright:
00007  *     Guido Tack, 2006
00008  *
00009  *  This file is part of Gecode, the generic constraint
00010  *  development environment:
00011  *     http://www.gecode.org
00012  *
00013  * Permission is hereby granted, free of charge, to any person obtaining
00014  * a copy of this software and associated documentation files (the
00015  * "Software"), to deal in the Software without restriction, including
00016  * without limitation the rights to use, copy, modify, merge, publish,
00017  * distribute, sublicense, and/or sell copies of the Software, and to
00018  * permit persons to whom the Software is furnished to do so, subject to
00019  * the following conditions:
00020  *
00021  * The above copyright notice and this permission notice shall be
00022  * included in all copies or substantial portions of the Software.
00023  *
00024  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00025  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00026  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00027  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00028  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00029  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00030  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00031  *
00032  */
00033 
00034 #ifndef GECODE_GIST_NODECURSOR_HH
00035 #define GECODE_GIST_NODECURSOR_HH
00036 
00037 #include <gecode/gist/visualnode.hh>
00038 
00039 namespace Gecode { namespace Gist {
00040 
00042   template<class Node>
00043   class NodeCursor {
00044   private:
00046     Node* _startNode;
00048     Node* _node;
00050     unsigned int _alternative;
00051   protected:
00053     const typename Node::NodeAllocator& na;
00055     void node(Node* n);
00057     Node* startNode(void);
00058   public:
00060     NodeCursor(Node* theNode, const typename Node::NodeAllocator& na);
00062     Node* node(void);
00064     unsigned int alternative(void);
00066     void alternative(unsigned int a);
00067 
00069 
00070 
00071     bool mayMoveUpwards(void);
00073     void moveUpwards(void);
00075     bool mayMoveDownwards(void);
00077     void moveDownwards(void);
00079     bool mayMoveSidewards(void);
00081     void moveSidewards(void);
00083   };
00084 
00086   class HideFailedCursor : public NodeCursor<VisualNode> {
00087   private:
00088     bool onlyDirty;
00089   public:
00091     HideFailedCursor(VisualNode* theNode,
00092                      const VisualNode::NodeAllocator& na,
00093                      bool onlyDirtyNodes);
00095 
00096 
00097     bool mayMoveDownwards(void);
00099     void processCurrentNode(void);
00101   };
00102 
00104   class UnhideAllCursor : public NodeCursor<VisualNode> {
00105   public:
00107     UnhideAllCursor(VisualNode* theNode,
00108                     const VisualNode::NodeAllocator& na);
00110 
00111 
00112     void processCurrentNode(void);
00114   };
00115 
00117   class UnstopAllCursor : public NodeCursor<VisualNode> {
00118   public:
00120     UnstopAllCursor(VisualNode* theNode,
00121                     const VisualNode::NodeAllocator& na);
00123 
00124 
00125     void processCurrentNode(void);
00127   };
00128 
00130   class NextSolCursor : public NodeCursor<VisualNode> {
00131   private:
00133     bool back;
00135     bool notOnSol(void);
00136   public:
00138     NextSolCursor(VisualNode* theNode, bool backwards,
00139                   const VisualNode::NodeAllocator& na);
00141 
00142 
00143     void processCurrentNode(void);
00145     bool mayMoveUpwards(void);
00147     bool mayMoveDownwards(void);
00149     void moveDownwards(void);
00151     bool mayMoveSidewards(void);
00153     void moveSidewards(void);
00155   };
00156 
00158   class StatCursor : public NodeCursor<VisualNode> {
00159   private:
00161     int curDepth;
00162   public:
00164     int depth;
00166     int failed;
00168     int solved;
00170     int choice;
00172     int open;
00173 
00175     StatCursor(VisualNode* theNode,
00176                const VisualNode::NodeAllocator& na);
00177 
00179 
00180 
00181     void processCurrentNode(void);
00183     void moveDownwards(void);
00185     void moveUpwards(void);
00187 
00188   };
00189 
00191   class BranchLabelCursor : public NodeCursor<VisualNode> {
00192   private:
00194     VisualNode::NodeAllocator& _na;
00196     BestNode* _curBest;
00198     int _c_d;
00200     int _a_d;
00202     bool _clear;
00203   public:
00205     BranchLabelCursor(VisualNode* theNode, BestNode* curBest,
00206                       int c_d, int a_d, bool clear,
00207                       VisualNode::NodeAllocator& na);
00209 
00210     void processCurrentNode(void);
00212   };
00213 
00215   class DisposeCursor : public NodeCursor<VisualNode> {
00216   public:
00218     DisposeCursor(VisualNode* theNode,
00219                   const VisualNode::NodeAllocator& na);
00220 
00222 
00223 
00224     void processCurrentNode(void);
00226 
00227   };
00228 
00229 }}
00230 
00231 #include <gecode/gist/nodecursor.hpp>
00232 
00233 #endif
00234 
00235 // STATISTICS: gist-any