Changeset 1577:15098fb5275c in lemon-0.x
- Timestamp:
- 07/20/05 18:05:04 (18 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2078
- Location:
- demo
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
demo/coloring.cc
r1560 r1577 17 17 if(argc<2) 18 18 { 19 std::cerr << "USAGE: coloring <input_file.lgf>" << std::endl;19 std::cerr << "USAGE: coloring input_file.lgf" << std::endl; 20 20 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; 21 21 return 0; -
demo/dim_to_dot.cc
r1435 r1577 6 6 // This program can be an aid in making up to date visualized documantation 7 7 // of demo programs. 8 9 // For later documentation (if marci does not do it) 10 // Az a graphviz csomag egy egyszeru formatuma, ami egy graphrajzolo csomag. 11 // Az EdgeSubGraphAdaptor doksijaban szerepel egy kirajzolt graf. Azt nem 12 // kezzel csinaltam, hanem a megfelelo dim file-bol ezzel a progival. A 13 // doxygen ugyanis ilyet eszik, igy a juzer vizualisan is latja a grafot a 14 // doksiban, es sajat maga is le tudja futtatni az algoritmust, mert ott van 15 // a kezeben a dim file is. Es mivel ez egy generalt file, ezert ha vmit 16 // valtoztatunk a dim-en, ezt is konnyu bemasolni. Uff. 17 8 18 9 19 #include <iostream> … … 18 28 using std::endl; 19 29 20 int main() 21 { 30 int main(int argc, char *argv[]) 31 { 32 if(argc<2) 33 { 34 std::cerr << "USAGE: sub_graph_adaptor_demo input_file.dim" << std::endl; 35 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; 36 return 0; 37 } 38 39 40 //input stream to read the graph from 41 std::ifstream is(argv[1]); 42 22 43 typedef SmartGraph Graph; 23 44 … … 32 53 LengthMap length(g); 33 54 34 readDimacs( std::cin, g, length, s, t);55 readDimacs(is, g, length, s, t); 35 56 36 57 cout << "digraph lemon_dot_example {" << endl; -
demo/lp_demo.cc
r1530 r1577 1 /* -*- C++ -*- 2 * demo/graph_to_eps.cc - Part of LEMON, a generic C++ optimization library 3 * 4 * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 5 * (Egervary Research Group on Combinatorial Optimization, EGRES). 6 * 7 * Permission to use, modify and distribute this software is granted 8 * provided that this copyright notice appears in all copies. For 9 * precise terms see the accompanying LICENSE file. 10 * 11 * This software is provided "AS IS" with no warranty of any kind, 12 * express or implied, and with no claim as to its suitability for any 13 * purpose. 14 * 15 */ 16 17 /// \ingroup demos 18 /// \file 19 /// \brief A program demonstrating the LEMON LP solver interface 20 /// 21 /// This program is a simple application of the LEMON LP solver 22 /// interface: we formulate a linear programming (LP) problem and then 23 /// solve it using the underlying solver (GLPK or CPLEX for 24 /// example). For the detailed documentation of the LEMON LP solver 25 /// interface read \ref lemon::LpSolverBase "this". 26 1 27 #ifdef HAVE_CONFIG_H 2 28 #include <config.h> … … 14 40 using namespace lemon; 15 41 42 43 16 44 #ifdef HAVE_GLPK 17 45 typedef LpGlpk LpDefault; 46 const char default_solver_name[]="GLPK"; 18 47 #elif HAVE_CPLEX 19 48 typedef LpCplex LpDefault; 49 const char default_solver_name[]="CPLEX"; 20 50 #endif 21 51 … … 30 60 typedef LpDefault::Col Col; 31 61 62 63 std::cout<<"A program demonstrating the LEMON LP solver interface"<<std::endl; 64 std::cout<<"Solver used: "<<default_solver_name<<std::endl; 32 65 33 66 //This will be a maximization … … 55 88 //Print results 56 89 if (lp.primalStatus()==LpSolverBase::OPTIMAL){ 57 printf("Z = %g; x1 = %g; x2 = %g; x3 = %g\n", 90 std::cout<<"Optimal solution found!"<<std::endl; 91 printf("optimum value = %g; x1 = %g; x2 = %g; x3 = %g\n", 58 92 lp.primalValue(), 59 93 lp.primal(x1), lp.primal(x2), lp.primal(x3)); -
demo/lp_maxflow_demo.cc
r1571 r1577 45 45 #ifdef HAVE_GLPK 46 46 typedef LpGlpk LpDefault; 47 const char default_solver_name[]="GLPK"; 47 48 #elif HAVE_CPLEX 48 49 typedef LpCplex LpDefault; 50 const char default_solver_name[]="CPLEX"; 49 51 #endif 50 52 … … 97 99 #endif 98 100 101 std::cout<<"Solver used: "<<default_solver_name<<std::endl; 102 99 103 //Solve with the underlying solver 100 104 lp.solve(); … … 107 111 if(argc<2) 108 112 { 109 std::cerr << " USAGE: lp_maxflow_demo <input_file.lgf>" << std::endl;113 std::cerr << " USAGE: lp_maxflow_demo input_file.lgf" << std::endl; 110 114 std::cerr << " The file 'input_file.lgf' has to contain a max " 111 115 << "flow instance in\n" -
demo/sub_graph_adaptor_demo.cc
r1560 r1577 17 17 #include <tight_edge_filter_map.h> 18 18 19 20 21 //#include <lemon/graph_reader.h> 22 //#include <lemon/graph_writer.h> 23 19 24 using namespace lemon; 20 25 … … 26 31 if(argc<2) 27 32 { 28 std::cerr << "USAGE: sub_graph_adaptor_demo <input_file.dim>" << std::endl;33 std::cerr << "USAGE: sub_graph_adaptor_demo input_file.dim" << std::endl; 29 34 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; 30 35 return 0; … … 48 53 49 54 readDimacs(is, g, length, s, t); 55 56 // GraphWriter<SmartGraph> writer(std::cout, g); 57 // writer.writeEdgeMap("length", length); 58 // writer.writeNode("source",s); 59 // writer.writeNode("target",t); 60 // writer.run(); 61 62 // GraphReader<ListGraph> reader(is,g); 63 // reader.readNode("source",s).readNode("target",t) 64 // .readEdgeMap("length",length).run(); 50 65 51 66 cout << "edges with lengths (of form id, source--length->target): " << endl;
Note: See TracChangeset
for help on using the changeset viewer.