Reworked versioning.
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2008
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
24 #include <lemon/concept_check.h>
25 #include <lemon/concepts/heap.h>
27 #include <lemon/list_graph.h>
29 #include <lemon/digraph_reader.h>
31 #include <lemon/bin_heap.h>
32 #include <lemon/fib_heap.h>
33 #include <lemon/radix_heap.h>
34 #include <lemon/bucket_heap.h>
36 #include "test_tools.h"
38 #include "heap_test.h"
40 #include <lemon/time_measure.h>
42 using namespace lemon;
43 using namespace lemon::concepts;
49 typedef IntIntMap ItemIntMap;
51 typedef ListDigraph Digraph;
53 typedef Digraph::Arc Arc;
54 typedef Digraph::Node Node;
55 typedef Digraph::ArcIt ArcIt;
56 typedef Digraph::NodeIt NodeIt;
57 typedef Digraph::ArcMap<int> LengthMap;
60 LengthMap length(digraph);
63 /// \todo create own test digraph
66 if( getenv("srcdir") )
67 f_name = std::string(getenv("srcdir"));
69 f_name += "/test/dijkstra_test.lgf";
71 std::ifstream input(f_name.c_str());
72 check(input, "Input file '" << f_name << "' not found.");
73 DigraphReader<Digraph>(input, digraph).
74 readArcMap("capacity", length).
75 readNode("source", start).
79 std::cout << "Checking Bin Heap" << std::endl;
81 typedef BinHeap<Prio, ItemIntMap> IntHeap;
82 checkConcept<Heap<Prio, ItemIntMap>, IntHeap>();
83 heapSortTest<IntHeap>(100);
84 heapIncreaseTest<IntHeap>(100);
86 typedef FibHeap<Prio, Digraph::NodeMap<int> > NodeHeap;
87 checkConcept<Heap<Prio, Digraph::NodeMap<int> >, NodeHeap>();
89 dijkstraHeapTest<Digraph, LengthMap, NodeHeap>(digraph, length, start);
90 std::cout << timer << std::endl;
93 std::cout << "Checking Fib Heap" << std::endl;
95 typedef FibHeap<Prio, ItemIntMap> IntHeap;
96 checkConcept<Heap<Prio, ItemIntMap>, IntHeap>();
97 heapSortTest<IntHeap>(100);
98 heapIncreaseTest<IntHeap>(100);
100 typedef FibHeap<Prio, Digraph::NodeMap<int> > NodeHeap;
101 checkConcept<Heap<Prio, Digraph::NodeMap<int> >, NodeHeap>();
103 dijkstraHeapTest<Digraph, LengthMap, NodeHeap>(digraph, length, start);
104 std::cout << timer << std::endl;
107 std::cout << "Checking Radix Heap" << std::endl;
109 typedef RadixHeap<ItemIntMap> IntHeap;
110 checkConcept<Heap<Prio, ItemIntMap>, IntHeap>();
111 heapSortTest<IntHeap>(100);
112 heapIncreaseTest<IntHeap>(100);
114 typedef RadixHeap<Digraph::NodeMap<int> > NodeHeap;
115 checkConcept<Heap<Prio, Digraph::NodeMap<int> >, NodeHeap>();
117 dijkstraHeapTest<Digraph, LengthMap, NodeHeap>(digraph, length, start);
118 std::cout << timer << std::endl;
122 std::cout << "Checking Bucket Heap" << std::endl;
124 typedef BucketHeap<ItemIntMap> IntHeap;
125 checkConcept<Heap<Prio, ItemIntMap>, IntHeap>();
126 heapSortTest<IntHeap>(100);
127 heapIncreaseTest<IntHeap>(100);
129 typedef BucketHeap<Digraph::NodeMap<int> > NodeHeap;
130 checkConcept<Heap<Prio, Digraph::NodeMap<int> >, NodeHeap>();
132 dijkstraHeapTest<Digraph, LengthMap, NodeHeap>(digraph, length, start);
133 std::cout << timer << std::endl;