15 #ifndef PAAL_TABU_LIST_HPP
16 #define PAAL_TABU_LIST_HPP
18 #include <boost/functional/hash.hpp>
20 #include <unordered_set>
24 namespace data_structures {
39 : m_size(size), m_forbiden_moves_set(size) {}
49 template <
typename Solution>
50 bool is_tabu(
const Solution &, Move move)
const {
51 return is_tabu(std::move(move));
60 template <
typename Solution>
void accept(
const Solution &, Move move) {
62 m_forbiden_moves_set.insert(move);
63 if (m_forbiden_moves_fifo.size() == m_size) {
64 m_forbiden_moves_set.erase(m_forbiden_moves_fifo.front());
65 m_forbiden_moves_fifo.pop_front();
67 m_forbiden_moves_fifo.push_back(std::move(move));
78 bool is_tabu(
const Move &move)
const {
79 return m_forbiden_moves_set.find(move) != m_forbiden_moves_set.end();
83 std::unordered_set<Move, boost::hash<Move>> m_forbiden_moves_set;
84 std::deque<Move> m_forbiden_moves_fifo;
95 template <
typename Solution,
typename Move>
118 std::make_pair(std::move(s), std::move(move)));
127 void accept(Solution &s,
const Move &move) {
128 base::accept(
nullptr, std::make_pair(std::move(s), std::move(move)));
135 #endif // PAAL_TABU_LIST_HPP
void accept(const Solution &, Move move)
accept member function
Computes size of TypesVector.
bool is_tabu(Solution s, Move move) const
is_tabu redirects work to base class
bool is_tabu(const Solution &, Move move) const
is tabu member function
tabu_list_remember_move(unsigned size)
tabu_list_remember_move constructor
This Tabu list remember both current solution and move It is implemented as tabu_list_remember_move<p...
This Tabu list remember some number of last moves.
void accept(Solution &s, const Move &move)
accept redirects work to base class
tabu_list_remember_solution_and_move(unsigned size)
constructor