lemon/network_simplex.h
changeset 904 16d466589b54
parent 663 8b0df68370a4
child 892 cbf32bf95954
equal deleted inserted replaced
15:8729eb5cd438 30:832716532a52
  1040       // Initialize artifical cost
  1040       // Initialize artifical cost
  1041       Cost ART_COST;
  1041       Cost ART_COST;
  1042       if (std::numeric_limits<Cost>::is_exact) {
  1042       if (std::numeric_limits<Cost>::is_exact) {
  1043         ART_COST = std::numeric_limits<Cost>::max() / 2 + 1;
  1043         ART_COST = std::numeric_limits<Cost>::max() / 2 + 1;
  1044       } else {
  1044       } else {
  1045         ART_COST = std::numeric_limits<Cost>::min();
  1045         ART_COST = 0;
  1046         for (int i = 0; i != _arc_num; ++i) {
  1046         for (int i = 0; i != _arc_num; ++i) {
  1047           if (_cost[i] > ART_COST) ART_COST = _cost[i];
  1047           if (_cost[i] > ART_COST) ART_COST = _cost[i];
  1048         }
  1048         }
  1049         ART_COST = (ART_COST + 1) * _node_num;
  1049         ART_COST = (ART_COST + 1) * _node_num;
  1050       }
  1050       }
  1455       
  1455       
  1456       // Shift potentials to meet the requirements of the GEQ/LEQ type
  1456       // Shift potentials to meet the requirements of the GEQ/LEQ type
  1457       // optimality conditions
  1457       // optimality conditions
  1458       if (_sum_supply == 0) {
  1458       if (_sum_supply == 0) {
  1459         if (_stype == GEQ) {
  1459         if (_stype == GEQ) {
  1460           Cost max_pot = std::numeric_limits<Cost>::min();
  1460           Cost max_pot = -std::numeric_limits<Cost>::max();
  1461           for (int i = 0; i != _node_num; ++i) {
  1461           for (int i = 0; i != _node_num; ++i) {
  1462             if (_pi[i] > max_pot) max_pot = _pi[i];
  1462             if (_pi[i] > max_pot) max_pot = _pi[i];
  1463           }
  1463           }
  1464           if (max_pot > 0) {
  1464           if (max_pot > 0) {
  1465             for (int i = 0; i != _node_num; ++i)
  1465             for (int i = 0; i != _node_num; ++i)