rbs.hpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Guido Tack <tack@gecode.org>
*
* Copyright:
* Guido Tack, 2012
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
namespace Gecode { namespace Search { namespace Seq {
forceinline
RestartStop::RestartStop(Stop* s)
: l(0), m_stop(s), e_stopped(false) {}
forceinline void
RestartStop::limit(const Search::Statistics& s, unsigned long int l0) {
l = l0;
m_stat += s;
e_stopped = false;
}
forceinline void
RestartStop::update(const Search::Statistics& s) {
m_stat += s;
}
forceinline bool
RestartStop::enginestopped(void) const {
return e_stopped;
}
forceinline Statistics
RestartStop::metastatistics(void) const {
return m_stat;
}
forceinline
RBS::RBS(Space* s, RestartStop* stop0,
Engine* e0, const Search::Statistics& stat, const Options& opt,
bool best0)
: e(e0), master(s), last(NULL), co(opt.cutoff), stop(stop0),
sslr(0),
complete(true), restart(false), best(best0) {
stop->limit(stat,(*co)());
}
}}}
// STATISTICS: search-seq
Gecode::Search::Engine
Search engine implementation interface
Definition search.hh:899
Gecode::Search::Options
Search engine options
Definition search.hh:746
Gecode::Search::Seq::RBS::stop
RestartStop * stop
The stop control object.
Definition rbs.hh:83
Gecode::Search::Seq::RBS::best
bool best
Whether the engine performs best solution search.
Definition rbs.hh:93
Gecode::Search::Seq::RBS::master
Space * master
The master space to restart from.
Definition rbs.hh:77
Gecode::Search::Seq::RBS::restart
bool restart
Whether a restart must be performed when next is called.
Definition rbs.hh:91
Gecode::Search::Seq::RBS::complete
bool complete
Whether search for the next solution will be complete.
Definition rbs.hh:89
Gecode::Search::Seq::RBS::e
Engine * e
The actual engine.
Definition rbs.hh:75
Gecode::Search::Seq::RBS::last
Space * last
The last solution space (possibly NULL).
Definition rbs.hh:79
Gecode::Search::Seq::RBS::sslr
unsigned long int sslr
How many solutions since the last restart.
Definition rbs.hh:85
Gecode::Search::Seq::RBS::RBS
RBS(Space *s, RestartStop *stop0, Engine *e0, const Search::Statistics &stat, const Options &o, bool best)
Constructor.
Definition rbs.hpp:65
Gecode::Search::Seq::RBS::co
Cutoff * co
The cutoff object.
Definition rbs.hh:81
Gecode::Search::Seq::RestartStop
Stop-object for restart engine
Definition rbs.hh:44
Gecode::Search::Seq::RestartStop::metastatistics
Statistics metastatistics(void) const
Return statistics for the meta engine.
Definition rbs.hpp:59
Gecode::Search::Seq::RestartStop::RestartStop
RestartStop(Stop *s)
Stop the meta engine if indicated by the stop object s.
Definition rbs.hpp:38
Gecode::Search::Seq::RestartStop::update
void update(const Search::Statistics &s)
Update statistics.
Definition rbs.hpp:49
Gecode::Search::Seq::RestartStop::limit
void limit(const Statistics &s, unsigned long int l)
Set current limit for the engine to l fails.
Definition rbs.hpp:42
Gecode::Search::Seq::RestartStop::enginestopped
bool enginestopped(void) const
Return whether the engine has been stopped.
Definition rbs.hpp:54
Gecode::Search::Statistics
Search engine statistics
Definition search.hh:147
Gecode::Search::Stop::Stop
Stop(void)
Default constructor.
Definition stop.hpp:41
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::Search::Seq
Definition pbs.cpp:36
Gecode::Search
Search engines
Gecode
Gecode toplevel namespace
forceinline
#define forceinline
Definition config.hpp:187