Add missing pointer initializing in min cost flow classes
authorkpeter
Mon, 06 Oct 2008 15:08:17 +0000
changeset 262390defb96ee61
parent 2622 fa2877651022
child 2624 dc4dd5fc0e25
Add missing pointer initializing in min cost flow classes
lemon/capacity_scaling.h
lemon/cost_scaling.h
lemon/cycle_canceling.h
lemon/network_simplex.h
     1.1 --- a/lemon/capacity_scaling.h	Sun Oct 05 20:08:13 2008 +0000
     1.2 +++ b/lemon/capacity_scaling.h	Mon Oct 06 15:08:17 2008 +0000
     1.3 @@ -255,9 +255,9 @@
     1.4                       const CostMap &cost,
     1.5                       const SupplyMap &supply ) :
     1.6        _graph(graph), _lower(&lower), _capacity(graph), _cost(cost),
     1.7 -      _supply(graph), _flow(0), _local_flow(false),
     1.8 -      _potential(0), _local_potential(false),
     1.9 -      _res_cap(graph), _excess(graph), _pred(graph)
    1.10 +      _supply(graph), _flow(NULL), _local_flow(false),
    1.11 +      _potential(NULL), _local_potential(false),
    1.12 +      _res_cap(graph), _excess(graph), _pred(graph), _dijkstra(NULL)
    1.13      {
    1.14        // Removing non-zero lower bounds
    1.15        _capacity = subMap(capacity, lower);
    1.16 @@ -288,9 +288,9 @@
    1.17                       const CostMap &cost,
    1.18                       const SupplyMap &supply ) :
    1.19        _graph(graph), _lower(NULL), _capacity(capacity), _cost(cost),
    1.20 -      _supply(supply), _flow(0), _local_flow(false),
    1.21 -      _potential(0), _local_potential(false),
    1.22 -      _res_cap(capacity), _excess(graph), _pred(graph)
    1.23 +      _supply(supply), _flow(NULL), _local_flow(false),
    1.24 +      _potential(NULL), _local_potential(false),
    1.25 +      _res_cap(capacity), _excess(graph), _pred(graph), _dijkstra(NULL)
    1.26      {
    1.27        // Checking the sum of supply values
    1.28        Supply sum = 0;
    1.29 @@ -317,9 +317,9 @@
    1.30                       Node s, Node t,
    1.31                       Supply flow_value ) :
    1.32        _graph(graph), _lower(&lower), _capacity(graph), _cost(cost),
    1.33 -      _supply(graph), _flow(0), _local_flow(false),
    1.34 -      _potential(0), _local_potential(false),
    1.35 -      _res_cap(graph), _excess(graph), _pred(graph)
    1.36 +      _supply(graph), _flow(NULL), _local_flow(false),
    1.37 +      _potential(NULL), _local_potential(false),
    1.38 +      _res_cap(graph), _excess(graph), _pred(graph), _dijkstra(NULL)
    1.39      {
    1.40        // Removing non-zero lower bounds
    1.41        _capacity = subMap(capacity, lower);
    1.42 @@ -354,9 +354,9 @@
    1.43                       Node s, Node t,
    1.44                       Supply flow_value ) :
    1.45        _graph(graph), _lower(NULL), _capacity(capacity), _cost(cost),
    1.46 -      _supply(graph, 0), _flow(0), _local_flow(false),
    1.47 -      _potential(0), _local_potential(false),
    1.48 -      _res_cap(capacity), _excess(graph), _pred(graph)
    1.49 +      _supply(graph, 0), _flow(NULL), _local_flow(false),
    1.50 +      _potential(NULL), _local_potential(false),
    1.51 +      _res_cap(capacity), _excess(graph), _pred(graph), _dijkstra(NULL)
    1.52      {
    1.53        _supply[s] =  flow_value;
    1.54        _supply[t] = -flow_value;
     2.1 --- a/lemon/cost_scaling.h	Sun Oct 05 20:08:13 2008 +0000
     2.2 +++ b/lemon/cost_scaling.h	Mon Oct 06 15:08:17 2008 +0000
     2.3 @@ -181,10 +181,10 @@
     2.4      PotentialMap *_potential;
     2.5      bool _local_potential;
     2.6  
     2.7 +    // The residual cost map
     2.8 +    ResidualCostMap<LargeCostMap> _res_cost;
     2.9      // The residual graph
    2.10      ResGraph *_res_graph;
    2.11 -    // The residual cost map
    2.12 -    ResidualCostMap<LargeCostMap> _res_cost;
    2.13      // The reduced cost map
    2.14      ReducedCostMap *_red_cost;
    2.15      // The excess map
    2.16 @@ -209,9 +209,9 @@
    2.17                   const CostMap &cost,
    2.18                   const SupplyMap &supply ) :
    2.19        _graph(graph), _lower(&lower), _capacity(graph), _orig_cost(cost),
    2.20 -      _cost(graph), _supply(graph), _flow(0), _local_flow(false),
    2.21 -      _potential(0), _local_potential(false), _res_cost(_cost),
    2.22 -      _excess(graph, 0)
    2.23 +      _cost(graph), _supply(graph), _flow(NULL), _local_flow(false),
    2.24 +      _potential(NULL), _local_potential(false), _res_cost(_cost),
    2.25 +      _res_graph(NULL), _red_cost(NULL), _excess(graph, 0)
    2.26      {
    2.27        // Removing non-zero lower bounds
    2.28        _capacity = subMap(capacity, lower);
    2.29 @@ -241,9 +241,9 @@
    2.30                   const CostMap &cost,
    2.31                   const SupplyMap &supply ) :
    2.32        _graph(graph), _lower(NULL), _capacity(capacity), _orig_cost(cost),
    2.33 -      _cost(graph), _supply(supply), _flow(0), _local_flow(false),
    2.34 -      _potential(0), _local_potential(false), _res_cost(_cost),
    2.35 -      _excess(graph, 0)
    2.36 +      _cost(graph), _supply(supply), _flow(NULL), _local_flow(false),
    2.37 +      _potential(NULL), _local_potential(false), _res_cost(_cost),
    2.38 +      _res_graph(NULL), _red_cost(NULL), _excess(graph, 0)
    2.39      {
    2.40        // Checking the sum of supply values
    2.41        Supply sum = 0;
    2.42 @@ -270,9 +270,9 @@
    2.43                   Node s, Node t,
    2.44                   Supply flow_value ) :
    2.45        _graph(graph), _lower(&lower), _capacity(graph), _orig_cost(cost),
    2.46 -      _cost(graph), _supply(graph), _flow(0), _local_flow(false),
    2.47 -      _potential(0), _local_potential(false), _res_cost(_cost),
    2.48 -      _excess(graph, 0)
    2.49 +      _cost(graph), _supply(graph), _flow(NULL), _local_flow(false),
    2.50 +      _potential(NULL), _local_potential(false), _res_cost(_cost),
    2.51 +      _res_graph(NULL), _red_cost(NULL), _excess(graph, 0)
    2.52      {
    2.53        // Removing nonzero lower bounds
    2.54        _capacity = subMap(capacity, lower);
    2.55 @@ -306,9 +306,9 @@
    2.56                   Node s, Node t,
    2.57                   Supply flow_value ) :
    2.58        _graph(graph), _lower(NULL), _capacity(capacity), _orig_cost(cost),
    2.59 -      _cost(graph), _supply(graph, 0), _flow(0), _local_flow(false),
    2.60 -      _potential(0), _local_potential(false), _res_cost(_cost),
    2.61 -      _excess(graph, 0)
    2.62 +      _cost(graph), _supply(graph, 0), _flow(NULL), _local_flow(false),
    2.63 +      _potential(NULL), _local_potential(false), _res_cost(_cost),
    2.64 +      _res_graph(NULL), _red_cost(NULL), _excess(graph, 0)
    2.65      {
    2.66        _supply[s] =  flow_value;
    2.67        _supply[t] = -flow_value;
     3.1 --- a/lemon/cycle_canceling.h	Sun Oct 05 20:08:13 2008 +0000
     3.2 +++ b/lemon/cycle_canceling.h	Mon Oct 06 15:08:17 2008 +0000
     3.3 @@ -168,8 +168,9 @@
     3.4                      const CostMap &cost,
     3.5                      const SupplyMap &supply ) :
     3.6        _graph(graph), _lower(&lower), _capacity(graph), _cost(cost),
     3.7 -      _supply(graph), _flow(0), _local_flow(false),
     3.8 -      _potential(0), _local_potential(false), _res_cost(_cost)
     3.9 +      _supply(graph), _flow(NULL), _local_flow(false),
    3.10 +      _potential(NULL), _local_potential(false), _res_graph(NULL),
    3.11 +      _res_cost(_cost)
    3.12      {
    3.13        // Removing non-zero lower bounds
    3.14        _capacity = subMap(capacity, lower);
    3.15 @@ -198,8 +199,9 @@
    3.16                      const CostMap &cost,
    3.17                      const SupplyMap &supply ) :
    3.18        _graph(graph), _lower(NULL), _capacity(capacity), _cost(cost),
    3.19 -      _supply(supply), _flow(0), _local_flow(false),
    3.20 -      _potential(0), _local_potential(false), _res_cost(_cost)
    3.21 +      _supply(supply), _flow(NULL), _local_flow(false),
    3.22 +      _potential(NULL), _local_potential(false), _res_graph(NULL),
    3.23 +      _res_cost(_cost)
    3.24      {
    3.25        // Checking the sum of supply values
    3.26        Supply sum = 0;
    3.27 @@ -226,8 +228,9 @@
    3.28                      Node s, Node t,
    3.29                      Supply flow_value ) :
    3.30        _graph(graph), _lower(&lower), _capacity(graph), _cost(cost),
    3.31 -      _supply(graph), _flow(0), _local_flow(false),
    3.32 -      _potential(0), _local_potential(false), _res_cost(_cost)
    3.33 +      _supply(graph), _flow(NULL), _local_flow(false),
    3.34 +      _potential(NULL), _local_potential(false), _res_graph(NULL),
    3.35 +      _res_cost(_cost)
    3.36      {
    3.37        // Removing non-zero lower bounds
    3.38        _capacity = subMap(capacity, lower);
    3.39 @@ -261,8 +264,9 @@
    3.40                      Node s, Node t,
    3.41                      Supply flow_value ) :
    3.42        _graph(graph), _lower(NULL), _capacity(capacity), _cost(cost),
    3.43 -      _supply(graph, 0), _flow(0), _local_flow(false),
    3.44 -      _potential(0), _local_potential(false), _res_cost(_cost)
    3.45 +      _supply(graph, 0), _flow(NULL), _local_flow(false),
    3.46 +      _potential(NULL), _local_potential(false), _res_graph(NULL),
    3.47 +      _res_cost(_cost)
    3.48      {
    3.49        _supply[s] =  flow_value;
    3.50        _supply[t] = -flow_value;
     4.1 --- a/lemon/network_simplex.h	Sun Oct 05 20:08:13 2008 +0000
     4.2 +++ b/lemon/network_simplex.h	Mon Oct 06 15:08:17 2008 +0000
     4.3 @@ -32,8 +32,6 @@
     4.4  #include <lemon/smart_graph.h>
     4.5  #include <lemon/math.h>
     4.6  
     4.7 -#define _DEBUG_
     4.8 -
     4.9  namespace lemon {
    4.10  
    4.11    /// \addtogroup min_cost_flow
    4.12 @@ -609,7 +607,7 @@
    4.13        _potential(_graph), _depth(_graph), _parent(_graph),
    4.14        _pred_edge(_graph), _thread(_graph), _forward(_graph),
    4.15        _state(_graph), _red_cost(_graph, _cost, _potential),
    4.16 -      _flow_result(0), _potential_result(0),
    4.17 +      _flow_result(NULL), _potential_result(NULL),
    4.18        _local_flow(false), _local_potential(false),
    4.19        _node_ref(graph), _edge_ref(graph)
    4.20      {
    4.21 @@ -659,7 +657,7 @@
    4.22        _potential(_graph), _depth(_graph), _parent(_graph),
    4.23        _pred_edge(_graph), _thread(_graph), _forward(_graph),
    4.24        _state(_graph), _red_cost(_graph, _cost, _potential),
    4.25 -      _flow_result(0), _potential_result(0),
    4.26 +      _flow_result(NULL), _potential_result(NULL),
    4.27        _local_flow(false), _local_potential(false),
    4.28        _node_ref(graph), _edge_ref(graph)
    4.29      {
    4.30 @@ -703,7 +701,7 @@
    4.31        _potential(_graph), _depth(_graph), _parent(_graph),
    4.32        _pred_edge(_graph), _thread(_graph), _forward(_graph),
    4.33        _state(_graph), _red_cost(_graph, _cost, _potential),
    4.34 -      _flow_result(0), _potential_result(0),
    4.35 +      _flow_result(NULL), _potential_result(NULL),
    4.36        _local_flow(false), _local_potential(false),
    4.37        _node_ref(graph), _edge_ref(graph)
    4.38      {
    4.39 @@ -753,7 +751,7 @@
    4.40        _potential(_graph), _depth(_graph), _parent(_graph),
    4.41        _pred_edge(_graph), _thread(_graph), _forward(_graph),
    4.42        _state(_graph), _red_cost(_graph, _cost, _potential),
    4.43 -      _flow_result(0), _potential_result(0),
    4.44 +      _flow_result(NULL), _potential_result(NULL),
    4.45        _local_flow(false), _local_potential(false),
    4.46        _node_ref(graph), _edge_ref(graph)
    4.47      {