# HG changeset patch # User athos # Date 1121875504 0 # Node ID 15098fb5275cb7e493f7232ad6c17978438f9d68 # Parent e5957f8866e6d8f41eee6f3bb17eb9c0cefd99f2 Documentation (lp_demo,lp_maxflow) and slight changes (rest). diff -r e5957f8866e6 -r 15098fb5275c demo/coloring.cc --- a/demo/coloring.cc Wed Jul 20 16:03:41 2005 +0000 +++ b/demo/coloring.cc Wed Jul 20 16:05:04 2005 +0000 @@ -16,7 +16,7 @@ { if(argc<2) { - std::cerr << "USAGE: coloring " << std::endl; + std::cerr << "USAGE: coloring input_file.lgf" << std::endl; std::cerr << "The file 'input_file.lgf' has to contain a graph in LEMON format together with a nodemap called 'coords' to draw the graph (e.g. sample.lgf is not such a file)." << std::endl; return 0; } diff -r e5957f8866e6 -r 15098fb5275c demo/dim_to_dot.cc --- a/demo/dim_to_dot.cc Wed Jul 20 16:03:41 2005 +0000 +++ b/demo/dim_to_dot.cc Wed Jul 20 16:05:04 2005 +0000 @@ -6,6 +6,16 @@ // This program can be an aid in making up to date visualized documantation // of demo programs. +// For later documentation (if marci does not do it) +// Az a graphviz csomag egy egyszeru formatuma, ami egy graphrajzolo csomag. +// Az EdgeSubGraphAdaptor doksijaban szerepel egy kirajzolt graf. Azt nem +// kezzel csinaltam, hanem a megfelelo dim file-bol ezzel a progival. A +// doxygen ugyanis ilyet eszik, igy a juzer vizualisan is latja a grafot a +// doksiban, es sajat maga is le tudja futtatni az algoritmust, mert ott van +// a kezeben a dim file is. Es mivel ez egy generalt file, ezert ha vmit +// valtoztatunk a dim-en, ezt is konnyu bemasolni. Uff. + + #include #include @@ -17,8 +27,19 @@ using std::cout; using std::endl; -int main() -{ +int main(int argc, char *argv[]) +{ + if(argc<2) + { + std::cerr << "USAGE: sub_graph_adaptor_demo input_file.dim" << std::endl; + std::cerr << "The file 'input_file.dim' has to contain a max flow instance in DIMACS format (e.g. sub_graph_adaptor_demo.dim is such a file)." << std::endl; + return 0; + } + + + //input stream to read the graph from + std::ifstream is(argv[1]); + typedef SmartGraph Graph; typedef Graph::Edge Edge; @@ -31,7 +52,7 @@ Node s, t; LengthMap length(g); - readDimacs(std::cin, g, length, s, t); + readDimacs(is, g, length, s, t); cout << "digraph lemon_dot_example {" << endl; cout << " node [ shape=ellipse, fontname=Helvetica, fontsize=10 ];" << endl; diff -r e5957f8866e6 -r 15098fb5275c demo/lp_demo.cc --- a/demo/lp_demo.cc Wed Jul 20 16:03:41 2005 +0000 +++ b/demo/lp_demo.cc Wed Jul 20 16:05:04 2005 +0000 @@ -1,3 +1,29 @@ +/* -*- C++ -*- + * demo/graph_to_eps.cc - Part of LEMON, a generic C++ optimization library + * + * Copyright (C) 2005 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. + * + */ + +/// \ingroup demos +/// \file +/// \brief A program demonstrating the LEMON LP solver interface +/// +/// This program is a simple application of the LEMON LP solver +/// interface: we formulate a linear programming (LP) problem and then +/// solve it using the underlying solver (GLPK or CPLEX for +/// example). For the detailed documentation of the LEMON LP solver +/// interface read \ref lemon::LpSolverBase "this". + #ifdef HAVE_CONFIG_H #include #endif @@ -13,10 +39,14 @@ using namespace lemon; + + #ifdef HAVE_GLPK typedef LpGlpk LpDefault; +const char default_solver_name[]="GLPK"; #elif HAVE_CPLEX typedef LpCplex LpDefault; +const char default_solver_name[]="CPLEX"; #endif int main() @@ -30,6 +60,9 @@ typedef LpDefault::Col Col; + std::cout<<"A program demonstrating the LEMON LP solver interface"<" << std::endl; + std::cerr << " USAGE: lp_maxflow_demo input_file.lgf" << std::endl; std::cerr << " The file 'input_file.lgf' has to contain a max " << "flow instance in\n" << " LEMON format (e.g. sample.lgf is such a file)." diff -r e5957f8866e6 -r 15098fb5275c demo/sub_gad_input.lgf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/demo/sub_gad_input.lgf Wed Jul 20 16:05:04 2005 +0000 @@ -0,0 +1,27 @@ +@nodeset +id +6 +5 +4 +3 +2 +1 +0 +@edgeset + id length +5 6 9 4 +4 6 8 2 +3 5 7 1 +2 5 6 3 +2 6 5 5 +2 4 4 2 +1 4 3 3 +0 3 2 1 +0 2 1 2 +0 1 0 3 +@nodes +source 0 +target 6 +@edges +@attributes +@end diff -r e5957f8866e6 -r 15098fb5275c demo/sub_graph_adaptor_demo.cc --- a/demo/sub_graph_adaptor_demo.cc Wed Jul 20 16:03:41 2005 +0000 +++ b/demo/sub_graph_adaptor_demo.cc Wed Jul 20 16:05:04 2005 +0000 @@ -16,6 +16,11 @@ #include #include + + +//#include +//#include + using namespace lemon; using std::cout; @@ -25,7 +30,7 @@ { if(argc<2) { - std::cerr << "USAGE: sub_graph_adaptor_demo " << std::endl; + std::cerr << "USAGE: sub_graph_adaptor_demo input_file.dim" << std::endl; std::cerr << "The file 'input_file.dim' has to contain a max flow instance in DIMACS format (e.g. sub_graph_adaptor_demo.dim is such a file)." << std::endl; return 0; } @@ -48,6 +53,16 @@ readDimacs(is, g, length, s, t); +// GraphWriter writer(std::cout, g); +// writer.writeEdgeMap("length", length); +// writer.writeNode("source",s); +// writer.writeNode("target",t); +// writer.run(); + +// GraphReader reader(is,g); +// reader.readNode("source",s).readNode("target",t) +// .readEdgeMap("length",length).run(); + cout << "edges with lengths (of form id, source--length->target): " << endl; for(EdgeIt e(g); e!=INVALID; ++e) cout << " " << g.id(e) << ", " << g.id(g.source(e)) << "--"