BICO 1.1

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

- File List
- File Members

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