BICO  1.0
 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 
25 
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