dignea  1.0.0
Diverse Instance Generator with Novelty Search and Evolutionary Algorithms
NearestNeighbour.h
1 
2 
3 #ifndef DIGNEA_TSP_NearestNeighbour_HEURISTIC_H
4 #define DIGNEA_TSP_NearestNeighbour_HEURISTIC_H
5 
6 #include <dignea/core/Heuristic.h>
7 #include <dignea/problems/TSP.h>
8 
9 #include <nlohmann/json.hpp>
10 #include <vector>
11 
12 namespace tsp_heuristics {
13 
14 using json = nlohmann::json;
15 using namespace std;
21 class NearestNeighbour : public Heuristic<IntFloatSolution> {
22  public:
24 
25  virtual ~NearestNeighbour() = default;
26 
27  void run() override;
28 
29  string getName() const { return "NearestNeighbour TSP"; };
30 
31  string getID() const { return "NN TSP"; }
32 
33  void setProblem(shared_ptr<TSP> prob);
34 
35  void setProblem(TSP *prob);
36 
37  Front<IntFloatSolution> getResults() const override;
38 };
39 
40 } // namespace tsp_heuristics
41 #endif // DIGNEA_TSP_NearestNeighbour_HEURISTIC_H
nlohmann::json json
Definition: MinKnap.h:85
Front class which stores the final results of an EA execution.
Definition: Front.h:26
Base heuristic class. This is the skeleton for future heuristic implementations. Extends AbstractEA f...
Definition: Heuristic.h:19
Traveling Salesman Problem implemented in dignea. Uses a IntFloat representation where the solutions ...
Definition: TSP.h:35
NearestNeighbour Heuristic for the Knapsack Problem. Tries to insert each item in the knapsack while ...
Definition: NearestNeighbour.h:21
string getName() const
Returns the name of the algorithm, this is used in the to_json method. Must be implemented in the sub...
Definition: NearestNeighbour.h:29
string getID() const
Returns the identificator of the algorithm, this is used in the to_json method. Must be implemented i...
Definition: NearestNeighbour.h:31