[Lemon-commits] [lemon_svn] marci: r1196 - in hugo/trunk/src: demo hugo work/marci work/marci/lp

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:43:48 CET 2006


Author: marci
Date: Mon Sep 20 11:05:19 2004
New Revision: 1196

Added:
   hugo/trunk/src/hugo/tight_edge_filter_map.h
      - copied unchanged from r1194, /hugo/trunk/src/demo/tight_edge_filter_map.h
Removed:
   hugo/trunk/src/demo/tight_edge_filter_map.h
Modified:
   hugo/trunk/src/demo/sub_graph_wrapper_demo.cc
   hugo/trunk/src/hugo/graph_wrapper.h
   hugo/trunk/src/work/marci/augmenting_flow.h
   hugo/trunk/src/work/marci/lp/lp_solver_wrapper.h

Log:


Modified: hugo/trunk/src/demo/sub_graph_wrapper_demo.cc
==============================================================================
--- hugo/trunk/src/demo/sub_graph_wrapper_demo.cc	(original)
+++ hugo/trunk/src/demo/sub_graph_wrapper_demo.cc	Mon Sep 20 11:05:19 2004
@@ -14,7 +14,7 @@
 #include <hugo/graph_wrapper.h>
 #include <hugo/dimacs.h>
 #include <hugo/preflow.h>
-#include <tight_edge_filter_map.h>
+#include <hugo/tight_edge_filter_map.h>
 
 using namespace hugo;
 

Modified: hugo/trunk/src/hugo/graph_wrapper.h
==============================================================================
--- hugo/trunk/src/hugo/graph_wrapper.h	(original)
+++ hugo/trunk/src/hugo/graph_wrapper.h	Mon Sep 20 11:05:19 2004
@@ -1096,8 +1096,8 @@
     public:
       typedef Number ValueType;
       typedef Edge KeyType;
-      ResCap(const ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>& _res_graph) : 
-	res_graph(&_res_graph) { }
+      ResCap(const ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>& 
+	     _res_graph) : res_graph(&_res_graph) { }
       Number operator[](const Edge& e) const { 
 	if (res_graph->forward(e)) 
 	  return (*(res_graph->capacity))[e]-(*(res_graph->flow))[e]; 

Modified: hugo/trunk/src/work/marci/augmenting_flow.h
==============================================================================
--- hugo/trunk/src/work/marci/augmenting_flow.h	(original)
+++ hugo/trunk/src/work/marci/augmenting_flow.h	Mon Sep 20 11:05:19 2004
@@ -9,7 +9,7 @@
 #include <bfs_dfs.h>
 #include <hugo/invalid.h>
 #include <hugo/maps.h>
-#include <tight_edge_filter_map.h>
+#include <hugo/tight_edge_filter_map.h>
 
 /// \file
 /// \brief Maximum flow algorithms.
@@ -247,6 +247,8 @@
   bool AugmentingFlow<Graph, Num, CapMap, FlowMap>::augmentOnShortestPath()
   {
     ResGW res_graph(*g, *capacity, *flow);
+    typename ResGW::ResCap res_cap(res_graph);
+
     bool _augment=false;
 
     //ReachedMap level(res_graph);
@@ -267,9 +269,9 @@
 	Node w=res_graph.head(e);
 	pred.set(w, e);
 	if (pred[v]!=INVALID) {
-	  free.set(w, std::min(free[v], res_graph.resCap(e)));
+	  free.set(w, std::min(free[v], res_cap[e]));
 	} else {
-	  free.set(w, res_graph.resCap(e));
+	  free.set(w, res_cap[e]);
 	}
 	if (res_graph.head(e)==t) { _augment=true; break; }
       }
@@ -295,6 +297,8 @@
   bool AugmentingFlow<Graph, Num, CapMap, FlowMap>::augmentOnShortestPath2()
   {
     ResGW res_graph(*g, *capacity, *flow);
+    typename ResGW::ResCap res_cap(res_graph);
+
     bool _augment=false;
 
     if (status!=AFTER_FAST_AUGMENTING) {
@@ -324,9 +328,9 @@
 	Node w=res_graph.head(e);
 	pred.set(w, e);
 	if (pred[v]!=INVALID) {
-	  free.set(w, std::min(free[v], res_graph.resCap(e)));
+	  free.set(w, std::min(free[v], res_cap[e]));
 	} else {
-	  free.set(w, res_graph.resCap(e));
+	  free.set(w, res_cap[e]);
 	}
 	if (res_graph.head(e)==t) { _augment=true; break; }
       }
@@ -357,6 +361,7 @@
     bool _augment=false;
 
     ResGW res_graph(*g, *capacity, *flow);
+    typename ResGW::ResCap res_cap(res_graph);
 
     //bfs for distances on the residual graph
     //ReachedMap level(res_graph);
@@ -392,7 +397,7 @@
 	  //original_edge.update();
 	  original_edge.set(f, e);
 	  //residual_capacity.update();
-	  residual_capacity.set(f, res_graph.resCap(e));
+	  residual_capacity.set(f, res_cap[e]);
 	} else {
 	  if (dist[res_graph.head(e)]==(dist[res_graph.tail(e)]+1)) {
 	    typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.tail(e)],
@@ -400,7 +405,7 @@
 	    //original_edge.update();
 	    original_edge.set(f, e);
 	    //residual_capacity.update();
-	    residual_capacity.set(f, res_graph.resCap(e));
+	    residual_capacity.set(f, res_cap[e]);
 	  }
 	}
       }
