#ifndef LEMON_INSERTION_TSP_H #define LEMON_INSERTION_TSP_H #include #include #include #include #include namespace lemon { namespace insertion_tsp_helper { template L vectorConvert(const std::vector &_path) { return L(_path.begin(), _path.end()); }; template <> std::vector vectorConvert( const std::vector &_path) { return _path; }; }; template class InsertionTsp { private: GRAPH_TYPEDEFS(FullGraph); public: typedef CM CostMap; typedef typename CM::Value Cost; InsertionTsp(const FullGraph &gr, const CostMap &cost) : _gr(gr), _cost(cost) {} enum InsertionMethod { INSERT_NEAREST, INSERT_FARTHEST, INSERT_CHEAPEST, INSERT_RANDOM }; Cost run(InsertionMethod method = INSERT_FARTHEST) { switch (method) { case INSERT_NEAREST: start, NearestSelection, DefaultInsert>(); break; case INSERT_FARTHEST: start, FarthestSelection, DefaultInsert>(); break; case INSERT_CHEAPEST: start, CheapestSelection, CheapestInsert>(); break; case INSERT_RANDOM: start, RandomSelection, DefaultInsert>(); break; } return sum; } template void tourNodes(L &container) { container(insertion_tsp_helper::vectorConvert(nodesPath)); } template