Generated on Thu Apr 11 13:59:18 2019 for Gecode by doxygen 1.6.3

rbs.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, 2012
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_RBS_HH__
00035 #define __GECODE_SEARCH_SEQ_RBS_HH__
00036 
00037 #include <gecode/search.hh>
00038 
00039 namespace Gecode { namespace Search { namespace Seq {
00040 
00041   class RBS;
00042 
00044   class GECODE_SEARCH_EXPORT RestartStop : public Stop {
00045     template<class,template<class>class> friend class ::Gecode::RBS;
00046     friend class ::Gecode::Search::Seq::RBS;
00047   private:
00049     unsigned long int l;
00051     Stop* m_stop;
00053     bool e_stopped;
00055     Statistics m_stat;
00056   public:
00058     RestartStop(Stop* s);
00060     virtual bool stop(const Statistics& s, const Options& o);
00062     void limit(const Statistics& s, unsigned long int l);
00064     void update(const Search::Statistics& s);
00066     bool enginestopped(void) const;
00068     Statistics metastatistics(void) const;
00069   };
00070 
00072   class GECODE_SEARCH_EXPORT RBS : public Engine {
00073   protected:
00075     Engine* e;
00077     Space* master;
00079     Space* last;
00081     Cutoff* co;
00083     RestartStop* stop;
00085     unsigned long int sslr;
00087     bool shared_info;
00089     bool complete;
00091     bool restart;
00093     bool best;
00094   public:
00096     RBS(Space* s, RestartStop* stop0, Engine* e0,
00097         const Search::Statistics& stat, const Options& o, bool best);
00099     virtual Space* next(void);
00101     virtual Statistics statistics(void) const;
00103     virtual bool stopped(void) const;
00105     virtual void constrain(const Space& b);
00107     virtual ~RBS(void);
00108   };
00109 
00110 }}}
00111 
00112 #include <gecode/search/seq/rbs.hpp>
00113 
00114 #endif
00115 
00116 // STATISTICS: search-seq