All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Pages
k_center_example.cpp
Go to the documentation of this file.
1 //=======================================================================
2 // Copyright (c) 2014 Piotr Smulewicz
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 //=======================================================================
19 #include "paal/utils/irange.hpp"
20 
21 #include <iostream>
22 #include <vector>
23 
24 int main() {
25  // sample data
26  const int parts = 2;
28  m(0, 1) = 3;
29  m(0, 2) = 4;
30  m(1, 2) = 5;
31  m(1, 0) = 3;
32  m(2, 0) = 4;
33  m(2, 1) = 5;
34  auto vertices = paal::irange(3);
35  std::vector<int> centers;
36 
37  // solution
38  std::cout << paal::greedy::kCenter(m, parts, vertices.begin(),
39  vertices.end(), back_inserter(centers))
40  << std::endl;
41 
42 }
auto irange(T begin, T end)
irange
Definition: irange.hpp:22
data_structures::metric_traits< Metric >::DistanceType kCenter(const Metric &metric, unsigned int numberOfClusters, const ItemIterator iBegin, const ItemIterator iEnd, OutputIterator result)
this is solve K Center problem and return radius example:
Definition: k_center.hpp:43
this metric is rectangle_array_metric with N == M.
int main()
[K Center Example]