Written hugo/ into includes.
authorathos
Thu, 06 May 2004 15:19:59 +0000
changeset 551d167149bde95
parent 550 9e7613fa6d27
child 552 83c22ca968d8
Written hugo/ into includes.
src/work/athos/makefile
src/work/athos/mincostflows.h
src/work/athos/mincostflows_test.cc
src/work/list_graph.h
src/work/marci/graph_wrapper.h
     1.1 --- a/src/work/athos/makefile	Thu May 06 15:14:13 2004 +0000
     1.2 +++ b/src/work/athos/makefile	Thu May 06 15:19:59 2004 +0000
     1.3 @@ -1,4 +1,4 @@
     1.4  BINARIES = suurballe minlength_demo mincostflows_test
     1.5 -INCLUDEDIRS= -I../../include -I.. -I../{athos,klao,marci,jacint,alpar,johanna,akos} 
     1.6 +INCLUDEDIRS= -I../.. -I.. -I../{athos,klao,marci,jacint,alpar,johanna,akos} 
     1.7  include ../makefile
     1.8  
     2.1 --- a/src/work/athos/mincostflows.h	Thu May 06 15:14:13 2004 +0000
     2.2 +++ b/src/work/athos/mincostflows.h	Thu May 06 15:19:59 2004 +0000
     2.3 @@ -7,10 +7,10 @@
     2.4  ///\brief An algorithm for finding a flow of value \c k (for small values of \c k) having minimal total cost 
     2.5  
     2.6  #include <iostream>
     2.7 -#include <dijkstra.h>
     2.8 +#include <hugo/dijkstra.h>
     2.9  #include <graph_wrapper.h>
    2.10 -#include <maps.h>
    2.11 -#include <vector.h>
    2.12 +#include <hugo/maps.h>
    2.13 +#include <vector>
    2.14  #include <for_each_macros.h>
    2.15  
    2.16  namespace hugo {
    2.17 @@ -85,14 +85,13 @@
    2.18  
    2.19      //auxiliary variables
    2.20  
    2.21 -    //The value is 1 iff the edge is reversed. 
    2.22 -    //If the algorithm has finished, the edges of the seeked paths are 
    2.23 -    //exactly those that are reversed 
    2.24 +    //To store the flow
    2.25      EdgeIntMap flow; 
    2.26 +    //To store the potentila (dual variables)
    2.27      typename Graph::template NodeMap<Length> potential;
    2.28      
    2.29      //Container to store found paths
    2.30 -    std::vector< std::vector<Edge> > paths;
    2.31 +    //std::vector< std::vector<Edge> > paths;
    2.32      //typedef DirPath<Graph> DPath;
    2.33      //DPath paths;
    2.34  
    2.35 @@ -186,6 +185,29 @@
    2.36        return total_length;
    2.37      }
    2.38  
    2.39 +    //This function checks, whether the given solution is optimal
    2.40 +    //Running after a \c run() should return with true
    2.41 +    bool checkSolution(){
    2.42 +      Length mod_pot;
    2.43 +      Length fl_e;
    2.44 +      FOR_EACH_LOC(typename Graph::EdgeIt, e, G){
    2.45 +	//C^{\Pi}_{i,j}
    2.46 +	mod_pot = length[e]-potential[G.head(e)]+potential[G.head(e)];
    2.47 +	fl_e = flow[e];
    2.48 +	if (0<fl_e && fl_e<capacity[e]){
    2.49 +	  if (mod_pot != 0)
    2.50 +	    return false;
    2.51 +	}
    2.52 +	else{
    2.53 +	  if (mod_pot > 0 && fl_e != 0)
    2.54 +	    return false;
    2.55 +	  if (mod_pot < 0 && fl_e != capacity[e])
    2.56 +	    return false;
    2.57 +	}
    2.58 +      }
    2.59 +      return true;
    2.60 +    }
    2.61 +    
    2.62      /*
    2.63        ///\todo To be implemented later
    2.64  
     3.1 --- a/src/work/athos/mincostflows_test.cc	Thu May 06 15:14:13 2004 +0000
     3.2 +++ b/src/work/athos/mincostflows_test.cc	Thu May 06 15:19:59 2004 +0000
     3.3 @@ -2,7 +2,7 @@
     3.4  #include <list_graph.h>
     3.5  #include <mincostflows.h>
     3.6  //#include <path.h>
     3.7 -#include <maps.h>
     3.8 +//#include <maps.h>
     3.9  
    3.10  using namespace std;
    3.11  using namespace hugo;
     4.1 --- a/src/work/list_graph.h	Thu May 06 15:14:13 2004 +0000
     4.2 +++ b/src/work/list_graph.h	Thu May 06 15:19:59 2004 +0000
     4.3 @@ -5,7 +5,7 @@
     4.4  #include <iostream>
     4.5  #include <vector>
     4.6  
     4.7 -#include <invalid.h>
     4.8 +#include <hugo/invalid.h>
     4.9  
    4.10  namespace hugo {
    4.11  
     5.1 --- a/src/work/marci/graph_wrapper.h	Thu May 06 15:14:13 2004 +0000
     5.2 +++ b/src/work/marci/graph_wrapper.h	Thu May 06 15:19:59 2004 +0000
     5.3 @@ -10,7 +10,7 @@
     5.4  ///
     5.5  ///\author Marton Makai
     5.6  
     5.7 -#include <invalid.h>
     5.8 +#include <hugo/invalid.h>
     5.9  //#include <iter_map.h>
    5.10  
    5.11  namespace hugo {