dignea  1.0.0
Diverse Instance Generator with Novelty Search and Evolutionary Algorithms
TSPInstance.h
Go to the documentation of this file.
1 
15 #ifndef DIGNEA_ITSPSOLUTION_H
16 #define DIGNEA_ITSPSOLUTION_H
17 
19 
20 #include <utility>
21 
22 using coords = std::pair<float, float>;
23 
33 class TSPInstance : public AbstractInstance<float, float> {
34  public:
36  TSPInstance();
37 
43  explicit TSPInstance(const int &nVars, const int &nObjs = 1);
44 
48  TSPInstance(const TSPInstance &solution);
49 
53  explicit TSPInstance(const TSPInstance *solution);
54 
57  TSPInstance(unique_ptr<TSPInstance> &ptr) = delete;
58 
59  virtual ~TSPInstance() = default;
60 
63  void setVariables(const vector<float> &vars) override;
64 
68  json to_json() const override;
69 
73  virtual void to_instance(std::ostream &os) const;
74 
78  vector<coords> to_coords() const;
79 };
80 
81 #endif
Solution for a Instance Generation Problem used in the EIG. This is a solution for AbstractDomain.
Definition: AbstractInstance.h:30
int nVars
Definition: Solution.h:194
int nObjs
Definition: Solution.h:195
Instance Traveling Salesman Problem Solution. Class which represents the solution for the Instance Tr...
Definition: TSPInstance.h:33
vector< coords > to_coords() const
Generates the vector of coordinates for the instance. Look the TSP getPoints() method.
Definition: TSPInstance.cpp:71
TSPInstance()
Creates a default TSPInstance.
Definition: TSPInstance.cpp:25
json to_json() const override
Creates and returns a JSON object with the information from the TSP.
Definition: TSPInstance.cpp:84
void setVariables(const vector< float > &vars) override
Set the variables for the instance.
Definition: TSPInstance.cpp:56
virtual void to_instance(std::ostream &os) const
Generates the instance representation of the TSP and puts it in the ostream.
Definition: TSPInstance.cpp:116
TSPInstance(unique_ptr< TSPInstance > &ptr)=delete
Cannot be used in the AbstractInstance.