@@ -472,6 +477,7 @@
     bool _augment=false;
 
     ResGW res_graph(*g, *capacity, *flow);
+    typename ResGW::ResCap res_cap(res_graph);
 
     //Potential map, for distances from s
     typename ResGW::template NodeMap<int> potential(res_graph, 0);
@@ -549,12 +555,12 @@
 	    pred.set(w, typename ErasingResGW::Edge(dfs));
 	    if (pred[v]!=INVALID) {
 	      free1.set
-		(w, std::min(free1[v], res_graph.resCap
-			     (typename ErasingResGW::Edge(dfs))));
+		(w, std::min(free1[v], res_cap
+			     [typename ErasingResGW::Edge(dfs)]));
 	    } else {
 	      free1.set
-		(w, res_graph.resCap
-		 (typename ErasingResGW::Edge(dfs)));
+		(w, res_cap
+		 [typename ErasingResGW::Edge(dfs)]);
 	    }
 
 	    if (w==t) {
@@ -576,7 +582,7 @@
 	  typename ErasingResGW::Edge e=pred[n];
 	  res_graph.augment(e, augment_value);
 	  n=erasing_res_graph.tail(e);
-	  if (res_graph.resCap(e)==0)
+	  if (res_cap[e]==0)
 	    erasing_res_graph.erase(e);
 	}
       }

Modified: hugo/trunk/src/work/marci/lp/lp_solver_wrapper.h
==============================================================================
--- hugo/trunk/src/work/marci/lp/lp_solver_wrapper.h	(original)
+++ hugo/trunk/src/work/marci/lp/lp_solver_wrapper.h	Mon Sep 20 11:05:19 2004
@@ -339,9 +339,10 @@
 		      double lo, double up) {
       lpx_set_row_bnds(lp, row_iter_map[row_it], bound_type, lo, up);
     }
-//   void setObjCoef(const RowIt& row_it, double obj_coef) { 
-//     lpx_set_obj_coef(lp, row_iter_map[row_it], obj_coef);
-//   }
+    ///.
+    void setObjCoef(const ColIt& col_it, double obj_coef) { 
+      lpx_set_obj_coef(lp, col_iter_map[col_it], obj_coef);
+    }
     ///.
     void solveSimplex() { lpx_simplex(lp); }
     ///.



More information about the Lemon-commits mailing list