COIN-OR::LEMON - Graph Library

Changeset 608:6e0525ec5355 in lemon for tools


Ignore:
Timestamp:
03/30/09 17:46:37 (11 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Children:
609:538b3dd9a2c0, 1372:f37f0845cf32
Phase:
public
Message:

Accept negative values as unbounded capacity in dimacs readers (#243)
and some doc improvements.

Location:
tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tools/dimacs-solver.cc

    r579 r608  
    7373template<class Value>
    7474void solve_max(ArgParser &ap, std::istream &is, std::ostream &,
    75               DimacsDescriptor &desc)
     75               Value infty, DimacsDescriptor &desc)
    7676{
    7777  bool report = !ap.given("q");
     
    8181  Timer ti;
    8282  ti.restart();
    83   readDimacsMax(is, g, cap, s, t, desc);
     83  readDimacsMax(is, g, cap, s, t, infty, desc);
    8484  if(report) std::cerr << "Read the file: " << ti << '\n';
    8585  ti.restart();
     
    116116           DimacsDescriptor &desc)
    117117{
     118  std::stringstream iss(ap["infcap"]);
     119  Value infty;
     120  iss >> infty;
     121  if(iss.fail())
     122    {
     123      std::cerr << "Cannot interpret '"
     124                << static_cast<std::string>(ap["infcap"]) << "' as infinite"
     125                << std::endl;
     126      exit(1);
     127    }
     128 
    118129  switch(desc.type)
    119130    {
     
    123134      break;
    124135    case DimacsDescriptor::MAX:
    125       solve_max<Value>(ap,is,os,desc);
     136      solve_max<Value>(ap,is,os,infty,desc);
    126137      break;
    127138    case DimacsDescriptor::SP:
     
    160171    .optionGroup("datatype","ldouble")
    161172    .onlyOneGroup("datatype")
     173    .stringOption("infcap","Value used for 'very high' capacities","0")
    162174    .run();
    163175
  • tools/dimacs-to-lgf.cc

    r463 r608  
    9797        DoubleArcMap lower(digraph), capacity(digraph), cost(digraph);
    9898        DoubleNodeMap supply(digraph);
    99         readDimacsMin(is, digraph, lower, capacity, cost, supply, desc);
     99        readDimacsMin(is, digraph, lower, capacity, cost, supply, 0, desc);
    100100        DigraphWriter<Digraph>(digraph, os).
    101101          nodeMap("supply", supply).
     
    112112        Node s, t;
    113113        DoubleArcMap capacity(digraph);
    114         readDimacsMax(is, digraph, capacity, s, t, desc);
     114        readDimacsMax(is, digraph, capacity, s, t, 0, desc);
    115115        DigraphWriter<Digraph>(digraph, os).
    116116          arcMap("capacity", capacity).
Note: See TracChangeset for help on using the changeset viewer.