0
2
1
| 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
|
| 2 |
* |
|
| 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
|
| 4 |
* |
|
| 5 |
* Copyright (C) 2003-2008 |
|
| 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
|
| 7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES). |
|
| 8 |
* |
|
| 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. |
|
| 12 |
* |
|
| 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 |
|
| 15 |
* purpose. |
|
| 16 |
* |
|
| 17 |
*/ |
|
| 18 |
|
|
| 19 |
#include <sstream> |
|
| 20 |
|
|
| 21 |
#include <lemon/smart_graph.h> |
|
| 22 |
#include <lemon/hao_orlin.h> |
|
| 23 |
|
|
| 24 |
#include <lemon/lgf_reader.h> |
|
| 25 |
#include "test_tools.h" |
|
| 26 |
|
|
| 27 |
using namespace lemon; |
|
| 28 |
using namespace std; |
|
| 29 |
|
|
| 30 |
const std::string lgf = |
|
| 31 |
"@nodes\n" |
|
| 32 |
"label\n" |
|
| 33 |
"0\n" |
|
| 34 |
"1\n" |
|
| 35 |
"2\n" |
|
| 36 |
"3\n" |
|
| 37 |
"4\n" |
|
| 38 |
"5\n" |
|
| 39 |
"@edges\n" |
|
| 40 |
" label capacity\n" |
|
| 41 |
"0 1 0 2\n" |
|
| 42 |
"1 2 1 2\n" |
|
| 43 |
"2 0 2 2\n" |
|
| 44 |
"3 4 3 2\n" |
|
| 45 |
"4 5 4 2\n" |
|
| 46 |
"5 3 5 2\n" |
|
| 47 |
"2 3 6 3\n"; |
|
| 48 |
|
|
| 49 |
int main() {
|
|
| 50 |
SmartGraph graph; |
|
| 51 |
SmartGraph::EdgeMap<int> capacity(graph); |
|
| 52 |
|
|
| 53 |
istringstream lgfs(lgf); |
|
| 54 |
graphReader(graph, lgfs). |
|
| 55 |
edgeMap("capacity", capacity).run();
|
|
| 56 |
|
|
| 57 |
HaoOrlin<SmartGraph, SmartGraph::EdgeMap<int> > ho(graph, capacity); |
|
| 58 |
ho.run(); |
|
| 59 |
|
|
| 60 |
check(ho.minCutValue() == 3, "Wrong cut value"); |
|
| 61 |
|
|
| 62 |
return 0; |
|
| 63 |
} |
| ... | ... |
@@ -21,6 +21,7 @@ |
| 21 | 21 |
test/graph_utils_test \ |
| 22 | 22 |
test/heap_test \ |
| 23 | 23 |
test/kruskal_test \ |
| 24 |
test/hao_orlin_test \ |
|
| 24 | 25 |
test/maps_test \ |
| 25 | 26 |
test/max_matching_test \ |
| 26 | 27 |
test/random_test \ |
| ... | ... |
@@ -48,6 +49,7 @@ |
| 48 | 49 |
test_graph_utils_test_SOURCES = test/graph_utils_test.cc |
| 49 | 50 |
test_heap_test_SOURCES = test/heap_test.cc |
| 50 | 51 |
test_kruskal_test_SOURCES = test/kruskal_test.cc |
| 52 |
test_hao_orlin_test_SOURCES = test/hao_orlin_test.cc |
|
| 51 | 53 |
test_maps_test_SOURCES = test/maps_test.cc |
| 52 | 54 |
test_max_matching_test_SOURCES = test/max_matching_test.cc |
| 53 | 55 |
test_path_test_SOURCES = test/path_test.cc |
0 comments (0 inline)