Changeset 492:b9b3473327e3 in lemon-main
- Timestamp:
- 02/16/09 19:15:52 (16 years ago)
- Branch:
- default
- Parents:
- 490:2eb5c8ca2c91 (diff), 491: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
- Location:
- lemon
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/CMakeLists.txt
r474 r492 15 15 lp_base.cc 16 16 lp_skeleton.cc 17 random.cc) 17 random.cc 18 bits/windows.cc 19 ) 18 20 19 21 IF(HAVE_GLPK) -
lemon/CMakeLists.txt
r491 r492 1 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}) 1 INCLUDE_DIRECTORIES( 2 ${CMAKE_SOURCE_DIR} 3 ${CMAKE_BINARY_DIR} 4 ) 2 5 3 ADD_LIBRARY(lemon 6 CONFIGURE_FILE( 7 ${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake 8 ${CMAKE_CURRENT_BINARY_DIR}/config.h 9 ) 10 11 SET(LEMON_SOURCES 4 12 arg_parser.cc 5 13 base.cc 6 14 color.cc 15 lp_base.cc 16 lp_skeleton.cc 7 17 random.cc 8 18 bits/windows.cc 9 19 ) 20 21 IF(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) 29 ENDIF(HAVE_GLPK) 30 31 ADD_LIBRARY(lemon ${LEMON_SOURCES}) 10 32 11 33 INSTALL( -
lemon/Makefile.am
r469 r492 13 13 lemon/lp_base.cc \ 14 14 lemon/lp_skeleton.cc \ 15 lemon/random.cc 15 lemon/random.cc \ 16 lemon/bits/windows.cc 16 17 17 18 … … 91 92 lemon/time_measure.h \ 92 93 lemon/tolerance.h \ 93 lemon/unionfind.h 94 lemon/unionfind.h \ 95 lemon/bits/windows.h 94 96 95 97 bits_HEADERS += \ -
lemon/Makefile.am
r491 r492 8 8 9 9 lemon_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 \ 13 15 lemon/random.cc \ 14 16 lemon/bits/windows.cc 15 17 16 #lemon_libemon_la_CXXFLAGS = $(GLPK_CFLAGS) $(CPLEX_CFLAGS) $(SOPLEX_CXXFLAGS) 17 #lemon_libemon_la_LDFLAGS = $(GLPK_LIBS) $(CPLEX_LIBS) $(SOPLEX_LIBS) 18 19 lemon_libemon_la_CXXFLAGS = \ 20 $(GLPK_CFLAGS) \ 21 $(CPLEX_CFLAGS) \ 22 $(SOPLEX_CXXFLAGS) \ 23 $(CLP_CXXFLAGS) 24 25 lemon_libemon_la_LDFLAGS = \ 26 $(GLPK_LIBS) \ 27 $(CPLEX_LIBS) \ 28 $(SOPLEX_LIBS) \ 29 $(CLP_LIBS) 30 31 if HAVE_GLPK 32 lemon_libemon_la_SOURCES += lemon/glpk.cc 33 endif 34 35 if HAVE_CPLEX 36 lemon_libemon_la_SOURCES += lemon/cplex.cc 37 endif 38 39 if HAVE_SOPLEX 40 lemon_libemon_la_SOURCES += lemon/soplex.cc 41 endif 42 43 if HAVE_CLP 44 lemon_libemon_la_SOURCES += lemon/clp.cc 45 endif 18 46 19 47 lemon_HEADERS += \ 20 lemon/arg_parser.h \ 48 lemon/adaptors.h \ 49 lemon/arg_parser.h \ 21 50 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 \ 25 56 lemon/concept_check.h \ 26 57 lemon/counter.h \ 27 58 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 \ 31 66 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 \ 33 72 lemon/kruskal.h \ 73 lemon/hao_orlin.h \ 34 74 lemon/lgf_reader.h \ 35 75 lemon/lgf_writer.h \ 36 76 lemon/list_graph.h \ 77 lemon/lp.h \ 78 lemon/lp_base.h \ 79 lemon/lp_skeleton.h \ 80 lemon/list_graph.h \ 37 81 lemon/maps.h \ 38 82 lemon/math.h \ 83 lemon/max_matching.h \ 84 lemon/nauty_reader.h \ 39 85 lemon/path.h \ 40 lemon/random.h \ 86 lemon/preflow.h \ 87 lemon/radix_sort.h \ 88 lemon/random.h \ 41 89 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 \ 44 94 lemon/unionfind.h \ 45 95 lemon/bits/windows.h … … 49 99 lemon/bits/array_map.h \ 50 100 lemon/bits/base_extender.h \ 51 101 lemon/bits/bezier.h \ 52 102 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 \ 54 106 lemon/bits/graph_extender.h \ 55 107 lemon/bits/map_extender.h \ 56 108 lemon/bits/path_dump.h \ 109 lemon/bits/solver_bits.h \ 57 110 lemon/bits/traits.h \ 111 lemon/bits/variant.h \ 58 112 lemon/bits/vector_map.h 59 113 -
lemon/graph_to_eps.h
r485 r492 30 30 #include<ctime> 31 31 #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> 39 33 #endif 40 34 … … 684 678 685 679 { 680 os << "%%CreationDate: "; 686 681 #ifndef WIN32 687 682 timeval tv; … … 690 685 char cbuf[26]; 691 686 ctime_r(&tv.tv_sec,cbuf); 692 os << "%%CreationDate: " <<cbuf;687 os << cbuf; 693 688 #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(); 718 690 #endif 719 #endif 720 }691 } 692 os << std::endl; 721 693 722 694 if (_autoArcWidthScale) { -
lemon/graph_to_eps.h
r491 r492 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). -
lemon/random.h
r440 r492 78 78 #include <unistd.h> 79 79 #else 80 #include < windows.h>80 #include <lemon/bits/windows.h> 81 81 #endif 82 82 … … 663 663 seed(getpid() + tv.tv_sec + tv.tv_usec); 664 664 #else 665 FILETIME time; 666 GetSystemTimeAsFileTime(&time); 667 seed(GetCurrentProcessId() + time.dwHighDateTime + time.dwLowDateTime); 665 seed(bits::getWinRndSeed()); 668 666 #endif 669 667 return true; -
lemon/random.h
r491 r492 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 541 541 /// @{ 542 542 543 ///\name Initialization544 ///545 /// @{546 547 543 /// \brief Default constructor 548 544 /// … … 691 687 } 692 688 693 /// @}694 695 ///\name Uniform distributions696 ///697 /// @{698 699 689 /// \brief Returns a random real number from the range [0, 1) 700 690 /// … … 751 741 return _random_bits::IntConversion<Number, Word>::convert(core); 752 742 } 753 754 /// @}755 743 756 744 unsigned int uinteger() { … … 787 775 ///\name Non-uniform distributions 788 776 /// 789 790 777 ///@{ 791 778 792 /// \brief Returns a random bool 779 /// \brief Returns a random bool with given probability of true result. 793 780 /// 794 781 /// It returns a random bool with given probability of true result. … … 797 784 } 798 785 799 /// Standard Gaussdistribution800 801 /// Standard Gaussdistribution.786 /// Standard normal (Gauss) distribution 787 788 /// Standard normal (Gauss) distribution. 802 789 /// \note The Cartesian form of the Box-Muller 803 790 /// transformation is used to generate a random normal distribution. … … 812 799 return std::sqrt(-2*std::log(S)/S)*V1; 813 800 } 814 /// Gaussdistribution with given mean and standard deviation815 816 /// Gaussdistribution 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. 817 804 /// \sa gauss() 818 805 double gauss(double mean,double std_dev) 819 806 { 820 807 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> ¶ms) 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)); 821 848 } 822 849 … … 924 951 ///\name Two dimensional distributions 925 952 /// 926 927 953 ///@{ 928 954 … … 941 967 return dim2::Point<double>(V1,V2); 942 968 } 943 /// A kind of two dimensional Gaussdistribution969 /// A kind of two dimensional normal (Gauss) distribution 944 970 945 971 /// This function provides a turning symmetric two-dimensional distribution. -
lemon/time_measure.h
r485 r492 25 25 26 26 #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> 35 28 #else 36 29 #include <unistd.h> … … 93 86 cstime=ts.tms_cstime/tck; 94 87 #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); 115 89 #endif 116 90 } -
lemon/time_measure.h
r491 r492 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-200 85 * Copyright (C) 2003-2009 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
Note: See TracChangeset
for help on using the changeset viewer.