Generated on Mon Nov 30 23:53:19 2009 for Gecode by doxygen 1.6.1

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: 2009-09-08 21:10:29 +0200 (Tue, 08 Sep 2009) $ by $Author: schulte $
00011  *     $Revision: 9692 $
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 NextSolCursor : public NodeCursor<VisualNode> {
00115   private:
00117     VisualNode* root;
00119     bool back;
00121     bool notOnSol(void);
00122   public:
00124     NextSolCursor(VisualNode* theNode, bool backwards);
00126 
00127 
00128     void processCurrentNode(void);
00130     bool mayMoveUpwards(void);
00132     bool mayMoveDownwards(void);
00134     void moveDownwards(void);
00136     bool mayMoveSidewards(void);
00138     void moveSidewards(void);
00140   };
00141 
00143   class StatCursor : public NodeCursor<VisualNode> {
00144   private:
00146     int curDepth;
00147   public:
00149     int depth;
00151     int failed;
00153     int solved;
00155     int choice;
00157     int open;
00158 
00160     StatCursor(VisualNode* theNode);
00161     
00163 
00164 
00165     void processCurrentNode(void);
00167     void moveDownwards(void);
00169     void moveUpwards(void);
00171     
00172   };
00173 
00174 }}
00175 
00176 #include <gecode/gist/nodecursor.hpp>
00177 
00178 #endif
00179 
00180 // STATISTICS: gist-any