path.hh
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
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