/* -*- C++ -*- * * This file is a part of LEMON, a generic C++ optimization library * * Copyright (C) 2003-2006 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport * (Egervary Research Group on Combinatorial Optimization, EGRES). * * Permission to use, modify and distribute this software is granted * provided that this copyright notice appears in all copies. For * precise terms see the accompanying LICENSE file. * * This software is provided "AS IS" with no warranty of any kind, * express or implied, and with no claim as to its suitability for any * purpose. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include "test_tools.h" #include "heap_test.h" #include using namespace lemon; using namespace lemon::concept; int main() { typedef int Item; typedef int Prio; typedef IntIntMap ItemIntMap; typedef ListGraph Graph; typedef Graph::Edge Edge; typedef Graph::Node Node; typedef Graph::EdgeIt EdgeIt; typedef Graph::NodeIt NodeIt; typedef Graph::EdgeMap LengthMap; Graph graph; LengthMap length(graph); Node start; /// \todo create own test graph std::string f_name; if( getenv("srcdir") ) f_name = std::string(getenv("srcdir")); else f_name = "."; f_name += "/dijkstra_test.lgf"; std::ifstream input(f_name.c_str()); check(input, "Input file '" << f_name << "' not found."); GraphReader(input, graph). readEdgeMap("capacity", length). readNode("source", start). run(); { std::cerr << "Checking Bin Heap" << std::endl; typedef BinHeap IntHeap; checkConcept, IntHeap>(); heapSortTest(100); heapIncreaseTest(100); typedef FibHeap > NodeHeap; checkConcept >, NodeHeap>(); Timer timer; dijkstraHeapTest(graph, length, start); std::cout << timer << std::endl; } { std::cerr << "Checking Fib Heap" << std::endl; typedef FibHeap IntHeap; checkConcept, IntHeap>(); heapSortTest(100); heapIncreaseTest(100); typedef FibHeap > NodeHeap; checkConcept >, NodeHeap>(); Timer timer; dijkstraHeapTest(graph, length, start); std::cout << timer << std::endl; } { std::cerr << "Checking Radix Heap" << std::endl; typedef RadixHeap IntHeap; checkConcept, IntHeap>(); heapSortTest(100); heapIncreaseTest(100); typedef RadixHeap > NodeHeap; checkConcept >, NodeHeap>(); Timer timer; dijkstraHeapTest(graph, length, start); std::cout << timer << std::endl; } { std::cerr << "Checking Linear Heap" << std::endl; typedef LinearHeap IntHeap; checkConcept, IntHeap>(); heapSortTest(100); heapIncreaseTest(100); typedef LinearHeap > NodeHeap; checkConcept >, NodeHeap>(); Timer timer; dijkstraHeapTest(graph, length, start); std::cout << timer << std::endl; } std::cout << __FILE__ ": All tests passed.\n"; return 0; }