Reimplemented MinMeanCycle to be much more efficient.
The new version implements Howard's algorithm instead of Karp's algorithm and
it is at least 10-20 times faster on all the 40-50 random graphs we have tested.
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
21 ///\brief Argument parser demo
23 /// This example shows how can the argument parser used.
25 /// \include arg_parser.cc
27 #include <lemon/arg_parser.h>
29 using namespace lemon;
30 int main(int argc, const char **argv)
32 ArgParser ap(argc,argv);
38 ap.refOption("n", "an integer input", i, true)
39 .refOption("val", "a double input", d)
40 .synonym("vals","val")
41 .refOption("name", "a string input", s)
42 .refOption("f", "a switch", b)
43 .refOption("nohelp", "", sil)
44 .refOption("gra","Choise A",g1)
45 .refOption("grb","Choise B",g2)
46 .refOption("grc","Choise C",g3)
47 .optionGroup("gr","gra")
48 .optionGroup("gr","grb")
49 .optionGroup("gr","grc")
52 .other("infile","The input file")
57 std::cout << "Parameters of '" << ap.commandName() << "':\n";
59 if(ap.given("n")) std::cout << " Value of -n: " << i << std::endl;
60 if(ap.given("val")) std::cout << " Value of -val: " << d << std::endl;
61 if(ap.given("name")) std::cout << " Value of -name: " << s << std::endl;
62 if(ap.given("f")) std::cout << " -f is given\n";
63 if(ap.given("nohelp")) std::cout << " Value of -nohelp: " << sil << std::endl;
65 switch(ap.files().size()) {
67 std::cout << " No file argument was given.\n";
70 std::cout << " 1 file argument was given. It is:\n";
74 << ap.files().size() << " file arguments were given. They are:\n";
76 for(unsigned int i=0;i<ap.files().size();++i)
77 std::cout << " '" << ap.files()[i] << "'\n";