1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
3 * This file is a part of LEMON, a generic C++ optimization library.
5 * Copyright (C) 2003-2011
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
19 #include <benchmark_tools.h>
20 #include <lemon/circulation.h>
21 #include <lemon/smart_graph.h>
22 #include <lemon/lgf_reader.h>
23 #include <lemon/dimacs.h>
24 #include <lemon/error.h>
27 std::string test_name = "circulation";
29 using namespace lemon;
31 int testMain(std::istream &input)
37 SmartDigraph::ArcMap<Value> lo_cap(g);
38 SmartDigraph::ArcMap<Value> up_cap(g);
39 SmartDigraph::ArcMap<Value> cost(g);
40 SmartDigraph::NodeMap<Value> sup(g);
44 readDimacsMin(input, g, lo_cap, up_cap, cost, sup);
45 } catch (FormatError& error) {
46 std::cerr << error.what() << std::endl;
53 Circulation<SmartDigraph,
54 SmartDigraph::ArcMap<Value>,SmartDigraph::ArcMap<Value>,
55 SmartDigraph::NodeMap<Value> > circ(g,lo_cap,up_cap,sup);
58 bool res = circ.run();
63 std::cerr << "A feasible circulation is found\n";
64 std::cerr << "Checking...\n";
66 bool res2 = circ.checkFlow();
69 std::cerr << "Success!\n";
71 std::cerr << "Oops!!!!\n";
75 std::cerr << "A dual solution is found\n";
76 std::cerr << "Checking...\n";
78 bool res2 = circ.checkBarrier();
81 std::cerr << "Success!\n";
83 std::cerr << "Dual-Oops!!!!\n";