All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Pages
n_queens_local_search.hpp
Go to the documentation of this file.
1 //=======================================================================
2 // Copyright (c) 2013 Piotr Wygocki
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //=======================================================================
15 #ifndef PAAL_N_QUEENS_LOCAL_SEARCH_HPP
16 #define PAAL_N_QUEENS_LOCAL_SEARCH_HPP
17 
18 #define BOOST_RESULT_OF_USE_DECLTYPE
19 
24 
25 namespace paal {
26 namespace local_search {
27 
33 template <typename... Args>
34 using n_queens_local_search_components = data_structures::components<
35  data_structures::NameWithDefault<GetMoves, n_queensget_moves>,
36  data_structures::NameWithDefault<Gain, n_queens_gain>,
38 
55 template <typename SearchStrategy, typename ContinueOnSuccess,
56  typename ContinueOnFail, typename NQueensPositionsVector,
57  typename... components>
58 bool n_queens_solution_local_search(NQueensPositionsVector &pos,
59  SearchStrategy searchStrategy,
60  ContinueOnSuccess on_success,
61  ContinueOnFail on_fail,
62  components... nQueenscomponents) {
64  return local_search(nqueens, std::move(searchStrategy),
65  std::move(on_success), std::move(on_fail),
66  std::move(nQueenscomponents)...);
67 }
68 
77 template <typename NQueensPositionsVector, typename... components>
78 void n_queens_solution_first_improving(NQueensPositionsVector &pos,
79  components... nQueenscomponents) {
82  std::move(nQueenscomponents)...);
83 }
84 
85 }
86 } // !paal
87 
88 #endif // PAAL_N_QUEENS_LOCAL_SEARCH_HPP
functor return false
Definition: functors.hpp:222
data_structures::components< GetMoves, Gain, Commit > components
Definition for the components class for local search usually this class is not directly used...
Adapts vector representing n queen problem to class able to efficiently compute gain of given move...
bool n_queens_solution_local_search(NQueensPositionsVector &pos, SearchStrategy searchStrategy, ContinueOnSuccess on_success, ContinueOnFail on_fail, components...nQueenscomponents)
n queen local search
This structure can be passed on Names list and represents Name and the default type value...
Definition: components.hpp:33
void n_queens_solution_first_improving(NQueensPositionsVector &pos, components...nQueenscomponents)
n queen local search (simple version)
data_structures::components< data_structures::NameWithDefault< GetMoves, n_queensget_moves >, data_structures::NameWithDefault< Gain, n_queens_gain >, data_structures::NameWithDefault< Commit, n_queens_commit >>::type< Args...> n_queens_local_search_components
NQueen Compoenents.
bool local_search(Solution &solution, SearchStrategy searchStrategy, ContinueOnSuccess succ, ContinueOnFail fail, components...comps)
detail
This strategy uses find_positive_predicate as stop condition.
functor return true
Definition: functors.hpp:227