diff -r 9eac00ea588f -r dceba191c00d test/tsp_test.cc --- a/test/tsp_test.cc Fri Aug 09 14:07:27 2013 +0200 +++ b/test/tsp_test.cc Fri Aug 09 11:28:17 2013 +0200 @@ -2,7 +2,7 @@ * * This file is a part of LEMON, a generic C++ optimization library. * - * Copyright (C) 2003-2010 + * Copyright (C) 2003-2013 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport * (Egervary Research Group on Combinatorial Optimization, EGRES). * @@ -41,7 +41,7 @@ // check(checkMetricCost(g, constMap(0)), "Wrong checkMetricCost()"); // check(checkMetricCost(g, constMap(1)), "Wrong checkMetricCost()"); // check(!checkMetricCost(g, constMap(-1)), "Wrong checkMetricCost()"); -// +// // FullGraph::EdgeMap cost(g); // for (NodeIt u(g); u != INVALID; ++u) { // for (NodeIt v(g); v != INVALID; ++v) { @@ -64,7 +64,7 @@ template bool checkTour(const FullGraph &gr, const Container &p) { FullGraph::NodeMap used(gr, false); - + int node_cnt = 0; for (typename Container::const_iterator it = p.begin(); it != p.end(); ++it) { FullGraph::Node node = *it; @@ -72,14 +72,14 @@ used[node] = true; ++node_cnt; } - + return (node_cnt == gr.nodeNum()); } // Checks tour validity bool checkTourPath(const FullGraph &gr, const Path &p) { FullGraph::NodeMap used(gr, false); - + if (!checkPath(gr, p)) return false; if (gr.nodeNum() <= 1 && p.length() != 0) return false; if (gr.nodeNum() > 1 && p.length() != gr.nodeNum()) return false; @@ -181,7 +181,7 @@ cost[g.edge(u, v)] = (pos[u] - pos[v]).normSquare(); } } - + check(alg.run() > 0, alg_name + ": Wrong total cost"); std::vector vec; @@ -195,14 +195,14 @@ check(checkTourPath(g, path), alg_name + ": Wrong tour"); check(checkCost(g, path, cost, alg.tourCost()), alg_name + ": Wrong tour cost"); - + check(!Tolerance().less(alg.tourCost(), opt2.run(alg.tourNodes())), "2-opt improvement: Wrong total cost"); check(checkTour(g, opt2.tourNodes()), "2-opt improvement: Wrong node sequence"); check(checkCost(g, opt2.tourNodes(), cost, opt2.tourCost()), "2-opt improvement: Wrong tour cost"); - + check(!Tolerance().less(alg.tourCost(), opt2.run(path)), "2-opt improvement: Wrong total cost"); check(checkTour(g, opt2.tourNodes()), @@ -212,7 +212,7 @@ } } -// Algorithm class for Nearest Insertion +// Algorithm class for Nearest Insertion template class NearestInsertionTsp : public InsertionTsp { public: @@ -223,7 +223,7 @@ } }; -// Algorithm class for Farthest Insertion +// Algorithm class for Farthest Insertion template class FarthestInsertionTsp : public InsertionTsp { public: @@ -234,7 +234,7 @@ } }; -// Algorithm class for Cheapest Insertion +// Algorithm class for Cheapest Insertion template class CheapestInsertionTsp : public InsertionTsp { public: @@ -245,7 +245,7 @@ } }; -// Algorithm class for Random Insertion +// Algorithm class for Random Insertion template class RandomInsertionTsp : public InsertionTsp { public: