[Lemon-commits] Balazs Dezso: Simple test for HaoOrlin algorithm...
Lemon HG
hg at lemon.cs.elte.hu
Tue Dec 2 12:04:59 CET 2008
details: http://lemon.cs.elte.hu/hg/lemon/rev/eac19fb31a09
changeset: 426:eac19fb31a09
user: Balazs Dezso <deba [at] inf.elte.hu>
date: Mon Dec 01 23:15:15 2008 +0100
description:
Simple test for HaoOrlin algorithm class (#58)
diffstat:
3 files changed, 66 insertions(+)
test/CMakeLists.txt | 1
test/Makefile.am | 2 +
test/hao_orlin_test.cc | 63 ++++++++++++++++++++++++++++++++++++++++++++++++
diffs (97 lines):
diff -r b8ce15103485 -r eac19fb31a09 test/CMakeLists.txt
--- a/test/CMakeLists.txt Mon Dec 01 23:12:16 2008 +0100
+++ b/test/CMakeLists.txt Mon Dec 01 23:15:15 2008 +0100
@@ -13,6 +13,7 @@
graph_copy_test
graph_test
graph_utils_test
+ hao_orlin_test
heap_test
kruskal_test
maps_test
diff -r b8ce15103485 -r eac19fb31a09 test/Makefile.am
--- a/test/Makefile.am Mon Dec 01 23:12:16 2008 +0100
+++ b/test/Makefile.am Mon Dec 01 23:15:15 2008 +0100
@@ -21,6 +21,7 @@
test/graph_utils_test \
test/heap_test \
test/kruskal_test \
+ test/hao_orlin_test \
test/maps_test \
test/max_matching_test \
test/random_test \
@@ -48,6 +49,7 @@
test_graph_utils_test_SOURCES = test/graph_utils_test.cc
test_heap_test_SOURCES = test/heap_test.cc
test_kruskal_test_SOURCES = test/kruskal_test.cc
+test_hao_orlin_test_SOURCES = test/hao_orlin_test.cc
test_maps_test_SOURCES = test/maps_test.cc
test_max_matching_test_SOURCES = test/max_matching_test.cc
test_path_test_SOURCES = test/path_test.cc
diff -r b8ce15103485 -r eac19fb31a09 test/hao_orlin_test.cc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hao_orlin_test.cc Mon Dec 01 23:15:15 2008 +0100
@@ -0,0 +1,63 @@
+/* -*- mode: C++; indent-tabs-mode: nil; -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library.
+ *
+ * Copyright (C) 2003-2008
+ * 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 <sstream>
+
+#include <lemon/smart_graph.h>
+#include <lemon/hao_orlin.h>
+
+#include <lemon/lgf_reader.h>
+#include "test_tools.h"
+
+using namespace lemon;
+using namespace std;
+
+const std::string lgf =
+ "@nodes\n"
+ "label\n"
+ "0\n"
+ "1\n"
+ "2\n"
+ "3\n"
+ "4\n"
+ "5\n"
+ "@edges\n"
+ " label capacity\n"
+ "0 1 0 2\n"
+ "1 2 1 2\n"
+ "2 0 2 2\n"
+ "3 4 3 2\n"
+ "4 5 4 2\n"
+ "5 3 5 2\n"
+ "2 3 6 3\n";
+
+int main() {
+ SmartGraph graph;
+ SmartGraph::EdgeMap<int> capacity(graph);
+
+ istringstream lgfs(lgf);
+ graphReader(graph, lgfs).
+ edgeMap("capacity", capacity).run();
+
+ HaoOrlin<SmartGraph, SmartGraph::EdgeMap<int> > ho(graph, capacity);
+ ho.run();
+
+ check(ho.minCutValue() == 3, "Wrong cut value");
+
+ return 0;
+}
More information about the Lemon-commits
mailing list