0
6
0
3
3
| 1 | 1 |
CMAKE_MINIMUM_REQUIRED(VERSION 2.6) |
| 2 | 2 |
|
| 3 | 3 |
IF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
|
| 4 | 4 |
INCLUDE(${CMAKE_SOURCE_DIR}/cmake/version.cmake)
|
| 5 | 5 |
ELSE(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
|
| 6 | 6 |
SET(PROJECT_NAME "LEMON") |
| 7 | 7 |
SET(PROJECT_VERSION "hg-tip" CACHE STRING "LEMON version string.") |
| 8 | 8 |
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
|
| 9 | 9 |
|
| 10 | 10 |
PROJECT(${PROJECT_NAME})
|
| 11 | 11 |
|
| 12 | 12 |
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
| 13 | 13 |
|
| 14 | 14 |
INCLUDE(FindDoxygen) |
| 15 | 15 |
INCLUDE(FindGhostscript) |
| 16 | 16 |
FIND_PACKAGE(GLPK 4.33) |
| 17 | 17 |
FIND_PACKAGE(CPLEX) |
| 18 | 18 |
FIND_PACKAGE(COIN) |
| 19 | 19 |
|
| 20 | 20 |
IF(MSVC) |
| 21 | 21 |
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4250 /wd4355 /wd4800 /wd4996")
|
| 22 | 22 |
# Suppressed warnings: |
| 23 | 23 |
# C4250: 'class1' : inherits 'class2::member' via dominance |
| 24 | 24 |
# C4355: 'this' : used in base member initializer list |
| 25 | 25 |
# C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning) |
| 26 | 26 |
# C4996: 'function': was declared deprecated |
| 27 | 27 |
ENDIF(MSVC) |
| 28 | 28 |
|
| 29 | 29 |
INCLUDE(CheckTypeSize) |
| 30 | 30 |
CHECK_TYPE_SIZE("long long" LEMON_LONG_LONG)
|
| 31 | 31 |
|
| 32 | 32 |
ENABLE_TESTING() |
| 33 | 33 |
|
| 34 | 34 |
ADD_SUBDIRECTORY(lemon) |
| 35 | 35 |
IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
|
| 36 | 36 |
ADD_SUBDIRECTORY(demo) |
| 37 | 37 |
ADD_SUBDIRECTORY(tools) |
| 38 | 38 |
ADD_SUBDIRECTORY(doc) |
| 39 | 39 |
ADD_SUBDIRECTORY(test) |
| 40 | 40 |
ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
|
| 41 | 41 |
|
| 42 | 42 |
IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
|
| 43 | 43 |
IF(WIN32) |
| 44 | 44 |
SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
|
| 45 | 45 |
SET(CPACK_PACKAGE_VENDOR "EGRES") |
| 46 | 46 |
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY |
| 47 |
"LEMON - Library |
|
| 47 |
"LEMON - Library for Efficient Modeling and Optimization in Networks") |
|
| 48 | 48 |
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
|
| 49 | 49 |
|
| 50 | 50 |
SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
|
| 51 | 51 |
|
| 52 | 52 |
SET(CPACK_PACKAGE_INSTALL_DIRECTORY |
| 53 | 53 |
"${PROJECT_NAME} ${PROJECT_VERSION}")
|
| 54 | 54 |
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY |
| 55 | 55 |
"${PROJECT_NAME} ${PROJECT_VERSION}")
|
| 56 | 56 |
|
| 57 | 57 |
SET(CPACK_COMPONENTS_ALL headers library html_documentation bin) |
| 58 | 58 |
|
| 59 | 59 |
SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers") |
| 60 | 60 |
SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library") |
| 61 | 61 |
SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities") |
| 62 | 62 |
SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation") |
| 63 | 63 |
|
| 64 | 64 |
SET(CPACK_COMPONENT_HEADERS_DESCRIPTION |
| 65 | 65 |
"C++ header files") |
| 66 | 66 |
SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION |
| 67 | 67 |
"DLL and import library") |
| 68 | 68 |
SET(CPACK_COMPONENT_BIN_DESCRIPTION |
| 69 | 69 |
"Command line utilities") |
| 70 | 70 |
SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION |
| 71 | 71 |
"Doxygen generated documentation") |
| 72 | 72 |
|
| 73 | 73 |
SET(CPACK_COMPONENT_HEADERS_DEPENDS library) |
| 74 | 74 |
|
| 75 | 75 |
SET(CPACK_COMPONENT_HEADERS_GROUP "Development") |
| 76 | 76 |
SET(CPACK_COMPONENT_LIBRARY_GROUP "Development") |
| 77 | 77 |
SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation") |
| 78 | 78 |
|
| 79 | 79 |
SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION |
| 80 | 80 |
"Components needed to develop software using LEMON") |
| 81 | 81 |
SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION |
| 82 | 82 |
"Documentation of LEMON") |
| 83 | 83 |
|
| 84 | 84 |
SET(CPACK_ALL_INSTALL_TYPES Full Developer) |
| 85 | 85 |
|
| 86 | 86 |
SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) |
| 87 | 87 |
SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full) |
| 88 | 88 |
SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full) |
| 89 | 89 |
|
| 90 | 90 |
SET(CPACK_GENERATOR "NSIS") |
| 91 | 91 |
SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico")
|
| 92 | 92 |
SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico")
|
| 93 | 93 |
#SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp")
|
| 94 | 94 |
SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico") |
| 95 | 95 |
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}")
|
| 1 |
================================================================== |
|
| 2 |
LEMON - a Library of Efficient Models and Optimization in Networks |
|
| 3 |
================================================================== |
|
| 1 |
===================================================================== |
|
| 2 |
LEMON - a Library for Efficient Modeling and Optimization in Networks |
|
| 3 |
===================================================================== |
|
| 4 | 4 |
|
| 5 | 5 |
LEMON is an open source library written in C++. It provides |
| 6 | 6 |
easy-to-use implementations of common data structures and algorithms |
| 7 | 7 |
in the area of optimization and helps implementing new ones. The main |
| 8 | 8 |
focus is on graphs and graph algorithms, thus it is especially |
| 9 | 9 |
suitable for solving design and optimization problems of |
| 10 | 10 |
telecommunication networks. To achieve wide usability its data |
| 11 | 11 |
structures and algorithms provide generic interfaces. |
| 12 | 12 |
|
| 13 | 13 |
Contents |
| 14 | 14 |
======== |
| 15 | 15 |
|
| 16 | 16 |
LICENSE |
| 17 | 17 |
|
| 18 | 18 |
Copying, distribution and modification conditions and terms. |
| 19 | 19 |
|
| 20 | 20 |
INSTALL |
| 21 | 21 |
|
| 22 | 22 |
General building and installation instructions. |
| 23 | 23 |
|
| 24 | 24 |
lemon/ |
| 25 | 25 |
|
| 26 | 26 |
Source code of LEMON library. |
| 27 | 27 |
|
| 28 | 28 |
doc/ |
| 29 | 29 |
|
| 30 | 30 |
Documentation of LEMON. The starting page is doc/html/index.html. |
| 31 | 31 |
|
| 32 | 32 |
demo/ |
| 33 | 33 |
|
| 34 | 34 |
Some example programs to make you easier to get familiar with LEMON. |
| 35 | 35 |
|
| 36 | 36 |
test/ |
| 37 | 37 |
|
| 38 | 38 |
Programs to check the integrity and correctness of LEMON. |
| 39 | 39 |
|
| 40 | 40 |
tools/ |
| 41 | 41 |
|
| 42 | 42 |
Various utilities related to LEMON. |
| ... | ... |
@@ -93,106 +93,96 @@ |
| 93 | 93 |
considering a new orientation, then an adaptor is worthwhile to use. |
| 94 | 94 |
To come back to the reverse oriented graph, in this situation |
| 95 | 95 |
\code |
| 96 | 96 |
template<typename Digraph> class ReverseDigraph; |
| 97 | 97 |
\endcode |
| 98 | 98 |
template class can be used. The code looks as follows |
| 99 | 99 |
\code |
| 100 | 100 |
ListDigraph g; |
| 101 | 101 |
ReverseDigraph<ListDigraph> rg(g); |
| 102 | 102 |
int result = algorithm(rg); |
| 103 | 103 |
\endcode |
| 104 | 104 |
During running the algorithm, the original digraph \c g is untouched. |
| 105 | 105 |
This techniques give rise to an elegant code, and based on stable |
| 106 | 106 |
graph adaptors, complex algorithms can be implemented easily. |
| 107 | 107 |
|
| 108 | 108 |
In flow, circulation and matching problems, the residual |
| 109 | 109 |
graph is of particular importance. Combining an adaptor implementing |
| 110 | 110 |
this with shortest path algorithms or minimum mean cycle algorithms, |
| 111 | 111 |
a range of weighted and cardinality optimization algorithms can be |
| 112 | 112 |
obtained. For other examples, the interested user is referred to the |
| 113 | 113 |
detailed documentation of particular adaptors. |
| 114 | 114 |
|
| 115 | 115 |
The behavior of graph adaptors can be very different. Some of them keep |
| 116 | 116 |
capabilities of the original graph while in other cases this would be |
| 117 | 117 |
meaningless. This means that the concepts that they meet depend |
| 118 | 118 |
on the graph adaptor, and the wrapped graph. |
| 119 | 119 |
For example, if an arc of a reversed digraph is deleted, this is carried |
| 120 | 120 |
out by deleting the corresponding arc of the original digraph, thus the |
| 121 | 121 |
adaptor modifies the original digraph. |
| 122 | 122 |
However in case of a residual digraph, this operation has no sense. |
| 123 | 123 |
|
| 124 | 124 |
Let us stand one more example here to simplify your work. |
| 125 | 125 |
ReverseDigraph has constructor |
| 126 | 126 |
\code |
| 127 | 127 |
ReverseDigraph(Digraph& digraph); |
| 128 | 128 |
\endcode |
| 129 | 129 |
This means that in a situation, when a <tt>const %ListDigraph&</tt> |
| 130 | 130 |
reference to a graph is given, then it have to be instantiated with |
| 131 | 131 |
<tt>Digraph=const %ListDigraph</tt>. |
| 132 | 132 |
\code |
| 133 | 133 |
int algorithm1(const ListDigraph& g) {
|
| 134 | 134 |
ReverseDigraph<const ListDigraph> rg(g); |
| 135 | 135 |
return algorithm2(rg); |
| 136 | 136 |
} |
| 137 | 137 |
\endcode |
| 138 | 138 |
*/ |
| 139 | 139 |
|
| 140 | 140 |
/** |
| 141 |
@defgroup semi_adaptors Semi-Adaptor Classes for Graphs |
|
| 142 |
@ingroup graphs |
|
| 143 |
\brief Graph types between real graphs and graph adaptors. |
|
| 144 |
|
|
| 145 |
This group contains some graph types between real graphs and graph adaptors. |
|
| 146 |
These classes wrap graphs to give new functionality as the adaptors do it. |
|
| 147 |
On the other hand they are not light-weight structures as the adaptors. |
|
| 148 |
*/ |
|
| 149 |
|
|
| 150 |
/** |
|
| 151 | 141 |
@defgroup maps Maps |
| 152 | 142 |
@ingroup datas |
| 153 | 143 |
\brief Map structures implemented in LEMON. |
| 154 | 144 |
|
| 155 | 145 |
This group contains the map structures implemented in LEMON. |
| 156 | 146 |
|
| 157 | 147 |
LEMON provides several special purpose maps and map adaptors that e.g. combine |
| 158 | 148 |
new maps from existing ones. |
| 159 | 149 |
|
| 160 | 150 |
<b>See also:</b> \ref map_concepts "Map Concepts". |
| 161 | 151 |
*/ |
| 162 | 152 |
|
| 163 | 153 |
/** |
| 164 | 154 |
@defgroup graph_maps Graph Maps |
| 165 | 155 |
@ingroup maps |
| 166 | 156 |
\brief Special graph-related maps. |
| 167 | 157 |
|
| 168 | 158 |
This group contains maps that are specifically designed to assign |
| 169 | 159 |
values to the nodes and arcs/edges of graphs. |
| 170 | 160 |
|
| 171 | 161 |
If you are looking for the standard graph maps (\c NodeMap, \c ArcMap, |
| 172 | 162 |
\c EdgeMap), see the \ref graph_concepts "Graph Structure Concepts". |
| 173 | 163 |
*/ |
| 174 | 164 |
|
| 175 | 165 |
/** |
| 176 | 166 |
\defgroup map_adaptors Map Adaptors |
| 177 | 167 |
\ingroup maps |
| 178 | 168 |
\brief Tools to create new maps from existing ones |
| 179 | 169 |
|
| 180 | 170 |
This group contains map adaptors that are used to create "implicit" |
| 181 | 171 |
maps from other maps. |
| 182 | 172 |
|
| 183 | 173 |
Most of them are \ref concepts::ReadMap "read-only maps". |
| 184 | 174 |
They can make arithmetic and logical operations between one or two maps |
| 185 | 175 |
(negation, shifting, addition, multiplication, logical 'and', 'or', |
| 186 | 176 |
'not' etc.) or e.g. convert a map to another one of different Value type. |
| 187 | 177 |
|
| 188 | 178 |
The typical usage of this classes is passing implicit maps to |
| 189 | 179 |
algorithms. If a function type algorithm is called then the function |
| 190 | 180 |
type map adaptors can be used comfortable. For example let's see the |
| 191 | 181 |
usage of map adaptors with the \c graphToEps() function. |
| 192 | 182 |
\code |
| 193 | 183 |
Color nodeColor(int deg) {
|
| 194 | 184 |
if (deg >= 2) {
|
| 195 | 185 |
return Color(0.5, 0.0, 0.5); |
| 196 | 186 |
} else if (deg == 1) {
|
| 197 | 187 |
return Color(1.0, 0.5, 1.0); |
| 198 | 188 |
} 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 | 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 |
/** |
| 20 | 20 |
\mainpage LEMON Documentation |
| 21 | 21 |
|
| 22 | 22 |
\section intro Introduction |
| 23 | 23 |
|
| 24 | 24 |
\subsection whatis What is LEMON |
| 25 | 25 |
|
| 26 |
LEMON stands for |
|
| 27 |
<b>L</b>ibrary of <b>E</b>fficient <b>M</b>odels |
|
| 26 |
LEMON stands for <b>L</b>ibrary for <b>E</b>fficient <b>M</b>odeling |
|
| 28 | 27 |
and <b>O</b>ptimization in <b>N</b>etworks. |
| 29 | 28 |
It is a C++ template |
| 30 | 29 |
library aimed at combinatorial optimization tasks which |
| 31 | 30 |
often involve in working |
| 32 | 31 |
with graphs. |
| 33 | 32 |
|
| 34 | 33 |
<b> |
| 35 | 34 |
LEMON is an <a class="el" href="http://opensource.org/">open source</a> |
| 36 | 35 |
project. |
| 37 | 36 |
You are free to use it in your commercial or |
| 38 | 37 |
non-commercial applications under very permissive |
| 39 | 38 |
\ref license "license terms". |
| 40 | 39 |
</b> |
| 41 | 40 |
|
| 42 | 41 |
\subsection howtoread How to read the documentation |
| 43 | 42 |
|
| 44 | 43 |
If you would like to get to know the library, see |
| 45 | 44 |
<a class="el" href="http://lemon.cs.elte.hu/pub/tutorial/">LEMON Tutorial</a>. |
| 46 | 45 |
|
| 47 | 46 |
If you know what you are looking for, then try to find it under the |
| 48 | 47 |
<a class="el" href="modules.html">Modules</a> section. |
| 49 | 48 |
|
| 50 | 49 |
If you are a user of the old (0.x) series of LEMON, please check out the |
| 51 | 50 |
\ref migration "Migration Guide" for the backward incompatibilities. |
| 52 | 51 |
*/ |
| 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 | 5 |
* Copyright (C) 2003-2008 |
| 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_EDGE_SET_H |
| 20 | 20 |
#define LEMON_EDGE_SET_H |
| 21 | 21 |
|
| 22 | 22 |
#include <lemon/core.h> |
| 23 | 23 |
#include <lemon/bits/edge_set_extender.h> |
| 24 | 24 |
|
| 25 |
/// \ingroup |
|
| 25 |
/// \ingroup graphs |
|
| 26 | 26 |
/// \file |
| 27 | 27 |
/// \brief ArcSet and EdgeSet classes. |
| 28 | 28 |
/// |
| 29 | 29 |
/// Graphs which use another graph's node-set as own. |
| 30 | 30 |
namespace lemon {
|
| 31 | 31 |
|
| 32 | 32 |
template <typename GR> |
| 33 | 33 |
class ListArcSetBase {
|
| 34 | 34 |
public: |
| 35 | 35 |
|
| 36 | 36 |
typedef typename GR::Node Node; |
| 37 | 37 |
typedef typename GR::NodeIt NodeIt; |
| 38 | 38 |
|
| 39 | 39 |
protected: |
| 40 | 40 |
|
| 41 | 41 |
struct NodeT {
|
| 42 | 42 |
int first_out, first_in; |
| 43 | 43 |
NodeT() : first_out(-1), first_in(-1) {}
|
| 44 | 44 |
}; |
| 45 | 45 |
|
| 46 | 46 |
typedef typename ItemSetTraits<GR, Node>:: |
| 47 | 47 |
template Map<NodeT>::Type NodesImplBase; |
| 48 | 48 |
|
| 49 | 49 |
NodesImplBase* _nodes; |
| 50 | 50 |
|
| 51 | 51 |
struct ArcT {
|
| 52 | 52 |
Node source, target; |
| 53 | 53 |
int next_out, next_in; |
| 54 | 54 |
int prev_out, prev_in; |
| 55 | 55 |
ArcT() : prev_out(-1), prev_in(-1) {}
|
| 56 | 56 |
}; |
| 57 | 57 |
|
| 58 | 58 |
std::vector<ArcT> arcs; |
| 59 | 59 |
|
| 60 | 60 |
int first_arc; |
| 61 | 61 |
int first_free_arc; |
| 62 | 62 |
|
| 63 | 63 |
const GR* _graph; |
| 64 | 64 |
|
| 65 | 65 |
void initalize(const GR& graph, NodesImplBase& nodes) {
|
| 66 | 66 |
_graph = &graph; |
| 67 | 67 |
_nodes = &nodes; |
| 68 | 68 |
} |
| 69 | 69 |
|
| 70 | 70 |
public: |
| 71 | 71 |
|
| 72 | 72 |
class Arc {
|
| 73 | 73 |
friend class ListArcSetBase<GR>; |
| ... | ... |
@@ -185,97 +185,97 @@ |
| 185 | 185 |
|
| 186 | 186 |
void nextIn(Arc& arc) const {
|
| 187 | 187 |
arc.id = arcs[arc.id].next_in; |
| 188 | 188 |
} |
| 189 | 189 |
|
| 190 | 190 |
int id(const Node& node) const { return _graph->id(node); }
|
| 191 | 191 |
int id(const Arc& arc) const { return arc.id; }
|
| 192 | 192 |
|
| 193 | 193 |
Node nodeFromId(int ix) const { return _graph->nodeFromId(ix); }
|
| 194 | 194 |
Arc arcFromId(int ix) const { return Arc(ix); }
|
| 195 | 195 |
|
| 196 | 196 |
int maxNodeId() const { return _graph->maxNodeId(); };
|
| 197 | 197 |
int maxArcId() const { return arcs.size() - 1; }
|
| 198 | 198 |
|
| 199 | 199 |
Node source(const Arc& arc) const { return arcs[arc.id].source;}
|
| 200 | 200 |
Node target(const Arc& arc) const { return arcs[arc.id].target;}
|
| 201 | 201 |
|
| 202 | 202 |
typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier; |
| 203 | 203 |
|
| 204 | 204 |
NodeNotifier& notifier(Node) const {
|
| 205 | 205 |
return _graph->notifier(Node()); |
| 206 | 206 |
} |
| 207 | 207 |
|
| 208 | 208 |
template <typename V> |
| 209 | 209 |
class NodeMap : public GR::template NodeMap<V> {
|
| 210 | 210 |
typedef typename GR::template NodeMap<V> Parent; |
| 211 | 211 |
|
| 212 | 212 |
public: |
| 213 | 213 |
|
| 214 | 214 |
explicit NodeMap(const ListArcSetBase<GR>& arcset) |
| 215 | 215 |
: Parent(*arcset._graph) {}
|
| 216 | 216 |
|
| 217 | 217 |
NodeMap(const ListArcSetBase<GR>& arcset, const V& value) |
| 218 | 218 |
: Parent(*arcset._graph, value) {}
|
| 219 | 219 |
|
| 220 | 220 |
NodeMap& operator=(const NodeMap& cmap) {
|
| 221 | 221 |
return operator=<NodeMap>(cmap); |
| 222 | 222 |
} |
| 223 | 223 |
|
| 224 | 224 |
template <typename CMap> |
| 225 | 225 |
NodeMap& operator=(const CMap& cmap) {
|
| 226 | 226 |
Parent::operator=(cmap); |
| 227 | 227 |
return *this; |
| 228 | 228 |
} |
| 229 | 229 |
}; |
| 230 | 230 |
|
| 231 | 231 |
}; |
| 232 | 232 |
|
| 233 |
/// \ingroup |
|
| 233 |
/// \ingroup graphs |
|
| 234 | 234 |
/// |
| 235 | 235 |
/// \brief Digraph using a node set of another digraph or graph and |
| 236 | 236 |
/// an own arc set. |
| 237 | 237 |
/// |
| 238 | 238 |
/// This structure can be used to establish another directed graph |
| 239 | 239 |
/// over a node set of an existing one. This class uses the same |
| 240 | 240 |
/// Node type as the underlying graph, and each valid node of the |
| 241 | 241 |
/// original graph is valid in this arc set, therefore the node |
| 242 | 242 |
/// objects of the original graph can be used directly with this |
| 243 | 243 |
/// class. The node handling functions (id handling, observing, and |
| 244 | 244 |
/// iterators) works equivalently as in the original graph. |
| 245 | 245 |
/// |
| 246 | 246 |
/// This implementation is based on doubly-linked lists, from each |
| 247 | 247 |
/// node the outgoing and the incoming arcs make up lists, therefore |
| 248 | 248 |
/// one arc can be erased in constant time. It also makes possible, |
| 249 | 249 |
/// that node can be removed from the underlying graph, in this case |
| 250 | 250 |
/// all arcs incident to the given node is erased from the arc set. |
| 251 | 251 |
/// |
| 252 | 252 |
/// \param GR The type of the graph which shares its node set with |
| 253 | 253 |
/// this class. Its interface must conform to the |
| 254 | 254 |
/// \ref concepts::Digraph "Digraph" or \ref concepts::Graph "Graph" |
| 255 | 255 |
/// concept. |
| 256 | 256 |
/// |
| 257 | 257 |
/// This class fully conforms to the \ref concepts::Digraph |
| 258 | 258 |
/// "Digraph" concept. |
| 259 | 259 |
template <typename GR> |
| 260 | 260 |
class ListArcSet : public ArcSetExtender<ListArcSetBase<GR> > {
|
| 261 | 261 |
typedef ArcSetExtender<ListArcSetBase<GR> > Parent; |
| 262 | 262 |
|
| 263 | 263 |
public: |
| 264 | 264 |
|
| 265 | 265 |
typedef typename Parent::Node Node; |
| 266 | 266 |
typedef typename Parent::Arc Arc; |
| 267 | 267 |
|
| 268 | 268 |
typedef typename Parent::NodesImplBase NodesImplBase; |
| 269 | 269 |
|
| 270 | 270 |
void eraseNode(const Node& node) {
|
| 271 | 271 |
Arc arc; |
| 272 | 272 |
Parent::firstOut(arc, node); |
| 273 | 273 |
while (arc != INVALID ) {
|
| 274 | 274 |
erase(arc); |
| 275 | 275 |
Parent::firstOut(arc, node); |
| 276 | 276 |
} |
| 277 | 277 |
|
| 278 | 278 |
Parent::firstIn(arc, node); |
| 279 | 279 |
while (arc != INVALID ) {
|
| 280 | 280 |
erase(arc); |
| 281 | 281 |
Parent::firstIn(arc, node); |
| ... | ... |
@@ -609,97 +609,97 @@ |
| 609 | 609 |
static int id(Arc e) { return e.id; }
|
| 610 | 610 |
static int id(Edge e) { return e.id; }
|
| 611 | 611 |
|
| 612 | 612 |
Node nodeFromId(int id) const { return _graph->nodeFromId(id); }
|
| 613 | 613 |
static Arc arcFromId(int id) { return Arc(id);}
|
| 614 | 614 |
static Edge edgeFromId(int id) { return Edge(id);}
|
| 615 | 615 |
|
| 616 | 616 |
int maxNodeId() const { return _graph->maxNodeId(); };
|
| 617 | 617 |
int maxEdgeId() const { return arcs.size() / 2 - 1; }
|
| 618 | 618 |
int maxArcId() const { return arcs.size()-1; }
|
| 619 | 619 |
|
| 620 | 620 |
Node source(Arc e) const { return arcs[e.id ^ 1].target; }
|
| 621 | 621 |
Node target(Arc e) const { return arcs[e.id].target; }
|
| 622 | 622 |
|
| 623 | 623 |
Node u(Edge e) const { return arcs[2 * e.id].target; }
|
| 624 | 624 |
Node v(Edge e) const { return arcs[2 * e.id + 1].target; }
|
| 625 | 625 |
|
| 626 | 626 |
typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier; |
| 627 | 627 |
|
| 628 | 628 |
NodeNotifier& notifier(Node) const {
|
| 629 | 629 |
return _graph->notifier(Node()); |
| 630 | 630 |
} |
| 631 | 631 |
|
| 632 | 632 |
template <typename V> |
| 633 | 633 |
class NodeMap : public GR::template NodeMap<V> {
|
| 634 | 634 |
typedef typename GR::template NodeMap<V> Parent; |
| 635 | 635 |
|
| 636 | 636 |
public: |
| 637 | 637 |
|
| 638 | 638 |
explicit NodeMap(const ListEdgeSetBase<GR>& arcset) |
| 639 | 639 |
: Parent(*arcset._graph) {}
|
| 640 | 640 |
|
| 641 | 641 |
NodeMap(const ListEdgeSetBase<GR>& arcset, const V& value) |
| 642 | 642 |
: Parent(*arcset._graph, value) {}
|
| 643 | 643 |
|
| 644 | 644 |
NodeMap& operator=(const NodeMap& cmap) {
|
| 645 | 645 |
return operator=<NodeMap>(cmap); |
| 646 | 646 |
} |
| 647 | 647 |
|
| 648 | 648 |
template <typename CMap> |
| 649 | 649 |
NodeMap& operator=(const CMap& cmap) {
|
| 650 | 650 |
Parent::operator=(cmap); |
| 651 | 651 |
return *this; |
| 652 | 652 |
} |
| 653 | 653 |
}; |
| 654 | 654 |
|
| 655 | 655 |
}; |
| 656 | 656 |
|
| 657 |
/// \ingroup |
|
| 657 |
/// \ingroup graphs |
|
| 658 | 658 |
/// |
| 659 | 659 |
/// \brief Graph using a node set of another digraph or graph and an |
| 660 | 660 |
/// own edge set. |
| 661 | 661 |
/// |
| 662 | 662 |
/// This structure can be used to establish another graph over a |
| 663 | 663 |
/// node set of an existing one. This class uses the same Node type |
| 664 | 664 |
/// as the underlying graph, and each valid node of the original |
| 665 | 665 |
/// graph is valid in this arc set, therefore the node objects of |
| 666 | 666 |
/// the original graph can be used directly with this class. The |
| 667 | 667 |
/// node handling functions (id handling, observing, and iterators) |
| 668 | 668 |
/// works equivalently as in the original graph. |
| 669 | 669 |
/// |
| 670 | 670 |
/// This implementation is based on doubly-linked lists, from each |
| 671 | 671 |
/// node the incident edges make up lists, therefore one edge can be |
| 672 | 672 |
/// erased in constant time. It also makes possible, that node can |
| 673 | 673 |
/// be removed from the underlying graph, in this case all edges |
| 674 | 674 |
/// incident to the given node is erased from the arc set. |
| 675 | 675 |
/// |
| 676 | 676 |
/// \param GR The type of the graph which shares its node set |
| 677 | 677 |
/// with this class. Its interface must conform to the |
| 678 | 678 |
/// \ref concepts::Digraph "Digraph" or \ref concepts::Graph "Graph" |
| 679 | 679 |
/// concept. |
| 680 | 680 |
/// |
| 681 | 681 |
/// This class fully conforms to the \ref concepts::Graph "Graph" |
| 682 | 682 |
/// concept. |
| 683 | 683 |
template <typename GR> |
| 684 | 684 |
class ListEdgeSet : public EdgeSetExtender<ListEdgeSetBase<GR> > {
|
| 685 | 685 |
typedef EdgeSetExtender<ListEdgeSetBase<GR> > Parent; |
| 686 | 686 |
|
| 687 | 687 |
public: |
| 688 | 688 |
|
| 689 | 689 |
typedef typename Parent::Node Node; |
| 690 | 690 |
typedef typename Parent::Arc Arc; |
| 691 | 691 |
typedef typename Parent::Edge Edge; |
| 692 | 692 |
|
| 693 | 693 |
typedef typename Parent::NodesImplBase NodesImplBase; |
| 694 | 694 |
|
| 695 | 695 |
void eraseNode(const Node& node) {
|
| 696 | 696 |
Arc arc; |
| 697 | 697 |
Parent::firstOut(arc, node); |
| 698 | 698 |
while (arc != INVALID ) {
|
| 699 | 699 |
erase(arc); |
| 700 | 700 |
Parent::firstOut(arc, node); |
| 701 | 701 |
} |
| 702 | 702 |
|
| 703 | 703 |
} |
| 704 | 704 |
|
| 705 | 705 |
void clearNodes() {
|
| ... | ... |
@@ -868,97 +868,97 @@ |
| 868 | 868 |
void nextIn(Arc& arc) const {
|
| 869 | 869 |
arc.id = arcs[arc.id].next_in; |
| 870 | 870 |
} |
| 871 | 871 |
|
| 872 | 872 |
int id(const Node& node) const { return _graph->id(node); }
|
| 873 | 873 |
int id(const Arc& arc) const { return arc.id; }
|
| 874 | 874 |
|
| 875 | 875 |
Node nodeFromId(int ix) const { return _graph->nodeFromId(ix); }
|
| 876 | 876 |
Arc arcFromId(int ix) const { return Arc(ix); }
|
| 877 | 877 |
|
| 878 | 878 |
int maxNodeId() const { return _graph->maxNodeId(); };
|
| 879 | 879 |
int maxArcId() const { return arcs.size() - 1; }
|
| 880 | 880 |
|
| 881 | 881 |
Node source(const Arc& arc) const { return arcs[arc.id].source;}
|
| 882 | 882 |
Node target(const Arc& arc) const { return arcs[arc.id].target;}
|
| 883 | 883 |
|
| 884 | 884 |
typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier; |
| 885 | 885 |
|
| 886 | 886 |
NodeNotifier& notifier(Node) const {
|
| 887 | 887 |
return _graph->notifier(Node()); |
| 888 | 888 |
} |
| 889 | 889 |
|
| 890 | 890 |
template <typename V> |
| 891 | 891 |
class NodeMap : public GR::template NodeMap<V> {
|
| 892 | 892 |
typedef typename GR::template NodeMap<V> Parent; |
| 893 | 893 |
|
| 894 | 894 |
public: |
| 895 | 895 |
|
| 896 | 896 |
explicit NodeMap(const SmartArcSetBase<GR>& arcset) |
| 897 | 897 |
: Parent(*arcset._graph) { }
|
| 898 | 898 |
|
| 899 | 899 |
NodeMap(const SmartArcSetBase<GR>& arcset, const V& value) |
| 900 | 900 |
: Parent(*arcset._graph, value) { }
|
| 901 | 901 |
|
| 902 | 902 |
NodeMap& operator=(const NodeMap& cmap) {
|
| 903 | 903 |
return operator=<NodeMap>(cmap); |
| 904 | 904 |
} |
| 905 | 905 |
|
| 906 | 906 |
template <typename CMap> |
| 907 | 907 |
NodeMap& operator=(const CMap& cmap) {
|
| 908 | 908 |
Parent::operator=(cmap); |
| 909 | 909 |
return *this; |
| 910 | 910 |
} |
| 911 | 911 |
}; |
| 912 | 912 |
|
| 913 | 913 |
}; |
| 914 | 914 |
|
| 915 | 915 |
|
| 916 |
/// \ingroup |
|
| 916 |
/// \ingroup graphs |
|
| 917 | 917 |
/// |
| 918 | 918 |
/// \brief Digraph using a node set of another digraph or graph and |
| 919 | 919 |
/// an own arc set. |
| 920 | 920 |
/// |
| 921 | 921 |
/// This structure can be used to establish another directed graph |
| 922 | 922 |
/// over a node set of an existing one. This class uses the same |
| 923 | 923 |
/// Node type as the underlying graph, and each valid node of the |
| 924 | 924 |
/// original graph is valid in this arc set, therefore the node |
| 925 | 925 |
/// objects of the original graph can be used directly with this |
| 926 | 926 |
/// class. The node handling functions (id handling, observing, and |
| 927 | 927 |
/// iterators) works equivalently as in the original graph. |
| 928 | 928 |
/// |
| 929 | 929 |
/// \param GR The type of the graph which shares its node set with |
| 930 | 930 |
/// this class. Its interface must conform to the |
| 931 | 931 |
/// \ref concepts::Digraph "Digraph" or \ref concepts::Graph "Graph" |
| 932 | 932 |
/// concept. |
| 933 | 933 |
/// |
| 934 | 934 |
/// This implementation is slightly faster than the \c ListArcSet, |
| 935 | 935 |
/// because it uses continuous storage for arcs and it uses just |
| 936 | 936 |
/// single-linked lists for enumerate outgoing and incoming |
| 937 | 937 |
/// arcs. Therefore the arcs cannot be erased from the arc sets. |
| 938 | 938 |
/// |
| 939 | 939 |
/// \warning If a node is erased from the underlying graph and this |
| 940 | 940 |
/// node is the source or target of one arc in the arc set, then |
| 941 | 941 |
/// the arc set is invalidated, and it cannot be used anymore. The |
| 942 | 942 |
/// validity can be checked with the \c valid() member function. |
| 943 | 943 |
/// |
| 944 | 944 |
/// This class fully conforms to the \ref concepts::Digraph |
| 945 | 945 |
/// "Digraph" concept. |
| 946 | 946 |
template <typename GR> |
| 947 | 947 |
class SmartArcSet : public ArcSetExtender<SmartArcSetBase<GR> > {
|
| 948 | 948 |
typedef ArcSetExtender<SmartArcSetBase<GR> > Parent; |
| 949 | 949 |
|
| 950 | 950 |
public: |
| 951 | 951 |
|
| 952 | 952 |
typedef typename Parent::Node Node; |
| 953 | 953 |
typedef typename Parent::Arc Arc; |
| 954 | 954 |
|
| 955 | 955 |
protected: |
| 956 | 956 |
|
| 957 | 957 |
typedef typename Parent::NodesImplBase NodesImplBase; |
| 958 | 958 |
|
| 959 | 959 |
void eraseNode(const Node& node) {
|
| 960 | 960 |
if (typename Parent::InArcIt(*this, node) == INVALID && |
| 961 | 961 |
typename Parent::OutArcIt(*this, node) == INVALID) {
|
| 962 | 962 |
return; |
| 963 | 963 |
} |
| 964 | 964 |
throw typename NodesImplBase::Notifier::ImmediateDetach(); |
| ... | ... |
@@ -1212,97 +1212,97 @@ |
| 1212 | 1212 |
static int id(Arc arc) { return arc.id; }
|
| 1213 | 1213 |
static int id(Edge arc) { return arc.id; }
|
| 1214 | 1214 |
|
| 1215 | 1215 |
Node nodeFromId(int id) const { return _graph->nodeFromId(id); }
|
| 1216 | 1216 |
static Arc arcFromId(int id) { return Arc(id); }
|
| 1217 | 1217 |
static Edge edgeFromId(int id) { return Edge(id);}
|
| 1218 | 1218 |
|
| 1219 | 1219 |
int maxNodeId() const { return _graph->maxNodeId(); };
|
| 1220 | 1220 |
int maxArcId() const { return arcs.size() - 1; }
|
| 1221 | 1221 |
int maxEdgeId() const { return arcs.size() / 2 - 1; }
|
| 1222 | 1222 |
|
| 1223 | 1223 |
Node source(Arc e) const { return arcs[e.id ^ 1].target; }
|
| 1224 | 1224 |
Node target(Arc e) const { return arcs[e.id].target; }
|
| 1225 | 1225 |
|
| 1226 | 1226 |
Node u(Edge e) const { return arcs[2 * e.id].target; }
|
| 1227 | 1227 |
Node v(Edge e) const { return arcs[2 * e.id + 1].target; }
|
| 1228 | 1228 |
|
| 1229 | 1229 |
typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier; |
| 1230 | 1230 |
|
| 1231 | 1231 |
NodeNotifier& notifier(Node) const {
|
| 1232 | 1232 |
return _graph->notifier(Node()); |
| 1233 | 1233 |
} |
| 1234 | 1234 |
|
| 1235 | 1235 |
template <typename V> |
| 1236 | 1236 |
class NodeMap : public GR::template NodeMap<V> {
|
| 1237 | 1237 |
typedef typename GR::template NodeMap<V> Parent; |
| 1238 | 1238 |
|
| 1239 | 1239 |
public: |
| 1240 | 1240 |
|
| 1241 | 1241 |
explicit NodeMap(const SmartEdgeSetBase<GR>& arcset) |
| 1242 | 1242 |
: Parent(*arcset._graph) { }
|
| 1243 | 1243 |
|
| 1244 | 1244 |
NodeMap(const SmartEdgeSetBase<GR>& arcset, const V& value) |
| 1245 | 1245 |
: Parent(*arcset._graph, value) { }
|
| 1246 | 1246 |
|
| 1247 | 1247 |
NodeMap& operator=(const NodeMap& cmap) {
|
| 1248 | 1248 |
return operator=<NodeMap>(cmap); |
| 1249 | 1249 |
} |
| 1250 | 1250 |
|
| 1251 | 1251 |
template <typename CMap> |
| 1252 | 1252 |
NodeMap& operator=(const CMap& cmap) {
|
| 1253 | 1253 |
Parent::operator=(cmap); |
| 1254 | 1254 |
return *this; |
| 1255 | 1255 |
} |
| 1256 | 1256 |
}; |
| 1257 | 1257 |
|
| 1258 | 1258 |
}; |
| 1259 | 1259 |
|
| 1260 |
/// \ingroup |
|
| 1260 |
/// \ingroup graphs |
|
| 1261 | 1261 |
/// |
| 1262 | 1262 |
/// \brief Graph using a node set of another digraph or graph and an |
| 1263 | 1263 |
/// own edge set. |
| 1264 | 1264 |
/// |
| 1265 | 1265 |
/// This structure can be used to establish another graph over a |
| 1266 | 1266 |
/// node set of an existing one. This class uses the same Node type |
| 1267 | 1267 |
/// as the underlying graph, and each valid node of the original |
| 1268 | 1268 |
/// graph is valid in this arc set, therefore the node objects of |
| 1269 | 1269 |
/// the original graph can be used directly with this class. The |
| 1270 | 1270 |
/// node handling functions (id handling, observing, and iterators) |
| 1271 | 1271 |
/// works equivalently as in the original graph. |
| 1272 | 1272 |
/// |
| 1273 | 1273 |
/// \param GR The type of the graph which shares its node set |
| 1274 | 1274 |
/// with this class. Its interface must conform to the |
| 1275 | 1275 |
/// \ref concepts::Digraph "Digraph" or \ref concepts::Graph "Graph" |
| 1276 | 1276 |
/// concept. |
| 1277 | 1277 |
/// |
| 1278 | 1278 |
/// This implementation is slightly faster than the \c ListEdgeSet, |
| 1279 | 1279 |
/// because it uses continuous storage for edges and it uses just |
| 1280 | 1280 |
/// single-linked lists for enumerate incident edges. Therefore the |
| 1281 | 1281 |
/// edges cannot be erased from the edge sets. |
| 1282 | 1282 |
/// |
| 1283 | 1283 |
/// \warning If a node is erased from the underlying graph and this |
| 1284 | 1284 |
/// node is incident to one edge in the edge set, then the edge set |
| 1285 | 1285 |
/// is invalidated, and it cannot be used anymore. The validity can |
| 1286 | 1286 |
/// be checked with the \c valid() member function. |
| 1287 | 1287 |
/// |
| 1288 | 1288 |
/// This class fully conforms to the \ref concepts::Graph |
| 1289 | 1289 |
/// "Graph" concept. |
| 1290 | 1290 |
template <typename GR> |
| 1291 | 1291 |
class SmartEdgeSet : public EdgeSetExtender<SmartEdgeSetBase<GR> > {
|
| 1292 | 1292 |
typedef EdgeSetExtender<SmartEdgeSetBase<GR> > Parent; |
| 1293 | 1293 |
|
| 1294 | 1294 |
public: |
| 1295 | 1295 |
|
| 1296 | 1296 |
typedef typename Parent::Node Node; |
| 1297 | 1297 |
typedef typename Parent::Arc Arc; |
| 1298 | 1298 |
typedef typename Parent::Edge Edge; |
| 1299 | 1299 |
|
| 1300 | 1300 |
protected: |
| 1301 | 1301 |
|
| 1302 | 1302 |
typedef typename Parent::NodesImplBase NodesImplBase; |
| 1303 | 1303 |
|
| 1304 | 1304 |
void eraseNode(const Node& node) {
|
| 1305 | 1305 |
if (typename Parent::IncEdgeIt(*this, node) == INVALID) {
|
| 1306 | 1306 |
return; |
| 1307 | 1307 |
} |
| 1308 | 1308 |
throw typename NodesImplBase::Notifier::ImmediateDetach(); |
| 1 | 1 |
prefix=@prefix@ |
| 2 | 2 |
exec_prefix=@exec_prefix@ |
| 3 | 3 |
libdir=@libdir@ |
| 4 | 4 |
includedir=@includedir@ |
| 5 | 5 |
|
| 6 | 6 |
Name: @PACKAGE_NAME@ |
| 7 |
Description: Library |
|
| 7 |
Description: Library for Efficient Modeling and Optimization in Networks |
|
| 8 | 8 |
Version: @PACKAGE_VERSION@ |
| 9 | 9 |
Libs: -L${libdir} -lemon @GLPK_LIBS@ @CPLEX_LIBS@ @SOPLEX_LIBS@ @CLP_LIBS@ @CBC_LIBS@
|
| 10 | 10 |
Cflags: -I${includedir}
|
0 comments (0 inline)