COIN-OR::LEMON - Graph Library

Changeset 1092:dceba191c00d in lemon-main for lemon/christofides_tsp.h


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
  • lemon/christofides_tsp.h

    r1074 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).
     
    3131
    3232namespace lemon {
    33  
     33
    3434  /// \ingroup tsp
    3535  ///
     
    109109          return _sum = 2 * _cost[_gr.edge(_gr(0), _gr(1))];
    110110        }
    111        
     111
    112112        // Compute min. cost spanning tree
    113113        std::vector<Edge> tree;
    114114        kruskal(_gr, _cost, std::back_inserter(tree));
    115        
     115
    116116        FullGraph::NodeMap<int> deg(_gr, 0);
    117117        for (int i = 0; i != int(tree.size()); ++i) {
     
    126126          if (deg[u] % 2 == 1) odd_nodes.push_back(u);
    127127        }
    128  
     128
    129129        SmartGraph sgr;
    130130        SmartGraph::EdgeMap<Cost> scost(sgr);
     
    140140          }
    141141        }
    142        
     142
    143143        // Compute min. cost perfect matching
    144144        MaxWeightedPerfectMatching<SmartGraph, SmartGraph::EdgeMap<Cost> >
    145145          mwpm(sgr, scost);
    146146        mwpm.run();
    147        
     147
    148148        for (SmartGraph::EdgeIt e(sgr); e != INVALID; ++e) {
    149149          if (mwpm.matching(e)) {
     
    152152          }
    153153        }
    154        
    155         // Join the spanning tree and the matching       
     154
     155        // Join the spanning tree and the matching
    156156        sgr.clear();
    157157        for (int i = 0; i != _gr.nodeNum(); ++i) {
     
    183183
    184184      /// @}
    185      
     185
    186186      /// \name Query Functions
    187187      /// @{
    188      
     188
    189189      /// \brief The total cost of the found tour.
    190190      ///
     
    195195        return _sum;
    196196      }
    197      
     197
    198198      /// \brief Returns a const reference to the node sequence of the
    199199      /// found tour.
     
    228228        std::copy(_path.begin(), _path.end(), out);
    229229      }
    230      
     230
    231231      /// \brief Gives back the found tour as a path.
    232232      ///
     
    245245        }
    246246      }
    247      
     247
    248248      /// @}
    249      
     249
    250250  };
    251251
Note: See TracChangeset for help on using the changeset viewer.