1 #ifndef DOUBLESOLUTION_H
2 #define DOUBLESOLUTION_H
4 #include "../base/solutionprovider.h"
5 #include "../base/proxyprovider.h"
6 #include "../base/partitionprovider.h"
36 virtual T
proxy(
unsigned int n,
unsigned int c)
const;
37 virtual std::vector<T>
proxies(
unsigned int n)
const;
39 virtual unsigned int clustersize(
unsigned int,
unsigned int)
const;
40 virtual T*
element(
unsigned int,
unsigned int,
unsigned int)
const;
41 virtual std::vector<T*>
cluster(
unsigned int,
unsigned int)
const;
42 virtual std::vector<std::vector<T*> >
clustering(
unsigned int)
const;
60 unsigned int proxynum = this->proxysets.size();
61 unsigned int partitionnum = this->partitions.size();
62 return proxynum<partitionnum?proxynum:partitionnum;
67 if (i<this->number_of_solutions())
69 unsigned int proxysize = this->proxysets[i].size();
70 unsigned int partitionsize = this->partitions[i].size();
71 return proxysize<partitionsize?proxysize:partitionsize;
78 if (n<this->proxysets.size())
79 if (c<this->proxysets[n].size())
80 return this->proxysets[n][c];
82 std::cerr <<
"DoubleSolution<T>::proxy(" << n <<
"," << c <<
"): requested proxy not available"
84 throw "ILLEGAL STATE";
89 if (n<this->proxysets.size())
90 return this->proxysets[n];
91 return std::vector<T>();
96 if (g<this->partitions.size())
97 if (c<this->partitions[g].size())
98 return this->partitions[g][c].size();
104 if (g<this->partitions.size())
105 if (c<this->partitions[g].size())
106 if (n<this->partitions[g][c].size())
107 return this->partitions[g][c][n];
113 if (g<this->partitions.size())
114 if (c<this->partitions[g].size())
115 return this->partitions[g][c];
116 return std::vector<T*>();
121 if (g<this->partitions.size())
122 return this->partitions[g];
123 return std::vector<std::vector<T*> >();
Data structure for partitions and proxies.
Abstract base class to access results of proxy / center based clustering algorithms.
virtual std::vector< std::vector< T * > > clustering(unsigned int) const
Returns the specified clustering as a vector of vector of pointers to the elements.
virtual unsigned int number_of_solutions() const
returns the number of available solutions
virtual double computationtime() const
returns the time needed for the last computation
virtual T proxy(unsigned int n, unsigned int c) const
returns the proxy for the specified clustering and cluster
virtual unsigned int size_of_solution(unsigned int) const
returns the size of a particular solution
virtual std::vector< T > proxies(unsigned int n) const
returns the proxies for the specified clustering
virtual std::vector< T * > cluster(unsigned int, unsigned int) const
Returns a vector of pointers to the elements of a particular cluster from the specified clustering...
virtual T * element(unsigned int, unsigned int, unsigned int) const
Returns a pointer to a particular element from the specified cluster and clustering.
Abstract base class to access results of partition based clustering algorithms.
virtual ~DoubleSolution()
std::vector< std::vector< T > > proxysets
virtual unsigned int clustersize(unsigned int, unsigned int) const
Returns the cardinality of the specified cluster from the computed clustering.
std::vector< std::vector< std::vector< T * > > > partitions
Abstract base class for algorithm solutions.