gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
Resolve gcc-4.3 warning in lemon/network_simplex.h
0 1 0
default
1 file changed with 2 insertions and 2 deletions:
↑ Collapse diff ↑
Ignore white space 96 line context
... ...
@@ -1000,98 +1000,98 @@
1000 1000
    /// the \c Value type of the map.
1001 1001
    ///
1002 1002
    /// \pre \ref run() must be called before using this function.
1003 1003
    template <typename FlowMap>
1004 1004
    void flowMap(FlowMap &map) const {
1005 1005
      for (ArcIt a(_graph); a != INVALID; ++a) {
1006 1006
        map.set(a, _flow[_arc_id[a]]);
1007 1007
      }
1008 1008
    }
1009 1009

	
1010 1010
    /// \brief Return the potential (dual value) of the given node.
1011 1011
    ///
1012 1012
    /// This function returns the potential (dual value) of the
1013 1013
    /// given node.
1014 1014
    ///
1015 1015
    /// \pre \ref run() must be called before using this function.
1016 1016
    Cost potential(const Node& n) const {
1017 1017
      return _pi[_node_id[n]];
1018 1018
    }
1019 1019

	
1020 1020
    /// \brief Return the potential map (the dual solution).
1021 1021
    ///
1022 1022
    /// This function copies the potential (dual value) of each node
1023 1023
    /// into the given map.
1024 1024
    /// The \c Cost type of the algorithm must be convertible to the
1025 1025
    /// \c Value type of the map.
1026 1026
    ///
1027 1027
    /// \pre \ref run() must be called before using this function.
1028 1028
    template <typename PotentialMap>
1029 1029
    void potentialMap(PotentialMap &map) const {
1030 1030
      for (NodeIt n(_graph); n != INVALID; ++n) {
1031 1031
        map.set(n, _pi[_node_id[n]]);
1032 1032
      }
1033 1033
    }
1034 1034

	
1035 1035
    /// @}
1036 1036

	
1037 1037
  private:
1038 1038

	
1039 1039
    // Initialize internal data structures
1040 1040
    bool init() {
1041 1041
      if (_node_num == 0) return false;
1042 1042

	
1043 1043
      // Check the sum of supply values
1044 1044
      _sum_supply = 0;
1045 1045
      for (int i = 0; i != _node_num; ++i) {
1046 1046
        _sum_supply += _supply[i];
1047 1047
      }
1048
      if ( !(_stype == GEQ && _sum_supply <= 0 ||
1049
             _stype == LEQ && _sum_supply >= 0) ) return false;
1048
      if ( !((_stype == GEQ && _sum_supply <= 0) ||
1049
             (_stype == LEQ && _sum_supply >= 0)) ) return false;
1050 1050

	
1051 1051
      // Remove non-zero lower bounds
1052 1052
      if (_have_lower) {
1053 1053
        for (int i = 0; i != _arc_num; ++i) {
1054 1054
          Value c = _lower[i];
1055 1055
          if (c >= 0) {
1056 1056
            _cap[i] = _upper[i] < INF ? _upper[i] - c : INF;
1057 1057
          } else {
1058 1058
            _cap[i] = _upper[i] < INF + c ? _upper[i] - c : INF;
1059 1059
          }
1060 1060
          _supply[_source[i]] -= c;
1061 1061
          _supply[_target[i]] += c;
1062 1062
        }
1063 1063
      } else {
1064 1064
        for (int i = 0; i != _arc_num; ++i) {
1065 1065
          _cap[i] = _upper[i];
1066 1066
        }
1067 1067
      }
1068 1068

	
1069 1069
      // Initialize artifical cost
1070 1070
      Cost ART_COST;
1071 1071
      if (std::numeric_limits<Cost>::is_exact) {
1072 1072
        ART_COST = std::numeric_limits<Cost>::max() / 4 + 1;
1073 1073
      } else {
1074 1074
        ART_COST = std::numeric_limits<Cost>::min();
1075 1075
        for (int i = 0; i != _arc_num; ++i) {
1076 1076
          if (_cost[i] > ART_COST) ART_COST = _cost[i];
1077 1077
        }
1078 1078
        ART_COST = (ART_COST + 1) * _node_num;
1079 1079
      }
1080 1080

	
1081 1081
      // Initialize arc maps
1082 1082
      for (int i = 0; i != _arc_num; ++i) {
1083 1083
        _flow[i] = 0;
1084 1084
        _state[i] = STATE_LOWER;
1085 1085
      }
1086 1086
      
1087 1087
      // Set data for the artificial root node
1088 1088
      _root = _node_num;
1089 1089
      _parent[_root] = -1;
1090 1090
      _pred[_root] = -1;
1091 1091
      _thread[_root] = 0;
1092 1092
      _rev_thread[0] = _root;
1093 1093
      _succ_num[_root] = _node_num + 1;
1094 1094
      _last_succ[_root] = _root - 1;
1095 1095
      _supply[_root] = -_sum_supply;
1096 1096
      _pi[_root] = _sum_supply < 0 ? -ART_COST : ART_COST;
1097 1097

	
0 comments (0 inline)