15 #ifndef PAAL_FL_ALGO_HPP
16 #define PAAL_FL_ALGO_HPP
24 namespace simple_algo {
38 template <
typename Metric,
typename FCosts,
typename FLSolution>
39 typename data_structures::metric_traits<Metric>::DistanceType
40 get_cfl_cost(
const Metric &m,
const FCosts &fcosts,
const FLSolution &fls) {
41 auto const &ch = fls.get_chosen_facilities();
43 typedef data_structures::metric_traits<Metric> MT;
44 typedef typename MT::DistanceType Dist;
49 for (
auto && f : ch) {
50 for (
auto && v : fls.get_clients_for_facility(f)) {
51 d += m(v.first, f) * v.second;
70 template <
typename Metric,
typename FCosts,
typename FLSolution>
71 typename data_structures::metric_traits<Metric>::DistanceType
72 get_fl_cost(
const Metric &m,
const FCosts &fcosts,
const FLSolution &fls) {
73 auto const &ch = fls.get_chosen_facilities();
75 typedef data_structures::metric_traits<Metric> MT;
76 typedef typename MT::DistanceType Dist;
81 for (
auto && f : ch) {
82 for (
auto && v : fls.get_clients_for_facility(f)) {
100 template <
typename Metric,
typename FLSolution>
101 typename data_structures::metric_traits<Metric>::DistanceType
102 get_km_cost(
const Metric &m,
const FLSolution &fls) {
104 return paal::simple_algo::get_fl_cost(std::move(m), m_zero_func,
110 #endif // PAAL_FL_ALGO_HPP
This file contains set of simple useful functors or functor adapters.
T accumulate_functor(const Range &rng, T init, Functor f, BinaryOperation bin_op=BinaryOperation{})
combination of boost::accumulate and boost::adaptors::transformed