COIN-OR::LEMON - Graph Library

Changeset 562:b9b3473327e3 in lemon


Ignore:
Timestamp:
02/16/09 19:15:52 (11 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Parents:
561:2eb5c8ca2c91 (diff), 511:879c55700cd4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Phase:
public
Message:

Merge

Location:
lemon
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • lemon/CMakeLists.txt

    r511 r562  
    1 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
     1INCLUDE_DIRECTORIES(
     2  ${CMAKE_SOURCE_DIR}
     3  ${CMAKE_BINARY_DIR}
     4)
    25
    3 ADD_LIBRARY(lemon
     6CONFIGURE_FILE(
     7  ${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
     8  ${CMAKE_CURRENT_BINARY_DIR}/config.h
     9)
     10
     11SET(LEMON_SOURCES
    412  arg_parser.cc
    513  base.cc
    614  color.cc
     15  lp_base.cc
     16  lp_skeleton.cc
    717  random.cc
    818  bits/windows.cc
    919)
     20
     21IF(HAVE_GLPK)
     22  SET(LEMON_SOURCES ${LEMON_SOURCES} glpk.cc)
     23  INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIR})
     24  IF(WIN32)
     25    INSTALL(FILES ${GLPK_BIN_DIR}/glpk.dll DESTINATION bin)
     26    INSTALL(FILES ${GLPK_BIN_DIR}/libltdl3.dll DESTINATION bin)
     27    INSTALL(FILES ${GLPK_BIN_DIR}/zlib1.dll DESTINATION bin)
     28  ENDIF(WIN32)
     29ENDIF(HAVE_GLPK)
     30
     31ADD_LIBRARY(lemon ${LEMON_SOURCES})
    1032
    1133INSTALL(
  • lemon/CMakeLists.txt

    r498 r562  
    1515  lp_base.cc
    1616  lp_skeleton.cc
    17   random.cc)
     17  random.cc
     18  bits/windows.cc
     19)
    1820
    1921IF(HAVE_GLPK)
  • lemon/Makefile.am

    r511 r562  
    88
    99lemon_libemon_la_SOURCES = \
    10         lemon/arg_parser.cc \
    11         lemon/base.cc \
    12         lemon/color.cc \
     10        lemon/arg_parser.cc \
     11        lemon/base.cc \
     12        lemon/color.cc \
     13        lemon/lp_base.cc \
     14        lemon/lp_skeleton.cc \
    1315        lemon/random.cc \
    1416        lemon/bits/windows.cc
    1517
    16 #lemon_libemon_la_CXXFLAGS = $(GLPK_CFLAGS) $(CPLEX_CFLAGS) $(SOPLEX_CXXFLAGS)
    17 #lemon_libemon_la_LDFLAGS = $(GLPK_LIBS) $(CPLEX_LIBS) $(SOPLEX_LIBS)
     18
     19lemon_libemon_la_CXXFLAGS = \
     20        $(GLPK_CFLAGS) \
     21        $(CPLEX_CFLAGS) \
     22        $(SOPLEX_CXXFLAGS) \
     23        $(CLP_CXXFLAGS)
     24
     25lemon_libemon_la_LDFLAGS = \
     26        $(GLPK_LIBS) \
     27        $(CPLEX_LIBS) \
     28        $(SOPLEX_LIBS) \
     29        $(CLP_LIBS)
     30
     31if HAVE_GLPK
     32lemon_libemon_la_SOURCES += lemon/glpk.cc
     33endif
     34
     35if HAVE_CPLEX
     36lemon_libemon_la_SOURCES += lemon/cplex.cc
     37endif
     38
     39if HAVE_SOPLEX
     40lemon_libemon_la_SOURCES += lemon/soplex.cc
     41endif
     42
     43if HAVE_CLP
     44lemon_libemon_la_SOURCES += lemon/clp.cc
     45endif
    1846
    1947lemon_HEADERS += \
    20         lemon/arg_parser.h \
     48        lemon/adaptors.h \
     49        lemon/arg_parser.h \
    2150        lemon/assert.h \
    22         lemon/bfs.h \
    23         lemon/bin_heap.h \
    24         lemon/color.h \
     51        lemon/bfs.h \
     52        lemon/bin_heap.h \
     53        lemon/circulation.h \
     54        lemon/clp.h \
     55        lemon/color.h \
    2556        lemon/concept_check.h \
    26         lemon/counter.h \
     57        lemon/counter.h \
    2758        lemon/core.h \
    28         lemon/dfs.h \
    29         lemon/dijkstra.h \
    30         lemon/dim2.h \
     59        lemon/cplex.h \
     60        lemon/dfs.h \
     61        lemon/dijkstra.h \
     62        lemon/dim2.h \
     63        lemon/dimacs.h \
     64        lemon/edge_set.h \
     65        lemon/elevator.h \
    3166        lemon/error.h \
    32         lemon/graph_to_eps.h \
     67        lemon/full_graph.h \
     68        lemon/glpk.h \
     69        lemon/graph_to_eps.h \
     70        lemon/grid_graph.h \
     71        lemon/hypercube_graph.h \
    3372        lemon/kruskal.h \
     73        lemon/hao_orlin.h \
    3474        lemon/lgf_reader.h \
    3575        lemon/lgf_writer.h \
    3676        lemon/list_graph.h \
     77        lemon/lp.h \
     78        lemon/lp_base.h \
     79        lemon/lp_skeleton.h \
     80        lemon/list_graph.h \
    3781        lemon/maps.h \
    3882        lemon/math.h \
     83        lemon/max_matching.h \
     84        lemon/nauty_reader.h \
    3985        lemon/path.h \
    40         lemon/random.h \
     86        lemon/preflow.h \
     87        lemon/radix_sort.h \
     88        lemon/random.h \
    4189        lemon/smart_graph.h \
    42         lemon/time_measure.h \
    43         lemon/tolerance.h \
     90        lemon/soplex.h \
     91        lemon/suurballe.h \
     92        lemon/time_measure.h \
     93        lemon/tolerance.h \
    4494        lemon/unionfind.h \
    4595        lemon/bits/windows.h
     
    4999        lemon/bits/array_map.h \
    50100        lemon/bits/base_extender.h \
    51         lemon/bits/bezier.h \
     101        lemon/bits/bezier.h \
    52102        lemon/bits/default_map.h \
    53         lemon/bits/enable_if.h \
     103        lemon/bits/edge_set_extender.h \
     104        lemon/bits/enable_if.h \
     105        lemon/bits/graph_adaptor_extender.h \
    54106        lemon/bits/graph_extender.h \
    55107        lemon/bits/map_extender.h \
    56108        lemon/bits/path_dump.h \
     109        lemon/bits/solver_bits.h \
    57110        lemon/bits/traits.h \
     111        lemon/bits/variant.h \
    58112        lemon/bits/vector_map.h
    59113
  • lemon/Makefile.am

    r492 r562  
    1313        lemon/lp_base.cc \
    1414        lemon/lp_skeleton.cc \
    15         lemon/random.cc
     15        lemon/random.cc \
     16        lemon/bits/windows.cc
    1617
    1718
     
    9192        lemon/time_measure.h \
    9293        lemon/tolerance.h \
    93         lemon/unionfind.h
     94        lemon/unionfind.h \
     95        lemon/bits/windows.h
    9496
    9597bits_HEADERS += \
  • lemon/graph_to_eps.h

    r511 r562  
    33 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    5  * Copyright (C) 2003-2008
     5 * Copyright (C) 2003-2009
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
  • lemon/graph_to_eps.h

    r556 r562  
    3030#include<ctime>
    3131#else
    32 #ifndef WIN32_LEAN_AND_MEAN
    33 #define WIN32_LEAN_AND_MEAN
    34 #endif
    35 #ifndef NOMINMAX
    36 #define NOMINMAX
    37 #endif
    38 #include<windows.h>
     32#include<lemon/bits/windows.h>
    3933#endif
    4034
     
    684678
    685679    {
     680      os << "%%CreationDate: ";
    686681#ifndef WIN32
    687682      timeval tv;
     
    690685      char cbuf[26];
    691686      ctime_r(&tv.tv_sec,cbuf);
    692       os << "%%CreationDate: " << cbuf;
     687      os << cbuf;
    693688#else
    694       SYSTEMTIME time;
    695       GetSystemTime(&time);
    696 #if defined(_MSC_VER) && (_MSC_VER < 1500)
    697       LPWSTR buf1, buf2, buf3;
    698       if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
    699                         L"ddd MMM dd", buf1, 11) &&
    700           GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time,
    701                         L"HH':'mm':'ss", buf2, 9) &&
    702           GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
    703                         L"yyyy", buf3, 5)) {
    704         os << "%%CreationDate: " << buf1 << ' '
    705            << buf2 << ' ' << buf3 << std::endl;
    706       }
    707 #else
    708         char buf1[11], buf2[9], buf3[5];
    709         if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
    710                           "ddd MMM dd", buf1, 11) &&
    711             GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time,
    712                           "HH':'mm':'ss", buf2, 9) &&
    713             GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
    714                           "yyyy", buf3, 5)) {
    715           os << "%%CreationDate: " << buf1 << ' '
    716              << buf2 << ' ' << buf3 << std::endl;
    717         }
     689      os << bits::getWinFormattedDate();
    718690#endif
    719 #endif
    720     }
     691    }
     692    os << std::endl;
    721693
    722694    if (_autoArcWidthScale) {
  • lemon/random.h

    r511 r562  
    33 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    5  * Copyright (C) 2003-2008
     5 * Copyright (C) 2003-2009
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
     
    541541    /// @{
    542542
    543     ///\name Initialization
    544     ///
    545     /// @{
    546 
    547543    /// \brief Default constructor
    548544    ///
     
    691687    }
    692688
    693     /// @}
    694 
    695     ///\name Uniform distributions
    696     ///
    697     /// @{
    698 
    699689    /// \brief Returns a random real number from the range [0, 1)
    700690    ///
     
    751741      return _random_bits::IntConversion<Number, Word>::convert(core);
    752742    }
    753 
    754     /// @}
    755743
    756744    unsigned int uinteger() {
     
    787775    ///\name Non-uniform distributions
    788776    ///
    789 
    790777    ///@{
    791778
    792     /// \brief Returns a random bool
     779    /// \brief Returns a random bool with given probability of true result.
    793780    ///
    794781    /// It returns a random bool with given probability of true result.
     
    797784    }
    798785
    799     /// Standard Gauss distribution
    800 
    801     /// Standard Gauss distribution.
     786    /// Standard normal (Gauss) distribution
     787
     788    /// Standard normal (Gauss) distribution.
    802789    /// \note The Cartesian form of the Box-Muller
    803790    /// transformation is used to generate a random normal distribution.
     
    812799      return std::sqrt(-2*std::log(S)/S)*V1;
    813800    }
    814     /// Gauss distribution with given mean and standard deviation
    815 
    816     /// Gauss distribution with given mean and standard deviation.
     801    /// Normal (Gauss) distribution with given mean and standard deviation
     802
     803    /// Normal (Gauss) distribution with given mean and standard deviation.
    817804    /// \sa gauss()
    818805    double gauss(double mean,double std_dev)
    819806    {
    820807      return gauss()*std_dev+mean;
     808    }
     809
     810    /// Lognormal distribution
     811
     812    /// Lognormal distribution. The parameters are the mean and the standard
     813    /// deviation of <tt>exp(X)</tt>.
     814    ///
     815    double lognormal(double n_mean,double n_std_dev)
     816    {
     817      return std::exp(gauss(n_mean,n_std_dev));
     818    }
     819    /// Lognormal distribution
     820
     821    /// Lognormal distribution. The parameter is an <tt>std::pair</tt> of
     822    /// the mean and the standard deviation of <tt>exp(X)</tt>.
     823    ///
     824    double lognormal(const std::pair<double,double> &params)
     825    {
     826      return std::exp(gauss(params.first,params.second));
     827    }
     828    /// Compute the lognormal parameters from mean and standard deviation
     829
     830    /// This function computes the lognormal parameters from mean and
     831    /// standard deviation. The return value can direcly be passed to
     832    /// lognormal().
     833    std::pair<double,double> lognormalParamsFromMD(double mean,
     834                                                   double std_dev)
     835    {
     836      double fr=std_dev/mean;
     837      fr*=fr;
     838      double lg=std::log(1+fr);
     839      return std::pair<double,double>(std::log(mean)-lg/2.0,std::sqrt(lg));
     840    }
     841    /// Lognormal distribution with given mean and standard deviation
     842
     843    /// Lognormal distribution with given mean and standard deviation.
     844    ///
     845    double lognormalMD(double mean,double std_dev)
     846    {
     847      return lognormal(lognormalParamsFromMD(mean,std_dev));
    821848    }
    822849
     
    924951    ///\name Two dimensional distributions
    925952    ///
    926 
    927953    ///@{
    928954
     
    941967      return dim2::Point<double>(V1,V2);
    942968    }
    943     /// A kind of two dimensional Gauss distribution
     969    /// A kind of two dimensional normal (Gauss) distribution
    944970
    945971    /// This function provides a turning symmetric two-dimensional distribution.
  • lemon/random.h

    r463 r562  
    7878#include <unistd.h>
    7979#else
    80 #include <windows.h>
     80#include <lemon/bits/windows.h>
    8181#endif
    8282
     
    663663      seed(getpid() + tv.tv_sec + tv.tv_usec);
    664664#else
    665       FILETIME time;
    666       GetSystemTimeAsFileTime(&time);
    667       seed(GetCurrentProcessId() + time.dwHighDateTime + time.dwLowDateTime);
     665      seed(bits::getWinRndSeed());
    668666#endif
    669667      return true;
  • lemon/time_measure.h

    r511 r562  
    33 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    5  * Copyright (C) 2003-2008
     5 * Copyright (C) 2003-2009
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
  • lemon/time_measure.h

    r556 r562  
    2525
    2626#ifdef WIN32
    27 #ifndef WIN32_LEAN_AND_MEAN
    28 #define WIN32_LEAN_AND_MEAN
    29 #endif
    30 #ifndef NOMINMAX
    31 #define NOMINMAX
    32 #endif
    33 #include <windows.h>
    34 #include <cmath>
     27#include <lemon/bits/windows.h>
    3528#else
    3629#include <unistd.h>
     
    9386      cstime=ts.tms_cstime/tck;
    9487#else
    95       static const double ch = 4294967296.0e-7;
    96       static const double cl = 1.0e-7;
    97 
    98       FILETIME system;
    99       GetSystemTimeAsFileTime(&system);
    100       rtime = ch * system.dwHighDateTime + cl * system.dwLowDateTime;
    101 
    102       FILETIME create, exit, kernel, user;
    103       if (GetProcessTimes(GetCurrentProcess(),&create, &exit, &kernel, &user)) {
    104         utime = ch * user.dwHighDateTime + cl * user.dwLowDateTime;
    105         stime = ch * kernel.dwHighDateTime + cl * kernel.dwLowDateTime;
    106         cutime = 0;
    107         cstime = 0;
    108       } else {
    109         rtime = 0;
    110         utime = 0;
    111         stime = 0;
    112         cutime = 0;
    113         cstime = 0;
    114       }
     88      bits::getWinProcTimes(rtime, utime, stime, cutime, cstime);
    11589#endif
    11690    }
Note: See TracChangeset for help on using the changeset viewer.