0
24
0
1
1
1
1
1
1
1
1
1
1
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 |
/** |
20 | 20 |
\dir demo |
21 | 21 |
\brief A collection of demo applications. |
22 | 22 |
|
23 | 23 |
This directory contains several simple demo applications, mainly |
24 | 24 |
for educational purposes. |
25 | 25 |
*/ |
26 | 26 |
|
27 | 27 |
/** |
28 | 28 |
\dir doc |
29 | 29 |
\brief Auxiliary (and the whole generated) documentation. |
30 | 30 |
|
31 | 31 |
This directory contains some auxiliary pages and the whole generated |
32 | 32 |
documentation. |
33 | 33 |
*/ |
34 | 34 |
|
35 | 35 |
/** |
36 | 36 |
\dir test |
37 | 37 |
\brief Test programs. |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 |
/** |
20 | 20 |
@defgroup datas Data Structures |
21 | 21 |
This group describes the several data structures implemented in LEMON. |
22 | 22 |
*/ |
23 | 23 |
|
24 | 24 |
/** |
25 | 25 |
@defgroup graphs Graph Structures |
26 | 26 |
@ingroup datas |
27 | 27 |
\brief Graph structures implemented in LEMON. |
28 | 28 |
|
29 | 29 |
The implementation of combinatorial algorithms heavily relies on |
30 | 30 |
efficient graph implementations. LEMON offers data structures which are |
31 | 31 |
planned to be easily used in an experimental phase of implementation studies, |
32 | 32 |
and thereafter the program code can be made efficient by small modifications. |
33 | 33 |
|
34 | 34 |
The most efficient implementation of diverse applications require the |
35 | 35 |
usage of different physical graph implementations. These differences |
36 | 36 |
appear in the size of graph we require to handle, memory or time usage |
37 | 37 |
limitations or in the set of operations through which the graph can be |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 |
namespace lemon { |
20 | 20 |
/*! |
21 | 21 |
|
22 | 22 |
|
23 | 23 |
|
24 | 24 |
\page lgf-format LEMON Graph Format (LGF) |
25 | 25 |
|
26 | 26 |
The \e LGF is a <em>column oriented</em> |
27 | 27 |
file format for storing graphs and associated data like |
28 | 28 |
node and edge maps. |
29 | 29 |
|
30 | 30 |
Each line with \c '#' first non-whitespace |
31 | 31 |
character is considered as a comment line. |
32 | 32 |
|
33 | 33 |
Otherwise the file consists of sections starting with |
34 | 34 |
a header line. The header lines starts with an \c '@' character followed by the |
35 | 35 |
type of section. The standard section types are \c \@nodes, \c |
36 | 36 |
\@arcs and \c \@edges |
37 | 37 |
and \@attributes. Each header line may also have an optional |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 | 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 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 |
#ifndef LEMON_BITS_DEFAULT_MAP_H |
20 | 20 |
#define LEMON_BITS_DEFAULT_MAP_H |
21 | 21 |
|
22 | 22 |
#include <lemon/config.h> |
23 | 23 |
#include <lemon/bits/array_map.h> |
24 | 24 |
#include <lemon/bits/vector_map.h> |
25 | 25 |
//#include <lemon/bits/debug_map.h> |
26 | 26 |
|
27 | 27 |
//\ingroup graphbits |
28 | 28 |
//\file |
29 | 29 |
//\brief Graph maps that construct and destruct their elements dynamically. |
30 | 30 |
|
31 | 31 |
namespace lemon { |
32 | 32 |
|
33 | 33 |
|
34 | 34 |
//#ifndef LEMON_USE_DEBUG_MAP |
35 | 35 |
|
36 | 36 |
template <typename _Graph, typename _Item, typename _Value> |
37 | 37 |
struct DefaultMapSelector { |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 |
#ifndef LEMON_BITS_MAP_EXTENDER_H |
20 | 20 |
#define LEMON_BITS_MAP_EXTENDER_H |
21 | 21 |
|
22 | 22 |
#include <iterator> |
23 | 23 |
|
24 | 24 |
#include <lemon/bits/traits.h> |
25 | 25 |
|
26 | 26 |
#include <lemon/concept_check.h> |
27 | 27 |
#include <lemon/concepts/maps.h> |
28 | 28 |
|
29 | 29 |
//\file |
30 | 30 |
//\brief Extenders for iterable maps. |
31 | 31 |
|
32 | 32 |
namespace lemon { |
33 | 33 |
|
34 | 34 |
// \ingroup graphbits |
35 | 35 |
// |
36 | 36 |
// \brief Extender for maps |
37 | 37 |
template <typename _Map> |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 |
#ifndef LEMON_BITS_PRED_MAP_PATH_H |
20 | 20 |
#define LEMON_BITS_PRED_MAP_PATH_H |
21 | 21 |
|
22 | 22 |
namespace lemon { |
23 | 23 |
|
24 | 24 |
template <typename _Digraph, typename _PredMap> |
25 | 25 |
class PredMapPath { |
26 | 26 |
public: |
27 | 27 |
typedef True RevPathTag; |
28 | 28 |
|
29 | 29 |
typedef _Digraph Digraph; |
30 | 30 |
typedef typename Digraph::Arc Arc; |
31 | 31 |
typedef _PredMap PredMap; |
32 | 32 |
|
33 | 33 |
PredMapPath(const Digraph& _digraph, const PredMap& _predMap, |
34 | 34 |
typename Digraph::Node _target) |
35 | 35 |
: digraph(_digraph), predMap(_predMap), target(_target) {} |
36 | 36 |
|
37 | 37 |
int length() const { |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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/bits/windows.h> |
23 | 23 |
|
24 | 24 |
#ifdef WIN32 |
25 | 25 |
#ifndef WIN32_LEAN_AND_MEAN |
26 | 26 |
#define WIN32_LEAN_AND_MEAN |
27 | 27 |
#endif |
28 | 28 |
#ifndef NOMINMAX |
29 | 29 |
#define NOMINMAX |
30 | 30 |
#endif |
31 | 31 |
#ifdef UNICODE |
32 | 32 |
#undef UNICODE |
33 | 33 |
#endif |
34 | 34 |
#include <windows.h> |
35 | 35 |
#ifdef LOCALE_INVARIANT |
36 | 36 |
#define MY_LOCALE LOCALE_INVARIANT |
37 | 37 |
#else |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 |
#ifndef LEMON_CORE_H |
20 | 20 |
#define LEMON_CORE_H |
21 | 21 |
|
22 | 22 |
#include <vector> |
23 | 23 |
#include <algorithm> |
24 | 24 |
|
25 | 25 |
#include <lemon/config.h> |
26 | 26 |
#include <lemon/bits/enable_if.h> |
27 | 27 |
#include <lemon/bits/traits.h> |
28 | 28 |
#include <lemon/assert.h> |
29 | 29 |
|
30 | 30 |
///\file |
31 | 31 |
///\brief LEMON core utilities. |
32 | 32 |
/// |
33 | 33 |
///This header file contains core utilities for LEMON. |
34 | 34 |
///It is automatically included by all graph types, therefore it usually |
35 | 35 |
///do not have to be included directly. |
36 | 36 |
|
37 | 37 |
namespace lemon { |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 |
#ifndef LEMON_DFS_H |
20 | 20 |
#define LEMON_DFS_H |
21 | 21 |
|
22 | 22 |
///\ingroup search |
23 | 23 |
///\file |
24 | 24 |
///\brief DFS algorithm. |
25 | 25 |
|
26 | 26 |
#include <lemon/list_graph.h> |
27 | 27 |
#include <lemon/bits/path_dump.h> |
28 | 28 |
#include <lemon/core.h> |
29 | 29 |
#include <lemon/error.h> |
30 | 30 |
#include <lemon/maps.h> |
31 | 31 |
#include <lemon/path.h> |
32 | 32 |
|
33 | 33 |
namespace lemon { |
34 | 34 |
|
35 | 35 |
///Default traits class of Dfs class. |
36 | 36 |
|
37 | 37 |
///Default traits class of Dfs class. |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 |
#ifndef LEMON_GRAPH_TO_EPS_H |
20 | 20 |
#define LEMON_GRAPH_TO_EPS_H |
21 | 21 |
|
22 | 22 |
#include<iostream> |
23 | 23 |
#include<fstream> |
24 | 24 |
#include<sstream> |
25 | 25 |
#include<algorithm> |
26 | 26 |
#include<vector> |
27 | 27 |
|
28 | 28 |
#ifndef WIN32 |
29 | 29 |
#include<sys/time.h> |
30 | 30 |
#include<ctime> |
31 | 31 |
#else |
32 | 32 |
#include<lemon/bits/windows.h> |
33 | 33 |
#endif |
34 | 34 |
|
35 | 35 |
#include<lemon/math.h> |
36 | 36 |
#include<lemon/core.h> |
37 | 37 |
#include<lemon/dim2.h> |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 |
///\ingroup lemon_io |
20 | 20 |
///\file |
21 | 21 |
///\brief \ref lgf-format "LEMON Graph Format" writer. |
22 | 22 |
|
23 | 23 |
|
24 | 24 |
#ifndef LEMON_LGF_WRITER_H |
25 | 25 |
#define LEMON_LGF_WRITER_H |
26 | 26 |
|
27 | 27 |
#include <iostream> |
28 | 28 |
#include <fstream> |
29 | 29 |
#include <sstream> |
30 | 30 |
|
31 | 31 |
#include <algorithm> |
32 | 32 |
|
33 | 33 |
#include <vector> |
34 | 34 |
#include <functional> |
35 | 35 |
|
36 | 36 |
#include <lemon/core.h> |
37 | 37 |
#include <lemon/maps.h> |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 |
#ifndef LEMON_LIST_GRAPH_H |
20 | 20 |
#define LEMON_LIST_GRAPH_H |
21 | 21 |
|
22 | 22 |
///\ingroup graphs |
23 | 23 |
///\file |
24 | 24 |
///\brief ListDigraph, ListGraph classes. |
25 | 25 |
|
26 | 26 |
#include <lemon/core.h> |
27 | 27 |
#include <lemon/error.h> |
28 | 28 |
#include <lemon/bits/graph_extender.h> |
29 | 29 |
|
30 | 30 |
#include <vector> |
31 | 31 |
#include <list> |
32 | 32 |
|
33 | 33 |
namespace lemon { |
34 | 34 |
|
35 | 35 |
class ListDigraphBase { |
36 | 36 |
|
37 | 37 |
protected: |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 |
///\ingroup paths |
20 | 20 |
///\file |
21 | 21 |
///\brief Classes for representing paths in digraphs. |
22 | 22 |
/// |
23 | 23 |
|
24 | 24 |
#ifndef LEMON_PATH_H |
25 | 25 |
#define LEMON_PATH_H |
26 | 26 |
|
27 | 27 |
#include <vector> |
28 | 28 |
#include <algorithm> |
29 | 29 |
|
30 | 30 |
#include <lemon/error.h> |
31 | 31 |
#include <lemon/core.h> |
32 | 32 |
#include <lemon/concepts/path.h> |
33 | 33 |
|
34 | 34 |
namespace lemon { |
35 | 35 |
|
36 | 36 |
/// \addtogroup paths |
37 | 37 |
/// @{ |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 |
/* |
20 | 20 |
* This file contains the reimplemented version of the Mersenne Twister |
21 | 21 |
* Generator of Matsumoto and Nishimura. |
22 | 22 |
* |
23 | 23 |
* See the appropriate copyright notice below. |
24 | 24 |
* |
25 | 25 |
* Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, |
26 | 26 |
* All rights reserved. |
27 | 27 |
* |
28 | 28 |
* Redistribution and use in source and binary forms, with or without |
29 | 29 |
* modification, are permitted provided that the following conditions |
30 | 30 |
* are met: |
31 | 31 |
* |
32 | 32 |
* 1. Redistributions of source code must retain the above copyright |
33 | 33 |
* notice, this list of conditions and the following disclaimer. |
34 | 34 |
* |
35 | 35 |
* 2. Redistributions in binary form must reproduce the above copyright |
36 | 36 |
* notice, this list of conditions and the following disclaimer in the |
37 | 37 |
* documentation and/or other materials provided with the distribution. |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 |
#ifndef LEMON_SMART_GRAPH_H |
20 | 20 |
#define LEMON_SMART_GRAPH_H |
21 | 21 |
|
22 | 22 |
///\ingroup graphs |
23 | 23 |
///\file |
24 | 24 |
///\brief SmartDigraph and SmartGraph classes. |
25 | 25 |
|
26 | 26 |
#include <vector> |
27 | 27 |
|
28 | 28 |
#include <lemon/core.h> |
29 | 29 |
#include <lemon/error.h> |
30 | 30 |
#include <lemon/bits/graph_extender.h> |
31 | 31 |
|
32 | 32 |
namespace lemon { |
33 | 33 |
|
34 | 34 |
class SmartDigraph; |
35 | 35 |
///Base of SmartDigraph |
36 | 36 |
|
37 | 37 |
///Base of SmartDigraph |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 |
#ifndef LEMON_TIME_MEASURE_H |
20 | 20 |
#define LEMON_TIME_MEASURE_H |
21 | 21 |
|
22 | 22 |
///\ingroup timecount |
23 | 23 |
///\file |
24 | 24 |
///\brief Tools for measuring cpu usage |
25 | 25 |
|
26 | 26 |
#ifdef WIN32 |
27 | 27 |
#include <lemon/bits/windows.h> |
28 | 28 |
#else |
29 | 29 |
#include <unistd.h> |
30 | 30 |
#include <sys/times.h> |
31 | 31 |
#include <sys/time.h> |
32 | 32 |
#endif |
33 | 33 |
|
34 | 34 |
#include <string> |
35 | 35 |
#include <fstream> |
36 | 36 |
#include <iostream> |
37 | 37 |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 |
#ifndef LEMON_TOLERANCE_H |
20 | 20 |
#define LEMON_TOLERANCE_H |
21 | 21 |
|
22 | 22 |
///\ingroup misc |
23 | 23 |
///\file |
24 | 24 |
///\brief A basic tool to handle the anomalies of calculation with |
25 | 25 |
///floating point numbers. |
26 | 26 |
/// |
27 | 27 |
|
28 | 28 |
namespace lemon { |
29 | 29 |
|
30 | 30 |
/// \addtogroup misc |
31 | 31 |
/// @{ |
32 | 32 |
|
33 | 33 |
///\brief A class to provide a basic way to |
34 | 34 |
///handle the comparison of numbers that are obtained |
35 | 35 |
///as a result of a probably inexact computation. |
36 | 36 |
/// |
37 | 37 |
///\ref Tolerance is a class to provide a basic way to |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 |
#ifndef LEMON_UNION_FIND_H |
20 | 20 |
#define LEMON_UNION_FIND_H |
21 | 21 |
|
22 | 22 |
//!\ingroup auxdat |
23 | 23 |
//!\file |
24 | 24 |
//!\brief Union-Find data structures. |
25 | 25 |
//! |
26 | 26 |
|
27 | 27 |
#include <vector> |
28 | 28 |
#include <list> |
29 | 29 |
#include <utility> |
30 | 30 |
#include <algorithm> |
31 | 31 |
#include <functional> |
32 | 32 |
|
33 | 33 |
#include <lemon/core.h> |
34 | 34 |
|
35 | 35 |
namespace lemon { |
36 | 36 |
|
37 | 37 |
/// \ingroup auxdat |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 |
#include <lemon/concepts/digraph.h> |
20 | 20 |
#include <lemon/smart_graph.h> |
21 | 21 |
#include <lemon/list_graph.h> |
22 | 22 |
#include <lemon/lgf_reader.h> |
23 | 23 |
#include <lemon/dfs.h> |
24 | 24 |
#include <lemon/path.h> |
25 | 25 |
|
26 | 26 |
#include "graph_test.h" |
27 | 27 |
#include "test_tools.h" |
28 | 28 |
|
29 | 29 |
using namespace lemon; |
30 | 30 |
|
31 | 31 |
char test_lgf[] = |
32 | 32 |
"@nodes\n" |
33 | 33 |
"label\n" |
34 | 34 |
"0\n" |
35 | 35 |
"1\n" |
36 | 36 |
"2\n" |
37 | 37 |
"3\n" |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 |
#include <lemon/smart_graph.h> |
20 | 20 |
#include <lemon/list_graph.h> |
21 | 21 |
#include <lemon/lgf_reader.h> |
22 | 22 |
#include <lemon/error.h> |
23 | 23 |
|
24 | 24 |
#include "test_tools.h" |
25 | 25 |
|
26 | 26 |
using namespace std; |
27 | 27 |
using namespace lemon; |
28 | 28 |
|
29 | 29 |
void digraph_copy_test() { |
30 | 30 |
const int nn = 10; |
31 | 31 |
|
32 | 32 |
// Build a digraph |
33 | 33 |
SmartDigraph from; |
34 | 34 |
SmartDigraph::NodeMap<int> fnm(from); |
35 | 35 |
SmartDigraph::ArcMap<int> fam(from); |
36 | 36 |
SmartDigraph::Node fn = INVALID; |
37 | 37 |
SmartDigraph::Arc fa = INVALID; |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 |
* Copyright (C) 2003- |
|
5 |
* Copyright (C) 2003-2011 |
|
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 |
#include <deque> |
20 | 20 |
#include <set> |
21 | 21 |
|
22 | 22 |
#include <lemon/concept_check.h> |
23 | 23 |
#include <lemon/concepts/maps.h> |
24 | 24 |
#include <lemon/maps.h> |
25 | 25 |
|
26 | 26 |
#include "test_tools.h" |
27 | 27 |
|
28 | 28 |
using namespace lemon; |
29 | 29 |
using namespace lemon::concepts; |
30 | 30 |
|
31 | 31 |
struct A {}; |
32 | 32 |
inline bool operator<(A, A) { return true; } |
33 | 33 |
struct B {}; |
34 | 34 |
|
35 | 35 |
class C { |
36 | 36 |
int x; |
37 | 37 |
public: |
... | ... |
@@ -40,66 +40,68 @@ |
40 | 40 |
|
41 | 41 |
class F { |
42 | 42 |
public: |
43 | 43 |
typedef A argument_type; |
44 | 44 |
typedef B result_type; |
45 | 45 |
|
46 | 46 |
B operator()(const A&) const { return B(); } |
47 | 47 |
private: |
48 | 48 |
F& operator=(const F&); |
49 | 49 |
}; |
50 | 50 |
|
51 | 51 |
int func(A) { return 3; } |
52 | 52 |
|
53 | 53 |
int binc(int a, B) { return a+1; } |
54 | 54 |
|
55 | 55 |
typedef ReadMap<A, double> DoubleMap; |
56 | 56 |
typedef ReadWriteMap<A, double> DoubleWriteMap; |
57 | 57 |
typedef ReferenceMap<A, double, double&, const double&> DoubleRefMap; |
58 | 58 |
|
59 | 59 |
typedef ReadMap<A, bool> BoolMap; |
60 | 60 |
typedef ReadWriteMap<A, bool> BoolWriteMap; |
61 | 61 |
typedef ReferenceMap<A, bool, bool&, const bool&> BoolRefMap; |
62 | 62 |
|
63 | 63 |
int main() |
64 | 64 |
{ |
65 | 65 |
// Map concepts |
66 | 66 |
checkConcept<ReadMap<A,B>, ReadMap<A,B> >(); |
67 | 67 |
checkConcept<ReadMap<A,C>, ReadMap<A,C> >(); |
68 | 68 |
checkConcept<WriteMap<A,B>, WriteMap<A,B> >(); |
69 | 69 |
checkConcept<WriteMap<A,C>, WriteMap<A,C> >(); |
70 | 70 |
checkConcept<ReadWriteMap<A,B>, ReadWriteMap<A,B> >(); |
71 | 71 |
checkConcept<ReadWriteMap<A,C>, ReadWriteMap<A,C> >(); |
72 |
checkConcept<ReferenceMap<A,B,B&,const B&>, ReferenceMap<A,B,B&,const B&> >(); |
|
73 |
checkConcept<ReferenceMap<A,C,C&,const C&>, ReferenceMap<A,C,C&,const C&> >(); |
|
72 |
checkConcept<ReferenceMap<A,B,B&,const B&>, |
|
73 |
ReferenceMap<A,B,B&,const B&> >(); |
|
74 |
checkConcept<ReferenceMap<A,C,C&,const C&>, |
|
75 |
ReferenceMap<A,C,C&,const C&> >(); |
|
74 | 76 |
|
75 | 77 |
// NullMap |
76 | 78 |
{ |
77 | 79 |
checkConcept<ReadWriteMap<A,B>, NullMap<A,B> >(); |
78 | 80 |
NullMap<A,B> map1; |
79 | 81 |
NullMap<A,B> map2 = map1; |
80 | 82 |
map1 = nullMap<A,B>(); |
81 | 83 |
} |
82 | 84 |
|
83 | 85 |
// ConstMap |
84 | 86 |
{ |
85 | 87 |
checkConcept<ReadWriteMap<A,B>, ConstMap<A,B> >(); |
86 | 88 |
checkConcept<ReadWriteMap<A,C>, ConstMap<A,C> >(); |
87 | 89 |
ConstMap<A,B> map1; |
88 | 90 |
ConstMap<A,B> map2 = B(); |
89 | 91 |
ConstMap<A,B> map3 = map1; |
90 | 92 |
map1 = constMap<A>(B()); |
91 | 93 |
map1 = constMap<A,B>(); |
92 | 94 |
map1.setAll(B()); |
93 | 95 |
ConstMap<A,C> map4(C(1)); |
94 | 96 |
ConstMap<A,C> map5 = map4; |
95 | 97 |
map4 = constMap<A>(C(2)); |
96 | 98 |
map4.setAll(C(3)); |
97 | 99 |
|
98 | 100 |
checkConcept<ReadWriteMap<A,int>, ConstMap<A,int> >(); |
99 | 101 |
check(constMap<A>(10)[A()] == 10, "Something is wrong with ConstMap"); |
100 | 102 |
|
101 | 103 |
checkConcept<ReadWriteMap<A,int>, ConstMap<A,Const<int,10> > >(); |
102 | 104 |
ConstMap<A,Const<int,10> > map6; |
103 | 105 |
ConstMap<A,Const<int,10> > map7 = map6; |
104 | 106 |
map6 = constMap<A,int,10>(); |
105 | 107 |
map7 = constMap<A,Const<int,10> >(); |
... | ... |
@@ -170,65 +172,66 @@ |
170 | 172 |
{ |
171 | 173 |
typedef ComposeMap<DoubleMap, ReadMap<B,A> > CompMap; |
172 | 174 |
checkConcept<ReadMap<B,double>, CompMap>(); |
173 | 175 |
CompMap map1 = CompMap(DoubleMap(),ReadMap<B,A>()); |
174 | 176 |
CompMap map2 = composeMap(DoubleMap(), ReadMap<B,A>()); |
175 | 177 |
|
176 | 178 |
SparseMap<double, bool> m1(false); m1[3.14] = true; |
177 | 179 |
RangeMap<double> m2(2); m2[0] = 3.0; m2[1] = 3.14; |
178 | 180 |
check(!composeMap(m1,m2)[0] && composeMap(m1,m2)[1], |
179 | 181 |
"Something is wrong with ComposeMap") |
180 | 182 |
} |
181 | 183 |
|
182 | 184 |
// CombineMap |
183 | 185 |
{ |
184 | 186 |
typedef CombineMap<DoubleMap, DoubleMap, std::plus<double> > CombMap; |
185 | 187 |
checkConcept<ReadMap<A,double>, CombMap>(); |
186 | 188 |
CombMap map1 = CombMap(DoubleMap(), DoubleMap()); |
187 | 189 |
CombMap map2 = combineMap(DoubleMap(), DoubleMap(), std::plus<double>()); |
188 | 190 |
|
189 | 191 |
check(combineMap(constMap<B,int,2>(), identityMap<B>(), &binc)[B()] == 3, |
190 | 192 |
"Something is wrong with CombineMap"); |
191 | 193 |
} |
192 | 194 |
|
193 | 195 |
// FunctorToMap, MapToFunctor |
194 | 196 |
{ |
195 | 197 |
checkConcept<ReadMap<A,B>, FunctorToMap<F,A,B> >(); |
196 | 198 |
checkConcept<ReadMap<A,B>, FunctorToMap<F> >(); |
197 | 199 |
FunctorToMap<F> map1; |
198 | 200 |
FunctorToMap<F> map2 = FunctorToMap<F>(F()); |
199 | 201 |
B b = functorToMap(F())[A()]; |
200 | 202 |
|
201 | 203 |
checkConcept<ReadMap<A,B>, MapToFunctor<ReadMap<A,B> > >(); |
202 |
MapToFunctor<ReadMap<A,B> > map = |
|
204 |
MapToFunctor<ReadMap<A,B> > map = |
|
205 |
MapToFunctor<ReadMap<A,B> >(ReadMap<A,B>()); |
|
203 | 206 |
|
204 | 207 |
check(functorToMap(&func)[A()] == 3, |
205 | 208 |
"Something is wrong with FunctorToMap"); |
206 | 209 |
check(mapToFunctor(constMap<A,int>(2))(A()) == 2, |
207 | 210 |
"Something is wrong with MapToFunctor"); |
208 | 211 |
check(mapToFunctor(functorToMap(&func))(A()) == 3 && |
209 | 212 |
mapToFunctor(functorToMap(&func))[A()] == 3, |
210 | 213 |
"Something is wrong with FunctorToMap or MapToFunctor"); |
211 | 214 |
check(functorToMap(mapToFunctor(constMap<A,int>(2)))[A()] == 2, |
212 | 215 |
"Something is wrong with FunctorToMap or MapToFunctor"); |
213 | 216 |
} |
214 | 217 |
|
215 | 218 |
// ConvertMap |
216 | 219 |
{ |
217 | 220 |
checkConcept<ReadMap<double,double>, |
218 | 221 |
ConvertMap<ReadMap<double, int>, double> >(); |
219 | 222 |
ConvertMap<RangeMap<bool>, int> map1(rangeMap(1, true)); |
220 | 223 |
ConvertMap<RangeMap<bool>, int> map2 = convertMap<int>(rangeMap(2, false)); |
221 | 224 |
} |
222 | 225 |
|
223 | 226 |
// ForkMap |
224 | 227 |
{ |
225 | 228 |
checkConcept<DoubleWriteMap, ForkMap<DoubleWriteMap, DoubleWriteMap> >(); |
226 | 229 |
|
227 | 230 |
typedef RangeMap<double> RM; |
228 | 231 |
typedef SparseMap<int, double> SM; |
229 | 232 |
RM m1(10, -1); |
230 | 233 |
SM m2(-1); |
231 | 234 |
checkConcept<ReadWriteMap<int, double>, ForkMap<RM, SM> >(); |
232 | 235 |
checkConcept<ReadWriteMap<int, double>, ForkMap<SM, RM> >(); |
233 | 236 |
ForkMap<RM, SM> map1(m1,m2); |
234 | 237 |
ForkMap<SM, RM> map2 = forkMap(m2,m1); |
0 comments (0 inline)