lemon/network_simplex.h
branch1.2
changeset 974 2c48ba00fccd
parent 877 141f9c0db4a3
parent 891 5205145fabf6
equal deleted inserted replaced
29:7d65283874b3 31:ab65107fbc11
  1075       // Initialize artifical cost
  1075       // Initialize artifical cost
  1076       Cost ART_COST;
  1076       Cost ART_COST;
  1077       if (std::numeric_limits<Cost>::is_exact) {
  1077       if (std::numeric_limits<Cost>::is_exact) {
  1078         ART_COST = std::numeric_limits<Cost>::max() / 2 + 1;
  1078         ART_COST = std::numeric_limits<Cost>::max() / 2 + 1;
  1079       } else {
  1079       } else {
  1080         ART_COST = std::numeric_limits<Cost>::min();
  1080         ART_COST = 0;
  1081         for (int i = 0; i != _arc_num; ++i) {
  1081         for (int i = 0; i != _arc_num; ++i) {
  1082           if (_cost[i] > ART_COST) ART_COST = _cost[i];
  1082           if (_cost[i] > ART_COST) ART_COST = _cost[i];
  1083         }
  1083         }
  1084         ART_COST = (ART_COST + 1) * _node_num;
  1084         ART_COST = (ART_COST + 1) * _node_num;
  1085       }
  1085       }
  1587 
  1587 
  1588       // Shift potentials to meet the requirements of the GEQ/LEQ type
  1588       // Shift potentials to meet the requirements of the GEQ/LEQ type
  1589       // optimality conditions
  1589       // optimality conditions
  1590       if (_sum_supply == 0) {
  1590       if (_sum_supply == 0) {
  1591         if (_stype == GEQ) {
  1591         if (_stype == GEQ) {
  1592           Cost max_pot = std::numeric_limits<Cost>::min();
  1592           Cost max_pot = -std::numeric_limits<Cost>::max();
  1593           for (int i = 0; i != _node_num; ++i) {
  1593           for (int i = 0; i != _node_num; ++i) {
  1594             if (_pi[i] > max_pot) max_pot = _pi[i];
  1594             if (_pi[i] > max_pot) max_pot = _pi[i];
  1595           }
  1595           }
  1596           if (max_pot > 0) {
  1596           if (max_pot > 0) {
  1597             for (int i = 0; i != _node_num; ++i)
  1597             for (int i = 0; i != _node_num; ++i)