test/dijkstra_test.cc
changeset 802 994c7df296c9
parent 440 88ed40ad0d4f
child 877 141f9c0db4a3
child 1007 7e368d9b67f7
     1.1 --- a/test/dijkstra_test.cc	Fri Nov 13 12:33:33 2009 +0100
     1.2 +++ b/test/dijkstra_test.cc	Thu Dec 10 17:05:35 2009 +0100
     1.3 @@ -2,7 +2,7 @@
     1.4   *
     1.5   * This file is a part of LEMON, a generic C++ optimization library.
     1.6   *
     1.7 - * Copyright (C) 2003-2008
     1.8 + * Copyright (C) 2003-2009
     1.9   * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.10   * (Egervary Research Group on Combinatorial Optimization, EGRES).
    1.11   *
    1.12 @@ -60,48 +60,94 @@
    1.13    typedef Digraph::Arc Arc;
    1.14  
    1.15    Digraph G;
    1.16 -  Node s, t;
    1.17 +  Node s, t, n;
    1.18    Arc e;
    1.19    VType l;
    1.20 +  int i;
    1.21    bool b;
    1.22    DType::DistMap d(G);
    1.23    DType::PredMap p(G);
    1.24    LengthMap length;
    1.25    Path<Digraph> pp;
    1.26 +  concepts::ReadMap<Node,bool> nm;
    1.27  
    1.28    {
    1.29      DType dijkstra_test(G,length);
    1.30 +    const DType& const_dijkstra_test = dijkstra_test;
    1.31  
    1.32      dijkstra_test.run(s);
    1.33      dijkstra_test.run(s,t);
    1.34  
    1.35 +    dijkstra_test.init();
    1.36 +    dijkstra_test.addSource(s);
    1.37 +    dijkstra_test.addSource(s, 1);
    1.38 +    n = dijkstra_test.processNextNode();
    1.39 +    n = const_dijkstra_test.nextNode();
    1.40 +    b = const_dijkstra_test.emptyQueue();
    1.41 +    i = const_dijkstra_test.queueSize();
    1.42 +    
    1.43 +    dijkstra_test.start();
    1.44 +    dijkstra_test.start(t);
    1.45 +    dijkstra_test.start(nm);
    1.46 +
    1.47 +    l  = const_dijkstra_test.dist(t);
    1.48 +    e  = const_dijkstra_test.predArc(t);
    1.49 +    s  = const_dijkstra_test.predNode(t);
    1.50 +    b  = const_dijkstra_test.reached(t);
    1.51 +    b  = const_dijkstra_test.processed(t);
    1.52 +    d  = const_dijkstra_test.distMap();
    1.53 +    p  = const_dijkstra_test.predMap();
    1.54 +    pp = const_dijkstra_test.path(t);
    1.55 +    l  = const_dijkstra_test.currentDist(t);
    1.56 +  }
    1.57 +  {
    1.58 +    DType
    1.59 +      ::SetPredMap<concepts::ReadWriteMap<Node,Arc> >
    1.60 +      ::SetDistMap<concepts::ReadWriteMap<Node,VType> >
    1.61 +      ::SetStandardProcessedMap
    1.62 +      ::SetProcessedMap<concepts::WriteMap<Node,bool> >
    1.63 +      ::SetOperationTraits<DijkstraDefaultOperationTraits<VType> >
    1.64 +      ::SetHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
    1.65 +      ::SetStandardHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
    1.66 +      ::SetHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> >, 
    1.67 +                concepts::ReadWriteMap<Node,int> >
    1.68 +      ::Create dijkstra_test(G,length);
    1.69 +
    1.70 +    LengthMap length_map;
    1.71 +    concepts::ReadWriteMap<Node,Arc> pred_map;
    1.72 +    concepts::ReadWriteMap<Node,VType> dist_map;
    1.73 +    concepts::WriteMap<Node,bool> processed_map;
    1.74 +    concepts::ReadWriteMap<Node,int> heap_cross_ref;
    1.75 +    BinHeap<VType, concepts::ReadWriteMap<Node,int> > heap(heap_cross_ref);
    1.76 +    
    1.77 +    dijkstra_test
    1.78 +      .lengthMap(length_map)
    1.79 +      .predMap(pred_map)
    1.80 +      .distMap(dist_map)
    1.81 +      .processedMap(processed_map)
    1.82 +      .heap(heap, heap_cross_ref);
    1.83 +
    1.84 +    dijkstra_test.run(s);
    1.85 +    dijkstra_test.run(s,t);
    1.86 +
    1.87 +    dijkstra_test.addSource(s);
    1.88 +    dijkstra_test.addSource(s, 1);
    1.89 +    n = dijkstra_test.processNextNode();
    1.90 +    n = dijkstra_test.nextNode();
    1.91 +    b = dijkstra_test.emptyQueue();
    1.92 +    i = dijkstra_test.queueSize();
    1.93 +    
    1.94 +    dijkstra_test.start();
    1.95 +    dijkstra_test.start(t);
    1.96 +    dijkstra_test.start(nm);
    1.97 +
    1.98      l  = dijkstra_test.dist(t);
    1.99      e  = dijkstra_test.predArc(t);
   1.100      s  = dijkstra_test.predNode(t);
   1.101      b  = dijkstra_test.reached(t);
   1.102 -    d  = dijkstra_test.distMap();
   1.103 -    p  = dijkstra_test.predMap();
   1.104 +    b  = dijkstra_test.processed(t);
   1.105      pp = dijkstra_test.path(t);
   1.106 -  }
   1.107 -  {
   1.108 -    DType
   1.109 -      ::SetPredMap<concepts::ReadWriteMap<Node,Arc> >
   1.110 -      ::SetDistMap<concepts::ReadWriteMap<Node,VType> >
   1.111 -      ::SetProcessedMap<concepts::WriteMap<Node,bool> >
   1.112 -      ::SetStandardProcessedMap
   1.113 -      ::SetOperationTraits<DijkstraDefaultOperationTraits<VType> >
   1.114 -      ::SetHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
   1.115 -      ::SetStandardHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
   1.116 -      ::Create dijkstra_test(G,length);
   1.117 -
   1.118 -    dijkstra_test.run(s);
   1.119 -    dijkstra_test.run(s,t);
   1.120 -
   1.121 -    l  = dijkstra_test.dist(t);
   1.122 -    e  = dijkstra_test.predArc(t);
   1.123 -    s  = dijkstra_test.predNode(t);
   1.124 -    b  = dijkstra_test.reached(t);
   1.125 -    pp = dijkstra_test.path(t);
   1.126 +    l  = dijkstra_test.currentDist(t);
   1.127    }
   1.128  
   1.129  }