Project
Criterion.h
Go to the documentation of this file.
1 #ifndef CRITERION_H
2 #define CRITERION_H
3 
10 #include <iostream>
11 #include <string>
12 #include <vector>
13 
21 class Criterion {
22 public:
31  Criterion(std::string id, int direction = 1, float weight = 0.0f);
32 
38  Criterion(const Criterion &crit);
39 
40  ~Criterion();
41 
42  friend std::ostream &operator<<(std::ostream &out, const Criterion &crit);
43 
52  void generateDirection(unsigned long int seed = 0);
53 
62  void generateWeight(unsigned long int seed = 0);
63 
64  // TODO Remove getter and setter
65  // Performance wise after some profiling we found that getter and setter,
66  // especially for elementary classes can loose a lot of time compared to
67  // access directly the variable. Therefore in order to optimize the code, they
68  // should be removed.
69 
75  std::string getId() const;
76 
82  void setId(std::string id);
83 
89  int getDirection() const;
90 
96  void setDirection(int direction);
97 
103  float getWeight() const;
104 
110  void setWeight(float weight);
111 
112 private:
113  std::string id_;
114  // TODO remove direction_ attribute
115  // Originally, the direction_ attribute has a signification in the thesis of
116  // Sobrie, it informs if we should maximize or minimize the specific
117  // criterion. In the current implementation, we did not implement this
118  // feature, therefore this arguments is obesolete and should be removed during
119  // a code clean.
120  int direction_;
121  float weight_;
122 };
123 
124 #endif
Criterion datastructure.
Definition: Criterion.h:21
Criterion(std::string id, int direction=1, float weight=0.0f)
void generateDirection(unsigned long int seed=0)
float getWeight() const
void generateWeight(unsigned long int seed=0)
void setWeight(float weight)
void setId(std::string id)
int getDirection() const
Criterion(const Criterion &crit)
std::string getId() const
void setDirection(int direction)