#include #include #include #include "muscles/rgreedy.h" #include "tsp/problem.h" #include "tsp/solution.h" #include "tsp/tsp.h" auto mainGreedy(tsp::Problem const& problem, std::size_t start) { std::mt19937 rng; auto greedy = RGreedy{0}; return greedy(problem, rng, start); } int main(int argc, char **argv) { tsp::Tsp tspData{"../data/phd"}; tsp::Problem const& problem = tspData.points(); tsp::Solution solution; std::size_t start = 0; if(argc > 1) { std::istringstream iss{argv[1]}; iss >> start; } solution = mainGreedy(problem, start); std::cout << "distance: " << solution.value() << std::endl; // save { std::ofstream ofs{"solution"}; ofs << solution; } { std::ofstream ofs{"solution.ids"}; solution.printIndices(ofs); } }