Changeset 2509:a8081c9cd96a in lemon-0.x
- Timestamp:
- 11/14/07 07:28:08 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3374
- Location:
- lemon
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/capacity_scaling.h
r2507 r2509 27 27 28 28 #include <vector> 29 #include <lemon/graph_adaptor.h> 29 30 #include <lemon/dijkstra.h> 30 #include <lemon/graph_adaptor.h>31 31 32 32 #define WITH_SCALING … … 44 44 45 45 /// \brief Implementation of the capacity scaling version of the 46 /// successive shortest path algorithm for finding a minimum cost flow. 46 /// successive shortest path algorithm for finding a minimum cost 47 /// flow. 47 48 /// 48 /// \ref lemon::CapacityScaling "CapacityScaling" implements a 49 /// capacity scaling algorithm for finding a minimum cost flow. 49 /// \ref lemon::CapacityScaling "CapacityScaling" implements the 50 /// capacity scaling version of the successive shortest path 51 /// algorithm for finding a minimum cost flow. 50 52 /// 51 53 /// \param Graph The directed graph type the algorithm runs on. … … 58 60 /// - Edge capacities and costs should be nonnegative integers. 59 61 /// However \c CostMap::Value should be signed type. 60 /// - Supply values should be integers.62 /// - Supply values should be signed integers. 61 63 /// - \c LowerMap::Value must be convertible to 62 64 /// \c CapacityMap::Value and \c CapacityMap::Value must be … … 114 116 public: 115 117 116 typedef typename MapBase<ResEdge, Cost>::Value Value;117 typedef typename MapBase<ResEdge, Cost>::Key Key;118 119 118 ReducedCostMap( const ResGraph &_gr, 120 119 const CostMap &_cost, … … 122 121 gr(_gr), cost_map(_cost), pot_map(_pot) {} 123 122 124 Value operator[](const Key&e) const {123 Cost operator[](const ResEdge &e) const { 125 124 return ResGraph::forward(e) ? 126 125 cost_map[e] - pot_map[gr.source(e)] + pot_map[gr.target(e)] : … … 130 129 }; //class ReducedCostMap 131 130 132 /// \brief Map adaptor for \ref lemon::Dijkstra "Dijkstra" class to133 /// update node potentials.131 /// \brief Map class for the \ref lemon::Dijkstra "Dijkstra" 132 /// algorithm to update node potentials. 134 133 class PotentialUpdateMap : public MapBase<ResNode, Cost> 135 134 { … … 142 141 public: 143 142 144 typedef typename MapBase<ResNode, Cost>::Value Value;145 typedef typename MapBase<ResNode, Cost>::Key Key;146 147 143 void potentialMap(PotentialMap &_pot) { 148 144 pot = &_pot; … … 153 149 } 154 150 155 void set(const Key &n, const Value&v) {151 void set(const ResNode &n, const Cost &v) { 156 152 data.push_back(Pair(n, v)); 157 153 } … … 186 182 187 183 /// \brief Map adaptor class for filtering edges with at least 188 /// \c delta residual capacity 184 /// \c delta residual capacity. 189 185 class DeltaFilterMap : public MapBase<ResEdge, bool> 190 186 { … … 196 192 public: 197 193 198 typedef typename MapBase<ResEdge, Cost>::Value Value;199 typedef typename MapBase<ResEdge, Cost>::Key Key;200 201 194 DeltaFilterMap(const ResGraph &_gr, const Capacity &_delta) : 202 195 gr(_gr), delta(_delta) {} 203 196 204 Value operator[](const Key&e) const {197 bool operator[](const ResEdge &e) const { 205 198 return gr.rescap(e) >= delta; 206 199 } … … 299 292 /// \brief The delta parameter used for capacity scaling. 300 293 Capacity delta; 301 /// \brief Edge filter map. 294 /// \brief Edge filter map for filtering edges with at least 295 /// \c delta residual capacity. 302 296 DeltaFilterMap delta_filter; 303 /// \brief The delta residual graph. 297 /// \brief The delta residual graph (i.e. the subgraph of the 298 /// residual graph consisting of edges with at least \c delta 299 /// residual capacity). 304 300 DeltaResGraph dres_graph; 305 301 /// \brief Map for identifing deficit nodes. … … 574 570 if (red_cost[e] < 0) { 575 571 res_graph.augment(e, r = res_graph.rescap(e)); 572 imbalance[dres_graph.source(e)] -= r; 576 573 imbalance[dres_graph.target(e)] += r; 577 imbalance[dres_graph.source(e)] -= r;578 574 } 579 575 } -
lemon/cycle_canceling.h
r2457 r2509 26 26 27 27 #include <vector> 28 #include <lemon/graph_adaptor.h> 28 29 #include <lemon/circulation.h> 29 #include <lemon/graph_adaptor.h>30 30 31 31 /// \brief The used cycle-canceling method. … … 80 80 /// - Edge capacities and costs should be nonnegative integers. 81 81 /// However \c CostMap::Value should be signed type. 82 /// - Supply values should be integers.82 /// - Supply values should be signed integers. 83 83 /// - \c LowerMap::Value must be convertible to 84 84 /// \c CapacityMap::Value and \c CapacityMap::Value must be … … 132 132 public: 133 133 134 typedef typename MapBase<ResEdge, Cost>::Value Value;135 typedef typename MapBase<ResEdge, Cost>::Key Key;136 137 134 ResCostMap(const CostMap &_cost) : cost_map(_cost) {} 138 135 139 Value operator[](const Key&e) const {136 Cost operator[](const ResEdge &e) const { 140 137 return ResGraph::forward(e) ? cost_map[e] : -cost_map[e]; 141 138 } -
lemon/min_cost_flow.h
r2474 r2509 57 57 /// - Edge capacities and costs should be nonnegative integers. 58 58 /// However \c CostMap::Value should be signed type. 59 /// - Supply values should be integers.59 /// - Supply values should be signed integers. 60 60 /// - \c LowerMap::Value must be convertible to 61 61 /// \c CapacityMap::Value and \c CapacityMap::Value must be -
lemon/min_mean_cycle.h
r2437 r2509 23 23 /// 24 24 /// \file 25 /// \brief Karp algorithm for finding a minimum mean cycle. 26 25 /// \brief Karp's algorithm for finding a minimum mean (directed) cycle. 26 27 #include <vector> 27 28 #include <lemon/graph_utils.h> 28 29 #include <lemon/topology.h> … … 64 65 protected: 65 66 66 /// \brief Data st urcture for path data.67 /// \brief Data structure for path data. 67 68 struct PathData 68 69 { … … 151 152 // Creating vectors for all nodes 152 153 int n = nodes.size(); 153 for (int i = 0; i < n odes.size(); ++i) {154 for (int i = 0; i < n; ++i) { 154 155 dmap[nodes[i]].resize(n + 1); 155 156 } -
lemon/network_simplex.h
r2471 r2509 27 27 28 28 #include <limits> 29 #include <lemon/graph_adaptor.h> 30 #include <lemon/graph_utils.h> 29 31 #include <lemon/smart_graph.h> 30 #include <lemon/graph_utils.h>31 32 32 33 /// \brief The pivot rule used in the algorithm. … … 86 87 /// - Edge capacities and costs should be nonnegative integers. 87 88 /// However \c CostMap::Value should be signed type. 88 /// - Supply values should be integers.89 /// - Supply values should be signed integers. 89 90 /// - \c LowerMap::Value must be convertible to 90 91 /// \c CapacityMap::Value and \c CapacityMap::Value must be … … 149 150 public: 150 151 151 typedef typename MapBase<Edge, Cost>::Value Value;152 typedef typename MapBase<Edge, Cost>::Key Key;153 154 152 ReducedCostMap( const SGraph &_gr, 155 153 const SCostMap &_cm, … … 157 155 gr(_gr), cost_map(_cm), pot_map(_pm) {} 158 156 159 Value operator[](const Key&e) const {157 Cost operator[](const Edge &e) const { 160 158 return cost_map[e] - pot_map[gr.source(e)] + pot_map[gr.target(e)]; 161 159 }
Note: See TracChangeset
for help on using the changeset viewer.