Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Friends
Macros
Pages
examples
greedy
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
//=======================================================================
16
#include "
paal/greedy/k_center/k_center.hpp
"
18
#include "
paal/data_structures/metric/basic_metrics.hpp
"
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;
27
paal::data_structures::array_metric<int>
m(3);
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
}
irange.hpp
paal::irange
auto irange(T begin, T end)
irange
Definition:
irange.hpp:22
basic_metrics.hpp
paal::greedy::kCenter
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
paal::data_structures::array_metric
this metric is rectangle_array_metric with N == M.
Definition:
basic_metrics.hpp:137
main
int main()
[K Center Example]
Definition:
k_center_example.cpp:24
k_center.hpp
Generated on Tue Jan 31 2017 00:30:50 by
1.8.5