Changeset 1092:dceba191c00d in lemon-main
- Timestamp:
- 08/09/13 11:28:17 (11 years ago)
- Branch:
- default
- Children:
- 1093:fb1c7da561ce, 1165:e0ccc1f0268f
- Phase:
- public
- Files:
-
- 130 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/coding_style.dox
r919 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
doc/dirs.dox
r925 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
doc/groups.dox
r1080 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 430 430 data are required to be integer). 431 431 432 For more details about these implementations and for a comprehensive 432 For more details about these implementations and for a comprehensive 433 433 experimental study, see the paper \cite KiralyKovacs12MCF. 434 434 It also compares these codes to other publicly available … … 571 571 \image latex planar.eps "Plane graph" width=\textwidth 572 572 */ 573 573 574 574 /** 575 575 @defgroup tsp Traveling Salesman Problem -
doc/lgf.dox
r1074 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
doc/min_cost_flow.dox
r1053 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/adaptors.h
r998 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/assert.h
r1072 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/base.cc
r1054 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/bellman_ford.h
r1080 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/bfs.h
r1074 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/bin_heap.h
r711 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/bits/alteration_notifier.h
r979 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/bits/array_map.h
r877 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/bits/bezier.h
r997 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/bits/default_map.h
r877 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/bits/edge_set_extender.h
r1000 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/bits/graph_adaptor_extender.h
r882 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/bits/graph_extender.h
r1027 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 844 844 845 845 typedef AlterationNotifier<BpGraphExtender, Node> NodeNotifier; 846 typedef AlterationNotifier<BpGraphExtender, RedNode> RedNodeNotifier; 846 typedef AlterationNotifier<BpGraphExtender, RedNode> RedNodeNotifier; 847 847 typedef AlterationNotifier<BpGraphExtender, BlueNode> BlueNodeNotifier; 848 848 typedef AlterationNotifier<BpGraphExtender, Arc> ArcNotifier; -
lemon/bits/lock.h
r979 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 25 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 34 34 public: 35 35 Lock() { 36 36 pthread_mutex_init(&_lock, 0); 37 37 } 38 38 ~Lock() { 39 39 pthread_mutex_destroy(&_lock); 40 40 } 41 41 void lock() { 42 42 pthread_mutex_lock(&_lock); 43 43 } 44 44 void unlock() { 45 45 pthread_mutex_unlock(&_lock); 46 46 } 47 47 … … 58 58 void lock() {} 59 59 void unlock() {} 60 }; 60 }; 61 61 #endif 62 62 } -
lemon/bits/map_extender.h
r802 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/bits/path_dump.h
r887 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/bits/solver_bits.h
r989 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/bits/traits.h
r1026 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/bits/windows.cc
r1001 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 141 141 #endif 142 142 } 143 143 144 144 WinLock::~WinLock() { 145 145 #ifdef WIN32 -
lemon/bits/windows.h
r979 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/capacity_scaling.h
r1080 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 839 839 return OPTIMAL; 840 840 } 841 841 842 842 // Check if the upper bound is greater or equal to the lower bound 843 843 // on each arc. -
lemon/cbc.cc
r1000 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/cbc.h
r1064 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/christofides_tsp.h
r1074 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 31 31 32 32 namespace lemon { 33 33 34 34 /// \ingroup tsp 35 35 /// … … 109 109 return _sum = 2 * _cost[_gr.edge(_gr(0), _gr(1))]; 110 110 } 111 111 112 112 // Compute min. cost spanning tree 113 113 std::vector<Edge> tree; 114 114 kruskal(_gr, _cost, std::back_inserter(tree)); 115 115 116 116 FullGraph::NodeMap<int> deg(_gr, 0); 117 117 for (int i = 0; i != int(tree.size()); ++i) { … … 126 126 if (deg[u] % 2 == 1) odd_nodes.push_back(u); 127 127 } 128 128 129 129 SmartGraph sgr; 130 130 SmartGraph::EdgeMap<Cost> scost(sgr); … … 140 140 } 141 141 } 142 142 143 143 // Compute min. cost perfect matching 144 144 MaxWeightedPerfectMatching<SmartGraph, SmartGraph::EdgeMap<Cost> > 145 145 mwpm(sgr, scost); 146 146 mwpm.run(); 147 147 148 148 for (SmartGraph::EdgeIt e(sgr); e != INVALID; ++e) { 149 149 if (mwpm.matching(e)) { … … 152 152 } 153 153 } 154 155 // Join the spanning tree and the matching 154 155 // Join the spanning tree and the matching 156 156 sgr.clear(); 157 157 for (int i = 0; i != _gr.nodeNum(); ++i) { … … 183 183 184 184 /// @} 185 185 186 186 /// \name Query Functions 187 187 /// @{ 188 188 189 189 /// \brief The total cost of the found tour. 190 190 /// … … 195 195 return _sum; 196 196 } 197 197 198 198 /// \brief Returns a const reference to the node sequence of the 199 199 /// found tour. … … 228 228 std::copy(_path.begin(), _path.end(), out); 229 229 } 230 230 231 231 /// \brief Gives back the found tour as a path. 232 232 /// … … 245 245 } 246 246 } 247 247 248 248 /// @} 249 249 250 250 }; 251 251 -
lemon/circulation.h
r1074 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/clp.cc
r989 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/clp.h
r877 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/concept_check.h
r1083 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/concepts/bpgraph.h
r1087 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 805 805 806 806 /// \brief Gives back the red end node of the edge. 807 /// 807 /// 808 808 /// Gives back the red end node of the edge. 809 809 RedNode redNode(const Edge&) const { return RedNode(); } 810 810 811 811 /// \brief Gives back the blue end node of the edge. 812 /// 812 /// 813 813 /// Gives back the blue end node of the edge. 814 814 BlueNode blueNode(const Edge&) const { return BlueNode(); } -
lemon/concepts/digraph.h
r1086 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/concepts/graph.h
r1086 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/concepts/graph_components.h
r1087 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 392 392 393 393 /// \brief Gives back the red end node of the edge. 394 /// 394 /// 395 395 /// Gives back the red end node of the edge. 396 396 RedNode redNode(const Edge&) const { return RedNode(); } 397 397 398 398 /// \brief Gives back the blue end node of the edge. 399 /// 399 /// 400 400 /// Gives back the blue end node of the edge. 401 401 BlueNode blueNode(const Edge&) const { return BlueNode(); } … … 1151 1151 typedef typename Base::Arc Arc; 1152 1152 typedef typename Base::Edge Edge; 1153 1153 1154 1154 typedef IterableBpGraphComponent BpGraph; 1155 1155 … … 1211 1211 typename _BpGraph::RedNode rn(INVALID); 1212 1212 bpgraph.first(rn); 1213 bpgraph.next(rn); 1213 bpgraph.next(rn); 1214 1214 typename _BpGraph::BlueNode bn(INVALID); 1215 1215 bpgraph.first(bn); -
lemon/concepts/heap.h
r1084 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/concepts/maps.h
r1083 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/concepts/path.h
r1084 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/connectivity.h
r1091 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/core.h
r1086 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 255 255 256 256 namespace _graph_utils_bits { 257 257 258 258 template <typename Graph, typename Enable = void> 259 259 struct CountRedNodesSelector { … … 265 265 template <typename Graph> 266 266 struct CountRedNodesSelector< 267 Graph, typename 268 enable_if<typename Graph::NodeNumTag, void>::type> 267 Graph, typename 268 enable_if<typename Graph::NodeNumTag, void>::type> 269 269 { 270 270 static int count(const Graph &g) { 271 271 return g.redNum(); 272 272 } 273 }; 273 }; 274 274 } 275 275 … … 280 280 /// graph structures it is specialized to run in O(1). 281 281 /// 282 /// If the graph contains a \e redNum() member function and a 282 /// If the graph contains a \e redNum() member function and a 283 283 /// \e NodeNumTag tag then this function calls directly the member 284 284 /// function to query the cardinality of the node set. … … 289 289 290 290 namespace _graph_utils_bits { 291 291 292 292 template <typename Graph, typename Enable = void> 293 293 struct CountBlueNodesSelector { … … 299 299 template <typename Graph> 300 300 struct CountBlueNodesSelector< 301 Graph, typename 302 enable_if<typename Graph::NodeNumTag, void>::type> 301 Graph, typename 302 enable_if<typename Graph::NodeNumTag, void>::type> 303 303 { 304 304 static int count(const Graph &g) { 305 305 return g.blueNum(); 306 306 } 307 }; 307 }; 308 308 } 309 309 … … 314 314 /// graph structures it is specialized to run in O(1). 315 315 /// 316 /// If the graph contains a \e blueNum() member function and a 316 /// If the graph contains a \e blueNum() member function and a 317 317 /// \e NodeNumTag tag then this function calls directly the member 318 318 /// function to query the cardinality of the node set. … … 1866 1866 /// The Digraph type 1867 1867 typedef GR Digraph; 1868 1868 1869 1869 protected: 1870 1870 -
lemon/cost_scaling.h
r1080 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 905 905 return OPTIMAL; 906 906 } 907 907 908 908 // Check if the upper bound is greater or equal to the lower bound 909 909 // on each arc. -
lemon/cplex.cc
r1063 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/cplex.h
r1074 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/cycle_canceling.h
r1081 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 784 784 return OPTIMAL; 785 785 } 786 786 787 787 // Check if the upper bound is greater or equal to the lower bound 788 788 // on each arc. … … 961 961 buildResidualNetwork(); 962 962 while (true) { 963 963 964 964 typename HwMmc::TerminationCause hw_tc = 965 965 hw_mmc.findCycleMean(hw_iter_limit); … … 977 977 hw_mmc.findCycle(); 978 978 } 979 979 980 980 // Compute delta value 981 981 Value delta = INF; -
lemon/dfs.h
r1074 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/dijkstra.h
r1074 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/dimacs.h
r877 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/edge_set.h
r877 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/edmonds_karp.h
r1074 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 37 37 struct EdmondsKarpDefaultTraits { 38 38 39 /// \brief The digraph type the algorithm runs on. 39 /// \brief The digraph type the algorithm runs on. 40 40 typedef GR Digraph; 41 41 … … 61 61 /// \brief Instantiates a FlowMap. 62 62 /// 63 /// This function instantiates a \ref FlowMap. 63 /// This function instantiates a \ref FlowMap. 64 64 /// \param digraph The digraph for which we would like to define 65 65 /// the flow map. … … 96 96 /// \tparam GR The type of the digraph the algorithm runs on. 97 97 /// \tparam CAP The type of the capacity map. The default map 98 /// type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". 98 /// type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". 99 99 /// \tparam TR The traits class that defines various types used by the 100 100 /// algorithm. By default, it is \ref EdmondsKarpDefaultTraits … … 105 105 #ifdef DOXYGEN 106 106 template <typename GR, typename CAP, typename TR> 107 #else 107 #else 108 108 template <typename GR, 109 109 typename CAP = typename GR::template ArcMap<int>, 110 110 typename TR = EdmondsKarpDefaultTraits<GR, CAP> > 111 111 #endif … … 121 121 typedef typename Traits::CapacityMap CapacityMap; 122 122 /// The type of the flow values. 123 typedef typename Traits::Value Value; 123 typedef typename Traits::Value Value; 124 124 125 125 /// The type of the flow map. … … 132 132 TEMPLATE_DIGRAPH_TYPEDEFS(Digraph); 133 133 typedef typename Digraph::template NodeMap<Arc> PredMap; 134 134 135 135 const Digraph& _graph; 136 136 const CapacityMap* _capacity; … … 143 143 PredMap* _pred; 144 144 std::vector<Node> _queue; 145 145 146 146 Tolerance _tolerance; 147 147 Value _flow_value; … … 149 149 void createStructures() { 150 150 if (!_flow) { 151 152 151 _flow = Traits::createFlowMap(_graph); 152 _local_flow = true; 153 153 } 154 154 if (!_pred) { 155 155 _pred = new PredMap(_graph); 156 156 } 157 157 _queue.resize(countNodes(_graph)); … … 160 160 void destroyStructures() { 161 161 if (_local_flow) { 162 162 delete _flow; 163 163 } 164 164 if (_pred) { 165 166 } 167 } 168 165 delete _pred; 166 } 167 } 168 169 169 public: 170 170 … … 179 179 typedef T FlowMap; 180 180 static FlowMap *createFlowMap(const Digraph&) { 181 181 LEMON_ASSERT(false, "FlowMap is not initialized"); 182 182 return 0; 183 183 } … … 190 190 /// type 191 191 template <typename T> 192 struct SetFlowMap 192 struct SetFlowMap 193 193 : public EdmondsKarp<Digraph, CapacityMap, SetFlowMapTraits<T> > { 194 194 typedef EdmondsKarp<Digraph, CapacityMap, SetFlowMapTraits<T> > Create; … … 198 198 199 199 protected: 200 200 201 201 EdmondsKarp() {} 202 202 … … 205 205 /// \brief The constructor of the class. 206 206 /// 207 /// The constructor of the class. 208 /// \param digraph The digraph the algorithm runs on. 209 /// \param capacity The capacity of the arcs. 207 /// The constructor of the class. 208 /// \param digraph The digraph the algorithm runs on. 209 /// \param capacity The capacity of the arcs. 210 210 /// \param source The source node. 211 211 /// \param target The target node. 212 212 EdmondsKarp(const Digraph& digraph, const CapacityMap& capacity, 213 213 Node source, Node target) 214 214 : _graph(digraph), _capacity(&capacity), _source(source), _target(target), 215 215 _flow(0), _local_flow(false), _pred(0), _tolerance(), _flow_value() 216 216 { 217 217 LEMON_ASSERT(_source != _target, … … 245 245 EdmondsKarp& flowMap(FlowMap& map) { 246 246 if (_local_flow) { 247 248 247 delete _flow; 248 _local_flow = false; 249 249 } 250 250 _flow = ↦ … … 277 277 _tolerance = tolerance; 278 278 return *this; 279 } 279 } 280 280 281 281 /// \brief Returns a const reference to the tolerance. … … 285 285 const Tolerance& tolerance() const { 286 286 return _tolerance; 287 } 287 } 288 288 289 289 /// \name Execution control … … 292 292 /// you have to call one of the \ref init() functions first, then 293 293 /// \ref start() or multiple times the \ref augment() function. 294 294 295 295 ///@{ 296 296 … … 306 306 _flow_value = 0; 307 307 } 308 308 309 309 /// \brief Initializes the algorithm using the given flow map. 310 310 /// … … 318 318 createStructures(); 319 319 for (ArcIt e(_graph); e != INVALID; ++e) { 320 320 _flow->set(e, flowMap[e]); 321 321 } 322 322 _flow_value = 0; … … 335 335 /// contain a feasible flow, i.e. at each node excluding the source 336 336 /// and the target, the incoming flow should be equal to the 337 /// outgoing flow. 337 /// outgoing flow. 338 338 /// \return \c false when the given \c flowMap does not contain a 339 339 /// feasible flow. … … 342 342 createStructures(); 343 343 for (ArcIt e(_graph); e != INVALID; ++e) { 344 344 _flow->set(e, flowMap[e]); 345 345 } 346 346 for (NodeIt it(_graph); it != INVALID; ++it) { … … 373 373 374 374 /// \brief Augments the solution along a shortest path. 375 /// 375 /// 376 376 /// Augments the solution along a shortest path. This function searches a 377 377 /// shortest path between the source and the target … … 384 384 bool augment() { 385 385 for (NodeIt n(_graph); n != INVALID; ++n) { 386 387 } 388 386 _pred->set(n, INVALID); 387 } 388 389 389 int first = 0, last = 1; 390 390 391 391 _queue[0] = _source; 392 392 _pred->set(_source, OutArcIt(_graph, _source)); 393 393 394 394 while (first != last && (*_pred)[_target] == INVALID) { 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 395 Node n = _queue[first++]; 396 397 for (OutArcIt e(_graph, n); e != INVALID; ++e) { 398 Value rem = (*_capacity)[e] - (*_flow)[e]; 399 Node t = _graph.target(e); 400 if (_tolerance.positive(rem) && (*_pred)[t] == INVALID) { 401 _pred->set(t, e); 402 _queue[last++] = t; 403 } 404 } 405 for (InArcIt e(_graph, n); e != INVALID; ++e) { 406 Value rem = (*_flow)[e]; 407 Node t = _graph.source(e); 408 if (_tolerance.positive(rem) && (*_pred)[t] == INVALID) { 409 _pred->set(t, e); 410 _queue[last++] = t; 411 } 412 } 413 413 } 414 414 415 415 if ((*_pred)[_target] != INVALID) { 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 n = _graph.target(e); 431 } 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 n = _graph.target(e); 447 } 448 449 450 _flow_value += prem; 451 416 Node n = _target; 417 Arc e = (*_pred)[n]; 418 419 Value prem = (*_capacity)[e] - (*_flow)[e]; 420 n = _graph.source(e); 421 while (n != _source) { 422 e = (*_pred)[n]; 423 if (_graph.target(e) == n) { 424 Value rem = (*_capacity)[e] - (*_flow)[e]; 425 if (rem < prem) prem = rem; 426 n = _graph.source(e); 427 } else { 428 Value rem = (*_flow)[e]; 429 if (rem < prem) prem = rem; 430 n = _graph.target(e); 431 } 432 } 433 434 n = _target; 435 e = (*_pred)[n]; 436 437 _flow->set(e, (*_flow)[e] + prem); 438 n = _graph.source(e); 439 while (n != _source) { 440 e = (*_pred)[n]; 441 if (_graph.target(e) == n) { 442 _flow->set(e, (*_flow)[e] + prem); 443 n = _graph.source(e); 444 } else { 445 _flow->set(e, (*_flow)[e] - prem); 446 n = _graph.target(e); 447 } 448 } 449 450 _flow_value += prem; 451 return true; 452 452 } else { 453 453 return false; 454 454 } 455 455 } … … 458 458 /// 459 459 /// Executes the algorithm by performing augmenting phases until the 460 /// optimal solution is reached. 460 /// optimal solution is reached. 461 461 /// \pre One of the \ref init() functions must be called before 462 462 /// using this function. … … 466 466 467 467 /// \brief Runs the algorithm. 468 /// 468 /// 469 469 /// Runs the Edmonds-Karp algorithm. 470 470 /// \note ek.run() is just a shortcut of the following code. 471 ///\code 471 ///\code 472 472 /// ek.init(); 473 473 /// ek.start(); … … 484 484 /// functions.\n 485 485 /// Either \ref run() or \ref start() should be called before using them. 486 486 487 487 ///@{ 488 488 … … 543 543 void minCutMap(CutMap& cutMap) const { 544 544 for (NodeIt n(_graph); n != INVALID; ++n) { 545 545 cutMap.set(n, (*_pred)[n] != INVALID); 546 546 } 547 547 cutMap.set(_source, true); 548 } 548 } 549 549 550 550 /// @} -
lemon/euler.h
r919 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/fractional_matching.h
r1074 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/full_graph.h
r1025 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 875 875 static int id(Arc e) { return e._id; } 876 876 static int id(Edge e) { return e._id; } 877 877 878 878 static Node nodeFromId(int id) { return Node(id);} 879 879 static Arc arcFromId(int id) { return Arc(id);} … … 905 905 return n._id - _red_num; 906 906 } 907 907 908 908 void clear() { 909 909 _red_num = 0; _blue_num = 0; … … 911 911 } 912 912 913 Edge edge(const Node& u, const Node& v) const { 913 Edge edge(const Node& u, const Node& v) const { 914 914 if (u._id < _red_num) { 915 915 if (v._id < _red_num) { … … 927 927 } 928 928 929 Arc arc(const Node& u, const Node& v) const { 929 Arc arc(const Node& u, const Node& v) const { 930 930 if (u._id < _red_num) { 931 931 if (v._id < _red_num) { -
lemon/glpk.cc
r1063 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/glpk.h
r1074 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 149 149 #ifdef DOXYGEN 150 150 /// Write the problem or the solution to a file in the given format 151 151 152 152 /// This function writes the problem or the solution 153 153 /// to a file in the given format. -
lemon/gomory_hu.h
r1080 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/graph_to_eps.h
r1079 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/greedy_tsp.h
r1074 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 68 68 Cost _sum; 69 69 std::vector<Node> _path; 70 70 71 71 private: 72 72 73 73 // Functor class to compare edges by their costs 74 74 class EdgeComp { -
lemon/grosso_locatelli_pullan_mc.h
r1053 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 121 121 BoolMatrix _gr; 122 122 int _n; 123 123 124 124 // Search options 125 125 bool _delta_based_restart; 126 126 int _restart_delta_limit; 127 127 128 128 // Search limits 129 129 int _iteration_limit; … … 443 443 /// \name Execution Control 444 444 /// The \ref run() function can be used to execute the algorithm.\n 445 /// The functions \ref iterationLimit(int), \ref stepLimit(int), and 445 /// The functions \ref iterationLimit(int), \ref stepLimit(int), and 446 446 /// \ref sizeLimit(int) can be used to specify various limits for the 447 447 /// search process. 448 448 449 449 /// @{ 450 450 451 451 /// \brief Sets the maximum number of iterations. 452 452 /// … … 460 460 /// likely finds larger cliques. For smaller values, the algorithm is 461 461 /// faster but probably gives worse results. 462 /// 462 /// 463 463 /// The default value is \c 1000. 464 464 /// \c -1 means that number of iterations is not limited. … … 475 475 return *this; 476 476 } 477 477 478 478 /// \brief Sets the maximum number of search steps. 479 479 /// … … 487 487 /// likely finds larger cliques. For smaller values, the algorithm is 488 488 /// faster but probably gives worse results. 489 /// 489 /// 490 490 /// The default value is \c -1, which means that number of steps 491 491 /// is not limited explicitly. However, the number of iterations is … … 503 503 return *this; 504 504 } 505 505 506 506 /// \brief Sets the desired clique size. 507 507 /// … … 509 509 /// limit. If a clique of this size (or a larger one) is found, then the 510 510 /// algorithm terminates. 511 /// 511 /// 512 512 /// This function is especially useful if you know an exact upper bound 513 /// for the size of the cliques in the graph or if any clique above 513 /// for the size of the cliques in the graph or if any clique above 514 514 /// a certain size limit is sufficient for your application. 515 /// 515 /// 516 516 /// The default value is \c -1, which means that the size limit is set to 517 517 /// the number of nodes in the graph. … … 525 525 return *this; 526 526 } 527 527 528 528 /// \brief The maximum number of iterations. 529 529 /// … … 535 535 return _iteration_limit; 536 536 } 537 537 538 538 /// \brief The maximum number of search steps. 539 539 /// … … 545 545 return _step_limit; 546 546 } 547 547 548 548 /// \brief The desired clique size. 549 549 /// … … 584 584 /// \name Query Functions 585 585 /// The results of the algorithm can be obtained using these functions.\n 586 /// The run() function must be called before using them. 586 /// The run() function must be called before using them. 587 587 588 588 /// @{ … … 677 677 678 678 private: 679 679 680 680 // Initialize search options and limits 681 681 void initOptions() { … … 683 683 _delta_based_restart = true; 684 684 _restart_delta_limit = 4; 685 685 686 686 // Search limits 687 687 _iteration_limit = 1000; -
lemon/hao_orlin.h
r915 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/hartmann_orlin_mmc.h
r1080 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/howard_mmc.h
r1074 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 156 156 /// these values. 157 157 enum TerminationCause { 158 158 159 159 /// No directed cycle can be found in the digraph. 160 160 NO_CYCLE = 0, 161 161 162 162 /// Optimal solution (minimum cycle mean) is found. 163 163 OPTIMAL = 1, … … 357 357 /// 358 358 /// \param limit The maximum allowed number of iterations during 359 /// the search process. Its default value implies that the algorithm 359 /// the search process. Its default value implies that the algorithm 360 360 /// runs until it finds the exact optimal solution. 361 361 /// 362 362 /// \return The termination cause of the search process. 363 /// For more information, see \ref TerminationCause. 363 /// For more information, see \ref TerminationCause. 364 364 TerminationCause findCycleMean(int limit = std::numeric_limits<int>::max()) { 365 365 // Initialize and find strongly connected components … … 390 390 _best_node = _curr_node; 391 391 } 392 392 393 393 if (iter_limit_reached) break; 394 394 } -
lemon/insertion_tsp.h
r1074 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 361 361 Node u = _notused[i]; 362 362 Cost min_cost = costDiff(_tour.back(), _tour.front(), u); 363 int min_pos = 0; 363 int min_pos = 0; 364 364 for (unsigned int j=1; j<_tour.size(); ++j) { 365 365 Cost curr_cost = costDiff(_tour[j-1], _tour[j], u); … … 391 391 _notused[min_node] = _notused.back(); 392 392 _notused.pop_back(); 393 393 394 394 // Insert the selected node into the tour 395 395 const int ipos = _ins_pos[sn]; … … 406 406 Cost nc1 = costDiff(_tour[ipos_prev], _tour[ipos], u); 407 407 Cost nc2 = costDiff(_tour[ipos], _tour[ipos_next], u); 408 408 409 409 if (nc1 <= curr_cost || nc2 <= curr_cost) { 410 410 // A new position is better than the old one … … 421 421 // The minimum should be found again 422 422 curr_cost = costDiff(_tour.back(), _tour.front(), u); 423 curr_pos = 0; 423 curr_pos = 0; 424 424 for (unsigned int j=1; j<_tour.size(); ++j) { 425 425 Cost tmp_cost = costDiff(_tour[j-1], _tour[j], u); … … 434 434 } 435 435 } 436 436 437 437 _ins_cost[u] = curr_cost; 438 438 _ins_pos[u] = curr_pos; -
lemon/karp_mmc.h
r1080 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/kruskal.h
r921 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/lgf_reader.h
r1074 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 15 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 2639 2639 _red_node_index.insert(std::make_pair(converter(map[n]), n)); 2640 2640 } 2641 for (BlueNodeIt n(_graph); n != INVALID; ++n) { 2641 for (BlueNodeIt n(_graph); n != INVALID; ++n) { 2642 2642 _blue_node_index.insert(std::make_pair(converter(map[n]), n)); 2643 2643 } -
lemon/lgf_writer.h
r1074 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 186 186 ValueStorage(const Value& value, const Converter& converter = Converter()) 187 187 : _value(value), _converter(converter) {} 188 188 189 189 virtual std::string get() { 190 190 return _converter(_value); -
lemon/list_graph.h
r1049 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 1766 1766 void next(BlueNode& node) const { 1767 1767 node.id = nodes[node.id].partition_next; 1768 } 1768 } 1769 1769 1770 1770 void first(Arc& e) const { -
lemon/lp.h
r1064 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/lp_base.cc
r877 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/lp_base.h
r1076 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 1029 1029 } 1030 1030 }; 1031 1031 1032 1032 protected: 1033 1033 virtual void _write(std::string, std::string format) const … … 1035 1035 throw UnsupportedFormatError(format); 1036 1036 } 1037 1037 1038 1038 public: 1039 1039 -
lemon/lp_skeleton.cc
r1063 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/lp_skeleton.h
r1063 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/maps.h
r942 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/matching.h
r877 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/math.h
r1054 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/max_cardinality_search.h
r977 r1092 1 /* -*- C++-*-1 /* -*- mode: C++; indent-tabs-mode: nil; -*- 2 2 * 3 * This file is a part of LEMON, a generic C++ optimization library 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 22 22 23 23 /// \ingroup search 24 /// \file 24 /// \file 25 25 /// \brief Maximum cardinality search in undirected digraphs. 26 26 … … 42 42 template <typename GR, typename CAP> 43 43 struct MaxCardinalitySearchDefaultTraits { 44 /// The digraph type the algorithm runs on. 44 /// The digraph type the algorithm runs on. 45 45 typedef GR Digraph; 46 46 … … 51 51 52 52 static CapacityMap *createCapacityMap(const Digraph& g) { 53 53 return new CapacityMap(g); 54 54 } 55 55 }; … … 61 61 62 62 static CapacityMap *createCapacityMap(const Digraph&) { 63 63 return new CapacityMap; 64 64 } 65 65 }; … … 91 91 /// \brief Instantiates a HeapCrossRef. 92 92 /// 93 /// This function instantiates a \ref HeapCrossRef. 94 /// \param digraph is the digraph, to which we would like to define the 93 /// This function instantiates a \ref HeapCrossRef. 94 /// \param digraph is the digraph, to which we would like to define the 95 95 /// HeapCrossRef. 96 96 static HeapCrossRef *createHeapCrossRef(const Digraph &digraph) { 97 97 return new HeapCrossRef(digraph); 98 98 } 99 99 100 100 template <typename CapacityMap> 101 101 struct HeapSelector { 102 102 template <typename Value, typename Ref> 103 struct Selector { 103 struct Selector { 104 104 typedef BinHeap<Value, Ref, std::greater<Value> > Heap; 105 105 }; … … 129 129 /// \brief Instantiates a Heap. 130 130 /// 131 /// This function instantiates a \ref Heap. 131 /// This function instantiates a \ref Heap. 132 132 /// \param crossref The cross reference of the heap. 133 133 static Heap *createHeap(HeapCrossRef& crossref) { … … 144 144 /// \brief Instantiates a ProcessedMap. 145 145 /// 146 /// This function instantiates a \ref ProcessedMap. 146 /// This function instantiates a \ref ProcessedMap. 147 147 /// \param digraph is the digraph, to which 148 148 /// we would like to define the \ref ProcessedMap … … 157 157 158 158 /// \brief The type of the map that stores the cardinalities of the nodes. 159 /// 159 /// 160 160 /// The type of the map that stores the cardinalities of the nodes. 161 161 /// It must meet the \ref concepts::WriteMap "WriteMap" concept. … … 164 164 /// \brief Instantiates a CardinalityMap. 165 165 /// 166 /// This function instantiates a \ref CardinalityMap. 167 /// \param digraph is the digraph, to which we would like to define the \ref 166 /// This function instantiates a \ref CardinalityMap. 167 /// \param digraph is the digraph, to which we would like to define the \ref 168 168 /// CardinalityMap 169 169 static CardinalityMap *createCardinalityMap(const Digraph &digraph) { … … 173 173 174 174 }; 175 175 176 176 /// \ingroup search 177 177 /// 178 178 /// \brief Maximum Cardinality Search algorithm class. 179 179 /// 180 /// This class provides an efficient implementation of Maximum Cardinality 181 /// Search algorithm. The maximum cardinality search first chooses any 180 /// This class provides an efficient implementation of Maximum Cardinality 181 /// Search algorithm. The maximum cardinality search first chooses any 182 182 /// node of the digraph. Then every time it chooses one unprocessed node 183 183 /// with maximum cardinality, i.e the sum of capacities on out arcs to the nodes … … 187 187 188 188 /// The arc capacities are passed to the algorithm using a 189 /// \ref concepts::ReadMap "ReadMap", so it is easy to change it to any 189 /// \ref concepts::ReadMap "ReadMap", so it is easy to change it to any 190 190 /// kind of capacity. 191 191 /// 192 /// The type of the capacity is determined by the \ref 192 /// The type of the capacity is determined by the \ref 193 193 /// concepts::ReadMap::Value "Value" of the capacity map. 194 194 /// … … 197 197 /// 198 198 /// \param GR The digraph type the algorithm runs on. The value of 199 /// Digraph is not used directly by the search algorithm, it 199 /// Digraph is not used directly by the search algorithm, it 200 200 /// is only passed to \ref MaxCardinalitySearchDefaultTraits. 201 /// \param CAP This read-only ArcMap determines the capacities of 201 /// \param CAP This read-only ArcMap determines the capacities of 202 202 /// the arcs. It is read once for each arc, so the map may involve in 203 203 /// relatively time consuming process to compute the arc capacity if 204 204 /// it is necessary. The default map type is \ref 205 205 /// ConstMap "ConstMap<concepts::Digraph::Arc, Const<int,1> >". The value 206 /// of CapacityMap is not used directly by search algorithm, it is only 207 /// passed to \ref MaxCardinalitySearchDefaultTraits. 208 /// \param TR Traits class to set various data types used by the 209 /// algorithm. The default traits class is 210 /// \ref MaxCardinalitySearchDefaultTraits 211 /// "MaxCardinalitySearchDefaultTraits<GR, CAP>". 212 /// See \ref MaxCardinalitySearchDefaultTraits 206 /// of CapacityMap is not used directly by search algorithm, it is only 207 /// passed to \ref MaxCardinalitySearchDefaultTraits. 208 /// \param TR Traits class to set various data types used by the 209 /// algorithm. The default traits class is 210 /// \ref MaxCardinalitySearchDefaultTraits 211 /// "MaxCardinalitySearchDefaultTraits<GR, CAP>". 212 /// See \ref MaxCardinalitySearchDefaultTraits 213 213 /// for the documentation of a MaxCardinalitySearch traits class. 214 214 … … 216 216 template <typename GR, typename CAP, typename TR> 217 217 #else 218 template <typename GR, typename CAP = 219 220 typename TR = 218 template <typename GR, typename CAP = 219 ConstMap<typename GR::Arc, Const<int,1> >, 220 typename TR = 221 221 MaxCardinalitySearchDefaultTraits<GR, CAP> > 222 222 #endif … … 227 227 ///The type of the underlying digraph. 228 228 typedef typename Traits::Digraph Digraph; 229 229 230 230 ///The type of the capacity of the arcs. 231 231 typedef typename Traits::CapacityMap::Value Value; … … 267 267 268 268 typedef MaxCardinalitySearch Create; 269 269 270 270 ///\name Named template parameters 271 271 … … 276 276 typedef T CapacityMap; 277 277 static CapacityMap *createCapacityMap(const Digraph &) { 278 279 280 } 281 }; 282 /// \brief \ref named-templ-param "Named parameter" for setting 278 LEMON_ASSERT(false,"Uninitialized parameter."); 279 return 0; 280 } 281 }; 282 /// \brief \ref named-templ-param "Named parameter" for setting 283 283 /// CapacityMap type 284 284 /// … … 286 286 /// for the algorithm. 287 287 template <class T> 288 struct SetCapacityMap 289 : public MaxCardinalitySearch<Digraph, CapacityMap, 290 DefCapacityMapTraits<T> > { 291 typedef MaxCardinalitySearch<Digraph, CapacityMap, 288 struct SetCapacityMap 289 : public MaxCardinalitySearch<Digraph, CapacityMap, 290 DefCapacityMapTraits<T> > { 291 typedef MaxCardinalitySearch<Digraph, CapacityMap, 292 292 DefCapacityMapTraits<T> > Create; 293 293 }; … … 296 296 struct DefCardinalityMapTraits : public Traits { 297 297 typedef T CardinalityMap; 298 static CardinalityMap *createCardinalityMap(const Digraph &) 298 static CardinalityMap *createCardinalityMap(const Digraph &) 299 299 { 300 301 302 } 303 }; 304 /// \brief \ref named-templ-param "Named parameter" for setting 300 LEMON_ASSERT(false,"Uninitialized parameter."); 301 return 0; 302 } 303 }; 304 /// \brief \ref named-templ-param "Named parameter" for setting 305 305 /// CardinalityMap type 306 306 /// 307 /// \ref named-templ-param "Named parameter" for setting CardinalityMap 307 /// \ref named-templ-param "Named parameter" for setting CardinalityMap 308 308 /// type for the algorithm. 309 309 template <class T> 310 struct SetCardinalityMap 311 : public MaxCardinalitySearch<Digraph, CapacityMap, 312 DefCardinalityMapTraits<T> > { 313 typedef MaxCardinalitySearch<Digraph, CapacityMap, 310 struct SetCardinalityMap 311 : public MaxCardinalitySearch<Digraph, CapacityMap, 312 DefCardinalityMapTraits<T> > { 313 typedef MaxCardinalitySearch<Digraph, CapacityMap, 314 314 DefCardinalityMapTraits<T> > Create; 315 315 }; 316 316 317 317 template <class T> 318 318 struct DefProcessedMapTraits : public Traits { 319 319 typedef T ProcessedMap; 320 320 static ProcessedMap *createProcessedMap(const Digraph &) { 321 322 323 } 324 }; 325 /// \brief \ref named-templ-param "Named parameter" for setting 321 LEMON_ASSERT(false,"Uninitialized parameter."); 322 return 0; 323 } 324 }; 325 /// \brief \ref named-templ-param "Named parameter" for setting 326 326 /// ProcessedMap type 327 327 /// … … 329 329 /// for the algorithm. 330 330 template <class T> 331 struct SetProcessedMap 332 : public MaxCardinalitySearch<Digraph, CapacityMap, 333 DefProcessedMapTraits<T> > { 334 typedef MaxCardinalitySearch<Digraph, CapacityMap, 331 struct SetProcessedMap 332 : public MaxCardinalitySearch<Digraph, CapacityMap, 333 DefProcessedMapTraits<T> > { 334 typedef MaxCardinalitySearch<Digraph, CapacityMap, 335 335 DefProcessedMapTraits<T> > Create; 336 336 }; 337 337 338 338 template <class H, class CR> 339 339 struct DefHeapTraits : public Traits { … … 341 341 typedef H Heap; 342 342 static HeapCrossRef *createHeapCrossRef(const Digraph &) { 343 344 343 LEMON_ASSERT(false,"Uninitialized parameter."); 344 return 0; 345 345 } 346 346 static Heap *createHeap(HeapCrossRef &) { 347 348 349 } 350 }; 351 /// \brief \ref named-templ-param "Named parameter" for setting heap 347 LEMON_ASSERT(false,"Uninitialized parameter."); 348 return 0; 349 } 350 }; 351 /// \brief \ref named-templ-param "Named parameter" for setting heap 352 352 /// and cross reference type 353 353 /// 354 /// \ref named-templ-param "Named parameter" for setting heap and cross 354 /// \ref named-templ-param "Named parameter" for setting heap and cross 355 355 /// reference type for the algorithm. 356 356 template <class H, class CR = typename Digraph::template NodeMap<int> > 357 357 struct SetHeap 358 : public MaxCardinalitySearch<Digraph, CapacityMap, 359 DefHeapTraits<H, CR> > { 360 typedef MaxCardinalitySearch< Digraph, CapacityMap, 358 : public MaxCardinalitySearch<Digraph, CapacityMap, 359 DefHeapTraits<H, CR> > { 360 typedef MaxCardinalitySearch< Digraph, CapacityMap, 361 361 DefHeapTraits<H, CR> > Create; 362 362 }; … … 367 367 typedef H Heap; 368 368 static HeapCrossRef *createHeapCrossRef(const Digraph &digraph) { 369 369 return new HeapCrossRef(digraph); 370 370 } 371 371 static Heap *createHeap(HeapCrossRef &crossref) { 372 373 } 374 }; 375 376 /// \brief \ref named-templ-param "Named parameter" for setting heap and 372 return new Heap(crossref); 373 } 374 }; 375 376 /// \brief \ref named-templ-param "Named parameter" for setting heap and 377 377 /// cross reference type with automatic allocation 378 378 /// 379 /// \ref named-templ-param "Named parameter" for setting heap and cross 380 /// reference type. It can allocate the heap and the cross reference 381 /// object if the cross reference's constructor waits for the digraph as 379 /// \ref named-templ-param "Named parameter" for setting heap and cross 380 /// reference type. It can allocate the heap and the cross reference 381 /// object if the cross reference's constructor waits for the digraph as 382 382 /// parameter and the heap's constructor waits for the cross reference. 383 383 template <class H, class CR = typename Digraph::template NodeMap<int> > 384 384 struct SetStandardHeap 385 : public MaxCardinalitySearch<Digraph, CapacityMap, 386 DefStandardHeapTraits<H, CR> > { 387 typedef MaxCardinalitySearch<Digraph, CapacityMap, 388 DefStandardHeapTraits<H, CR> > 385 : public MaxCardinalitySearch<Digraph, CapacityMap, 386 DefStandardHeapTraits<H, CR> > { 387 typedef MaxCardinalitySearch<Digraph, CapacityMap, 388 DefStandardHeapTraits<H, CR> > 389 389 Create; 390 390 }; 391 391 392 392 ///@} 393 393 … … 397 397 MaxCardinalitySearch() {} 398 398 399 public: 400 399 public: 400 401 401 /// \brief Constructor. 402 402 /// … … 404 404 ///\param capacity the capacity map used by the algorithm. 405 405 MaxCardinalitySearch(const Digraph& digraph, 406 406 const CapacityMap& capacity) : 407 407 _graph(&digraph), 408 408 _capacity(&capacity), local_capacity(false), … … 442 442 MaxCardinalitySearch &capacityMap(const CapacityMap &m) { 443 443 if (local_capacity) { 444 445 444 delete _capacity; 445 local_capacity=false; 446 446 } 447 447 _capacity=&m; … … 457 457 } 458 458 459 /// \brief Sets the map storing the cardinalities calculated by the 459 /// \brief Sets the map storing the cardinalities calculated by the 460 460 /// algorithm. 461 461 /// … … 467 467 MaxCardinalitySearch &cardinalityMap(CardinalityMap &m) { 468 468 if(local_cardinality) { 469 470 469 delete _cardinality; 470 local_cardinality=false; 471 471 } 472 472 _cardinality = &m; … … 481 481 /// automatically allocated map, of course. 482 482 /// \return <tt> (*this) </tt> 483 MaxCardinalitySearch &processedMap(ProcessedMap &m) 483 MaxCardinalitySearch &processedMap(ProcessedMap &m) 484 484 { 485 485 if(local_processed) { 486 487 486 delete _processed; 487 local_processed=false; 488 488 } 489 489 _processed = &m; … … 508 508 MaxCardinalitySearch &heap(Heap& hp, HeapCrossRef &cr) { 509 509 if(local_heap_cross_ref) { 510 511 510 delete _heap_cross_ref; 511 local_heap_cross_ref = false; 512 512 } 513 513 _heap_cross_ref = &cr; 514 514 if(local_heap) { 515 516 515 delete _heap; 516 local_heap = false; 517 517 } 518 518 _heap = &hp; … … 545 545 void create_maps() { 546 546 if(!_capacity) { 547 548 547 local_capacity = true; 548 _capacity = Traits::createCapacityMap(*_graph); 549 549 } 550 550 if(!_cardinality) { 551 552 551 local_cardinality = true; 552 _cardinality = Traits::createCardinalityMap(*_graph); 553 553 } 554 554 if(!_processed) { 555 556 555 local_processed = true; 556 _processed = Traits::createProcessedMap(*_graph); 557 557 } 558 558 if (!_heap_cross_ref) { 559 560 559 local_heap_cross_ref = true; 560 _heap_cross_ref = Traits::createHeapCrossRef(*_graph); 561 561 } 562 562 if (!_heap) { 563 564 565 } 566 } 567 563 local_heap = true; 564 _heap = Traits::createHeap(*_heap_cross_ref); 565 } 566 } 567 568 568 void finalizeNodeData(Node node, Value capacity) { 569 569 _processed->set(node, true); … … 590 590 _heap->clear(); 591 591 for (NodeIt it(*_graph) ; it != INVALID ; ++it) { 592 593 594 } 595 } 596 592 _processed->set(it, false); 593 _heap_cross_ref->set(it, Heap::PRE_HEAP); 594 } 595 } 596 597 597 /// \brief Adds a new source node. 598 /// 598 /// 599 599 /// Adds a new source node to the priority heap. 600 600 /// … … 602 602 void addSource(Node source, Value capacity = 0) { 603 603 if(_heap->state(source) == Heap::PRE_HEAP) { 604 605 } 606 } 607 604 _heap->push(source, capacity); 605 } 606 } 607 608 608 /// \brief Processes the next node in the priority heap 609 609 /// … … 614 614 /// \warning The priority heap must not be empty! 615 615 Node processNextNode() { 616 Node node = _heap->top(); 616 Node node = _heap->top(); 617 617 finalizeNodeData(node, _heap->prio()); 618 618 _heap->pop(); 619 619 620 620 for (InArcIt it(*_graph, node); it != INVALID; ++it) { 621 622 623 624 625 626 627 628 629 630 631 621 Node source = _graph->source(it); 622 switch (_heap->state(source)) { 623 case Heap::PRE_HEAP: 624 _heap->push(source, (*_capacity)[it]); 625 break; 626 case Heap::IN_HEAP: 627 _heap->decrease(source, (*_heap)[source] + (*_capacity)[it]); 628 break; 629 case Heap::POST_HEAP: 630 break; 631 } 632 632 } 633 633 return node; … … 638 638 /// Next node to be processed. 639 639 /// 640 /// \return The next node to be processed or INVALID if the 640 /// \return The next node to be processed or INVALID if the 641 641 /// priority heap is empty. 642 Node nextNode() { 642 Node nextNode() { 643 643 return !_heap->empty() ? _heap->top() : INVALID; 644 644 } 645 645 646 646 /// \brief Returns \c false if there are nodes 647 647 /// to be processed in the priority heap … … 650 650 /// to be processed in the priority heap 651 651 bool emptyQueue() { return _heap->empty(); } 652 /// \brief Returns the number of the nodes to be processed 652 /// \brief Returns the number of the nodes to be processed 653 653 /// in the priority heap 654 654 /// 655 655 /// Returns the number of the nodes to be processed in the priority heap 656 656 int emptySize() { return _heap->size(); } 657 657 658 658 /// \brief Executes the algorithm. 659 659 /// … … 663 663 /// with addSource() before using this function. 664 664 /// 665 /// This method runs the Maximum Cardinality Search algorithm from the 665 /// This method runs the Maximum Cardinality Search algorithm from the 666 666 /// source node(s). 667 667 void start() { 668 668 while ( !_heap->empty() ) processNextNode(); 669 669 } 670 670 671 671 /// \brief Executes the algorithm until \c dest is reached. 672 672 /// … … 676 676 /// with addSource() before using this function. 677 677 /// 678 /// This method runs the %MaxCardinalitySearch algorithm from the source 678 /// This method runs the %MaxCardinalitySearch algorithm from the source 679 679 /// nodes. 680 680 void start(Node dest) { … … 682 682 if ( !_heap->empty() ) finalizeNodeData(_heap->top(), _heap->prio()); 683 683 } 684 684 685 685 /// \brief Executes the algorithm until a condition is met. 686 686 /// … … 697 697 if ( !_heap->empty() ) finalizeNodeData(_heap->top(),_heap->prio()); 698 698 } 699 699 700 700 /// \brief Runs the maximum cardinality search algorithm from node \c s. 701 701 /// 702 /// This method runs the %MaxCardinalitySearch algorithm from a root 702 /// This method runs the %MaxCardinalitySearch algorithm from a root 703 703 /// node \c s. 704 704 /// … … 715 715 } 716 716 717 /// \brief Runs the maximum cardinality search algorithm for the 717 /// \brief Runs the maximum cardinality search algorithm for the 718 718 /// whole digraph. 719 719 /// 720 /// This method runs the %MaxCardinalitySearch algorithm from all 720 /// This method runs the %MaxCardinalitySearch algorithm from all 721 721 /// unprocessed node of the digraph. 722 722 /// … … 740 740 } 741 741 } 742 742 743 743 ///@} 744 744 745 745 /// \name Query Functions 746 /// The results of the maximum cardinality search algorithm can be 746 /// The results of the maximum cardinality search algorithm can be 747 747 /// obtained using these functions. 748 748 /// \n 749 /// Before the use of these functions, either run() or start() must be 749 /// Before the use of these functions, either run() or start() must be 750 750 /// called. 751 751 752 752 ///@{ 753 753 … … 768 768 /// \brief Returns a reference to the NodeMap of cardinalities. 769 769 /// 770 /// Returns a reference to the NodeMap of cardinalities. \pre \ref run() 770 /// Returns a reference to the NodeMap of cardinalities. \pre \ref run() 771 771 /// must be called before using this function. 772 772 const CardinalityMap &cardinalityMap() const { return *_cardinality;} 773 773 774 774 /// \brief Checks if a node is reachable from the root. 775 775 /// … … 785 785 /// \pre \ref run() must be called before using this function. 786 786 bool processed(Node v) { return (*_heap_cross_ref)[v] == Heap::POST_HEAP; } 787 787 788 788 ///@} 789 789 }; -
lemon/min_cost_arborescence.h
r1080 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/nagamochi_ibaraki.h
r978 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 304 304 //This is here to avoid a gcc-3.3 compilation error. 305 305 //It should never be called. 306 NagamochiIbaraki() {} 307 306 NagamochiIbaraki() {} 307 308 308 public: 309 309 … … 415 415 for (typename Graph::OutArcIt a(_graph, n); a != INVALID; ++a) { 416 416 typename Graph::Node m = _graph.target(a); 417 417 418 418 if (!(n < m)) continue; 419 419 420 420 (*_nodes)[n].sum += (*_capacity)[a]; 421 421 (*_nodes)[m].sum += (*_capacity)[a]; 422 422 423 423 int c = (*_nodes)[m].curr_arc; 424 424 if (c != -1 && _arcs[c ^ 1].target == n) { … … 426 426 } else { 427 427 _edges[index].capacity = (*_capacity)[a]; 428 428 429 429 _arcs[index << 1].prev = -1; 430 430 if ((*_nodes)[n].first_arc != -1) { … … 436 436 437 437 (*_nodes)[m].curr_arc = (index << 1); 438 438 439 439 _arcs[(index << 1) | 1].prev = -1; 440 440 if ((*_nodes)[m].first_arc != -1) { … … 444 444 (*_nodes)[m].first_arc = ((index << 1) | 1); 445 445 _arcs[(index << 1) | 1].target = n; 446 446 447 447 ++index; 448 448 } … … 453 453 _min_cut = std::numeric_limits<Value>::max(); 454 454 455 for (typename Graph::Node n = _first_node; 455 for (typename Graph::Node n = _first_node; 456 456 n != INVALID; n = (*_nodes)[n].next) { 457 457 if ((*_nodes)[n].sum < _min_cut) { … … 478 478 479 479 _heap->clear(); 480 for (typename Graph::Node n = _first_node; 480 for (typename Graph::Node n = _first_node; 481 481 n != INVALID; n = (*_nodes)[n].next) { 482 482 (*_heap_cross_ref)[n] = Heap::PRE_HEAP; … … 498 498 for (int a = (*_nodes)[n].first_arc; a != -1; a = _arcs[a].next) { 499 499 switch (_heap->state(_arcs[a].target)) { 500 case Heap::PRE_HEAP: 500 case Heap::PRE_HEAP: 501 501 { 502 502 Value nv = _edges[a >> 1].capacity; … … 564 564 if (!merged) { 565 565 for (int b = (*_nodes)[n].first_arc; b != -1; b = _arcs[b].next) { 566 (*_nodes)[_arcs[b].target].curr_arc = b; 566 (*_nodes)[_arcs[b].target].curr_arc = b; 567 567 } 568 568 merged = true; … … 574 574 if ((b ^ a) == 1) continue; 575 575 typename Graph::Node o = _arcs[b].target; 576 int c = (*_nodes)[o].curr_arc; 576 int c = (*_nodes)[o].curr_arc; 577 577 if (c != -1 && _arcs[c ^ 1].target == n) { 578 578 _edges[c >> 1].capacity += _edges[b >> 1].capacity; … … 607 607 } else { 608 608 (*_nodes)[n].first_arc = _arcs[a].next; 609 } 609 } 610 610 if (_arcs[a].next != -1) { 611 611 _arcs[_arcs[a].next].prev = _arcs[a].prev; … … 615 615 (*_next_rep)[(*_nodes)[n].last_rep] = m; 616 616 (*_nodes)[n].last_rep = (*_nodes)[m].last_rep; 617 617 618 618 if ((*_nodes)[m].prev != INVALID) { 619 619 (*_nodes)[(*_nodes)[m].prev].next = (*_nodes)[m].next; -
lemon/nearest_neighbor_tsp.h
r1074 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/network_simplex.h
r1080 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 1235 1235 return true; 1236 1236 } 1237 1237 1238 1238 // Check if the upper bound is greater or equal to the lower bound 1239 1239 // on each arc. -
lemon/opt2_tsp.h
r1074 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/path.h
r1044 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/planarity.h
r999 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/preflow.h
r1080 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 555 555 } 556 556 } 557 for (NodeIt n(_graph); n != INVALID; ++n) 557 for (NodeIt n(_graph); n != INVALID; ++n) 558 558 if(n!=_source && n!=_target && _tolerance.positive((*_excess)[n])) 559 559 _level->activate(n); 560 560 561 561 return true; 562 562 } … … 586 586 level = _level->highestActiveLevel(); 587 587 --num; 588 588 589 589 Value excess = (*_excess)[n]; 590 590 int new_level = _level->maxLevel(); -
lemon/radix_sort.h
r1042 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/smart_graph.h
r1025 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 1264 1264 max_red = -1; 1265 1265 } 1266 Parent::notifier(RedNode()).erase(asRedNodeUnsafe(node)); 1266 Parent::notifier(RedNode()).erase(asRedNodeUnsafe(node)); 1267 1267 } else { 1268 1268 first_blue = nodes[n].partition_next; -
lemon/soplex.cc
r877 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/soplex.h
r877 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/suurballe.h
r1080 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/time_measure.h
r1054 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 99 99 static Format format() { return _format; } 100 100 101 101 102 102 ///Read the current time values of the process 103 103 void stamp() … … 523 523 /// on destruction. 524 524 TimeReport(std::string title,std::ostream &os=std::cerr,bool run=true, 525 525 bool active=true) 526 526 : Timer(run), _title(title), _os(os), _active(active) {} 527 527 ///Destructor that prints the ellapsed time … … 530 530 if(_active) _os << _title << *this << std::endl; 531 531 } 532 532 533 533 ///Retrieve the activity status 534 534 -
lemon/unionfind.h
r877 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/adaptors_test.cc
r1084 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/arc_look_up_test.cc
r993 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 69 69 std::istringstream lgfs(lgf); 70 70 DigraphReader<ListDigraph>(graph, lgfs).run(); 71 71 72 72 AllArcLookUp<ListDigraph> lookup(graph); 73 73 74 74 int numArcs = countArcs(graph); 75 75 76 76 int arcCnt = 0; 77 77 for(ListDigraph::NodeIt n1(graph); n1 != INVALID; ++n1) 78 78 for(ListDigraph::NodeIt n2(graph); n2 != INVALID; ++n2) 79 79 for(ListDigraph::Arc a = lookup(n1, n2); a != INVALID; 80 81 80 a = lookup(n1, n2, a)) 81 ++arcCnt; 82 82 check(arcCnt==numArcs, "Wrong total number of arcs"); 83 83 -
test/bellman_ford_test.cc
r1085 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/bfs_test.cc
r1084 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/bpgraph_test.cc
r1026 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 114 114 BpGraph G; 115 115 RedNode 116 n1 = G.addRedNode(), n4 = G.addRedNode(); 116 n1 = G.addRedNode(), n4 = G.addRedNode(); 117 117 BlueNode 118 118 n2 = G.addBlueNode(), n3 = G.addBlueNode(); … … 162 162 BpGraph G; 163 163 RedNode 164 n1 = G.addRedNode(), n4 = G.addRedNode(); 164 n1 = G.addRedNode(), n4 = G.addRedNode(); 165 165 BlueNode 166 166 n2 = G.addBlueNode(), n3 = G.addBlueNode(); … … 217 217 n2 = G.addBlueNode(), 218 218 n3 = G.addBlueNode(); 219 Edge 219 Edge 220 220 e1 = G.addEdge(n1, n2), 221 221 e2 = G.addEdge(n1, n3); -
test/circulation_test.cc
r1084 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/connectivity_test.cc
r1091 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/dfs_test.cc
r1086 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 224 224 check(dfs.run(s1,t1) && dfs.reached(t1),"Node 3 is reachable from Node 6."); 225 225 } 226 226 227 227 { 228 228 NullMap<Node,Arc> myPredMap; -
test/digraph_test.cc
r1085 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/dijkstra_test.cc
r1084 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/edge_set_test.cc
r1084 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/euler_test.cc
r1084 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 103 103 Digraph::Node n = d.addNode(); 104 104 ::lemon::ignore_unused_variable_warning(n); 105 105 106 106 checkDiEulerIt(d); 107 107 checkDiEulerIt(g); -
test/fractional_matching_test.cc
r1085 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/gomory_hu_test.cc
r1084 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/graph_copy_test.cc
r1026 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 54 54 } 55 55 } 56 56 57 57 // Test digraph copy 58 58 GR to; … … 73 73 nodeCrossRef(ncr).arcCrossRef(ecr). 74 74 node(fn, tn).arc(fa, ta).run(); 75 75 76 76 check(countNodes(from) == countNodes(to), "Wrong copy."); 77 77 check(countArcs(from) == countArcs(to), "Wrong copy."); … … 101 101 // Test repeated copy 102 102 digraphCopy(from, to).run(); 103 103 104 104 check(countNodes(from) == countNodes(to), "Wrong copy."); 105 105 check(countArcs(from) == countArcs(to), "Wrong copy."); … … 204 204 // Test repeated copy 205 205 graphCopy(from, to).run(); 206 206 207 207 check(countNodes(from) == countNodes(to), "Wrong copy."); 208 208 check(countEdges(from) == countEdges(to), "Wrong copy."); … … 367 367 // Test repeated copy 368 368 bpGraphCopy(from, to).run(); 369 369 370 370 check(countNodes(from) == countNodes(to), "Wrong copy."); 371 371 check(countRedNodes(from) == countRedNodes(to), "Wrong copy."); -
test/graph_test.cc
r1084 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/graph_test.h
r1027 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/hao_orlin_test.cc
r1084 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/heap_test.cc
r948 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/lgf_reader_writer_test.cc
r1030 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 386 386 writer.arcMap("arc_map1", arc_map); 387 387 writer.arcMap("arc_map2", arc_map, WriterConverter()); 388 writer.node("node", n2); 388 writer.node("node", n2); 389 389 writer.edge("edge", e1); 390 390 writer.arc("arc", graph.direct(e1, false)); … … 493 493 writer.arcMap("arc_map2", arc_map, WriterConverter()); 494 494 writer.node("node", n); 495 writer.redNode("red_node", rn1); 495 writer.redNode("red_node", rn1); 496 496 writer.blueNode("blue_node", bn2); 497 497 writer.edge("edge", e1); -
test/lgf_test.cc
r954 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 15 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 64 64 65 65 66 int main() 66 int main() 67 67 { 68 68 { 69 ListDigraph d; 69 ListDigraph d; 70 70 ListDigraph::Node s,t; 71 71 ListDigraph::ArcMap<int> label(d); … … 94 94 95 95 { 96 ListDigraph d; 96 ListDigraph d; 97 97 std::istringstream input(test_lgf_nomap); 98 98 digraphReader(d, input). … … 111 111 112 112 { 113 ListDigraph d; 113 ListDigraph d; 114 114 std::istringstream input(test_lgf_bad1); 115 115 bool ok=false; … … 118 118 run(); 119 119 } 120 catch (FormatError&) 120 catch (FormatError&) 121 121 { 122 122 ok = true; … … 140 140 141 141 { 142 ListDigraph d; 142 ListDigraph d; 143 143 std::istringstream input(test_lgf_bad2); 144 144 bool ok=false; -
test/lp_test.cc
r1078 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/maps_test.cc
r1086 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/matching_test.cc
r1084 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/max_cardinality_search_test.cc
r955 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 68 68 ProcMap proc; 69 69 HeapCrossRef crossref(g); 70 70 71 71 typedef MaxCardinalitySearch<Digraph,CapMap> 72 72 ::SetCapacityMap<CapMap> … … 82 82 MaxCardType::Heap& heap = const_cast<MaxCardType::Heap&>(heap_const); 83 83 maxcard.heap(heap,crossref); 84 84 85 85 maxcard.capacityMap(cap).cardinalityMap(card).processedMap(proc); 86 86 -
test/max_clique_test.cc
r918 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 55 55 "5 7 14\n" 56 56 "6 7 15\n"; 57 57 58 58 59 59 // Check with general graphs … … 63 63 typedef GrossoLocatelliPullanMc<GR> McAlg; 64 64 typedef McAlg::CliqueNodeIt CliqueIt; 65 65 66 66 // Basic tests 67 67 { … … 82 82 check(static_cast<GR::Node>(it1) == u && ++it1 == INVALID, 83 83 "Wrong CliqueNodeIt"); 84 84 85 85 GR::Node v = g.addNode(); 86 86 check(mc.run(rule) == McAlg::ITERATION_LIMIT, "Wrong termination cause"); … … 110 110 .nodeMap("max_clique", max_clique) 111 111 .run(); 112 112 113 113 McAlg mc(g); 114 114 mc.iterationLimit(50); … … 134 134 typedef GrossoLocatelliPullanMc<FullGraph> McAlg; 135 135 typedef McAlg::CliqueNodeIt CliqueIt; 136 136 137 137 for (int size = 0; size <= 40; size = size * 3 + 1) { 138 138 GR g(size); … … 157 157 GridGraph::NodeMap<char> map(g); 158 158 GrossoLocatelliPullanMc<GridGraph> mc(g); 159 159 160 160 mc.iterationLimit(100); 161 161 check(mc.run(rule) == mc.ITERATION_LIMIT, "Wrong termination cause"); … … 180 180 checkMaxCliqueFullGraph(GrossoLocatelliPullanMc<FullGraph>::DEGREE_BASED); 181 181 checkMaxCliqueFullGraph(GrossoLocatelliPullanMc<FullGraph>::PENALTY_BASED); 182 182 183 183 checkMaxCliqueGridGraph(GrossoLocatelliPullanMc<GridGraph>::RANDOM); 184 184 checkMaxCliqueGridGraph(GrossoLocatelliPullanMc<GridGraph>::DEGREE_BASED); 185 185 checkMaxCliqueGridGraph(GrossoLocatelliPullanMc<GridGraph>::PENALTY_BASED); 186 186 187 187 return 0; 188 188 } -
test/max_flow_test.cc
r1087 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 223 223 { 224 224 DIGRAPH_TYPEDEFS(SmartDigraph); 225 225 226 226 SmartDigraph g; 227 227 SmartDigraph::ArcMap<int> cap(g),iflow(g); … … 383 383 checkMaxFlowAlg<PType2, PreflowStartFunctions<PType2> >(); 384 384 initFlowTest(); 385 385 386 386 // Check EdmondsKarp 387 387 typedef EdmondsKarp<SmartDigraph, SmartDigraph::ArcMap<int> > EKType1; … … 391 391 392 392 initFlowTest(); 393 393 394 394 return 0; 395 395 } -
test/min_cost_arborescence_test.cc
r1084 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/min_cost_flow_test.cc
r877 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/min_mean_cycle_test.cc
r1012 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 211 211 checkMmcAlg<HowardMmc<GR, IntArcMap> >(gr, l3, c3, 0, 1); 212 212 checkMmcAlg<HowardMmc<GR, IntArcMap> >(gr, l4, c4, -1, 1); 213 213 214 214 // Howard with iteration limit 215 215 HowardMmc<GR, IntArcMap> mmc(gr, l1); -
test/nagamochi_ibaraki_test.cc
r1087 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/path_test.cc
r1044 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/radix_sort_test.cc
r1043 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 53 53 template<class T> 54 54 T listsort(typename T::iterator b, typename T::iterator e) 55 { 55 { 56 56 if(b==e) return T(); 57 57 typename T::iterator bn=b; -
test/suurballe_test.cc
r1084 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/time_measure_test.cc
r1083 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
test/tsp_test.cc
r1037 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 42 42 // check(checkMetricCost(g, constMap<Edge>(1)), "Wrong checkMetricCost()"); 43 43 // check(!checkMetricCost(g, constMap<Edge>(-1)), "Wrong checkMetricCost()"); 44 // 44 // 45 45 // FullGraph::EdgeMap<float> cost(g); 46 46 // for (NodeIt u(g); u != INVALID; ++u) { … … 65 65 bool checkTour(const FullGraph &gr, const Container &p) { 66 66 FullGraph::NodeMap<bool> used(gr, false); 67 67 68 68 int node_cnt = 0; 69 69 for (typename Container::const_iterator it = p.begin(); it != p.end(); ++it) { … … 73 73 ++node_cnt; 74 74 } 75 75 76 76 return (node_cnt == gr.nodeNum()); 77 77 } … … 80 80 bool checkTourPath(const FullGraph &gr, const Path<FullGraph> &p) { 81 81 FullGraph::NodeMap<bool> used(gr, false); 82 82 83 83 if (!checkPath(gr, p)) return false; 84 84 if (gr.nodeNum() <= 1 && p.length() != 0) return false; … … 182 182 } 183 183 } 184 184 185 185 check(alg.run() > 0, alg_name + ": Wrong total cost"); 186 186 … … 196 196 check(checkCost(g, path, cost, alg.tourCost()), 197 197 alg_name + ": Wrong tour cost"); 198 198 199 199 check(!Tolerance<double>().less(alg.tourCost(), opt2.run(alg.tourNodes())), 200 200 "2-opt improvement: Wrong total cost"); … … 203 203 check(checkCost(g, opt2.tourNodes(), cost, opt2.tourCost()), 204 204 "2-opt improvement: Wrong tour cost"); 205 205 206 206 check(!Tolerance<double>().less(alg.tourCost(), opt2.run(path)), 207 207 "2-opt improvement: Wrong total cost"); … … 213 213 } 214 214 215 // Algorithm class for Nearest Insertion 215 // Algorithm class for Nearest Insertion 216 216 template <typename CM> 217 217 class NearestInsertionTsp : public InsertionTsp<CM> { … … 224 224 }; 225 225 226 // Algorithm class for Farthest Insertion 226 // Algorithm class for Farthest Insertion 227 227 template <typename CM> 228 228 class FarthestInsertionTsp : public InsertionTsp<CM> { … … 235 235 }; 236 236 237 // Algorithm class for Cheapest Insertion 237 // Algorithm class for Cheapest Insertion 238 238 template <typename CM> 239 239 class CheapestInsertionTsp : public InsertionTsp<CM> { … … 246 246 }; 247 247 248 // Algorithm class for Random Insertion 248 // Algorithm class for Random Insertion 249 249 template <typename CM> 250 250 class RandomInsertionTsp : public InsertionTsp<CM> { -
tools/dimacs-solver.cc
r1006 r1092 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
Note: See TracChangeset
for help on using the changeset viewer.