lemon/network_simplex.h
changeset 877 141f9c0db4a3
parent 862 b6f76c95992e
child 889 0bca98cbebbb
     1.1 --- a/lemon/network_simplex.h	Wed Mar 17 12:35:52 2010 +0100
     1.2 +++ b/lemon/network_simplex.h	Sat Mar 06 14:35:12 2010 +0000
     1.3 @@ -2,7 +2,7 @@
     1.4   *
     1.5   * This file is a part of LEMON, a generic C++ optimization library.
     1.6   *
     1.7 - * Copyright (C) 2003-2009
     1.8 + * Copyright (C) 2003-2010
     1.9   * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.10   * (Egervary Research Group on Combinatorial Optimization, EGRES).
    1.11   *
    1.12 @@ -97,7 +97,7 @@
    1.13        /// infinite upper bound.
    1.14        UNBOUNDED
    1.15      };
    1.16 -    
    1.17 +
    1.18      /// \brief Constants for selecting the type of the supply constraints.
    1.19      ///
    1.20      /// Enum type containing constants for selecting the supply type,
    1.21 @@ -115,7 +115,7 @@
    1.22        /// supply/demand constraints in the definition of the problem.
    1.23        LEQ
    1.24      };
    1.25 -    
    1.26 +
    1.27      /// \brief Constants for selecting the pivot rule.
    1.28      ///
    1.29      /// Enum type containing constants for selecting the pivot rule for
    1.30 @@ -158,7 +158,7 @@
    1.31        /// candidate list and extends this list in every iteration.
    1.32        ALTERING_LIST
    1.33      };
    1.34 -    
    1.35 +
    1.36    private:
    1.37  
    1.38      TEMPLATE_DIGRAPH_TYPEDEFS(GR);
    1.39 @@ -227,11 +227,11 @@
    1.40      int first, second, right, last;
    1.41      int stem, par_stem, new_stem;
    1.42      Value delta;
    1.43 -    
    1.44 +
    1.45      const Value MAX;
    1.46  
    1.47    public:
    1.48 -  
    1.49 +
    1.50      /// \brief Constant for infinite upper bounds (capacities).
    1.51      ///
    1.52      /// Constant for infinite upper bounds (capacities).
    1.53 @@ -498,8 +498,8 @@
    1.54            }
    1.55          }
    1.56          if (_curr_length == 0) return false;
    1.57 -      
    1.58 -      search_end:        
    1.59 +
    1.60 +      search_end:
    1.61          _minor_count = 1;
    1.62          _next_arc = e;
    1.63          return true;
    1.64 @@ -608,7 +608,7 @@
    1.65            }
    1.66          }
    1.67          if (_curr_length == 0) return false;
    1.68 -        
    1.69 +
    1.70        search_end:
    1.71  
    1.72          // Make heap of the candidate list (approximating a partial sort)
    1.73 @@ -634,7 +634,7 @@
    1.74      ///
    1.75      /// \param graph The digraph the algorithm runs on.
    1.76      /// \param arc_mixing Indicate if the arcs have to be stored in a
    1.77 -    /// mixed order in the internal data structure. 
    1.78 +    /// mixed order in the internal data structure.
    1.79      /// In special cases, it could lead to better overall performance,
    1.80      /// but it is usually slower. Therefore it is disabled by default.
    1.81      NetworkSimplex(const GR& graph, bool arc_mixing = false) :
    1.82 @@ -649,7 +649,7 @@
    1.83          "The flow type of NetworkSimplex must be signed");
    1.84        LEMON_ASSERT(std::numeric_limits<Cost>::is_signed,
    1.85          "The cost type of NetworkSimplex must be signed");
    1.86 -        
    1.87 +
    1.88        // Reset data structures
    1.89        reset();
    1.90      }
    1.91 @@ -763,7 +763,7 @@
    1.92        _supply[_node_id[t]] = -k;
    1.93        return *this;
    1.94      }
    1.95 -    
    1.96 +
    1.97      /// \brief Set the type of the supply constraints.
    1.98      ///
    1.99      /// This function sets the type of the supply/demand constraints.
   1.100 @@ -789,7 +789,7 @@
   1.101      ///
   1.102      /// This function runs the algorithm.
   1.103      /// The paramters can be specified using functions \ref lowerMap(),
   1.104 -    /// \ref upperMap(), \ref costMap(), \ref supplyMap(), \ref stSupply(), 
   1.105 +    /// \ref upperMap(), \ref costMap(), \ref supplyMap(), \ref stSupply(),
   1.106      /// \ref supplyType().
   1.107      /// For example,
   1.108      /// \code
   1.109 @@ -944,12 +944,12 @@
   1.110            _target[i] = _node_id[_graph.target(a)];
   1.111          }
   1.112        }
   1.113 -      
   1.114 +
   1.115        // Reset parameters
   1.116        resetParams();
   1.117        return *this;
   1.118      }
   1.119 -    
   1.120 +
   1.121      /// @}
   1.122  
   1.123      /// \name Query Functions
   1.124 @@ -1089,7 +1089,7 @@
   1.125          _flow[i] = 0;
   1.126          _state[i] = STATE_LOWER;
   1.127        }
   1.128 -      
   1.129 +
   1.130        // Set data for the artificial root node
   1.131        _root = _node_num;
   1.132        _parent[_root] = -1;
   1.133 @@ -1263,7 +1263,7 @@
   1.134        // Search the cycle along the path form the second node to the root
   1.135        for (int u = second; u != join; u = _parent[u]) {
   1.136          e = _pred[u];
   1.137 -        d = _forward[u] ? 
   1.138 +        d = _forward[u] ?
   1.139            (_cap[e] >= MAX ? INF : _cap[e] - _flow[e]) : _flow[e];
   1.140          if (d <= delta) {
   1.141            delta = d;
   1.142 @@ -1567,7 +1567,7 @@
   1.143            updatePotential();
   1.144          }
   1.145        }
   1.146 -      
   1.147 +
   1.148        // Check feasibility
   1.149        for (int e = _search_arc_num; e != _all_arc_num; ++e) {
   1.150          if (_flow[e] != 0) return INFEASIBLE;
   1.151 @@ -1584,7 +1584,7 @@
   1.152            }
   1.153          }
   1.154        }
   1.155 -      
   1.156 +
   1.157        // Shift potentials to meet the requirements of the GEQ/LEQ type
   1.158        // optimality conditions
   1.159        if (_sum_supply == 0) {