BICO 1.1

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Pages
proxysolution.h
Go to the documentation of this file.
1 #ifndef PROXYSOLUTION_H
2 #define PROXYSOLUTION_H
3
4 #include "../base/solutionprovider.h"
5 #include "../base/proxyprovider.h"
6
7 #include <vector>
8
9 namespace CluE
10 {
11
19 template<typename T> struct ProxySolution : public SolutionProvider, public ProxyProvider<T>
20 {
21 public:
22
23 ProxySolution();
24
25 virtual ~ProxySolution()
26 {
27 }
28
29 virtual double computationtime() const;
30 virtual unsigned int number_of_solutions() const;
31 virtual unsigned int size_of_solution(unsigned int) const;
32
33 virtual T proxy(unsigned int n, unsigned int c) const;
34 virtual std::vector<T> proxies(unsigned int n) const;
35
36 double seconds;
37 std::vector<std::vector<T>> proxysets;
38 };
39
40 template<typename T> ProxySolution<T>::ProxySolution() : seconds()
41 {
42 }
43
44 template<typename T> double ProxySolution<T>::computationtime() const
45 {
46 return seconds;
47 }
48
49 template<typename T> unsigned int ProxySolution<T>::number_of_solutions() const
50 {
51 return this->proxysets.size();
52 }
53
54 template<typename T> unsigned int ProxySolution<T>::size_of_solution(unsigned int i) const
55 {
56 if (i<this->proxysets.size())
57 return this->proxysets[i].size();
58 return 0;
59 }
60
61 template<typename T> T ProxySolution<T>::proxy(unsigned int n, unsigned int c) const
62 {
63 if (n<this->proxysets.size())
64 if (c<this->proxysets[n].size())
65 return this->proxysets[n][c];
66
67 std::cerr << "ProxySolution<T>::proxy(" << n << "," << c << "): requested proxy not available" << std::endl;
68 throw "ILLEGAL STATE";
69 }
70
71 template<typename T> std::vector<T> ProxySolution<T>::proxies(unsigned int n) const
72 {
73 if (n<this->proxysets.size())
74 return this->proxysets[n];
75 return std::vector<T>();
76 }
77
78 }
79
80 #endif
CluE::ProxyProvider
Abstract base class to access results of proxy / center based clustering algorithms.
Definition: proxyprovider.h:14
CluE::ProxySolution::proxysets
std::vector< std::vector< T > > proxysets
Definition: proxysolution.h:37
CluE::ProxySolution::ProxySolution
ProxySolution()
Definition: proxysolution.h:40
CluE::ProxySolution::proxies
virtual std::vector< T > proxies(unsigned int n) const
returns the proxies for the specified clustering
Definition: proxysolution.h:71
CluE::ProxySolution::proxy
virtual T proxy(unsigned int n, unsigned int c) const
returns the proxy for the specified clustering and cluster
Definition: proxysolution.h:61
CluE::ProxySolution::computationtime
virtual double computationtime() const
returns the time needed for the last computation
Definition: proxysolution.h:44
CluE::ProxySolution::seconds
double seconds
Definition: proxysolution.h:36
CluE::ProxySolution::number_of_solutions
virtual unsigned int number_of_solutions() const
returns the number of available solutions
Definition: proxysolution.h:49
CluE::ProxySolution
Data structure for proxies.
Definition: proxysolution.h:19
CluE::ProxySolution::~ProxySolution
virtual ~ProxySolution()
Definition: proxysolution.h:25
CluE::ProxySolution::size_of_solution
virtual unsigned int size_of_solution(unsigned int) const
returns the size of a particular solution
Definition: proxysolution.h:54
CluE::SolutionProvider
Abstract base class for algorithm solutions.
Definition: solutionprovider.h:16