COIN-OR::LEMON - Graph Library

Ticket #268: ns-vs-fix-b72846480f05.patch

File ns-vs-fix-b72846480f05.patch, 2.4 KB (added by Peter Kovacs, 15 years ago)
  • lemon/network_simplex.h

    # HG changeset patch
    # User Peter Kovacs <kpeter@inf.elte.hu>
    # Date 1240478711 -7200
    # Node ID b72846480f05ab53f80323bee1e111ecc6e9bbc9
    # Parent  85cb3aa71cced72f8915b8abf50f705037a76bb1
    VS compatibility fix (#268)
    
    diff --git a/lemon/network_simplex.h b/lemon/network_simplex.h
    a b  
    381381        const double BLOCK_SIZE_FACTOR = 2.0;
    382382        const int MIN_BLOCK_SIZE = 10;
    383383
    384         _block_size = std::max( int(BLOCK_SIZE_FACTOR * sqrt(_arc_num)),
    385                                 MIN_BLOCK_SIZE );
     384        _block_size =
     385          std::max( int(BLOCK_SIZE_FACTOR * sqrt(double(_arc_num))),
     386                    MIN_BLOCK_SIZE );
    386387      }
    387388
    388389      // Find next entering arc
     
    457458        const double MINOR_LIMIT_FACTOR = 0.1;
    458459        const int MIN_MINOR_LIMIT = 3;
    459460
    460         _list_length = std::max( int(LIST_LENGTH_FACTOR * sqrt(_arc_num)),
    461                                  MIN_LIST_LENGTH );
    462         _minor_limit = std::max( int(MINOR_LIMIT_FACTOR * _list_length),
    463                                  MIN_MINOR_LIMIT );
     461        _list_length =
     462          std::max( int(LIST_LENGTH_FACTOR * sqrt(double(_arc_num))),
     463                    MIN_LIST_LENGTH );
     464        _minor_limit =
     465          std::max( int(MINOR_LIMIT_FACTOR * _list_length),
     466                    MIN_MINOR_LIMIT );
    464467        _curr_length = _minor_count = 0;
    465468        _candidates.resize(_list_length);
    466469      }
     
    577580        const double HEAD_LENGTH_FACTOR = 0.1;
    578581        const int MIN_HEAD_LENGTH = 3;
    579582
    580         _block_size = std::max( int(BLOCK_SIZE_FACTOR * sqrt(_arc_num)),
    581                                 MIN_BLOCK_SIZE );
    582         _head_length = std::max( int(HEAD_LENGTH_FACTOR * _block_size),
    583                                  MIN_HEAD_LENGTH );
     583        _block_size =
     584          std::max( int(BLOCK_SIZE_FACTOR * sqrt(double(_arc_num))),
     585                    MIN_BLOCK_SIZE );
     586        _head_length =
     587          std::max( int(HEAD_LENGTH_FACTOR * _block_size),
     588                    MIN_HEAD_LENGTH );
    584589        _candidates.resize(_head_length + _block_size);
    585590        _curr_length = 0;
    586591      }
     
    12251230      }
    12261231
    12271232      // Store the arcs in a mixed order
    1228       int k = std::max(int(sqrt(_arc_num)), 10);
     1233      int k = std::max(int(sqrt(double(_arc_num))), 10);
    12291234      int i = 0;
    12301235      for (ArcIt e(_graph); e != INVALID; ++e) {
    12311236        _arc_ref[i] = e;