16 #ifndef PAAL_2_LOCAL_SEARCH_HPP
17 #define PAAL_2_LOCAL_SEARCH_HPP
51 template <
typename... Args>
53 Gain, data_structures::NameWithDefault<GetMoves, two_local_searchget_moves>,
54 data_structures::NameWithDefault<Commit, two_local_search_commit>>::type<
68 template <
typename Gain,
typename GetMoves = two_local_searchget_moves>
70 return TwoLocalcomponents<Gain, GetMoves>(std::move(ch), std::move(gm));
79 template <
typename Metric>
101 template <
typename SearchStrategy,
typename ContinueOnSuccess,
102 typename ContinueOnFail,
typename Cycle,
typename...
components>
104 ContinueOnSuccess on_success, ContinueOnFail on_fail,
107 CSFLCh cycleSFLCh(cycle);
109 cycleAdapted(cycleSFLCh);
110 return local_search(cycleAdapted, std::move(searchStrategy),
111 std::move(on_success), std::move(on_fail),
112 std::move(comps)...);
125 template <
typename Cycle,
typename...
components>
129 std::move(comps)...);
135 #endif // PAAL_2_LOCAL_SEARCH_HPP
bool two_local_search(Cycle &cycle, SearchStrategy searchStrategy, ContinueOnSuccess on_success, ContinueOnFail on_fail, components...comps)
local search for two - opt in tsp adapts tsp to local_search_multi_solution
adapts cycle to have begin and end pointing to edge collection
data_structures::components< GetMoves, Gain, Commit > components
Definition for the components class for local search usually this class is not directly used...
data_structures::components< Gain, data_structures::NameWithDefault< GetMoves, two_local_searchget_moves >, data_structures::NameWithDefault< Commit, two_local_search_commit >>::type< Args...> TwoLocalcomponents
represents step of 2 local search in multi solution where Solution is Cycle, SolutionElement is pair ...
auto get_default_two_local_components(const Metric &m)
get default two local search components
bool local_search(Solution &solution, SearchStrategy searchStrategy, ContinueOnSuccess succ, ContinueOnFail fail, components...comps)
detail
adopts any cycle to start (vbegin) i place of the last change(flip)
This strategy uses find_positive_predicate as stop condition.
auto make_two_local_search_components(Gain ch, GetMoves gm=GetMoves{})
make template function for TwoLocalcomponents, just to avoid providing type names in template...
bool tsp_first_improving(Cycle &cycle, components...comps)
simple version of two_local_search