15 #ifndef PAAL_FACILITY_LOCATION_SWAP_HPP
16 #define PAAL_FACILITY_LOCATION_SWAP_HPP
22 #include <boost/iterator/iterator_adaptor.hpp>
23 #include <boost/iterator/transform_iterator.hpp>
38 template <
typename T>
class Swap {
46 Swap(T from, T to) : m_from(from), m_to(to) {}
106 template <
class Solution,
class VertexType>
109 auto ret = sol.add_facility_tentative(s.get_to());
110 ret += sol.remove_facility_tentative(s.get_from());
111 auto back = sol.add_facility_tentative(s.get_from());
112 back += sol.remove_facility_tentative(s.get_to());
113 assert(ret == -back);
129 template <
typename Solution,
typename VertexType>
131 sol.add_facility(s.get_to());
132 sol.remove_facility(s.get_from());
143 template <
typename Solution>
146 make_swap{}, s.getChosenCopy(), s.getUnchosenCopy());
148 return boost::make_iterator_range(begin, end);
155 #endif // PAAL_FACILITY_LOCATION_SWAP_HPP
void set_to(T to)
from setter
gain functor for swap in facility location problem.
Swap< T > operator()(T from, T to) const
operator()
auto operator()(const Solution &s) const
operator()
T get_from() const
from getter
T get_to() const
to getter
void set_from(T from)
form setter
commit functor for facility location problem
bool operator()(Solution &sol, const Swap< VertexType > &s) const
operator()
auto operator()(Solution &sol, const Swap< VertexType > &s) const
operator()
combine_iterator< Joiner, detail::rem_ref< Ranges >...> make_combine_iterator(Joiner joiner, Ranges &&...ranges)
make for combine_iterator
bool local_search(Solution &solution, SearchStrategy searchStrategy, ContinueOnSuccess succ, ContinueOnFail fail, components...comps)
detail
get moves functor for facility location problem
Swap(T from, T to)
constructor