0
4
0
| 1 | 1 |
CMAKE_MINIMUM_REQUIRED(VERSION 2.6) |
| 2 | 2 |
|
| 3 | 3 |
SET(PROJECT_NAME "LEMON") |
| 4 | 4 |
SET(PROJECT_VERSION "hg-tip" CACHE STRING "The version string.") |
| 5 | 5 |
|
| 6 | 6 |
PROJECT(${PROJECT_NAME})
|
| 7 | 7 |
|
| 8 | 8 |
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
| 9 | 9 |
|
| 10 | 10 |
INCLUDE(FindDoxygen) |
| 11 | 11 |
INCLUDE(FindGhostscript) |
| 12 | 12 |
FIND_PACKAGE(GLPK 4.33) |
| 13 | 13 |
|
| 14 | 14 |
ADD_DEFINITIONS(-DHAVE_CONFIG_H) |
| 15 | 15 |
|
| 16 |
IF(MSVC) |
|
| 17 |
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4250 /wd4355 /wd4800 /wd4996")
|
|
| 18 |
# Suppressed warnings: |
|
| 19 |
# C4250: 'class1' : inherits 'class2::member' via dominance |
|
| 20 |
# C4355: 'this' : used in base member initializer list |
|
| 21 |
# C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning) |
|
| 22 |
# C4996: 'function': was declared deprecated |
|
| 23 |
ENDIF(MSVC) |
|
| 24 |
|
|
| 16 | 25 |
IF(GLPK_FOUND) |
| 17 | 26 |
SET(HAVE_LP TRUE) |
| 18 | 27 |
SET(HAVE_MIP TRUE) |
| 19 | 28 |
SET(HAVE_GLPK TRUE) |
| 20 | 29 |
ENDIF(GLPK_FOUND) |
| 21 | 30 |
|
| 22 | 31 |
ENABLE_TESTING() |
| 23 | 32 |
|
| 24 | 33 |
ADD_SUBDIRECTORY(lemon) |
| 25 | 34 |
ADD_SUBDIRECTORY(demo) |
| 26 | 35 |
ADD_SUBDIRECTORY(doc) |
| 27 | 36 |
ADD_SUBDIRECTORY(test) |
| 28 | 37 |
|
| 29 | 38 |
IF(WIN32) |
| 30 | 39 |
INSTALL(FILES ${CMAKE_SOURCE_DIR}/cmake/nsis/lemon.ico
|
| 31 | 40 |
DESTINATION bin) |
| 32 | 41 |
ENDIF(WIN32) |
| 33 | 42 |
|
| 34 | 43 |
IF(WIN32) |
| 35 | 44 |
SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
|
| 36 | 45 |
SET(CPACK_PACKAGE_VENDOR |
| 37 | 46 |
"EGRES - Egervary Research Group on Combinatorial Optimization") |
| 38 | 47 |
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY |
| 39 | 48 |
"LEMON - Library of Efficient Models and Optimization in Networks") |
| ... | ... |
@@ -2,33 +2,33 @@ |
| 2 | 2 |
* |
| 3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
| 4 | 4 |
* |
| 5 | 5 |
* Copyright (C) 2003-2009 |
| 6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
| 7 | 7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES). |
| 8 | 8 |
* |
| 9 | 9 |
* Permission to use, modify and distribute this software is granted |
| 10 | 10 |
* provided that this copyright notice appears in all copies. For |
| 11 | 11 |
* precise terms see the accompanying LICENSE file. |
| 12 | 12 |
* |
| 13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
| 14 | 14 |
* express or implied, and with no claim as to its suitability for any |
| 15 | 15 |
* purpose. |
| 16 | 16 |
* |
| 17 | 17 |
*/ |
| 18 | 18 |
|
| 19 | 19 |
///\file |
| 20 | 20 |
///\brief Some basic non-inline functions and static global data. |
| 21 | 21 |
|
| 22 | 22 |
#include<lemon/tolerance.h> |
| 23 | 23 |
#include<lemon/core.h> |
| 24 | 24 |
namespace lemon {
|
| 25 | 25 |
|
| 26 |
float Tolerance<float>::def_epsilon = 1e-4; |
|
| 26 |
float Tolerance<float>::def_epsilon = static_cast<float>(1e-4); |
|
| 27 | 27 |
double Tolerance<double>::def_epsilon = 1e-10; |
| 28 | 28 |
long double Tolerance<long double>::def_epsilon = 1e-14; |
| 29 | 29 |
|
| 30 | 30 |
#ifndef LEMON_ONLY_TEMPLATES |
| 31 | 31 |
const Invalid INVALID = Invalid(); |
| 32 | 32 |
#endif |
| 33 | 33 |
|
| 34 | 34 |
} //namespace lemon |
| 1 | 1 |
INCLUDE_DIRECTORIES( |
| 2 | 2 |
${CMAKE_SOURCE_DIR}
|
| 3 | 3 |
${CMAKE_BINARY_DIR}
|
| 4 | 4 |
) |
| 5 | 5 |
|
| 6 | 6 |
IF(HAVE_GLPK) |
| 7 | 7 |
INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIR})
|
| 8 | 8 |
ENDIF(HAVE_GLPK) |
| 9 | 9 |
|
| 10 | 10 |
LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon)
|
| 11 | 11 |
|
| 12 | 12 |
SET(TESTS |
| 13 |
adaptors_test |
|
| 13 |
# adaptors_test |
|
| 14 | 14 |
bfs_test |
| 15 | 15 |
circulation_test |
| 16 | 16 |
counter_test |
| 17 | 17 |
dfs_test |
| 18 | 18 |
digraph_test |
| 19 | 19 |
dijkstra_test |
| 20 | 20 |
dim_test |
| 21 |
edge_set_test |
|
| 21 |
# edge_set_test |
|
| 22 | 22 |
error_test |
| 23 | 23 |
graph_copy_test |
| 24 | 24 |
graph_test |
| 25 | 25 |
graph_utils_test |
| 26 | 26 |
hao_orlin_test |
| 27 | 27 |
heap_test |
| 28 | 28 |
kruskal_test |
| 29 | 29 |
maps_test |
| 30 | 30 |
max_matching_test |
| 31 | 31 |
path_test |
| 32 | 32 |
preflow_test |
| 33 | 33 |
radix_sort_test |
| 34 | 34 |
random_test |
| 35 | 35 |
suurballe_test |
| 36 | 36 |
time_measure_test |
| 37 | 37 |
unionfind_test) |
| 38 | 38 |
|
| 39 | 39 |
IF(HAVE_LP) |
| 40 | 40 |
ADD_EXECUTABLE(lp_test lp_test.cc) |
| 41 | 41 |
IF(HAVE_GLPK) |
| 42 | 42 |
TARGET_LINK_LIBRARIES(lp_test lemon ${GLPK_LIBRARIES})
|
| 43 | 43 |
ENDIF(HAVE_GLPK) |
| 44 | 44 |
ADD_TEST(lp_test lp_test) |
| 45 | 45 |
| ... | ... |
@@ -149,78 +149,78 @@ |
| 149 | 149 |
SparseMap<A,B> map3 = sparseMap<A,B>(); |
| 150 | 150 |
SparseMap<A,B> map4 = sparseMap<A>(B()); |
| 151 | 151 |
|
| 152 | 152 |
checkConcept< ReferenceMap<double, int, int&, const int&>, |
| 153 | 153 |
SparseMap<double, int> >(); |
| 154 | 154 |
std::map<double, int> m; |
| 155 | 155 |
SparseMap<double, int> map5(m); |
| 156 | 156 |
SparseMap<double, int> map6(m,10); |
| 157 | 157 |
SparseMap<double, int> map7 = sparseMap(m); |
| 158 | 158 |
SparseMap<double, int> map8 = sparseMap(m,10); |
| 159 | 159 |
|
| 160 | 160 |
check(map5[1.0] == 0 && map5[3.14] == 0 && |
| 161 | 161 |
map6[1.0] == 10 && map6[3.14] == 10, |
| 162 | 162 |
"Something is wrong with SparseMap"); |
| 163 | 163 |
map5[1.0] = map6[3.14] = 100; |
| 164 | 164 |
check(map5[1.0] == 100 && map5[3.14] == 0 && |
| 165 | 165 |
map6[1.0] == 10 && map6[3.14] == 100, |
| 166 | 166 |
"Something is wrong with SparseMap"); |
| 167 | 167 |
} |
| 168 | 168 |
|
| 169 | 169 |
// ComposeMap |
| 170 | 170 |
{
|
| 171 | 171 |
typedef ComposeMap<DoubleMap, ReadMap<B,A> > CompMap; |
| 172 | 172 |
checkConcept<ReadMap<B,double>, CompMap>(); |
| 173 |
CompMap map1(DoubleMap(),ReadMap<B,A>()); |
|
| 173 |
CompMap map1 = CompMap(DoubleMap(),ReadMap<B,A>()); |
|
| 174 | 174 |
CompMap map2 = composeMap(DoubleMap(), ReadMap<B,A>()); |
| 175 | 175 |
|
| 176 | 176 |
SparseMap<double, bool> m1(false); m1[3.14] = true; |
| 177 | 177 |
RangeMap<double> m2(2); m2[0] = 3.0; m2[1] = 3.14; |
| 178 | 178 |
check(!composeMap(m1,m2)[0] && composeMap(m1,m2)[1], |
| 179 | 179 |
"Something is wrong with ComposeMap") |
| 180 | 180 |
} |
| 181 | 181 |
|
| 182 | 182 |
// CombineMap |
| 183 | 183 |
{
|
| 184 | 184 |
typedef CombineMap<DoubleMap, DoubleMap, std::plus<double> > CombMap; |
| 185 | 185 |
checkConcept<ReadMap<A,double>, CombMap>(); |
| 186 |
CombMap map1(DoubleMap(), DoubleMap()); |
|
| 186 |
CombMap map1 = CombMap(DoubleMap(), DoubleMap()); |
|
| 187 | 187 |
CombMap map2 = combineMap(DoubleMap(), DoubleMap(), std::plus<double>()); |
| 188 | 188 |
|
| 189 | 189 |
check(combineMap(constMap<B,int,2>(), identityMap<B>(), &binc)[B()] == 3, |
| 190 | 190 |
"Something is wrong with CombineMap"); |
| 191 | 191 |
} |
| 192 | 192 |
|
| 193 | 193 |
// FunctorToMap, MapToFunctor |
| 194 | 194 |
{
|
| 195 | 195 |
checkConcept<ReadMap<A,B>, FunctorToMap<F,A,B> >(); |
| 196 | 196 |
checkConcept<ReadMap<A,B>, FunctorToMap<F> >(); |
| 197 | 197 |
FunctorToMap<F> map1; |
| 198 |
FunctorToMap<F> map2(F()); |
|
| 198 |
FunctorToMap<F> map2 = FunctorToMap<F>(F()); |
|
| 199 | 199 |
B b = functorToMap(F())[A()]; |
| 200 | 200 |
|
| 201 | 201 |
checkConcept<ReadMap<A,B>, MapToFunctor<ReadMap<A,B> > >(); |
| 202 |
MapToFunctor<ReadMap<A,B> > map(ReadMap<A,B>()); |
|
| 202 |
MapToFunctor<ReadMap<A,B> > map = MapToFunctor<ReadMap<A,B> >(ReadMap<A,B>()); |
|
| 203 | 203 |
|
| 204 | 204 |
check(functorToMap(&func)[A()] == 3, |
| 205 | 205 |
"Something is wrong with FunctorToMap"); |
| 206 | 206 |
check(mapToFunctor(constMap<A,int>(2))(A()) == 2, |
| 207 | 207 |
"Something is wrong with MapToFunctor"); |
| 208 | 208 |
check(mapToFunctor(functorToMap(&func))(A()) == 3 && |
| 209 | 209 |
mapToFunctor(functorToMap(&func))[A()] == 3, |
| 210 | 210 |
"Something is wrong with FunctorToMap or MapToFunctor"); |
| 211 | 211 |
check(functorToMap(mapToFunctor(constMap<A,int>(2)))[A()] == 2, |
| 212 | 212 |
"Something is wrong with FunctorToMap or MapToFunctor"); |
| 213 | 213 |
} |
| 214 | 214 |
|
| 215 | 215 |
// ConvertMap |
| 216 | 216 |
{
|
| 217 | 217 |
checkConcept<ReadMap<double,double>, |
| 218 | 218 |
ConvertMap<ReadMap<double, int>, double> >(); |
| 219 | 219 |
ConvertMap<RangeMap<bool>, int> map1(rangeMap(1, true)); |
| 220 | 220 |
ConvertMap<RangeMap<bool>, int> map2 = convertMap<int>(rangeMap(2, false)); |
| 221 | 221 |
} |
| 222 | 222 |
|
| 223 | 223 |
// ForkMap |
| 224 | 224 |
{
|
| 225 | 225 |
checkConcept<DoubleWriteMap, ForkMap<DoubleWriteMap, DoubleWriteMap> >(); |
| 226 | 226 |
|
0 comments (0 inline)