All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Pages
facility_location_remove.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_FACILITY_LOCATION_REMOVE_HPP
16 #define PAAL_FACILITY_LOCATION_REMOVE_HPP
17 
20 
21 #include <boost/iterator/iterator_adaptor.hpp>
22 #include <boost/iterator/transform_iterator.hpp>
23 
24 #include <cassert>
25 #include <vector>
26 #include <numeric>
27 #include <cstdlib>
28 
29 namespace paal {
30 namespace local_search {
31 
46  template <typename Solution, typename ChosenElement>
47  auto operator()(Solution &s, ChosenElement e) {
48  auto ret = s.remove_facility_tentative(e);
49  // TODO for capacitated version we should just restart copy
50  auto back = s.add_facility_tentative(e);
51  assert(ret == -back);
52  return -ret;
53  }
54 };
55 
68  template <typename Solution, typename ChosenElement>
69  bool operator()(Solution &s, ChosenElement e) {
70  s.remove_facility(e);
71  return true;
72  }
73 };
74 
87  template <typename Solution>
88  auto operator()(const Solution &sol) {
89  return sol.getChosenCopy();
90  }
91 };
92 
93 } // local_search
94 } // paal
95 
96 #endif // PAAL_FACILITY_LOCATION_REMOVE_HPP
get moves functor for facility location remove
auto operator()(Solution &s, ChosenElement e)
operator()
bool local_search(Solution &solution, SearchStrategy searchStrategy, ContinueOnSuccess succ, ContinueOnFail fail, components...comps)
detail
bool operator()(Solution &s, ChosenElement e)
operator()