All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Pages
search_traits.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_SEARCH_TRAITS_HPP
16 #define PAAL_SEARCH_TRAITS_HPP
17 
21 
22 namespace paal {
23 namespace local_search {
24 
30 template <typename search_components> struct search_components_traits {
31  typedef typename data_structures::component_traits<
32  search_components>::template type<GetMoves>::type GetMovesT;
33  typedef typename data_structures::component_traits<
34  search_components>::template type<Gain>::type GainT;
35  typedef typename data_structures::component_traits<
36  search_components>::template type<Commit>::type CommitT;
37 };
38 
45 template <typename GetMoves, typename Solution> class move_type_from_get_moves {
46  typedef typename std::remove_reference<
47  typename std::result_of<GetMoves(Solution &)>::type>::type MovesRange;
48  typedef typename boost::range_iterator<MovesRange>::type MoveIterator;
49 
50  public:
51  typedef typename std::iterator_traits<MoveIterator>::value_type value_type;
52  typedef typename std::iterator_traits<MoveIterator>::reference reference;
53 };
54 
61 template <typename SearchComponents, typename Solution>
63  typename search_components_traits<SearchComponents>::GetMovesT, Solution> {
64 };
65 
72 template <typename Gain, typename GetMoves, typename Solution>
74  typedef typename move_type_from_get_moves<GetMoves, Solution>::value_type
75  Move;
76 
77  public:
79 };
80 
87 template <typename SearchComponents, typename Solution>
89  typename search_components_traits<SearchComponents>::GainT,
90  typename search_components_traits<SearchComponents>::GetMovesT, Solution>::type;
91 
92 }
93 }
94 #endif // PAAL_SEARCH_TRAITS_HPP
typename fitness_from_gain_and_get_moves< typename search_components_traits< SearchComponents >::GainT, typename search_components_traits< SearchComponents >::GetMovesT, Solution >::type fitness_t
metafunction returns Fitness type in single_solution case
typename components::type< Args...> search_components
search_components template alias
metafunction returns move type in single_solution case
Traits class for search_components.
metafunction returns Fitness type in single_solution case
bool local_search(Solution &solution, SearchStrategy searchStrategy, ContinueOnSuccess succ, ContinueOnFail fail, components...comps)
detail
typename std::decay< typename std::result_of< F >::type >::type pure_result_of_t
return pure type of function (decays const and reference)
metafunction returns move type in single_solution case