Generated on Mon May 10 06:46:31 2010 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  *  Last modified:
00010  *     $Date: 2010-03-30 13:35:10 +0200 (Tue, 30 Mar 2010) $ by $Author: tack $
00011  *     $Revision: 10600 $
00012  *
00013  *  This file is part of Gecode, the generic constraint
00014  *  development environment:
00015  *     http://www.gecode.org
00016  *
00017  * Permission is hereby granted, free of charge, to any person obtaining
00018  * a copy of this software and associated documentation files (the
00019  * "Software"), to deal in the Software without restriction, including
00020  * without limitation the rights to use, copy, modify, merge, publish,
00021  * distribute, sublicense, and/or sell copies of the Software, and to
00022  * permit persons to whom the Software is furnished to do so, subject to
00023  * the following conditions:
00024  *
00025  * The above copyright notice and this permission notice shall be
00026  * included in all copies or substantial portions of the Software.
00027  *
00028  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00029  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00030  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00031  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00032  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00033  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00034  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00035  *
00036  */
00037 
00038 #ifndef GECODE_GIST_NODECURSOR_HH
00039 #define GECODE_GIST_NODECURSOR_HH
00040 
00041 #include <gecode/gist/visualnode.hh>
00042 
00043 namespace Gecode { namespace Gist {
00044 
00046   template<class Node>
00047   class NodeCursor {
00048   private:
00050     Node* _startNode;
00052     Node* _node;
00054     unsigned int _alternative;
00055   protected:
00057     void node(Node* n);
00059     Node* startNode(void);
00060   public:
00062     NodeCursor(Node* theNode);
00064     Node* node(void);
00066     unsigned int alternative(void);
00068     void alternative(unsigned int a);
00069 
00071 
00072 
00073     bool mayMoveUpwards(void);
00075     void moveUpwards(void);
00077     bool mayMoveDownwards(void);
00079     void moveDownwards(void);
00081     bool mayMoveSidewards(void);
00083     void moveSidewards(void);
00085   };
00086 
00088   class HideFailedCursor : public NodeCursor<VisualNode> {
00089   public:
00091     HideFailedCursor(VisualNode* theNode);
00093 
00094 
00095     bool mayMoveDownwards(void);
00097     void processCurrentNode(void);
00099   };
00100 
00102   class UnhideAllCursor : public NodeCursor<VisualNode> {
00103   public:
00105     UnhideAllCursor(VisualNode* theNode);
00107 
00108 
00109     void processCurrentNode(void);
00111   };
00112 
00114   class UnstopAllCursor : public NodeCursor<VisualNode> {
00115   public:
00117     UnstopAllCursor(VisualNode* theNode);
00119 
00120 
00121     void processCurrentNode(void);
00123   };
00124 
00126   class NextSolCursor : public NodeCursor<VisualNode> {
00127   private:
00129     VisualNode* root;
00131     bool back;
00133     bool notOnSol(void);
00134   public:
00136     NextSolCursor(VisualNode* theNode, bool backwards);
00138 
00139 
00140     void processCurrentNode(void);
00142     bool mayMoveUpwards(void);
00144     bool mayMoveDownwards(void);
00146     void moveDownwards(void);
00148     bool mayMoveSidewards(void);
00150     void moveSidewards(void);
00152   };
00153 
00155   class StatCursor : public NodeCursor<VisualNode> {
00156   private:
00158     int curDepth;
00159   public:
00161     int depth;
00163     int failed;
00165     int solved;
00167     int choice;
00169     int open;
00170 
00172     StatCursor(VisualNode* theNode);
00173     
00175 
00176 
00177     void processCurrentNode(void);
00179     void moveDownwards(void);
00181     void moveUpwards(void);
00183     
00184   };
00185 
00186 }}
00187 
00188 #include <gecode/gist/nodecursor.hpp>
00189 
00190 #endif
00191 
00192 // STATISTICS: gist-any