Generated on Sun Feb 17 15:24:28 2019 for Gecode by doxygen 1.6.3

path.hh

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Christian Schulte <schulte@gecode.org>
00005  *
00006  *  Copyright:
00007  *     Christian Schulte, 2003
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_SEARCH_SEQ_PATH_HH__
00035 #define __GECODE_SEARCH_SEQ_PATH_HH__
00036 
00037 #include <algorithm>
00038 
00039 #include <gecode/search.hh>
00040 #include <gecode/search/support.hh>
00041 #include <gecode/search/worker.hh>
00042 #include <gecode/search/nogoods.hh>
00043 
00044 namespace Gecode { namespace Search { namespace Seq {
00045 
00059   template<class Tracer>
00060   class GECODE_VTABLE_EXPORT Path : public NoGoods {
00061     friend class Search::NoGoodsProp;
00062   public:
00064     typedef typename Tracer::ID ID;
00066     class Edge {
00067     protected:
00069       Space* _space;
00071       unsigned int _alt;
00073       const Choice* _choice;
00075       ID _nid;
00076     public:
00078       Edge(void);
00080       Edge(Space* s, Space* c, unsigned int nid);
00081 
00083       Space* space(void) const;
00085       void space(Space* s);
00086 
00088       const Choice* choice(void) const;
00089 
00091       unsigned int alt(void) const;
00093       unsigned int truealt(void) const;
00095       bool leftmost(void) const;
00097       bool rightmost(void) const;
00099       void next(void);
00101       bool lao(void) const;
00102 
00104       unsigned int nid(void) const;
00105 
00107       void dispose(void);
00108     };
00109   protected:
00111     Support::DynamicStack<Edge,Heap> ds;
00113     unsigned int _ngdl;
00114   public:
00116     Path(unsigned int l);
00118     unsigned int ngdl(void) const;
00120     void ngdl(unsigned int l);
00122     const Choice* push(Worker& stat, Space* s, Space* c, unsigned int nid);
00124     void next(void);
00126     Edge& top(void) const;
00128     bool empty(void) const;
00130     int lc(void) const;
00132     void unwind(int l, Tracer& t);
00134     void commit(Space* s, int i) const;
00136     Space* recompute(unsigned int& d, unsigned int a_d, Worker& s,
00137                      Tracer& t);
00139     Space* recompute(unsigned int& d, unsigned int a_d, Worker& s,
00140                      const Space& best, int& mark,
00141                      Tracer& t);
00143     int entries(void) const;
00145     void reset(void);
00147     virtual void post(Space& home) const;
00148   };
00149 
00150 }}}
00151 
00152 #include <gecode/search/seq/path.hpp>
00153 
00154 #endif
00155 
00156 // STATISTICS: search-seq