Changeset 511:325c9430723e in lemon0.x for src/work
 Timestamp:
 05/03/04 12:27:20 (17 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@671
 Location:
 src/work/athos
 Files:

 1 added
 2 edited
Legend:
 Unmodified
 Added
 Removed

src/work/athos/makefile
r331 r511 1 CXX2 = g++2.95 2 CXX3 := $(shell type p g++3.3  type p g++3.2  type p g++3.0  type p g++3  echo g++) 3 CXX=$(CXX3) 4 CC=$(CXX) 5 #LEDAROOT ?= /ledasrc/LEDA4.1 6 #BOOSTROOT ?= /home/marci/boost 7 INCLUDEDIRS ?= I../../include I.. I../{marci,jacint,alpar,athos,akos,klao} #I$(BOOSTROOT) 8 #LEDAINCLUDE ?= I$(LEDAROOT)/incl 9 CXXFLAGS = g O W Wall $(INCLUDEDIRS) ansi pedantic 1 BINARIES = suurballe minlength_demo 2 INCLUDEDIRS= I../../include I.. I../{athos,klao,marci,jacint,alpar,johanna,akos} 3 include ../makefile 10 4 11 #LEDABINARIES = lg_vs_sg leda_graph_demo leda_bfs_dfs max_bipartite_matching_demo12 BINARIES = suurballe13 #gw_vs_not preflow_demo_boost edmonds_karp_demo_boost preflow_demo_jacint preflow_demo_athos edmonds_karp_demo_alpar preflow_demo_leda14 15 all: $(BINARIES)16 17 .depend dep depend:18 $(CXX) $(INCLUDEDIRS) M $(BINARIES:=.cc) > .depend #2>/dev/null19 # g++ $(INCLUDEDIRS) $(LEDAINCLUDE) M $(LEDABINARIES:=.cc) >> .depend #2>/dev/null20 21 22 23 makefile: .depend24 sinclude .depend25 26 clean:27 $(RM) *.o $(BINARIES) .depend28 29 .PHONY: all clean dep depend 
src/work/athos/minlengthpaths.h
r491 r511 11 11 #include <graph_wrapper.h> 12 12 #include <maps.h> 13 #include <vector >13 #include <vector.h> 14 14 15 15 … … 32 32 33 33 typedef typename LengthMap::ValueType Length; 34 34 35 35 typedef typename Graph::Node Node; 36 36 typedef typename Graph::NodeIt NodeIt; 37 37 typedef typename Graph::Edge Edge; 38 38 typedef typename Graph::OutEdgeIt OutEdgeIt; 39 typedef typename Graph:: EdgeMap<int> EdgeIntMap;39 typedef typename Graph::template EdgeMap<int> EdgeIntMap; 40 40 41 41 typedef ConstMap<Edge,int> ConstMap; … … 43 43 typedef ResGraphWrapper<const Graph,int,ConstMap,EdgeIntMap> ResGraphType; 44 44 45 46 45 class ModLengthMap { 47 typedef typename ResGraphType:: NodeMap<Length> NodeMap;46 typedef typename ResGraphType::template NodeMap<Length> NodeMap; 48 47 const ResGraphType& G; 49 48 const EdgeIntMap& rev; … … 53 52 typedef typename LengthMap::KeyType KeyType; 54 53 typedef typename LengthMap::ValueType ValueType; 55 54 56 55 ValueType operator[](typename ResGraphType::Edge e) const { 57 56 //if ( (12*rev[e])*ol[e](pot[G.head(e)]pot[G.tail(e)] ) <0 ){ … … 60 59 return (12*rev[e])*ol[e](pot[G.head(e)]pot[G.tail(e)]); 61 60 } 62 61 63 62 ModLengthMap(const ResGraphType& _G, const EdgeIntMap& _rev, 64 63 const LengthMap &o, const NodeMap &p) : 65 64 G(_G), rev(_rev), ol(o), pot(p){}; 66 }; 65 };//ModLengthMap 66 67 67 68 68 69 … … 79 80 //Container to store found paths 80 81 std::vector< std::vector<Edge> > paths; 82 //typedef DirPath<Graph> DPath; 83 //DPath paths; 84 85 86 Length total_length; 81 87 82 88 public : … … 95 101 ConstMap const1map(1); 96 102 103 97 104 //We need a residual graph, in which some of the edges are reversed 98 105 ResGraphType res_graph(G, const1map, reversed); 99 106 100 107 //Initialize the copy of the Dijkstra potential to zero 101 typename ResGraphType:: NodeMap<Length> dijkstra_dist(res_graph);108 typename ResGraphType::template NodeMap<Length> dijkstra_dist(res_graph); 102 109 ModLengthMap mod_length(res_graph, reversed, length, dijkstra_dist); 103 110 … … 134 141 135 142 //Let's find the paths 136 //We put the paths into vectors (just for now). In the meantime we lose137 // the information stored in 'reversed'143 //We put the paths into stl vectors (as an inner representation). 144 //In the meantime we lose the information stored in 'reversed'. 138 145 //We suppose the lengths to be positive now. 146 147 //Meanwhile we put the total length of the found paths 148 //in the member variable total_length 139 149 paths.clear(); 150 total_length=0; 140 151 paths.resize(k); 141 152 for (int j=0; j<i; ++j){ … … 153 164 n = G.head(e); 154 165 paths[j].push_back(e); 166 total_length += length[e]; 155 167 reversed[e] = 1reversed[e]; 156 168 } … … 161 173 } 162 174 175 ///This function gives back the total length of the found paths. 176 ///Assumes that \c run() has been run and nothing changed since then. 177 Length totalLength(){ 178 return total_length; 179 } 180 181 ///This function gives back the \c jth path in argument p. 182 ///Assumes that \c run() has been run and nothing changed since then. 183 /// \warning It is assumed that \c p is constructed to be a path of graph \c G. 184 template<typename DirPath> 185 void getPath(DirPath& p, int j){ 186 p.clear(); 187 typename DirPath::Builder B(p); 188 for(typename std::vector<Edge>::iterator i=paths[j].begin(); 189 i!=paths[j].end(); ++i ){ 190 B.pushBack(*j); 191 } 192 193 B.commit(); 194 } 163 195 164 196 }; //class MinLengthPaths
Note: See TracChangeset
for help on using the changeset viewer.