COIN-OR::LEMON - Graph Library

Changeset 1092:dceba191c00d in lemon-main for test/tsp_test.cc


Ignore:
Timestamp:
08/09/13 11:28:17 (11 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Children:
1093:fb1c7da561ce, 1165:e0ccc1f0268f
Phase:
public
Message:

Apply unify-sources.sh to the source tree

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/tsp_test.cc

    r1037 r1092  
    33 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    5  * Copyright (C) 2003-2010
     5 * Copyright (C) 2003-2013
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
     
    4242//   check(checkMetricCost(g, constMap<Edge>(1)), "Wrong checkMetricCost()");
    4343//   check(!checkMetricCost(g, constMap<Edge>(-1)), "Wrong checkMetricCost()");
    44 //   
     44//
    4545//   FullGraph::EdgeMap<float> cost(g);
    4646//   for (NodeIt u(g); u != INVALID; ++u) {
     
    6565bool checkTour(const FullGraph &gr, const Container &p) {
    6666  FullGraph::NodeMap<bool> used(gr, false);
    67  
     67
    6868  int node_cnt = 0;
    6969  for (typename Container::const_iterator it = p.begin(); it != p.end(); ++it) {
     
    7373    ++node_cnt;
    7474  }
    75  
     75
    7676  return (node_cnt == gr.nodeNum());
    7777}
     
    8080bool checkTourPath(const FullGraph &gr, const Path<FullGraph> &p) {
    8181  FullGraph::NodeMap<bool> used(gr, false);
    82  
     82
    8383  if (!checkPath(gr, p)) return false;
    8484  if (gr.nodeNum() <= 1 && p.length() != 0) return false;
     
    182182      }
    183183    }
    184    
     184
    185185    check(alg.run() > 0, alg_name + ": Wrong total cost");
    186186
     
    196196    check(checkCost(g, path, cost, alg.tourCost()),
    197197      alg_name + ": Wrong tour cost");
    198    
     198
    199199    check(!Tolerance<double>().less(alg.tourCost(), opt2.run(alg.tourNodes())),
    200200      "2-opt improvement: Wrong total cost");
     
    203203    check(checkCost(g, opt2.tourNodes(), cost, opt2.tourCost()),
    204204      "2-opt improvement: Wrong tour cost");
    205    
     205
    206206    check(!Tolerance<double>().less(alg.tourCost(), opt2.run(path)),
    207207      "2-opt improvement: Wrong total cost");
     
    213213}
    214214
    215 // Algorithm class for Nearest Insertion 
     215// Algorithm class for Nearest Insertion
    216216template <typename CM>
    217217class NearestInsertionTsp : public InsertionTsp<CM> {
     
    224224};
    225225
    226 // Algorithm class for Farthest Insertion 
     226// Algorithm class for Farthest Insertion
    227227template <typename CM>
    228228class FarthestInsertionTsp : public InsertionTsp<CM> {
     
    235235};
    236236
    237 // Algorithm class for Cheapest Insertion 
     237// Algorithm class for Cheapest Insertion
    238238template <typename CM>
    239239class CheapestInsertionTsp : public InsertionTsp<CM> {
     
    246246};
    247247
    248 // Algorithm class for Random Insertion 
     248// Algorithm class for Random Insertion
    249249template <typename CM>
    250250class RandomInsertionTsp : public InsertionTsp<CM> {
Note: See TracChangeset for help on using the changeset viewer.