COIN-OR::LEMON - Graph Library

Changeset 1577:15098fb5275c in lemon-0.x


Ignore:
Timestamp:
07/20/05 18:05:04 (19 years ago)
Author:
athos
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2078
Message:

Documentation (lp_demo,lp_maxflow) and slight changes (rest).

Location:
demo
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • demo/coloring.cc

    r1560 r1577  
    1717  if(argc<2)
    1818  {
    19       std::cerr << "USAGE: coloring <input_file.lgf>" << std::endl;
     19      std::cerr << "USAGE: coloring input_file.lgf" << std::endl;
    2020      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;
    2121      return 0;
  • demo/dim_to_dot.cc

    r1435 r1577  
    66// This program can be an aid in making up to date visualized documantation
    77// 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
    818
    919#include <iostream>
     
    1828using std::endl;
    1929
    20 int main()
    21 {   
     30int 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
    2243  typedef SmartGraph Graph;
    2344
     
    3253  LengthMap length(g);
    3354
    34   readDimacs(std::cin, g, length, s, t);
     55  readDimacs(is, g, length, s, t);
    3556
    3657  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
    127#ifdef HAVE_CONFIG_H
    228#include <config.h>
     
    1440using namespace lemon;
    1541
     42
     43
    1644#ifdef HAVE_GLPK
    1745typedef LpGlpk LpDefault;
     46const char default_solver_name[]="GLPK";
    1847#elif HAVE_CPLEX
    1948typedef LpCplex LpDefault;
     49const char default_solver_name[]="CPLEX";
    2050#endif
    2151
     
    3060  typedef LpDefault::Col Col;
    3161 
     62
     63  std::cout<<"A program demonstrating the LEMON LP solver interface"<<std::endl;
     64  std::cout<<"Solver used: "<<default_solver_name<<std::endl;
    3265
    3366  //This will be a maximization
     
    5588  //Print results
    5689  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",
    5892           lp.primalValue(),
    5993           lp.primal(x1), lp.primal(x2), lp.primal(x3));
  • demo/lp_maxflow_demo.cc

    r1571 r1577  
    4545#ifdef HAVE_GLPK
    4646typedef LpGlpk LpDefault;
     47const char default_solver_name[]="GLPK";
    4748#elif HAVE_CPLEX
    4849typedef LpCplex LpDefault;
     50const char default_solver_name[]="CPLEX";
    4951#endif
    5052
     
    9799#endif
    98100
     101  std::cout<<"Solver used: "<<default_solver_name<<std::endl;
     102
    99103  //Solve with the underlying solver
    100104  lp.solve();
     
    107111  if(argc<2)
    108112  {
    109       std::cerr << "  USAGE: lp_maxflow_demo <input_file.lgf>" << std::endl;
     113      std::cerr << "  USAGE: lp_maxflow_demo input_file.lgf" << std::endl;
    110114      std::cerr << "  The file 'input_file.lgf' has to contain a max "
    111115                << "flow instance in\n"
  • demo/sub_graph_adaptor_demo.cc

    r1560 r1577  
    1717#include <tight_edge_filter_map.h>
    1818
     19
     20
     21//#include <lemon/graph_reader.h>
     22//#include <lemon/graph_writer.h>
     23
    1924using namespace lemon;
    2025
     
    2631  if(argc<2)
    2732  {
    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;
    2934      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;
    3035      return 0;
     
    4853
    4954  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();
    5065
    5166  cout << "edges with lengths (of form id, source--length->target): " << endl;
Note: See TracChangeset for help on using the changeset viewer.