All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Pages
k_median_solution.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_K_MEDIAN_SOLUTION_HPP
16 #define PAAL_K_MEDIAN_SOLUTION_HPP
17 
18 #include "paal/utils/functors.hpp"
20 
21 namespace paal {
22 namespace data_structures {
23 
29 template <typename voronoiType>
31  utils::return_zero_functor, voronoiType> {
33  utils::return_zero_functor, voronoiType> base;
34 
35  public:
44  typename base::UnchosenFacilitiesSet uf, int k)
45  : base(std::move(voronoi), std::move(uf), m_zero_func) {
46  assert(int(base::get_chosen_facilities().size()) == k);
47  }
48 
49  private:
50  utils::return_zero_functor m_zero_func;
51 };
52 
53 } // data_structures
54 
55 namespace data_structures {
61 template <typename voronoi>
63  data_structures::k_median_solution<voronoi>> {
66 
67  public:
68  typedef typename VT::VertexType VertexType;
69  typedef typename VT::DistanceType Dist;
70  typedef typename VT::GeneratorsSet ChosenFacilitiesSet;
72  typedef puretype(std::declval<KMS>().get_unchosen_facilities())
73  UnchosenFacilitiesSet;
74 };
75 }
76 
77 } // paal
78 
79 #endif // PAAL_K_MEDIAN_SOLUTION_HPP
default VertexType is int.
k_median_solution(voronoiType voronoi, typename base::UnchosenFacilitiesSet uf, int k)
constructor
Computes size of TypesVector.
describes solution to facility location The initial solution is passed as voronoi, which has to be the model of the Voronoi concept. The generators of the voronoi are the facilities and the vertices are the clients.
#define puretype(t)
for given expression returns its type with removed const and reference
This file contains set of simple useful functors or functor adapters.
simple implementation of the Voronoi concept.
Definition: voronoi.hpp:42
const ChosenFacilitiesSet & get_chosen_facilities() const
setter for unchosen facilities