3 #ifndef DIGNEA_TSP_TwoOpt_HEURISTIC_H
4 #define DIGNEA_TSP_TwoOpt_HEURISTIC_H
6 #include <dignea/core/Heuristic.h>
9 #include <nlohmann/json.hpp>
12 namespace tsp_heuristics {
23 TwoOpt(
const bool randomInit =
true);
25 virtual ~
TwoOpt() =
default;
30 return randomInitialisation ?
"TwoOpt TSP" :
"NN-TwoOpt TSP";
34 return randomInitialisation ?
"TwoOpt TSP" :
"NN-TwoOpt TSP";
37 void setProblem(shared_ptr<TSP> prob);
39 void setProblem(
TSP* prob);
44 vector<int> performSwap(
const int& i,
const int& k,
45 const vector<int>& tour);
47 float calculateLength(
const vector<int>& tour,
const TSP* problem);
50 bool randomInitialisation;
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
TwoOpt Heuristic for the Knapsack Problem. Tries to insert each item in the knapsack while there is r...
Definition: TwoOpt.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: TwoOpt.h:29
string getID() const
Returns the identificator of the algorithm, this is used in the to_json method. Must be implemented i...
Definition: TwoOpt.h:33