!
!
!
1
1
2
2
1
1
21
21
1
1
1
1
1
1
1
1
1
1
1
1
1
1
12
12
| 1 | 1 |
LEMON code without an explicit copyright is covered by the following |
| 2 | 2 |
copyright/license. |
| 3 | 3 |
|
| 4 |
Copyright (C) 2003- |
|
| 4 |
Copyright (C) 2003-2009 Egervary Jeno Kombinatorikus Optimalizalasi |
|
| 5 | 5 |
Kutatocsoport (Egervary Combinatorial Optimization Research Group, |
| 6 | 6 |
EGRES). |
| 7 | 7 |
|
| 8 | 8 |
Permission is hereby granted, free of charge, to any person or organization |
| 9 | 9 |
obtaining a copy of the software and accompanying documentation covered by |
| 10 | 10 |
this license (the "Software") to use, reproduce, display, distribute, |
| 11 | 11 |
execute, and transmit the Software, and to prepare derivative works of the |
| 12 | 12 |
Software, and to permit third-parties to whom the Software is furnished to |
| 13 | 13 |
do so, all subject to the following: |
| 14 | 14 |
|
| 15 | 15 |
The copyright notices in the Software and this entire statement, including |
| 16 | 16 |
the above license grant, this restriction and the following disclaimer, |
| 17 | 17 |
must be included in all copies of the Software, in whole or in part, and |
| 18 | 18 |
all derivative works of the Software, unless such copies or derivative |
| 19 | 19 |
works are solely in the form of machine-executable object code generated by |
| 20 | 20 |
a source language processor. |
| 21 | 21 |
|
| 22 | 22 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 23 | 23 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 24 | 24 |
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT |
| 25 | 25 |
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE |
| 26 | 26 |
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, |
| 27 | 27 |
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 28 | 28 |
DEALINGS IN THE SOFTWARE. |
| 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-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 |
///\ingroup demos |
| 20 | 20 |
///\file |
| 21 | 21 |
///\brief Argument parser demo |
| 22 | 22 |
/// |
| 23 | 23 |
/// This example shows how the argument parser can be used. |
| 24 | 24 |
/// |
| 25 | 25 |
/// \include arg_parser_demo.cc |
| 26 | 26 |
|
| 27 | 27 |
#include <lemon/arg_parser.h> |
| 28 | 28 |
|
| 29 | 29 |
using 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-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 |
/// \ingroup demos |
| 20 | 20 |
/// \file |
| 21 | 21 |
/// \brief Demo of the graph drawing function \ref graphToEps() |
| 22 | 22 |
/// |
| 23 | 23 |
/// This demo program shows examples how to use the function \ref |
| 24 | 24 |
/// graphToEps(). It takes no input but simply creates seven |
| 25 | 25 |
/// <tt>.eps</tt> files demonstrating the capability of \ref |
| 26 | 26 |
/// graphToEps(), and showing how to draw directed graphs, |
| 27 | 27 |
/// how to handle parallel egdes, how to change the properties (like |
| 28 | 28 |
/// color, shape, size, title etc.) of nodes and arcs individually |
| 29 | 29 |
/// using appropriate graph maps. |
| ... | ... |
@@ -64,143 +64,143 @@ |
| 64 | 64 |
|
| 65 | 65 |
coords[n1]=Point(50,50); sizes[n1]=1; colors[n1]=1; shapes[n1]=0; |
| 66 | 66 |
coords[n2]=Point(50,70); sizes[n2]=2; colors[n2]=2; shapes[n2]=2; |
| 67 | 67 |
coords[n3]=Point(70,70); sizes[n3]=1; colors[n3]=3; shapes[n3]=0; |
| 68 | 68 |
coords[n4]=Point(70,50); sizes[n4]=2; colors[n4]=4; shapes[n4]=1; |
| 69 | 69 |
coords[n5]=Point(85,60); sizes[n5]=3; colors[n5]=5; shapes[n5]=2; |
| 70 | 70 |
|
| 71 | 71 |
Arc a; |
| 72 | 72 |
|
| 73 | 73 |
a=g.addArc(n1,n2); acolors[a]=0; widths[a]=1; |
| 74 | 74 |
a=g.addArc(n2,n3); acolors[a]=0; widths[a]=1; |
| 75 | 75 |
a=g.addArc(n3,n5); acolors[a]=0; widths[a]=3; |
| 76 | 76 |
a=g.addArc(n5,n4); acolors[a]=0; widths[a]=1; |
| 77 | 77 |
a=g.addArc(n4,n1); acolors[a]=0; widths[a]=1; |
| 78 | 78 |
a=g.addArc(n2,n4); acolors[a]=1; widths[a]=2; |
| 79 | 79 |
a=g.addArc(n3,n4); acolors[a]=2; widths[a]=1; |
| 80 | 80 |
|
| 81 | 81 |
IdMap<ListDigraph,Node> id(g); |
| 82 | 82 |
|
| 83 | 83 |
// Create .eps files showing the digraph with different options |
| 84 | 84 |
cout << "Create 'graph_to_eps_demo_out_1_pure.eps'" << endl; |
| 85 | 85 |
graphToEps(g,"graph_to_eps_demo_out_1_pure.eps"). |
| 86 | 86 |
coords(coords). |
| 87 | 87 |
title("Sample .eps figure").
|
| 88 |
copyright("(C) 2003-
|
|
| 88 |
copyright("(C) 2003-2009 LEMON Project").
|
|
| 89 | 89 |
run(); |
| 90 | 90 |
|
| 91 | 91 |
cout << "Create 'graph_to_eps_demo_out_2.eps'" << endl; |
| 92 | 92 |
graphToEps(g,"graph_to_eps_demo_out_2.eps"). |
| 93 | 93 |
coords(coords). |
| 94 | 94 |
title("Sample .eps figure").
|
| 95 |
copyright("(C) 2003-
|
|
| 95 |
copyright("(C) 2003-2009 LEMON Project").
|
|
| 96 | 96 |
absoluteNodeSizes().absoluteArcWidths(). |
| 97 | 97 |
nodeScale(2).nodeSizes(sizes). |
| 98 | 98 |
nodeShapes(shapes). |
| 99 | 99 |
nodeColors(composeMap(palette,colors)). |
| 100 | 100 |
arcColors(composeMap(palette,acolors)). |
| 101 | 101 |
arcWidthScale(.4).arcWidths(widths). |
| 102 | 102 |
nodeTexts(id).nodeTextSize(3). |
| 103 | 103 |
run(); |
| 104 | 104 |
|
| 105 | 105 |
cout << "Create 'graph_to_eps_demo_out_3_arr.eps'" << endl; |
| 106 | 106 |
graphToEps(g,"graph_to_eps_demo_out_3_arr.eps"). |
| 107 | 107 |
title("Sample .eps figure (with arrowheads)").
|
| 108 |
copyright("(C) 2003-
|
|
| 108 |
copyright("(C) 2003-2009 LEMON Project").
|
|
| 109 | 109 |
absoluteNodeSizes().absoluteArcWidths(). |
| 110 | 110 |
nodeColors(composeMap(palette,colors)). |
| 111 | 111 |
coords(coords). |
| 112 | 112 |
nodeScale(2).nodeSizes(sizes). |
| 113 | 113 |
nodeShapes(shapes). |
| 114 | 114 |
arcColors(composeMap(palette,acolors)). |
| 115 | 115 |
arcWidthScale(.4).arcWidths(widths). |
| 116 | 116 |
nodeTexts(id).nodeTextSize(3). |
| 117 | 117 |
drawArrows().arrowWidth(2).arrowLength(2). |
| 118 | 118 |
run(); |
| 119 | 119 |
|
| 120 | 120 |
// Add more arcs to the digraph |
| 121 | 121 |
a=g.addArc(n1,n4); acolors[a]=2; widths[a]=1; |
| 122 | 122 |
a=g.addArc(n4,n1); acolors[a]=1; widths[a]=2; |
| 123 | 123 |
|
| 124 | 124 |
a=g.addArc(n1,n2); acolors[a]=1; widths[a]=1; |
| 125 | 125 |
a=g.addArc(n1,n2); acolors[a]=2; widths[a]=1; |
| 126 | 126 |
a=g.addArc(n1,n2); acolors[a]=3; widths[a]=1; |
| 127 | 127 |
a=g.addArc(n1,n2); acolors[a]=4; widths[a]=1; |
| 128 | 128 |
a=g.addArc(n1,n2); acolors[a]=5; widths[a]=1; |
| 129 | 129 |
a=g.addArc(n1,n2); acolors[a]=6; widths[a]=1; |
| 130 | 130 |
a=g.addArc(n1,n2); acolors[a]=7; widths[a]=1; |
| 131 | 131 |
|
| 132 | 132 |
cout << "Create 'graph_to_eps_demo_out_4_par.eps'" << endl; |
| 133 | 133 |
graphToEps(g,"graph_to_eps_demo_out_4_par.eps"). |
| 134 | 134 |
title("Sample .eps figure (parallel arcs)").
|
| 135 |
copyright("(C) 2003-
|
|
| 135 |
copyright("(C) 2003-2009 LEMON Project").
|
|
| 136 | 136 |
absoluteNodeSizes().absoluteArcWidths(). |
| 137 | 137 |
nodeShapes(shapes). |
| 138 | 138 |
coords(coords). |
| 139 | 139 |
nodeScale(2).nodeSizes(sizes). |
| 140 | 140 |
nodeColors(composeMap(palette,colors)). |
| 141 | 141 |
arcColors(composeMap(palette,acolors)). |
| 142 | 142 |
arcWidthScale(.4).arcWidths(widths). |
| 143 | 143 |
nodeTexts(id).nodeTextSize(3). |
| 144 | 144 |
enableParallel().parArcDist(1.5). |
| 145 | 145 |
run(); |
| 146 | 146 |
|
| 147 | 147 |
cout << "Create 'graph_to_eps_demo_out_5_par_arr.eps'" << endl; |
| 148 | 148 |
graphToEps(g,"graph_to_eps_demo_out_5_par_arr.eps"). |
| 149 | 149 |
title("Sample .eps figure (parallel arcs and arrowheads)").
|
| 150 |
copyright("(C) 2003-
|
|
| 150 |
copyright("(C) 2003-2009 LEMON Project").
|
|
| 151 | 151 |
absoluteNodeSizes().absoluteArcWidths(). |
| 152 | 152 |
nodeScale(2).nodeSizes(sizes). |
| 153 | 153 |
coords(coords). |
| 154 | 154 |
nodeShapes(shapes). |
| 155 | 155 |
nodeColors(composeMap(palette,colors)). |
| 156 | 156 |
arcColors(composeMap(palette,acolors)). |
| 157 | 157 |
arcWidthScale(.3).arcWidths(widths). |
| 158 | 158 |
nodeTexts(id).nodeTextSize(3). |
| 159 | 159 |
enableParallel().parArcDist(1). |
| 160 | 160 |
drawArrows().arrowWidth(1).arrowLength(1). |
| 161 | 161 |
run(); |
| 162 | 162 |
|
| 163 | 163 |
cout << "Create 'graph_to_eps_demo_out_6_par_arr_a4.eps'" << endl; |
| 164 | 164 |
graphToEps(g,"graph_to_eps_demo_out_6_par_arr_a4.eps"). |
| 165 | 165 |
title("Sample .eps figure (fits to A4)").
|
| 166 |
copyright("(C) 2003-
|
|
| 166 |
copyright("(C) 2003-2009 LEMON Project").
|
|
| 167 | 167 |
scaleToA4(). |
| 168 | 168 |
absoluteNodeSizes().absoluteArcWidths(). |
| 169 | 169 |
nodeScale(2).nodeSizes(sizes). |
| 170 | 170 |
coords(coords). |
| 171 | 171 |
nodeShapes(shapes). |
| 172 | 172 |
nodeColors(composeMap(palette,colors)). |
| 173 | 173 |
arcColors(composeMap(palette,acolors)). |
| 174 | 174 |
arcWidthScale(.3).arcWidths(widths). |
| 175 | 175 |
nodeTexts(id).nodeTextSize(3). |
| 176 | 176 |
enableParallel().parArcDist(1). |
| 177 | 177 |
drawArrows().arrowWidth(1).arrowLength(1). |
| 178 | 178 |
run(); |
| 179 | 179 |
|
| 180 | 180 |
// Create an .eps file showing the colors of a default Palette |
| 181 | 181 |
ListDigraph h; |
| 182 | 182 |
ListDigraph::NodeMap<int> hcolors(h); |
| 183 | 183 |
ListDigraph::NodeMap<Point> hcoords(h); |
| 184 | 184 |
|
| 185 | 185 |
int cols=int(sqrt(double(palette.size()))); |
| 186 | 186 |
for(int i=0;i<int(paletteW.size());i++) {
|
| 187 | 187 |
Node n=h.addNode(); |
| 188 | 188 |
hcoords[n]=Point(1+i%cols,1+i/cols); |
| 189 | 189 |
hcolors[n]=i; |
| 190 | 190 |
} |
| 191 | 191 |
|
| 192 | 192 |
cout << "Create 'graph_to_eps_demo_out_7_colors.eps'" << endl; |
| 193 | 193 |
graphToEps(h,"graph_to_eps_demo_out_7_colors.eps"). |
| 194 | 194 |
scale(60). |
| 195 | 195 |
title("Sample .eps figure (Palette demo)").
|
| 196 |
copyright("(C) 2003-
|
|
| 196 |
copyright("(C) 2003-2009 LEMON Project").
|
|
| 197 | 197 |
coords(hcoords). |
| 198 | 198 |
absoluteNodeSizes().absoluteArcWidths(). |
| 199 | 199 |
nodeScale(.45). |
| 200 | 200 |
distantColorNodeTexts(). |
| 201 | 201 |
nodeTexts(hcolors).nodeTextSize(.6). |
| 202 | 202 |
nodeColors(composeMap(paletteW,hcolors)). |
| 203 | 203 |
run(); |
| 204 | 204 |
|
| 205 | 205 |
return 0; |
| 206 | 206 |
} |
| 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-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 |
///\ingroup demos |
| 20 | 20 |
///\file |
| 21 | 21 |
///\brief Demonstrating graph input and output |
| 22 | 22 |
/// |
| 23 | 23 |
/// This program gives an example of how to read and write a digraph |
| 24 | 24 |
/// and additional maps from/to a stream or a file using the |
| 25 | 25 |
/// \ref lgf-format "LGF" format. |
| 26 | 26 |
/// |
| 27 | 27 |
/// The \c "digraph.lgf" file: |
| 28 | 28 |
/// \include digraph.lgf |
| 29 | 29 |
/// |
| 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-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 |
|
| 21 | 21 |
\page coding_style LEMON Coding Style |
| 22 | 22 |
|
| 23 | 23 |
\section naming_conv Naming Conventions |
| 24 | 24 |
|
| 25 | 25 |
In order to make development easier we have made some conventions |
| 26 | 26 |
according to coding style. These include names of types, classes, |
| 27 | 27 |
functions, variables, constants and exceptions. If these conventions |
| 28 | 28 |
are met in one's code then it is easier to read and maintain |
| 29 | 29 |
it. Please comply with these conventions if you want to contribute |
| 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-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 |
\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. |
| ... | ... |
@@ -50,28 +50,28 @@ |
| 50 | 50 |
/** |
| 51 | 51 |
\dir lemon |
| 52 | 52 |
\brief Base include directory of LEMON. |
| 53 | 53 |
|
| 54 | 54 |
This is the base directory of LEMON includes, so each include file must be |
| 55 | 55 |
prefixed with this, e.g. |
| 56 | 56 |
\code |
| 57 | 57 |
#include<lemon/list_graph.h> |
| 58 | 58 |
#include<lemon/dijkstra.h> |
| 59 | 59 |
\endcode |
| 60 | 60 |
*/ |
| 61 | 61 |
|
| 62 | 62 |
/** |
| 63 | 63 |
\dir concepts |
| 64 | 64 |
\brief Concept descriptors and checking classes. |
| 65 | 65 |
|
| 66 | 66 |
This directory contains the concept descriptors and concept checking tools. |
| 67 | 67 |
For more information see the \ref concept "Concepts" module. |
| 68 | 68 |
*/ |
| 69 | 69 |
|
| 70 | 70 |
/** |
| 71 | 71 |
\dir bits |
| 72 | 72 |
\brief Auxiliary tools for implementation. |
| 73 | 73 |
|
| 74 |
This directory contains some auxiliary classes for implementing graphs, |
|
| 74 |
This directory contains some auxiliary classes for implementing graphs, |
|
| 75 | 75 |
maps and some other classes. |
| 76 | 76 |
As a user you typically don't have to deal with these files. |
| 77 | 77 |
*/ |
| 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-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 |
namespace lemon {
|
| 20 | 20 |
|
| 21 | 21 |
/** |
| 22 | 22 |
@defgroup datas Data Structures |
| 23 | 23 |
This group describes the several data structures implemented in LEMON. |
| 24 | 24 |
*/ |
| 25 | 25 |
|
| 26 | 26 |
/** |
| 27 | 27 |
@defgroup graphs Graph Structures |
| 28 | 28 |
@ingroup datas |
| 29 | 29 |
\brief Graph structures implemented in 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-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 |
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 |
| 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-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 |
|
| 21 | 21 |
\page license License Terms |
| 22 | 22 |
|
| 23 | 23 |
\verbinclude LICENSE |
| 24 | 24 |
|
| 25 | 25 |
*/ |
| 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-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 | 26 |
LEMON stands for |
| 27 | 27 |
<b>L</b>ibrary of <b>E</b>fficient <b>M</b>odels |
| 28 | 28 |
and <b>O</b>ptimization in <b>N</b>etworks. |
| 29 | 29 |
It is a C++ template |
| 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-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 |
namespace lemon {
|
| 20 | 20 |
/*! |
| 21 | 21 |
|
| 22 | 22 |
\page migration Migration from the 0.x Series |
| 23 | 23 |
|
| 24 | 24 |
This guide gives an in depth description on what has changed compared |
| 25 | 25 |
to the 0.x release series. |
| 26 | 26 |
|
| 27 | 27 |
Many of these changes adjusted automatically by the |
| 28 | 28 |
<tt>lemon-0.x-to-1.x.sh</tt> tool. Those requiring manual |
| 29 | 29 |
update are typeset <b>boldface</b>. |
| 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-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 |
|
| 21 | 21 |
\page named-param Named Parameters |
| 22 | 22 |
|
| 23 | 23 |
\section named-func-param Named Function Parameters |
| 24 | 24 |
|
| 25 | 25 |
Several modern languages provide a convenient way to refer the |
| 26 | 26 |
function parameters by name also when you call the function. It is |
| 27 | 27 |
especially comfortable in case of a function having tons of parameters |
| 28 | 28 |
with natural default values. Sadly, C++ lack this amenity. |
| 29 | 29 |
| 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-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 |
/// The namespace of LEMON |
| 20 | 20 |
|
| 21 | 21 |
/// The namespace of LEMON |
| 22 | 22 |
/// |
| 23 | 23 |
namespace lemon {
|
| 24 | 24 |
|
| 25 | 25 |
/// The namespace of LEMON concepts and concept checking classes |
| 26 | 26 |
|
| 27 | 27 |
/// The namespace of LEMON concepts and concept checking classes |
| 28 | 28 |
/// |
| 29 | 29 |
namespace concepts {}
|
| 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-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 |
#ifndef LEMON_TEMPLATE_H |
| 20 | 20 |
#define LEMON_TEMPLATE_H |
| 21 | 21 |
|
| 22 | 22 |
#endif // LEMON_TEMPLATE_H |
| 1 | 1 |
EXTRA_DIST += \ |
| 2 | 2 |
lemon/lemon.pc.in \ |
| 3 | 3 |
lemon/CMakeLists.txt |
| 4 | 4 |
|
| 5 | 5 |
pkgconfig_DATA += lemon/lemon.pc |
| 6 | 6 |
|
| 7 | 7 |
lib_LTLIBRARIES += lemon/libemon.la |
| 8 | 8 |
|
| 9 | 9 |
lemon_libemon_la_SOURCES = \ |
| 10 |
lemon/arg_parser.cc \ |
|
| 11 |
lemon/base.cc \ |
|
| 12 |
lemon/color.cc \ |
|
| 13 |
lemon/random.cc |
|
| 10 |
lemon/arg_parser.cc \ |
|
| 11 |
lemon/base.cc \ |
|
| 12 |
lemon/color.cc \ |
|
| 13 |
lemon/random.cc |
|
| 14 | 14 |
|
| 15 | 15 |
#lemon_libemon_la_CXXFLAGS = $(GLPK_CFLAGS) $(CPLEX_CFLAGS) $(SOPLEX_CXXFLAGS) $(AM_CXXFLAGS) |
| 16 | 16 |
#lemon_libemon_la_LDFLAGS = $(GLPK_LIBS) $(CPLEX_LIBS) $(SOPLEX_LIBS) |
| 17 | 17 |
|
| 18 | 18 |
lemon_HEADERS += \ |
| 19 | 19 |
lemon/adaptors.h \ |
| 20 |
|
|
| 20 |
lemon/arg_parser.h \ |
|
| 21 | 21 |
lemon/assert.h \ |
| 22 |
lemon/bfs.h \ |
|
| 23 |
lemon/bin_heap.h \ |
|
| 24 |
lemon/circulation.h \ |
|
| 25 |
lemon/color.h \ |
|
| 22 |
lemon/bfs.h \ |
|
| 23 |
lemon/bin_heap.h \ |
|
| 24 |
lemon/circulation.h \ |
|
| 25 |
lemon/color.h \ |
|
| 26 | 26 |
lemon/concept_check.h \ |
| 27 |
|
|
| 27 |
lemon/counter.h \ |
|
| 28 | 28 |
lemon/core.h \ |
| 29 |
lemon/dfs.h \ |
|
| 30 |
lemon/dijkstra.h \ |
|
| 31 |
lemon/dim2.h \ |
|
| 32 |
lemon/dimacs.h \ |
|
| 29 |
lemon/dfs.h \ |
|
| 30 |
lemon/dijkstra.h \ |
|
| 31 |
lemon/dim2.h \ |
|
| 32 |
lemon/dimacs.h \ |
|
| 33 | 33 |
lemon/elevator.h \ |
| 34 | 34 |
lemon/error.h \ |
| 35 | 35 |
lemon/full_graph.h \ |
| 36 |
lemon/graph_to_eps.h \ |
|
| 37 |
lemon/grid_graph.h \ |
|
| 36 |
lemon/graph_to_eps.h \ |
|
| 37 |
lemon/grid_graph.h \ |
|
| 38 | 38 |
lemon/hypercube_graph.h \ |
| 39 | 39 |
lemon/kruskal.h \ |
| 40 | 40 |
lemon/hao_orlin.h \ |
| 41 | 41 |
lemon/lgf_reader.h \ |
| 42 | 42 |
lemon/lgf_writer.h \ |
| 43 | 43 |
lemon/list_graph.h \ |
| 44 | 44 |
lemon/maps.h \ |
| 45 | 45 |
lemon/math.h \ |
| 46 | 46 |
lemon/max_matching.h \ |
| 47 | 47 |
lemon/nauty_reader.h \ |
| 48 | 48 |
lemon/path.h \ |
| 49 | 49 |
lemon/preflow.h \ |
| 50 |
|
|
| 50 |
lemon/random.h \ |
|
| 51 | 51 |
lemon/smart_graph.h \ |
| 52 | 52 |
lemon/suurballe.h \ |
| 53 |
lemon/time_measure.h \ |
|
| 54 |
lemon/tolerance.h \ |
|
| 53 |
lemon/time_measure.h \ |
|
| 54 |
lemon/tolerance.h \ |
|
| 55 | 55 |
lemon/unionfind.h |
| 56 | 56 |
|
| 57 | 57 |
bits_HEADERS += \ |
| 58 | 58 |
lemon/bits/alteration_notifier.h \ |
| 59 | 59 |
lemon/bits/array_map.h \ |
| 60 | 60 |
lemon/bits/base_extender.h \ |
| 61 |
|
|
| 61 |
lemon/bits/bezier.h \ |
|
| 62 | 62 |
lemon/bits/default_map.h \ |
| 63 |
|
|
| 63 |
lemon/bits/enable_if.h \ |
|
| 64 | 64 |
lemon/bits/graph_adaptor_extender.h \ |
| 65 | 65 |
lemon/bits/graph_extender.h \ |
| 66 | 66 |
lemon/bits/map_extender.h \ |
| 67 | 67 |
lemon/bits/path_dump.h \ |
| 68 | 68 |
lemon/bits/traits.h \ |
| 69 | 69 |
lemon/bits/variant.h \ |
| 70 | 70 |
lemon/bits/vector_map.h |
| 71 | 71 |
|
| 72 | 72 |
concept_HEADERS += \ |
| 73 | 73 |
lemon/concepts/digraph.h \ |
| 74 | 74 |
lemon/concepts/graph.h \ |
| 75 | 75 |
lemon/concepts/graph_components.h \ |
| 76 | 76 |
lemon/concepts/heap.h \ |
| 77 | 77 |
lemon/concepts/maps.h \ |
| 78 | 78 |
lemon/concepts/path.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-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 |
#ifndef LEMON_ADAPTORS_H |
| 20 | 20 |
#define LEMON_ADAPTORS_H |
| 21 | 21 |
|
| 22 | 22 |
/// \ingroup graph_adaptors |
| 23 | 23 |
/// \file |
| 24 | 24 |
/// \brief Several graph adaptors |
| 25 | 25 |
/// |
| 26 | 26 |
/// This file contains several useful adaptors for digraphs and graphs. |
| 27 | 27 |
|
| 28 | 28 |
#include <lemon/core.h> |
| 29 | 29 |
#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-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 |
#include <lemon/arg_parser.h> |
| 20 | 20 |
|
| 21 | 21 |
namespace lemon {
|
| 22 | 22 |
|
| 23 | 23 |
void ArgParser::_showHelp(void *p) |
| 24 | 24 |
{
|
| 25 | 25 |
(static_cast<ArgParser*>(p))->showHelp(); |
| 26 | 26 |
exit(1); |
| 27 | 27 |
} |
| 28 | 28 |
|
| 29 | 29 |
ArgParser::ArgParser(int argc, const char * const *argv) |
| 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-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 |
#ifndef LEMON_ARG_PARSER_H |
| 20 | 20 |
#define LEMON_ARG_PARSER_H |
| 21 | 21 |
|
| 22 | 22 |
#include <vector> |
| 23 | 23 |
#include <map> |
| 24 | 24 |
#include <list> |
| 25 | 25 |
#include <string> |
| 26 | 26 |
#include <iostream> |
| 27 | 27 |
#include <sstream> |
| 28 | 28 |
#include <algorithm> |
| 29 | 29 |
#include <lemon/assert.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-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 |
#ifndef LEMON_ASSERT_H |
| 20 | 20 |
#define LEMON_ASSERT_H |
| 21 | 21 |
|
| 22 | 22 |
/// \ingroup exceptions |
| 23 | 23 |
/// \file |
| 24 | 24 |
/// \brief Extended assertion handling |
| 25 | 25 |
|
| 26 | 26 |
#include <lemon/error.h> |
| 27 | 27 |
|
| 28 | 28 |
namespace lemon {
|
| 29 | 29 |
| 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-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 | 26 |
float Tolerance<float>::def_epsilon = 1e-4; |
| 27 | 27 |
double Tolerance<double>::def_epsilon = 1e-10; |
| 28 | 28 |
long double Tolerance<long double>::def_epsilon = 1e-14; |
| 29 | 29 |
| 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-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 |
#ifndef LEMON_BFS_H |
| 20 | 20 |
#define LEMON_BFS_H |
| 21 | 21 |
|
| 22 | 22 |
///\ingroup search |
| 23 | 23 |
///\file |
| 24 | 24 |
///\brief BFS 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> |
| 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-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 |
#ifndef LEMON_BIN_HEAP_H |
| 20 | 20 |
#define LEMON_BIN_HEAP_H |
| 21 | 21 |
|
| 22 | 22 |
///\ingroup auxdat |
| 23 | 23 |
///\file |
| 24 | 24 |
///\brief Binary Heap implementation. |
| 25 | 25 |
|
| 26 | 26 |
#include <vector> |
| 27 | 27 |
#include <utility> |
| 28 | 28 |
#include <functional> |
| 29 | 29 |
| 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-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 |
#ifndef LEMON_BITS_ALTERATION_NOTIFIER_H |
| 20 | 20 |
#define LEMON_BITS_ALTERATION_NOTIFIER_H |
| 21 | 21 |
|
| 22 | 22 |
#include <vector> |
| 23 | 23 |
#include <list> |
| 24 | 24 |
|
| 25 | 25 |
#include <lemon/core.h> |
| 26 | 26 |
|
| 27 | 27 |
//\ingroup graphbits |
| 28 | 28 |
//\file |
| 29 | 29 |
//\brief Observer notifier for graph alteration observers. |
| 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-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 |
#ifndef LEMON_BITS_ARRAY_MAP_H |
| 20 | 20 |
#define LEMON_BITS_ARRAY_MAP_H |
| 21 | 21 |
|
| 22 | 22 |
#include <memory> |
| 23 | 23 |
|
| 24 | 24 |
#include <lemon/bits/traits.h> |
| 25 | 25 |
#include <lemon/bits/alteration_notifier.h> |
| 26 | 26 |
#include <lemon/concept_check.h> |
| 27 | 27 |
#include <lemon/concepts/maps.h> |
| 28 | 28 |
|
| 29 | 29 |
// \ingroup graphbits |
| 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-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 |
#ifndef LEMON_BITS_BASE_EXTENDER_H |
| 20 | 20 |
#define LEMON_BITS_BASE_EXTENDER_H |
| 21 | 21 |
|
| 22 | 22 |
#include <lemon/core.h> |
| 23 | 23 |
#include <lemon/error.h> |
| 24 | 24 |
|
| 25 | 25 |
#include <lemon/bits/map_extender.h> |
| 26 | 26 |
#include <lemon/bits/default_map.h> |
| 27 | 27 |
|
| 28 | 28 |
#include <lemon/concept_check.h> |
| 29 | 29 |
#include <lemon/concepts/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-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 |
#ifndef LEMON_BEZIER_H |
| 20 | 20 |
#define LEMON_BEZIER_H |
| 21 | 21 |
|
| 22 | 22 |
//\ingroup misc |
| 23 | 23 |
//\file |
| 24 | 24 |
//\brief Classes to compute with Bezier curves. |
| 25 | 25 |
// |
| 26 | 26 |
//Up to now this file is used internally by \ref graph_to_eps.h |
| 27 | 27 |
|
| 28 | 28 |
#include<lemon/dim2.h> |
| 29 | 29 |
| 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-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 |
#ifndef LEMON_BITS_DEFAULT_MAP_H |
| 20 | 20 |
#define LEMON_BITS_DEFAULT_MAP_H |
| 21 | 21 |
|
| 22 | 22 |
#include <lemon/bits/array_map.h> |
| 23 | 23 |
#include <lemon/bits/vector_map.h> |
| 24 | 24 |
//#include <lemon/bits/debug_map.h> |
| 25 | 25 |
|
| 26 | 26 |
//\ingroup graphbits |
| 27 | 27 |
//\file |
| 28 | 28 |
//\brief Graph maps that construct and destruct their elements dynamically. |
| 29 | 29 |
| 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-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 |
// This file contains a modified version of the enable_if library from BOOST. |
| 20 | 20 |
// See the appropriate copyright notice below. |
| 21 | 21 |
|
| 22 | 22 |
// Boost enable_if library |
| 23 | 23 |
|
| 24 | 24 |
// Copyright 2003 (c) The Trustees of Indiana University. |
| 25 | 25 |
|
| 26 | 26 |
// Use, modification, and distribution is subject to the Boost Software |
| 27 | 27 |
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
| 28 | 28 |
// http://www.boost.org/LICENSE_1_0.txt) |
| 29 | 29 |
| 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-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 |
#ifndef LEMON_BITS_GRAPH_ADAPTOR_EXTENDER_H |
| 20 | 20 |
#define LEMON_BITS_GRAPH_ADAPTOR_EXTENDER_H |
| 21 | 21 |
|
| 22 | 22 |
#include <lemon/core.h> |
| 23 | 23 |
#include <lemon/error.h> |
| 24 | 24 |
|
| 25 | 25 |
#include <lemon/bits/default_map.h> |
| 26 | 26 |
|
| 27 | 27 |
namespace lemon {
|
| 28 | 28 |
|
| 29 | 29 |
template <typename _Digraph> |
| 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-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 |
#ifndef LEMON_BITS_GRAPH_EXTENDER_H |
| 20 | 20 |
#define LEMON_BITS_GRAPH_EXTENDER_H |
| 21 | 21 |
|
| 22 | 22 |
#include <lemon/core.h> |
| 23 | 23 |
|
| 24 | 24 |
#include <lemon/bits/map_extender.h> |
| 25 | 25 |
#include <lemon/bits/default_map.h> |
| 26 | 26 |
|
| 27 | 27 |
#include <lemon/concept_check.h> |
| 28 | 28 |
#include <lemon/concepts/maps.h> |
| 29 | 29 |
| 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-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 |
#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 |
| 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-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 |
#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; |
| 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-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 |
#ifndef LEMON_BITS_TRAITS_H |
| 20 | 20 |
#define LEMON_BITS_TRAITS_H |
| 21 | 21 |
|
| 22 | 22 |
//\file |
| 23 | 23 |
//\brief Traits for graphs and maps |
| 24 | 24 |
// |
| 25 | 25 |
|
| 26 | 26 |
#include <lemon/bits/enable_if.h> |
| 27 | 27 |
|
| 28 | 28 |
namespace lemon {
|
| 29 | 29 |
| 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-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 |
#ifndef LEMON_BITS_VARIANT_H |
| 20 | 20 |
#define LEMON_BITS_VARIANT_H |
| 21 | 21 |
|
| 22 | 22 |
#include <lemon/assert.h> |
| 23 | 23 |
|
| 24 | 24 |
// \file |
| 25 | 25 |
// \brief Variant types |
| 26 | 26 |
|
| 27 | 27 |
namespace lemon {
|
| 28 | 28 |
|
| 29 | 29 |
namespace _variant_bits {
|
| 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-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 |
#ifndef LEMON_BITS_VECTOR_MAP_H |
| 20 | 20 |
#define LEMON_BITS_VECTOR_MAP_H |
| 21 | 21 |
|
| 22 | 22 |
#include <vector> |
| 23 | 23 |
#include <algorithm> |
| 24 | 24 |
|
| 25 | 25 |
#include <lemon/core.h> |
| 26 | 26 |
#include <lemon/bits/alteration_notifier.h> |
| 27 | 27 |
|
| 28 | 28 |
#include <lemon/concept_check.h> |
| 29 | 29 |
#include <lemon/concepts/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-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 |
#ifndef LEMON_CIRCULATION_H |
| 20 | 20 |
#define LEMON_CIRCULATION_H |
| 21 | 21 |
|
| 22 | 22 |
#include <lemon/tolerance.h> |
| 23 | 23 |
#include <lemon/elevator.h> |
| 24 | 24 |
|
| 25 | 25 |
///\ingroup max_flow |
| 26 | 26 |
///\file |
| 27 | 27 |
///\brief Push-relabel algorithm for finding a feasible circulation. |
| 28 | 28 |
/// |
| 29 | 29 |
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-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 Color constants |
| 21 | 21 |
|
| 22 | 22 |
#include<lemon/color.h> |
| 23 | 23 |
|
| 24 | 24 |
namespace lemon {
|
| 25 | 25 |
|
| 26 | 26 |
const Color WHITE(1,1,1); |
| 27 | 27 |
|
| 28 | 28 |
const Color BLACK(0,0,0); |
| 29 | 29 |
const Color RED(1,0,0); |
| 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-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 |
#ifndef LEMON_COLOR_H |
| 20 | 20 |
#define LEMON_COLOR_H |
| 21 | 21 |
|
| 22 | 22 |
#include<vector> |
| 23 | 23 |
#include<lemon/math.h> |
| 24 | 24 |
#include<lemon/maps.h> |
| 25 | 25 |
|
| 26 | 26 |
|
| 27 | 27 |
///\ingroup misc |
| 28 | 28 |
///\file |
| 29 | 29 |
///\brief Tools to manage RGB colors. |
| 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-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 |
// The contents of this file was inspired by the concept checking |
| 20 | 20 |
// utility of the BOOST library (http://www.boost.org). |
| 21 | 21 |
|
| 22 | 22 |
///\file |
| 23 | 23 |
///\brief Basic utilities for concept checking. |
| 24 | 24 |
/// |
| 25 | 25 |
|
| 26 | 26 |
#ifndef LEMON_CONCEPT_CHECK_H |
| 27 | 27 |
#define LEMON_CONCEPT_CHECK_H |
| 28 | 28 |
|
| 29 | 29 |
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-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 |
#ifndef LEMON_CONCEPT_DIGRAPH_H |
| 20 | 20 |
#define LEMON_CONCEPT_DIGRAPH_H |
| 21 | 21 |
|
| 22 | 22 |
///\ingroup graph_concepts |
| 23 | 23 |
///\file |
| 24 | 24 |
///\brief The concept of directed graphs. |
| 25 | 25 |
|
| 26 | 26 |
#include <lemon/core.h> |
| 27 | 27 |
#include <lemon/concepts/maps.h> |
| 28 | 28 |
#include <lemon/concept_check.h> |
| 29 | 29 |
#include <lemon/concepts/graph_components.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-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 |
///\ingroup graph_concepts |
| 20 | 20 |
///\file |
| 21 | 21 |
///\brief The concept of Undirected Graphs. |
| 22 | 22 |
|
| 23 | 23 |
#ifndef LEMON_CONCEPT_GRAPH_H |
| 24 | 24 |
#define LEMON_CONCEPT_GRAPH_H |
| 25 | 25 |
|
| 26 | 26 |
#include <lemon/concepts/graph_components.h> |
| 27 | 27 |
#include <lemon/concepts/graph.h> |
| 28 | 28 |
#include <lemon/core.h> |
| 29 | 29 |
| 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-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 |
///\ingroup graph_concepts |
| 20 | 20 |
///\file |
| 21 | 21 |
///\brief The concept of graph components. |
| 22 | 22 |
|
| 23 | 23 |
|
| 24 | 24 |
#ifndef LEMON_CONCEPT_GRAPH_COMPONENTS_H |
| 25 | 25 |
#define LEMON_CONCEPT_GRAPH_COMPONENTS_H |
| 26 | 26 |
|
| 27 | 27 |
#include <lemon/core.h> |
| 28 | 28 |
#include <lemon/concepts/maps.h> |
| 29 | 29 |
| 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-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 |
///\ingroup concept |
| 20 | 20 |
///\file |
| 21 | 21 |
///\brief The concept of heaps. |
| 22 | 22 |
|
| 23 | 23 |
#ifndef LEMON_CONCEPT_HEAP_H |
| 24 | 24 |
#define LEMON_CONCEPT_HEAP_H |
| 25 | 25 |
|
| 26 | 26 |
#include <lemon/core.h> |
| 27 | 27 |
|
| 28 | 28 |
namespace lemon {
|
| 29 | 29 |
| 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-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 |
#ifndef LEMON_CONCEPT_MAPS_H |
| 20 | 20 |
#define LEMON_CONCEPT_MAPS_H |
| 21 | 21 |
|
| 22 | 22 |
#include <lemon/core.h> |
| 23 | 23 |
#include <lemon/concept_check.h> |
| 24 | 24 |
|
| 25 | 25 |
///\ingroup map_concepts |
| 26 | 26 |
///\file |
| 27 | 27 |
///\brief The concept of maps. |
| 28 | 28 |
|
| 29 | 29 |
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-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 |
///\ingroup concept |
| 20 | 20 |
///\file |
| 21 | 21 |
///\brief Classes for representing paths in digraphs. |
| 22 | 22 |
/// |
| 23 | 23 |
|
| 24 | 24 |
#ifndef LEMON_CONCEPT_PATH_H |
| 25 | 25 |
#define LEMON_CONCEPT_PATH_H |
| 26 | 26 |
|
| 27 | 27 |
#include <lemon/core.h> |
| 28 | 28 |
#include <lemon/concept_check.h> |
| 29 | 29 |
| 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-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 |
#ifndef LEMON_CONNECTIVITY_H |
| 20 | 20 |
#define LEMON_CONNECTIVITY_H |
| 21 | 21 |
|
| 22 | 22 |
#include <lemon/dfs.h> |
| 23 | 23 |
#include <lemon/bfs.h> |
| 24 | 24 |
#include <lemon/core.h> |
| 25 | 25 |
#include <lemon/maps.h> |
| 26 | 26 |
#include <lemon/adaptors.h> |
| 27 | 27 |
|
| 28 | 28 |
#include <lemon/concepts/digraph.h> |
| 29 | 29 |
#include <lemon/concepts/graph.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-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 |
#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/bits/enable_if.h> |
| 26 | 26 |
#include <lemon/bits/traits.h> |
| 27 | 27 |
#include <lemon/assert.h> |
| 28 | 28 |
|
| 29 | 29 |
///\file |
| 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-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 |
#ifndef LEMON_COUNTER_H |
| 20 | 20 |
#define LEMON_COUNTER_H |
| 21 | 21 |
|
| 22 | 22 |
#include <string> |
| 23 | 23 |
#include <iostream> |
| 24 | 24 |
|
| 25 | 25 |
///\ingroup timecount |
| 26 | 26 |
///\file |
| 27 | 27 |
///\brief Tools for counting steps and events |
| 28 | 28 |
|
| 29 | 29 |
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-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 |
#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> |
| 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-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 |
#ifndef LEMON_DIJKSTRA_H |
| 20 | 20 |
#define LEMON_DIJKSTRA_H |
| 21 | 21 |
|
| 22 | 22 |
///\ingroup shortest_path |
| 23 | 23 |
///\file |
| 24 | 24 |
///\brief Dijkstra algorithm. |
| 25 | 25 |
|
| 26 | 26 |
#include <limits> |
| 27 | 27 |
#include <lemon/list_graph.h> |
| 28 | 28 |
#include <lemon/bin_heap.h> |
| 29 | 29 |
#include <lemon/bits/path_dump.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-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 |
#ifndef LEMON_DIM2_H |
| 20 | 20 |
#define LEMON_DIM2_H |
| 21 | 21 |
|
| 22 | 22 |
#include <iostream> |
| 23 | 23 |
|
| 24 | 24 |
///\ingroup misc |
| 25 | 25 |
///\file |
| 26 | 26 |
///\brief A simple two dimensional vector and a bounding box implementation |
| 27 | 27 |
/// |
| 28 | 28 |
/// The class \ref lemon::dim2::Point "dim2::Point" implements |
| 29 | 29 |
/// a two dimensional vector with the usual operations. |
| 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-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 |
#ifndef LEMON_DIMACS_H |
| 20 | 20 |
#define LEMON_DIMACS_H |
| 21 | 21 |
|
| 22 | 22 |
#include <iostream> |
| 23 | 23 |
#include <string> |
| 24 | 24 |
#include <vector> |
| 25 | 25 |
#include <lemon/maps.h> |
| 26 | 26 |
#include <lemon/error.h> |
| 27 | 27 |
|
| 28 | 28 |
/// \ingroup dimacs_group |
| 29 | 29 |
/// \file |
| ... | ... |
@@ -313,45 +313,45 @@ |
| 313 | 313 |
typename Digraph::Node u,v; |
| 314 | 314 |
NullMap<typename Digraph::Arc, int> n; |
| 315 | 315 |
if(desc.type==DimacsDescriptor::NONE) desc=dimacsType(is); |
| 316 | 316 |
if(desc.type!=DimacsDescriptor::MAT) |
| 317 | 317 |
throw FormatError("Problem type mismatch");
|
| 318 | 318 |
_readDimacs(is, g, n, u, v, desc); |
| 319 | 319 |
} |
| 320 | 320 |
|
| 321 | 321 |
/// DIMACS plain digraph writer function. |
| 322 | 322 |
/// |
| 323 | 323 |
/// This function writes a digraph without any designated nodes and |
| 324 | 324 |
/// maps into DIMACS format, i.e. into DIMACS file having a line |
| 325 | 325 |
/// starting with |
| 326 | 326 |
/// \code |
| 327 | 327 |
/// p mat |
| 328 | 328 |
/// \endcode |
| 329 | 329 |
/// If \c comment is not empty, then it will be printed in the first line |
| 330 | 330 |
/// prefixed by 'c'. |
| 331 | 331 |
template<typename Digraph> |
| 332 | 332 |
void writeDimacsMat(std::ostream& os, const Digraph &g, |
| 333 | 333 |
std::string comment="") {
|
| 334 | 334 |
typedef typename Digraph::NodeIt NodeIt; |
| 335 | 335 |
typedef typename Digraph::ArcIt ArcIt; |
| 336 | 336 |
|
| 337 |
if(!comment.empty()) |
|
| 337 |
if(!comment.empty()) |
|
| 338 | 338 |
os << "c " << comment << std::endl; |
| 339 | 339 |
os << "p mat " << g.nodeNum() << " " << g.arcNum() << std::endl; |
| 340 | 340 |
|
| 341 | 341 |
typename Digraph::template NodeMap<int> nodes(g); |
| 342 | 342 |
int i = 1; |
| 343 | 343 |
for(NodeIt v(g); v != INVALID; ++v) {
|
| 344 | 344 |
nodes.set(v, i); |
| 345 | 345 |
++i; |
| 346 | 346 |
} |
| 347 | 347 |
for(ArcIt e(g); e != INVALID; ++e) {
|
| 348 | 348 |
os << "a " << nodes[g.source(e)] << " " << nodes[g.target(e)] |
| 349 | 349 |
<< std::endl; |
| 350 | 350 |
} |
| 351 | 351 |
} |
| 352 | 352 |
|
| 353 | 353 |
/// @} |
| 354 | 354 |
|
| 355 | 355 |
} //namespace lemon |
| 356 | 356 |
|
| 357 | 357 |
#endif //LEMON_DIMACS_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-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 |
#ifndef LEMON_ELEVATOR_H |
| 20 | 20 |
#define LEMON_ELEVATOR_H |
| 21 | 21 |
|
| 22 | 22 |
///\ingroup auxdat |
| 23 | 23 |
///\file |
| 24 | 24 |
///\brief Elevator class |
| 25 | 25 |
/// |
| 26 | 26 |
///Elevator class implements an efficient data structure |
| 27 | 27 |
///for labeling items in push-relabel type algorithms. |
| 28 | 28 |
/// |
| 29 | 29 |
| 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-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 |
#ifndef LEMON_ERROR_H |
| 20 | 20 |
#define LEMON_ERROR_H |
| 21 | 21 |
|
| 22 | 22 |
/// \ingroup exceptions |
| 23 | 23 |
/// \file |
| 24 | 24 |
/// \brief Basic exception classes and error handling. |
| 25 | 25 |
|
| 26 | 26 |
#include <exception> |
| 27 | 27 |
#include <string> |
| 28 | 28 |
#include <sstream> |
| 29 | 29 |
#include <iostream> |
| 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-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 |
#ifndef LEMON_FULL_GRAPH_H |
| 20 | 20 |
#define LEMON_FULL_GRAPH_H |
| 21 | 21 |
|
| 22 | 22 |
#include <lemon/core.h> |
| 23 | 23 |
#include <lemon/bits/graph_extender.h> |
| 24 | 24 |
|
| 25 | 25 |
///\ingroup graphs |
| 26 | 26 |
///\file |
| 27 | 27 |
///\brief FullGraph and FullDigraph classes. |
| 28 | 28 |
|
| 29 | 29 |
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-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 |
#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> |
| 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-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 |
#ifndef GRID_GRAPH_H |
| 20 | 20 |
#define GRID_GRAPH_H |
| 21 | 21 |
|
| 22 | 22 |
#include <lemon/core.h> |
| 23 | 23 |
#include <lemon/bits/graph_extender.h> |
| 24 | 24 |
#include <lemon/dim2.h> |
| 25 | 25 |
#include <lemon/assert.h> |
| 26 | 26 |
|
| 27 | 27 |
///\ingroup graphs |
| 28 | 28 |
///\file |
| 29 | 29 |
///\brief GridGraph 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-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 |
#ifndef LEMON_HAO_ORLIN_H |
| 20 | 20 |
#define LEMON_HAO_ORLIN_H |
| 21 | 21 |
|
| 22 | 22 |
#include <vector> |
| 23 | 23 |
#include <list> |
| 24 | 24 |
#include <limits> |
| 25 | 25 |
|
| 26 | 26 |
#include <lemon/maps.h> |
| 27 | 27 |
#include <lemon/core.h> |
| 28 | 28 |
#include <lemon/tolerance.h> |
| 29 | 29 |
|
| ... | ... |
@@ -217,49 +217,49 @@ |
| 217 | 217 |
|
| 218 | 218 |
void findMinCutOut() {
|
| 219 | 219 |
|
| 220 | 220 |
for (NodeIt n(_graph); n != INVALID; ++n) {
|
| 221 | 221 |
_excess->set(n, 0); |
| 222 | 222 |
} |
| 223 | 223 |
|
| 224 | 224 |
for (ArcIt a(_graph); a != INVALID; ++a) {
|
| 225 | 225 |
_flow->set(a, 0); |
| 226 | 226 |
} |
| 227 | 227 |
|
| 228 | 228 |
int bucket_num = 0; |
| 229 | 229 |
std::vector<Node> queue(_node_num); |
| 230 | 230 |
int qfirst = 0, qlast = 0, qsep = 0; |
| 231 | 231 |
|
| 232 | 232 |
{
|
| 233 | 233 |
typename Digraph::template NodeMap<bool> reached(_graph, false); |
| 234 | 234 |
|
| 235 | 235 |
reached.set(_source, true); |
| 236 | 236 |
bool first_set = true; |
| 237 | 237 |
|
| 238 | 238 |
for (NodeIt t(_graph); t != INVALID; ++t) {
|
| 239 | 239 |
if (reached[t]) continue; |
| 240 | 240 |
_sets.push_front(std::list<int>()); |
| 241 |
|
|
| 241 |
|
|
| 242 | 242 |
queue[qlast++] = t; |
| 243 | 243 |
reached.set(t, true); |
| 244 | 244 |
|
| 245 | 245 |
while (qfirst != qlast) {
|
| 246 | 246 |
if (qsep == qfirst) {
|
| 247 | 247 |
++bucket_num; |
| 248 | 248 |
_sets.front().push_front(bucket_num); |
| 249 | 249 |
_dormant[bucket_num] = !first_set; |
| 250 | 250 |
_first[bucket_num] = _last[bucket_num] = INVALID; |
| 251 | 251 |
qsep = qlast; |
| 252 | 252 |
} |
| 253 | 253 |
|
| 254 | 254 |
Node n = queue[qfirst++]; |
| 255 | 255 |
addItem(n, bucket_num); |
| 256 | 256 |
|
| 257 | 257 |
for (InArcIt a(_graph, n); a != INVALID; ++a) {
|
| 258 | 258 |
Node u = _graph.source(a); |
| 259 | 259 |
if (!reached[u] && _tolerance.positive((*_capacity)[a])) {
|
| 260 | 260 |
reached.set(u, true); |
| 261 | 261 |
queue[qlast++] = u; |
| 262 | 262 |
} |
| 263 | 263 |
} |
| 264 | 264 |
} |
| 265 | 265 |
first_set = false; |
| ... | ... |
@@ -517,49 +517,49 @@ |
| 517 | 517 |
void findMinCutIn() {
|
| 518 | 518 |
|
| 519 | 519 |
for (NodeIt n(_graph); n != INVALID; ++n) {
|
| 520 | 520 |
_excess->set(n, 0); |
| 521 | 521 |
} |
| 522 | 522 |
|
| 523 | 523 |
for (ArcIt a(_graph); a != INVALID; ++a) {
|
| 524 | 524 |
_flow->set(a, 0); |
| 525 | 525 |
} |
| 526 | 526 |
|
| 527 | 527 |
int bucket_num = 0; |
| 528 | 528 |
std::vector<Node> queue(_node_num); |
| 529 | 529 |
int qfirst = 0, qlast = 0, qsep = 0; |
| 530 | 530 |
|
| 531 | 531 |
{
|
| 532 | 532 |
typename Digraph::template NodeMap<bool> reached(_graph, false); |
| 533 | 533 |
|
| 534 | 534 |
reached.set(_source, true); |
| 535 | 535 |
|
| 536 | 536 |
bool first_set = true; |
| 537 | 537 |
|
| 538 | 538 |
for (NodeIt t(_graph); t != INVALID; ++t) {
|
| 539 | 539 |
if (reached[t]) continue; |
| 540 | 540 |
_sets.push_front(std::list<int>()); |
| 541 |
|
|
| 541 |
|
|
| 542 | 542 |
queue[qlast++] = t; |
| 543 | 543 |
reached.set(t, true); |
| 544 | 544 |
|
| 545 | 545 |
while (qfirst != qlast) {
|
| 546 | 546 |
if (qsep == qfirst) {
|
| 547 | 547 |
++bucket_num; |
| 548 | 548 |
_sets.front().push_front(bucket_num); |
| 549 | 549 |
_dormant[bucket_num] = !first_set; |
| 550 | 550 |
_first[bucket_num] = _last[bucket_num] = INVALID; |
| 551 | 551 |
qsep = qlast; |
| 552 | 552 |
} |
| 553 | 553 |
|
| 554 | 554 |
Node n = queue[qfirst++]; |
| 555 | 555 |
addItem(n, bucket_num); |
| 556 | 556 |
|
| 557 | 557 |
for (OutArcIt a(_graph, n); a != INVALID; ++a) {
|
| 558 | 558 |
Node u = _graph.target(a); |
| 559 | 559 |
if (!reached[u] && _tolerance.positive((*_capacity)[a])) {
|
| 560 | 560 |
reached.set(u, true); |
| 561 | 561 |
queue[qlast++] = u; |
| 562 | 562 |
} |
| 563 | 563 |
} |
| 564 | 564 |
} |
| 565 | 565 |
first_set = false; |
| 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-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 |
#ifndef HYPERCUBE_GRAPH_H |
| 20 | 20 |
#define HYPERCUBE_GRAPH_H |
| 21 | 21 |
|
| 22 | 22 |
#include <vector> |
| 23 | 23 |
#include <lemon/core.h> |
| 24 | 24 |
#include <lemon/assert.h> |
| 25 | 25 |
#include <lemon/bits/graph_extender.h> |
| 26 | 26 |
|
| 27 | 27 |
///\ingroup graphs |
| 28 | 28 |
///\file |
| 29 | 29 |
///\brief HypercubeGraph 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-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 |
#ifndef LEMON_KRUSKAL_H |
| 20 | 20 |
#define LEMON_KRUSKAL_H |
| 21 | 21 |
|
| 22 | 22 |
#include <algorithm> |
| 23 | 23 |
#include <vector> |
| 24 | 24 |
#include <lemon/unionfind.h> |
| 25 | 25 |
#include <lemon/maps.h> |
| 26 | 26 |
|
| 27 | 27 |
#include <lemon/core.h> |
| 28 | 28 |
#include <lemon/bits/traits.h> |
| 29 | 29 |
| 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-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 |
///\ingroup lemon_io |
| 20 | 20 |
///\file |
| 21 | 21 |
///\brief \ref lgf-format "LEMON Graph Format" reader. |
| 22 | 22 |
|
| 23 | 23 |
|
| 24 | 24 |
#ifndef LEMON_LGF_READER_H |
| 25 | 25 |
#define LEMON_LGF_READER_H |
| 26 | 26 |
|
| 27 | 27 |
#include <iostream> |
| 28 | 28 |
#include <fstream> |
| 29 | 29 |
#include <sstream> |
| 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-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 |
///\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> |
| 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-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 |
#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 |
| 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-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 |
#ifndef LEMON_MAPS_H |
| 20 | 20 |
#define LEMON_MAPS_H |
| 21 | 21 |
|
| 22 | 22 |
#include <iterator> |
| 23 | 23 |
#include <functional> |
| 24 | 24 |
#include <vector> |
| 25 | 25 |
|
| 26 | 26 |
#include <lemon/core.h> |
| 27 | 27 |
|
| 28 | 28 |
///\file |
| 29 | 29 |
///\ingroup maps |
| 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-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 |
#ifndef LEMON_MATH_H |
| 20 | 20 |
#define LEMON_MATH_H |
| 21 | 21 |
|
| 22 | 22 |
///\ingroup misc |
| 23 | 23 |
///\file |
| 24 | 24 |
///\brief Some extensions to the standard \c cmath library. |
| 25 | 25 |
/// |
| 26 | 26 |
///Some extensions to the standard \c cmath library. |
| 27 | 27 |
/// |
| 28 | 28 |
///This file includes the standard math library (cmath). |
| 29 | 29 |
| 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-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 |
#ifndef LEMON_MAX_MATCHING_H |
| 20 | 20 |
#define LEMON_MAX_MATCHING_H |
| 21 | 21 |
|
| 22 | 22 |
#include <vector> |
| 23 | 23 |
#include <queue> |
| 24 | 24 |
#include <set> |
| 25 | 25 |
#include <limits> |
| 26 | 26 |
|
| 27 | 27 |
#include <lemon/core.h> |
| 28 | 28 |
#include <lemon/unionfind.h> |
| 29 | 29 |
#include <lemon/bin_heap.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-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 |
#ifndef LEMON_NAUTY_READER_H |
| 20 | 20 |
#define LEMON_NAUTY_READER_H |
| 21 | 21 |
|
| 22 | 22 |
#include <vector> |
| 23 | 23 |
#include <iostream> |
| 24 | 24 |
#include <string> |
| 25 | 25 |
|
| 26 | 26 |
/// \ingroup nauty_group |
| 27 | 27 |
/// \file |
| 28 | 28 |
/// \brief Nauty file reader. |
| 29 | 29 |
| 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-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 |
///\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 |
| 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-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 |
#ifndef LEMON_PREFLOW_H |
| 20 | 20 |
#define LEMON_PREFLOW_H |
| 21 | 21 |
|
| 22 | 22 |
#include <lemon/tolerance.h> |
| 23 | 23 |
#include <lemon/elevator.h> |
| 24 | 24 |
|
| 25 | 25 |
/// \file |
| 26 | 26 |
/// \ingroup max_flow |
| 27 | 27 |
/// \brief Implementation of the preflow algorithm. |
| 28 | 28 |
|
| 29 | 29 |
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-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 Instantiation of the Random class. |
| 21 | 21 |
|
| 22 | 22 |
#include <lemon/random.h> |
| 23 | 23 |
|
| 24 | 24 |
namespace lemon {
|
| 25 | 25 |
/// \brief Global random number generator instance |
| 26 | 26 |
/// |
| 27 | 27 |
/// A global Mersenne Twister random number generator instance. |
| 28 | 28 |
Random rnd; |
| 29 | 29 |
} |
| 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-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 |
* 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 |
| 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-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 |
#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> |
| 1 |
/* -*- C++ -*- |
|
| 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
|
| 2 | 2 |
* |
| 3 |
* This file is a part of LEMON, a generic C++ optimization library |
|
| 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
|
| 4 | 4 |
* |
| 5 |
* Copyright (C) 2003- |
|
| 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 |
#ifndef LEMON_SUURBALLE_H |
| 20 | 20 |
#define LEMON_SUURBALLE_H |
| 21 | 21 |
|
| 22 | 22 |
///\ingroup shortest_path |
| 23 | 23 |
///\file |
| 24 | 24 |
///\brief An algorithm for finding arc-disjoint paths between two |
| 25 | 25 |
/// nodes having minimum total length. |
| 26 | 26 |
|
| 27 | 27 |
#include <vector> |
| 28 | 28 |
#include <lemon/bin_heap.h> |
| 29 | 29 |
#include <lemon/path.h> |
| ... | ... |
@@ -55,79 +55,79 @@ |
| 55 | 55 |
#ifdef DOXYGEN |
| 56 | 56 |
template <typename Digraph, typename LengthMap> |
| 57 | 57 |
#else |
| 58 | 58 |
template < typename Digraph = ListDigraph, |
| 59 | 59 |
typename LengthMap = typename Digraph::template ArcMap<int> > |
| 60 | 60 |
#endif |
| 61 | 61 |
class Suurballe |
| 62 | 62 |
{
|
| 63 | 63 |
TEMPLATE_DIGRAPH_TYPEDEFS(Digraph); |
| 64 | 64 |
|
| 65 | 65 |
typedef typename LengthMap::Value Length; |
| 66 | 66 |
typedef ConstMap<Arc, int> ConstArcMap; |
| 67 | 67 |
typedef typename Digraph::template NodeMap<Arc> PredMap; |
| 68 | 68 |
|
| 69 | 69 |
public: |
| 70 | 70 |
|
| 71 | 71 |
/// The type of the flow map. |
| 72 | 72 |
typedef typename Digraph::template ArcMap<int> FlowMap; |
| 73 | 73 |
/// The type of the potential map. |
| 74 | 74 |
typedef typename Digraph::template NodeMap<Length> PotentialMap; |
| 75 | 75 |
/// The type of the path structures. |
| 76 | 76 |
typedef SimplePath<Digraph> Path; |
| 77 | 77 |
|
| 78 | 78 |
private: |
| 79 |
|
|
| 79 |
|
|
| 80 | 80 |
/// \brief Special implementation of the Dijkstra algorithm |
| 81 | 81 |
/// for finding shortest paths in the residual network. |
| 82 | 82 |
/// |
| 83 | 83 |
/// \ref ResidualDijkstra is a special implementation of the |
| 84 | 84 |
/// \ref Dijkstra algorithm for finding shortest paths in the |
| 85 | 85 |
/// residual network of the digraph with respect to the reduced arc |
| 86 | 86 |
/// lengths and modifying the node potentials according to the |
| 87 | 87 |
/// distance of the nodes. |
| 88 | 88 |
class ResidualDijkstra |
| 89 | 89 |
{
|
| 90 | 90 |
typedef typename Digraph::template NodeMap<int> HeapCrossRef; |
| 91 | 91 |
typedef BinHeap<Length, HeapCrossRef> Heap; |
| 92 | 92 |
|
| 93 | 93 |
private: |
| 94 | 94 |
|
| 95 | 95 |
// The digraph the algorithm runs on |
| 96 | 96 |
const Digraph &_graph; |
| 97 | 97 |
|
| 98 | 98 |
// The main maps |
| 99 | 99 |
const FlowMap &_flow; |
| 100 | 100 |
const LengthMap &_length; |
| 101 | 101 |
PotentialMap &_potential; |
| 102 | 102 |
|
| 103 | 103 |
// The distance map |
| 104 | 104 |
PotentialMap _dist; |
| 105 | 105 |
// The pred arc map |
| 106 | 106 |
PredMap &_pred; |
| 107 | 107 |
// The processed (i.e. permanently labeled) nodes |
| 108 | 108 |
std::vector<Node> _proc_nodes; |
| 109 |
|
|
| 109 |
|
|
| 110 | 110 |
Node _s; |
| 111 | 111 |
Node _t; |
| 112 | 112 |
|
| 113 | 113 |
public: |
| 114 | 114 |
|
| 115 | 115 |
/// Constructor. |
| 116 | 116 |
ResidualDijkstra( const Digraph &digraph, |
| 117 | 117 |
const FlowMap &flow, |
| 118 | 118 |
const LengthMap &length, |
| 119 | 119 |
PotentialMap &potential, |
| 120 | 120 |
PredMap &pred, |
| 121 | 121 |
Node s, Node t ) : |
| 122 | 122 |
_graph(digraph), _flow(flow), _length(length), _potential(potential), |
| 123 | 123 |
_dist(digraph), _pred(pred), _s(s), _t(t) {}
|
| 124 | 124 |
|
| 125 | 125 |
/// \brief Run the algorithm. It returns \c true if a path is found |
| 126 | 126 |
/// from the source node to the target node. |
| 127 | 127 |
bool run() {
|
| 128 | 128 |
HeapCrossRef heap_cross_ref(_graph, Heap::PRE_HEAP); |
| 129 | 129 |
Heap heap(heap_cross_ref); |
| 130 | 130 |
heap.push(_s, 0); |
| 131 | 131 |
_pred[_s] = INVALID; |
| 132 | 132 |
_proc_nodes.clear(); |
| 133 | 133 |
|
| ... | ... |
@@ -179,49 +179,49 @@ |
| 179 | 179 |
break; |
| 180 | 180 |
case Heap::POST_HEAP: |
| 181 | 181 |
break; |
| 182 | 182 |
} |
| 183 | 183 |
} |
| 184 | 184 |
} |
| 185 | 185 |
} |
| 186 | 186 |
if (heap.empty()) return false; |
| 187 | 187 |
|
| 188 | 188 |
// Update potentials of processed nodes |
| 189 | 189 |
Length t_dist = heap.prio(); |
| 190 | 190 |
for (int i = 0; i < int(_proc_nodes.size()); ++i) |
| 191 | 191 |
_potential[_proc_nodes[i]] += _dist[_proc_nodes[i]] - t_dist; |
| 192 | 192 |
return true; |
| 193 | 193 |
} |
| 194 | 194 |
|
| 195 | 195 |
}; //class ResidualDijkstra |
| 196 | 196 |
|
| 197 | 197 |
private: |
| 198 | 198 |
|
| 199 | 199 |
// The digraph the algorithm runs on |
| 200 | 200 |
const Digraph &_graph; |
| 201 | 201 |
// The length map |
| 202 | 202 |
const LengthMap &_length; |
| 203 |
|
|
| 203 |
|
|
| 204 | 204 |
// Arc map of the current flow |
| 205 | 205 |
FlowMap *_flow; |
| 206 | 206 |
bool _local_flow; |
| 207 | 207 |
// Node map of the current potentials |
| 208 | 208 |
PotentialMap *_potential; |
| 209 | 209 |
bool _local_potential; |
| 210 | 210 |
|
| 211 | 211 |
// The source node |
| 212 | 212 |
Node _source; |
| 213 | 213 |
// The target node |
| 214 | 214 |
Node _target; |
| 215 | 215 |
|
| 216 | 216 |
// Container to store the found paths |
| 217 | 217 |
std::vector< SimplePath<Digraph> > paths; |
| 218 | 218 |
int _path_num; |
| 219 | 219 |
|
| 220 | 220 |
// The pred arc map |
| 221 | 221 |
PredMap _pred; |
| 222 | 222 |
// Implementation of the Dijkstra algorithm for finding augmenting |
| 223 | 223 |
// shortest paths in the residual network |
| 224 | 224 |
ResidualDijkstra *_dijkstra; |
| 225 | 225 |
|
| 226 | 226 |
public: |
| 227 | 227 |
|
| ... | ... |
@@ -247,49 +247,49 @@ |
| 247 | 247 |
delete _dijkstra; |
| 248 | 248 |
} |
| 249 | 249 |
|
| 250 | 250 |
/// \brief Set the flow map. |
| 251 | 251 |
/// |
| 252 | 252 |
/// This function sets the flow map. |
| 253 | 253 |
/// |
| 254 | 254 |
/// The found flow contains only 0 and 1 values. It is the union of |
| 255 | 255 |
/// the found arc-disjoint paths. |
| 256 | 256 |
/// |
| 257 | 257 |
/// \return \c (*this) |
| 258 | 258 |
Suurballe& flowMap(FlowMap &map) {
|
| 259 | 259 |
if (_local_flow) {
|
| 260 | 260 |
delete _flow; |
| 261 | 261 |
_local_flow = false; |
| 262 | 262 |
} |
| 263 | 263 |
_flow = ↦ |
| 264 | 264 |
return *this; |
| 265 | 265 |
} |
| 266 | 266 |
|
| 267 | 267 |
/// \brief Set the potential map. |
| 268 | 268 |
/// |
| 269 | 269 |
/// This function sets the potential map. |
| 270 | 270 |
/// |
| 271 |
/// The potentials provide the dual solution of the underlying |
|
| 271 |
/// The potentials provide the dual solution of the underlying |
|
| 272 | 272 |
/// minimum cost flow problem. |
| 273 | 273 |
/// |
| 274 | 274 |
/// \return \c (*this) |
| 275 | 275 |
Suurballe& potentialMap(PotentialMap &map) {
|
| 276 | 276 |
if (_local_potential) {
|
| 277 | 277 |
delete _potential; |
| 278 | 278 |
_local_potential = false; |
| 279 | 279 |
} |
| 280 | 280 |
_potential = ↦ |
| 281 | 281 |
return *this; |
| 282 | 282 |
} |
| 283 | 283 |
|
| 284 | 284 |
/// \name Execution control |
| 285 | 285 |
/// The simplest way to execute the algorithm is to call the run() |
| 286 | 286 |
/// function. |
| 287 | 287 |
/// \n |
| 288 | 288 |
/// If you only need the flow that is the union of the found |
| 289 | 289 |
/// arc-disjoint paths, you may call init() and findFlow(). |
| 290 | 290 |
|
| 291 | 291 |
/// @{
|
| 292 | 292 |
|
| 293 | 293 |
/// \brief Run the algorithm. |
| 294 | 294 |
/// |
| 295 | 295 |
/// This function runs the algorithm. |
| ... | ... |
@@ -309,89 +309,89 @@ |
| 309 | 309 |
/// \endcode |
| 310 | 310 |
int run(int k = 2) {
|
| 311 | 311 |
init(); |
| 312 | 312 |
findFlow(k); |
| 313 | 313 |
findPaths(); |
| 314 | 314 |
return _path_num; |
| 315 | 315 |
} |
| 316 | 316 |
|
| 317 | 317 |
/// \brief Initialize the algorithm. |
| 318 | 318 |
/// |
| 319 | 319 |
/// This function initializes the algorithm. |
| 320 | 320 |
void init() {
|
| 321 | 321 |
// Initialize maps |
| 322 | 322 |
if (!_flow) {
|
| 323 | 323 |
_flow = new FlowMap(_graph); |
| 324 | 324 |
_local_flow = true; |
| 325 | 325 |
} |
| 326 | 326 |
if (!_potential) {
|
| 327 | 327 |
_potential = new PotentialMap(_graph); |
| 328 | 328 |
_local_potential = true; |
| 329 | 329 |
} |
| 330 | 330 |
for (ArcIt e(_graph); e != INVALID; ++e) (*_flow)[e] = 0; |
| 331 | 331 |
for (NodeIt n(_graph); n != INVALID; ++n) (*_potential)[n] = 0; |
| 332 | 332 |
|
| 333 |
_dijkstra = new ResidualDijkstra( _graph, *_flow, _length, |
|
| 333 |
_dijkstra = new ResidualDijkstra( _graph, *_flow, _length, |
|
| 334 | 334 |
*_potential, _pred, |
| 335 | 335 |
_source, _target ); |
| 336 | 336 |
} |
| 337 | 337 |
|
| 338 | 338 |
/// \brief Execute the successive shortest path algorithm to find |
| 339 | 339 |
/// an optimal flow. |
| 340 | 340 |
/// |
| 341 | 341 |
/// This function executes the successive shortest path algorithm to |
| 342 | 342 |
/// find a minimum cost flow, which is the union of \c k or less |
| 343 | 343 |
/// arc-disjoint paths. |
| 344 | 344 |
/// |
| 345 | 345 |
/// \return \c k if there are at least \c k arc-disjoint paths from |
| 346 | 346 |
/// \c s to \c t in the digraph. Otherwise it returns the number of |
| 347 | 347 |
/// arc-disjoint paths found. |
| 348 | 348 |
/// |
| 349 | 349 |
/// \pre \ref init() must be called before using this function. |
| 350 | 350 |
int findFlow(int k = 2) {
|
| 351 | 351 |
// Find shortest paths |
| 352 | 352 |
_path_num = 0; |
| 353 | 353 |
while (_path_num < k) {
|
| 354 | 354 |
// Run Dijkstra |
| 355 | 355 |
if (!_dijkstra->run()) break; |
| 356 | 356 |
++_path_num; |
| 357 | 357 |
|
| 358 | 358 |
// Set the flow along the found shortest path |
| 359 | 359 |
Node u = _target; |
| 360 | 360 |
Arc e; |
| 361 | 361 |
while ((e = _pred[u]) != INVALID) {
|
| 362 | 362 |
if (u == _graph.target(e)) {
|
| 363 | 363 |
(*_flow)[e] = 1; |
| 364 | 364 |
u = _graph.source(e); |
| 365 | 365 |
} else {
|
| 366 | 366 |
(*_flow)[e] = 0; |
| 367 | 367 |
u = _graph.target(e); |
| 368 | 368 |
} |
| 369 | 369 |
} |
| 370 | 370 |
} |
| 371 | 371 |
return _path_num; |
| 372 | 372 |
} |
| 373 |
|
|
| 373 |
|
|
| 374 | 374 |
/// \brief Compute the paths from the flow. |
| 375 | 375 |
/// |
| 376 | 376 |
/// This function computes the paths from the flow. |
| 377 | 377 |
/// |
| 378 | 378 |
/// \pre \ref init() and \ref findFlow() must be called before using |
| 379 | 379 |
/// this function. |
| 380 | 380 |
void findPaths() {
|
| 381 | 381 |
// Create the residual flow map (the union of the paths not found |
| 382 | 382 |
// so far) |
| 383 | 383 |
FlowMap res_flow(_graph); |
| 384 | 384 |
for(ArcIt a(_graph); a != INVALID; ++a) res_flow[a] = (*_flow)[a]; |
| 385 | 385 |
|
| 386 | 386 |
paths.clear(); |
| 387 | 387 |
paths.resize(_path_num); |
| 388 | 388 |
for (int i = 0; i < _path_num; ++i) {
|
| 389 | 389 |
Node n = _source; |
| 390 | 390 |
while (n != _target) {
|
| 391 | 391 |
OutArcIt e(_graph, n); |
| 392 | 392 |
for ( ; res_flow[e] == 0; ++e) ; |
| 393 | 393 |
n = _graph.target(e); |
| 394 | 394 |
paths[i].addBack(e); |
| 395 | 395 |
res_flow[e] = 0; |
| 396 | 396 |
} |
| 397 | 397 |
} |
| 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-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 |
#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 |
#define WIN32_LEAN_AND_MEAN |
| 28 | 28 |
#define NOMINMAX |
| 29 | 29 |
#include <windows.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-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 |
#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 |
| 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-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 |
#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> |
| ... | ... |
@@ -1168,49 +1168,49 @@ |
| 1168 | 1168 |
int kd = nodes[jd].left; |
| 1169 | 1169 |
if (nodes[jd].size == 1) {
|
| 1170 | 1170 |
if (nodes[jd].parent < 0) {
|
| 1171 | 1171 |
classes[id].parent = ~kd; |
| 1172 | 1172 |
classes[id].depth -= 1; |
| 1173 | 1173 |
nodes[kd].parent = ~id; |
| 1174 | 1174 |
deleteNode(jd); |
| 1175 | 1175 |
jd = kd; |
| 1176 | 1176 |
} else {
|
| 1177 | 1177 |
int pd = nodes[jd].parent; |
| 1178 | 1178 |
if (nodes[nodes[jd].next].size < cmax) {
|
| 1179 | 1179 |
pushLeft(nodes[jd].next, nodes[jd].left); |
| 1180 | 1180 |
if (less(jd, nodes[jd].next) || |
| 1181 | 1181 |
nodes[jd].item == nodes[pd].item) {
|
| 1182 | 1182 |
nodes[nodes[jd].next].prio = nodes[jd].prio; |
| 1183 | 1183 |
nodes[nodes[jd].next].item = nodes[jd].item; |
| 1184 | 1184 |
} |
| 1185 | 1185 |
popLeft(pd); |
| 1186 | 1186 |
deleteNode(jd); |
| 1187 | 1187 |
jd = pd; |
| 1188 | 1188 |
} else {
|
| 1189 | 1189 |
int ld = nodes[nodes[jd].next].left; |
| 1190 | 1190 |
popLeft(nodes[jd].next); |
| 1191 | 1191 |
pushRight(jd, ld); |
| 1192 |
if (less(ld, nodes[jd].left) || |
|
| 1192 |
if (less(ld, nodes[jd].left) || |
|
| 1193 | 1193 |
nodes[ld].item == nodes[pd].item) {
|
| 1194 | 1194 |
nodes[jd].item = nodes[ld].item; |
| 1195 | 1195 |
nodes[jd].prio = nodes[ld].prio; |
| 1196 | 1196 |
} |
| 1197 | 1197 |
if (nodes[nodes[jd].next].item == nodes[ld].item) {
|
| 1198 | 1198 |
setPrio(nodes[jd].next); |
| 1199 | 1199 |
} |
| 1200 | 1200 |
jd = nodes[jd].left; |
| 1201 | 1201 |
} |
| 1202 | 1202 |
} |
| 1203 | 1203 |
} else {
|
| 1204 | 1204 |
jd = nodes[jd].left; |
| 1205 | 1205 |
} |
| 1206 | 1206 |
} |
| 1207 | 1207 |
} |
| 1208 | 1208 |
|
| 1209 | 1209 |
void repairRight(int id) {
|
| 1210 | 1210 |
int jd = ~(classes[id].parent); |
| 1211 | 1211 |
while (nodes[jd].right != -1) {
|
| 1212 | 1212 |
int kd = nodes[jd].right; |
| 1213 | 1213 |
if (nodes[jd].size == 1) {
|
| 1214 | 1214 |
if (nodes[jd].parent < 0) {
|
| 1215 | 1215 |
classes[id].parent = ~kd; |
| 1216 | 1216 |
classes[id].depth -= 1; |
| 1 | 1 |
EXTRA_DIST += \ |
| 2 | 2 |
test/CMakeLists.txt |
| 3 | 3 |
|
| 4 | 4 |
noinst_HEADERS += \ |
| 5 | 5 |
test/graph_test.h \ |
| 6 |
|
|
| 6 |
test/test_tools.h |
|
| 7 | 7 |
|
| 8 | 8 |
check_PROGRAMS += \ |
| 9 | 9 |
test/bfs_test \ |
| 10 |
test/circulation_test \ |
|
| 11 |
test/counter_test \ |
|
| 10 |
test/circulation_test \ |
|
| 11 |
test/counter_test \ |
|
| 12 | 12 |
test/dfs_test \ |
| 13 | 13 |
test/digraph_test \ |
| 14 | 14 |
test/dijkstra_test \ |
| 15 |
|
|
| 15 |
test/dim_test \ |
|
| 16 | 16 |
test/error_test \ |
| 17 | 17 |
test/graph_adaptor_test \ |
| 18 | 18 |
test/graph_copy_test \ |
| 19 | 19 |
test/graph_test \ |
| 20 | 20 |
test/graph_utils_test \ |
| 21 | 21 |
test/hao_orlin_test \ |
| 22 | 22 |
test/heap_test \ |
| 23 | 23 |
test/kruskal_test \ |
| 24 |
|
|
| 24 |
test/maps_test \ |
|
| 25 | 25 |
test/max_matching_test \ |
| 26 |
test/path_test \ |
|
| 27 |
test/preflow_test \ |
|
| 28 |
test/random_test \ |
|
| 29 |
test/suurballe_test \ |
|
| 30 |
test/test_tools_fail \ |
|
| 31 |
test/test_tools_pass \ |
|
| 32 |
|
|
| 26 |
test/path_test \ |
|
| 27 |
test/preflow_test \ |
|
| 28 |
test/random_test \ |
|
| 29 |
test/suurballe_test \ |
|
| 30 |
test/test_tools_fail \ |
|
| 31 |
test/test_tools_pass \ |
|
| 32 |
test/time_measure_test \ |
|
| 33 | 33 |
test/unionfind_test |
| 34 | 34 |
|
| 35 | 35 |
TESTS += $(check_PROGRAMS) |
| 36 | 36 |
XFAIL_TESTS += test/test_tools_fail$(EXEEXT) |
| 37 | 37 |
|
| 38 | 38 |
test_bfs_test_SOURCES = test/bfs_test.cc |
| 39 | 39 |
test_circulation_test_SOURCES = test/circulation_test.cc |
| 40 | 40 |
test_counter_test_SOURCES = test/counter_test.cc |
| 41 | 41 |
test_dfs_test_SOURCES = test/dfs_test.cc |
| 42 | 42 |
test_digraph_test_SOURCES = test/digraph_test.cc |
| 43 | 43 |
test_dijkstra_test_SOURCES = test/dijkstra_test.cc |
| 44 | 44 |
test_dim_test_SOURCES = test/dim_test.cc |
| 45 | 45 |
test_error_test_SOURCES = test/error_test.cc |
| 46 | 46 |
test_graph_adaptor_test_SOURCES = test/graph_adaptor_test.cc |
| 47 | 47 |
test_graph_copy_test_SOURCES = test/graph_copy_test.cc |
| 48 | 48 |
test_graph_test_SOURCES = test/graph_test.cc |
| 49 | 49 |
test_graph_utils_test_SOURCES = test/graph_utils_test.cc |
| 50 | 50 |
test_heap_test_SOURCES = test/heap_test.cc |
| 51 | 51 |
test_kruskal_test_SOURCES = test/kruskal_test.cc |
| 52 | 52 |
test_hao_orlin_test_SOURCES = test/hao_orlin_test.cc |
| 53 | 53 |
test_maps_test_SOURCES = test/maps_test.cc |
| 54 | 54 |
test_max_matching_test_SOURCES = test/max_matching_test.cc |
| 55 | 55 |
test_path_test_SOURCES = test/path_test.cc |
| 56 | 56 |
test_preflow_test_SOURCES = test/preflow_test.cc |
| 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-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 |
#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/bfs.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; |
| 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-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 |
#include <iostream> |
| 20 | 20 |
|
| 21 | 21 |
#include "test_tools.h" |
| 22 | 22 |
#include <lemon/list_graph.h> |
| 23 | 23 |
#include <lemon/circulation.h> |
| 24 | 24 |
#include <lemon/lgf_reader.h> |
| 25 | 25 |
#include <lemon/concepts/digraph.h> |
| 26 | 26 |
#include <lemon/concepts/maps.h> |
| 27 | 27 |
|
| 28 | 28 |
using namespace lemon; |
| 29 | 29 |
| 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-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 |
#include <lemon/counter.h> |
| 20 | 20 |
#include <vector> |
| 21 | 21 |
|
| 22 | 22 |
using namespace lemon; |
| 23 | 23 |
|
| 24 | 24 |
template <typename T> |
| 25 | 25 |
void bubbleSort(std::vector<T>& v) {
|
| 26 | 26 |
Counter op("Bubble Sort - Operations: ");
|
| 27 | 27 |
Counter::NoSubCounter as(op, "Assignments: "); |
| 28 | 28 |
Counter::NoSubCounter co(op, "Comparisons: "); |
| 29 | 29 |
for (int i = v.size()-1; i > 0; --i) {
|
| 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-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 |
#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; |
| 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-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 |
#include <lemon/concepts/digraph.h> |
| 20 | 20 |
#include <lemon/list_graph.h> |
| 21 | 21 |
#include <lemon/smart_graph.h> |
| 22 | 22 |
#include <lemon/full_graph.h> |
| 23 | 23 |
|
| 24 | 24 |
#include "test_tools.h" |
| 25 | 25 |
#include "graph_test.h" |
| 26 | 26 |
|
| 27 | 27 |
using namespace lemon; |
| 28 | 28 |
using namespace lemon::concepts; |
| 29 | 29 |
| 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-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 |
#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/dijkstra.h> |
| 24 | 24 |
#include <lemon/path.h> |
| 25 | 25 |
#include <lemon/bin_heap.h> |
| 26 | 26 |
|
| 27 | 27 |
#include "graph_test.h" |
| 28 | 28 |
#include "test_tools.h" |
| 29 | 29 |
| 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-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 |
#include <lemon/dim2.h> |
| 20 | 20 |
#include <iostream> |
| 21 | 21 |
#include "test_tools.h" |
| 22 | 22 |
|
| 23 | 23 |
using namespace std; |
| 24 | 24 |
using namespace lemon; |
| 25 | 25 |
|
| 26 | 26 |
int main() |
| 27 | 27 |
{
|
| 28 | 28 |
typedef dim2::Point<int> Point; |
| 29 | 29 |
| 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-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 |
#include <iostream> |
| 20 | 20 |
|
| 21 | 21 |
#include <lemon/error.h> |
| 22 | 22 |
#include "test_tools.h" |
| 23 | 23 |
|
| 24 | 24 |
using namespace lemon; |
| 25 | 25 |
|
| 26 | 26 |
#ifdef LEMON_ENABLE_ASSERTS |
| 27 | 27 |
#undef LEMON_ENABLE_ASSERTS |
| 28 | 28 |
#endif |
| 29 | 29 |
| 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-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 |
#include<iostream> |
| 20 | 20 |
#include<lemon/concept_check.h> |
| 21 | 21 |
|
| 22 | 22 |
#include<lemon/list_graph.h> |
| 23 | 23 |
#include<lemon/smart_graph.h> |
| 24 | 24 |
|
| 25 | 25 |
#include<lemon/concepts/digraph.h> |
| 26 | 26 |
#include<lemon/concepts/graph.h> |
| 27 | 27 |
|
| 28 | 28 |
#include<lemon/adaptors.h> |
| 29 | 29 |
|
| ... | ... |
@@ -82,49 +82,49 @@ |
| 82 | 82 |
SubDigraph<concepts::Digraph, |
| 83 | 83 |
concepts::Digraph::NodeMap<bool>, |
| 84 | 84 |
concepts::Digraph::ArcMap<bool> > >(); |
| 85 | 85 |
|
| 86 | 86 |
typedef ListDigraph Digraph; |
| 87 | 87 |
typedef Digraph::NodeMap<bool> NodeFilter; |
| 88 | 88 |
typedef Digraph::ArcMap<bool> ArcFilter; |
| 89 | 89 |
typedef SubDigraph<Digraph, NodeFilter, ArcFilter> Adaptor; |
| 90 | 90 |
|
| 91 | 91 |
Digraph digraph; |
| 92 | 92 |
NodeFilter node_filter(digraph); |
| 93 | 93 |
ArcFilter arc_filter(digraph); |
| 94 | 94 |
Adaptor adaptor(digraph, node_filter, arc_filter); |
| 95 | 95 |
|
| 96 | 96 |
Digraph::Node n1 = digraph.addNode(); |
| 97 | 97 |
Digraph::Node n2 = digraph.addNode(); |
| 98 | 98 |
Digraph::Node n3 = digraph.addNode(); |
| 99 | 99 |
|
| 100 | 100 |
Digraph::Arc a1 = digraph.addArc(n1, n2); |
| 101 | 101 |
Digraph::Arc a2 = digraph.addArc(n1, n3); |
| 102 | 102 |
Digraph::Arc a3 = digraph.addArc(n2, n3); |
| 103 | 103 |
|
| 104 | 104 |
node_filter[n1] = node_filter[n2] = node_filter[n3] = true; |
| 105 | 105 |
arc_filter[a1] = arc_filter[a2] = arc_filter[a3] = true; |
| 106 |
|
|
| 106 |
|
|
| 107 | 107 |
checkGraphNodeList(adaptor, 3); |
| 108 | 108 |
checkGraphArcList(adaptor, 3); |
| 109 | 109 |
checkGraphConArcList(adaptor, 3); |
| 110 | 110 |
|
| 111 | 111 |
checkGraphOutArcList(adaptor, n1, 2); |
| 112 | 112 |
checkGraphOutArcList(adaptor, n2, 1); |
| 113 | 113 |
checkGraphOutArcList(adaptor, n3, 0); |
| 114 | 114 |
|
| 115 | 115 |
checkGraphInArcList(adaptor, n1, 0); |
| 116 | 116 |
checkGraphInArcList(adaptor, n2, 1); |
| 117 | 117 |
checkGraphInArcList(adaptor, n3, 2); |
| 118 | 118 |
|
| 119 | 119 |
checkNodeIds(adaptor); |
| 120 | 120 |
checkArcIds(adaptor); |
| 121 | 121 |
|
| 122 | 122 |
checkGraphNodeMap(adaptor); |
| 123 | 123 |
checkGraphArcMap(adaptor); |
| 124 | 124 |
|
| 125 | 125 |
arc_filter[a2] = false; |
| 126 | 126 |
|
| 127 | 127 |
checkGraphNodeList(adaptor, 3); |
| 128 | 128 |
checkGraphArcList(adaptor, 2); |
| 129 | 129 |
checkGraphConArcList(adaptor, 2); |
| 130 | 130 |
|
| ... | ... |
@@ -175,49 +175,49 @@ |
| 175 | 175 |
} |
| 176 | 176 |
|
| 177 | 177 |
void checkFilterNodes1() {
|
| 178 | 178 |
checkConcept<concepts::Digraph, |
| 179 | 179 |
FilterNodes<concepts::Digraph, |
| 180 | 180 |
concepts::Digraph::NodeMap<bool> > >(); |
| 181 | 181 |
|
| 182 | 182 |
typedef ListDigraph Digraph; |
| 183 | 183 |
typedef Digraph::NodeMap<bool> NodeFilter; |
| 184 | 184 |
typedef FilterNodes<Digraph, NodeFilter> Adaptor; |
| 185 | 185 |
|
| 186 | 186 |
Digraph digraph; |
| 187 | 187 |
NodeFilter node_filter(digraph); |
| 188 | 188 |
Adaptor adaptor(digraph, node_filter); |
| 189 | 189 |
|
| 190 | 190 |
Digraph::Node n1 = digraph.addNode(); |
| 191 | 191 |
Digraph::Node n2 = digraph.addNode(); |
| 192 | 192 |
Digraph::Node n3 = digraph.addNode(); |
| 193 | 193 |
|
| 194 | 194 |
Digraph::Arc a1 = digraph.addArc(n1, n2); |
| 195 | 195 |
Digraph::Arc a2 = digraph.addArc(n1, n3); |
| 196 | 196 |
Digraph::Arc a3 = digraph.addArc(n2, n3); |
| 197 | 197 |
|
| 198 | 198 |
node_filter[n1] = node_filter[n2] = node_filter[n3] = true; |
| 199 |
|
|
| 199 |
|
|
| 200 | 200 |
checkGraphNodeList(adaptor, 3); |
| 201 | 201 |
checkGraphArcList(adaptor, 3); |
| 202 | 202 |
checkGraphConArcList(adaptor, 3); |
| 203 | 203 |
|
| 204 | 204 |
checkGraphOutArcList(adaptor, n1, 2); |
| 205 | 205 |
checkGraphOutArcList(adaptor, n2, 1); |
| 206 | 206 |
checkGraphOutArcList(adaptor, n3, 0); |
| 207 | 207 |
|
| 208 | 208 |
checkGraphInArcList(adaptor, n1, 0); |
| 209 | 209 |
checkGraphInArcList(adaptor, n2, 1); |
| 210 | 210 |
checkGraphInArcList(adaptor, n3, 2); |
| 211 | 211 |
|
| 212 | 212 |
checkNodeIds(adaptor); |
| 213 | 213 |
checkArcIds(adaptor); |
| 214 | 214 |
|
| 215 | 215 |
checkGraphNodeMap(adaptor); |
| 216 | 216 |
checkGraphArcMap(adaptor); |
| 217 | 217 |
|
| 218 | 218 |
node_filter[n1] = false; |
| 219 | 219 |
|
| 220 | 220 |
checkGraphNodeList(adaptor, 2); |
| 221 | 221 |
checkGraphArcList(adaptor, 1); |
| 222 | 222 |
checkGraphConArcList(adaptor, 1); |
| 223 | 223 |
|
| ... | ... |
@@ -247,49 +247,49 @@ |
| 247 | 247 |
} |
| 248 | 248 |
|
| 249 | 249 |
void checkFilterArcs() {
|
| 250 | 250 |
checkConcept<concepts::Digraph, |
| 251 | 251 |
FilterArcs<concepts::Digraph, |
| 252 | 252 |
concepts::Digraph::ArcMap<bool> > >(); |
| 253 | 253 |
|
| 254 | 254 |
typedef ListDigraph Digraph; |
| 255 | 255 |
typedef Digraph::ArcMap<bool> ArcFilter; |
| 256 | 256 |
typedef FilterArcs<Digraph, ArcFilter> Adaptor; |
| 257 | 257 |
|
| 258 | 258 |
Digraph digraph; |
| 259 | 259 |
ArcFilter arc_filter(digraph); |
| 260 | 260 |
Adaptor adaptor(digraph, arc_filter); |
| 261 | 261 |
|
| 262 | 262 |
Digraph::Node n1 = digraph.addNode(); |
| 263 | 263 |
Digraph::Node n2 = digraph.addNode(); |
| 264 | 264 |
Digraph::Node n3 = digraph.addNode(); |
| 265 | 265 |
|
| 266 | 266 |
Digraph::Arc a1 = digraph.addArc(n1, n2); |
| 267 | 267 |
Digraph::Arc a2 = digraph.addArc(n1, n3); |
| 268 | 268 |
Digraph::Arc a3 = digraph.addArc(n2, n3); |
| 269 | 269 |
|
| 270 | 270 |
arc_filter[a1] = arc_filter[a2] = arc_filter[a3] = true; |
| 271 |
|
|
| 271 |
|
|
| 272 | 272 |
checkGraphNodeList(adaptor, 3); |
| 273 | 273 |
checkGraphArcList(adaptor, 3); |
| 274 | 274 |
checkGraphConArcList(adaptor, 3); |
| 275 | 275 |
|
| 276 | 276 |
checkGraphOutArcList(adaptor, n1, 2); |
| 277 | 277 |
checkGraphOutArcList(adaptor, n2, 1); |
| 278 | 278 |
checkGraphOutArcList(adaptor, n3, 0); |
| 279 | 279 |
|
| 280 | 280 |
checkGraphInArcList(adaptor, n1, 0); |
| 281 | 281 |
checkGraphInArcList(adaptor, n2, 1); |
| 282 | 282 |
checkGraphInArcList(adaptor, n3, 2); |
| 283 | 283 |
|
| 284 | 284 |
checkNodeIds(adaptor); |
| 285 | 285 |
checkArcIds(adaptor); |
| 286 | 286 |
|
| 287 | 287 |
checkGraphNodeMap(adaptor); |
| 288 | 288 |
checkGraphArcMap(adaptor); |
| 289 | 289 |
|
| 290 | 290 |
arc_filter[a2] = false; |
| 291 | 291 |
|
| 292 | 292 |
checkGraphNodeList(adaptor, 3); |
| 293 | 293 |
checkGraphArcList(adaptor, 2); |
| 294 | 294 |
checkGraphConArcList(adaptor, 2); |
| 295 | 295 |
|
| ... | ... |
@@ -556,49 +556,49 @@ |
| 556 | 556 |
concepts::Graph::EdgeMap<bool> > >(); |
| 557 | 557 |
|
| 558 | 558 |
typedef ListGraph Graph; |
| 559 | 559 |
typedef Graph::NodeMap<bool> NodeFilter; |
| 560 | 560 |
typedef Graph::EdgeMap<bool> EdgeFilter; |
| 561 | 561 |
typedef SubGraph<Graph, NodeFilter, EdgeFilter> Adaptor; |
| 562 | 562 |
|
| 563 | 563 |
Graph graph; |
| 564 | 564 |
NodeFilter node_filter(graph); |
| 565 | 565 |
EdgeFilter edge_filter(graph); |
| 566 | 566 |
Adaptor adaptor(graph, node_filter, edge_filter); |
| 567 | 567 |
|
| 568 | 568 |
Graph::Node n1 = graph.addNode(); |
| 569 | 569 |
Graph::Node n2 = graph.addNode(); |
| 570 | 570 |
Graph::Node n3 = graph.addNode(); |
| 571 | 571 |
Graph::Node n4 = graph.addNode(); |
| 572 | 572 |
|
| 573 | 573 |
Graph::Edge e1 = graph.addEdge(n1, n2); |
| 574 | 574 |
Graph::Edge e2 = graph.addEdge(n1, n3); |
| 575 | 575 |
Graph::Edge e3 = graph.addEdge(n2, n3); |
| 576 | 576 |
Graph::Edge e4 = graph.addEdge(n3, n4); |
| 577 | 577 |
|
| 578 | 578 |
node_filter[n1] = node_filter[n2] = node_filter[n3] = node_filter[n4] = true; |
| 579 | 579 |
edge_filter[e1] = edge_filter[e2] = edge_filter[e3] = edge_filter[e4] = true; |
| 580 |
|
|
| 580 |
|
|
| 581 | 581 |
checkGraphNodeList(adaptor, 4); |
| 582 | 582 |
checkGraphArcList(adaptor, 8); |
| 583 | 583 |
checkGraphEdgeList(adaptor, 4); |
| 584 | 584 |
checkGraphConArcList(adaptor, 8); |
| 585 | 585 |
checkGraphConEdgeList(adaptor, 4); |
| 586 | 586 |
|
| 587 | 587 |
checkGraphOutArcList(adaptor, n1, 2); |
| 588 | 588 |
checkGraphOutArcList(adaptor, n2, 2); |
| 589 | 589 |
checkGraphOutArcList(adaptor, n3, 3); |
| 590 | 590 |
checkGraphOutArcList(adaptor, n4, 1); |
| 591 | 591 |
|
| 592 | 592 |
checkGraphInArcList(adaptor, n1, 2); |
| 593 | 593 |
checkGraphInArcList(adaptor, n2, 2); |
| 594 | 594 |
checkGraphInArcList(adaptor, n3, 3); |
| 595 | 595 |
checkGraphInArcList(adaptor, n4, 1); |
| 596 | 596 |
|
| 597 | 597 |
checkGraphIncEdgeList(adaptor, n1, 2); |
| 598 | 598 |
checkGraphIncEdgeList(adaptor, n2, 2); |
| 599 | 599 |
checkGraphIncEdgeList(adaptor, n3, 3); |
| 600 | 600 |
checkGraphIncEdgeList(adaptor, n4, 1); |
| 601 | 601 |
|
| 602 | 602 |
checkNodeIds(adaptor); |
| 603 | 603 |
checkArcIds(adaptor); |
| 604 | 604 |
checkEdgeIds(adaptor); |
| ... | ... |
@@ -687,49 +687,49 @@ |
| 687 | 687 |
void checkFilterNodes2() {
|
| 688 | 688 |
checkConcept<concepts::Graph, |
| 689 | 689 |
FilterNodes<concepts::Graph, |
| 690 | 690 |
concepts::Graph::NodeMap<bool> > >(); |
| 691 | 691 |
|
| 692 | 692 |
typedef ListGraph Graph; |
| 693 | 693 |
typedef Graph::NodeMap<bool> NodeFilter; |
| 694 | 694 |
typedef FilterNodes<Graph, NodeFilter> Adaptor; |
| 695 | 695 |
|
| 696 | 696 |
Graph graph; |
| 697 | 697 |
NodeFilter node_filter(graph); |
| 698 | 698 |
Adaptor adaptor(graph, node_filter); |
| 699 | 699 |
|
| 700 | 700 |
Graph::Node n1 = graph.addNode(); |
| 701 | 701 |
Graph::Node n2 = graph.addNode(); |
| 702 | 702 |
Graph::Node n3 = graph.addNode(); |
| 703 | 703 |
Graph::Node n4 = graph.addNode(); |
| 704 | 704 |
|
| 705 | 705 |
Graph::Edge e1 = graph.addEdge(n1, n2); |
| 706 | 706 |
Graph::Edge e2 = graph.addEdge(n1, n3); |
| 707 | 707 |
Graph::Edge e3 = graph.addEdge(n2, n3); |
| 708 | 708 |
Graph::Edge e4 = graph.addEdge(n3, n4); |
| 709 | 709 |
|
| 710 | 710 |
node_filter[n1] = node_filter[n2] = node_filter[n3] = node_filter[n4] = true; |
| 711 |
|
|
| 711 |
|
|
| 712 | 712 |
checkGraphNodeList(adaptor, 4); |
| 713 | 713 |
checkGraphArcList(adaptor, 8); |
| 714 | 714 |
checkGraphEdgeList(adaptor, 4); |
| 715 | 715 |
checkGraphConArcList(adaptor, 8); |
| 716 | 716 |
checkGraphConEdgeList(adaptor, 4); |
| 717 | 717 |
|
| 718 | 718 |
checkGraphOutArcList(adaptor, n1, 2); |
| 719 | 719 |
checkGraphOutArcList(adaptor, n2, 2); |
| 720 | 720 |
checkGraphOutArcList(adaptor, n3, 3); |
| 721 | 721 |
checkGraphOutArcList(adaptor, n4, 1); |
| 722 | 722 |
|
| 723 | 723 |
checkGraphInArcList(adaptor, n1, 2); |
| 724 | 724 |
checkGraphInArcList(adaptor, n2, 2); |
| 725 | 725 |
checkGraphInArcList(adaptor, n3, 3); |
| 726 | 726 |
checkGraphInArcList(adaptor, n4, 1); |
| 727 | 727 |
|
| 728 | 728 |
checkGraphIncEdgeList(adaptor, n1, 2); |
| 729 | 729 |
checkGraphIncEdgeList(adaptor, n2, 2); |
| 730 | 730 |
checkGraphIncEdgeList(adaptor, n3, 3); |
| 731 | 731 |
checkGraphIncEdgeList(adaptor, n4, 1); |
| 732 | 732 |
|
| 733 | 733 |
checkNodeIds(adaptor); |
| 734 | 734 |
checkArcIds(adaptor); |
| 735 | 735 |
checkEdgeIds(adaptor); |
| ... | ... |
@@ -786,49 +786,49 @@ |
| 786 | 786 |
void checkFilterEdges() {
|
| 787 | 787 |
checkConcept<concepts::Graph, |
| 788 | 788 |
FilterEdges<concepts::Graph, |
| 789 | 789 |
concepts::Graph::EdgeMap<bool> > >(); |
| 790 | 790 |
|
| 791 | 791 |
typedef ListGraph Graph; |
| 792 | 792 |
typedef Graph::EdgeMap<bool> EdgeFilter; |
| 793 | 793 |
typedef FilterEdges<Graph, EdgeFilter> Adaptor; |
| 794 | 794 |
|
| 795 | 795 |
Graph graph; |
| 796 | 796 |
EdgeFilter edge_filter(graph); |
| 797 | 797 |
Adaptor adaptor(graph, edge_filter); |
| 798 | 798 |
|
| 799 | 799 |
Graph::Node n1 = graph.addNode(); |
| 800 | 800 |
Graph::Node n2 = graph.addNode(); |
| 801 | 801 |
Graph::Node n3 = graph.addNode(); |
| 802 | 802 |
Graph::Node n4 = graph.addNode(); |
| 803 | 803 |
|
| 804 | 804 |
Graph::Edge e1 = graph.addEdge(n1, n2); |
| 805 | 805 |
Graph::Edge e2 = graph.addEdge(n1, n3); |
| 806 | 806 |
Graph::Edge e3 = graph.addEdge(n2, n3); |
| 807 | 807 |
Graph::Edge e4 = graph.addEdge(n3, n4); |
| 808 | 808 |
|
| 809 | 809 |
edge_filter[e1] = edge_filter[e2] = edge_filter[e3] = edge_filter[e4] = true; |
| 810 |
|
|
| 810 |
|
|
| 811 | 811 |
checkGraphNodeList(adaptor, 4); |
| 812 | 812 |
checkGraphArcList(adaptor, 8); |
| 813 | 813 |
checkGraphEdgeList(adaptor, 4); |
| 814 | 814 |
checkGraphConArcList(adaptor, 8); |
| 815 | 815 |
checkGraphConEdgeList(adaptor, 4); |
| 816 | 816 |
|
| 817 | 817 |
checkGraphOutArcList(adaptor, n1, 2); |
| 818 | 818 |
checkGraphOutArcList(adaptor, n2, 2); |
| 819 | 819 |
checkGraphOutArcList(adaptor, n3, 3); |
| 820 | 820 |
checkGraphOutArcList(adaptor, n4, 1); |
| 821 | 821 |
|
| 822 | 822 |
checkGraphInArcList(adaptor, n1, 2); |
| 823 | 823 |
checkGraphInArcList(adaptor, n2, 2); |
| 824 | 824 |
checkGraphInArcList(adaptor, n3, 3); |
| 825 | 825 |
checkGraphInArcList(adaptor, n4, 1); |
| 826 | 826 |
|
| 827 | 827 |
checkGraphIncEdgeList(adaptor, n1, 2); |
| 828 | 828 |
checkGraphIncEdgeList(adaptor, n2, 2); |
| 829 | 829 |
checkGraphIncEdgeList(adaptor, n3, 3); |
| 830 | 830 |
checkGraphIncEdgeList(adaptor, n4, 1); |
| 831 | 831 |
|
| 832 | 832 |
checkNodeIds(adaptor); |
| 833 | 833 |
checkArcIds(adaptor); |
| 834 | 834 |
checkEdgeIds(adaptor); |
| 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-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 |
#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() {
|
| 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-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 |
#include <lemon/concepts/graph.h> |
| 20 | 20 |
#include <lemon/list_graph.h> |
| 21 | 21 |
#include <lemon/smart_graph.h> |
| 22 | 22 |
#include <lemon/full_graph.h> |
| 23 | 23 |
#include <lemon/grid_graph.h> |
| 24 | 24 |
#include <lemon/hypercube_graph.h> |
| 25 | 25 |
|
| 26 | 26 |
#include "test_tools.h" |
| 27 | 27 |
#include "graph_test.h" |
| 28 | 28 |
|
| 29 | 29 |
using 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-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 |
#ifndef LEMON_TEST_GRAPH_TEST_H |
| 20 | 20 |
#define LEMON_TEST_GRAPH_TEST_H |
| 21 | 21 |
|
| 22 | 22 |
#include <set> |
| 23 | 23 |
|
| 24 | 24 |
#include <lemon/core.h> |
| 25 | 25 |
#include <lemon/maps.h> |
| 26 | 26 |
|
| 27 | 27 |
#include "test_tools.h" |
| 28 | 28 |
|
| 29 | 29 |
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-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 |
#include <cstdlib> |
| 20 | 20 |
#include <ctime> |
| 21 | 21 |
|
| 22 | 22 |
#include <lemon/random.h> |
| 23 | 23 |
#include <lemon/list_graph.h> |
| 24 | 24 |
#include <lemon/smart_graph.h> |
| 25 | 25 |
#include <lemon/maps.h> |
| 26 | 26 |
|
| 27 | 27 |
#include "graph_test.h" |
| 28 | 28 |
#include "test_tools.h" |
| 29 | 29 |
| 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-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 |
#include <sstream> |
| 20 | 20 |
|
| 21 | 21 |
#include <lemon/smart_graph.h> |
| 22 | 22 |
#include <lemon/hao_orlin.h> |
| 23 | 23 |
|
| 24 | 24 |
#include <lemon/lgf_reader.h> |
| 25 | 25 |
#include "test_tools.h" |
| 26 | 26 |
|
| 27 | 27 |
using namespace lemon; |
| 28 | 28 |
using namespace std; |
| 29 | 29 |
| 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-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 |
#include <iostream> |
| 20 | 20 |
#include <fstream> |
| 21 | 21 |
#include <string> |
| 22 | 22 |
#include <vector> |
| 23 | 23 |
|
| 24 | 24 |
#include <lemon/concept_check.h> |
| 25 | 25 |
#include <lemon/concepts/heap.h> |
| 26 | 26 |
|
| 27 | 27 |
#include <lemon/smart_graph.h> |
| 28 | 28 |
|
| 29 | 29 |
#include <lemon/lgf_reader.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-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 |
#include <iostream> |
| 20 | 20 |
#include <vector> |
| 21 | 21 |
|
| 22 | 22 |
#include "test_tools.h" |
| 23 | 23 |
#include <lemon/maps.h> |
| 24 | 24 |
#include <lemon/kruskal.h> |
| 25 | 25 |
#include <lemon/list_graph.h> |
| 26 | 26 |
|
| 27 | 27 |
#include <lemon/concepts/maps.h> |
| 28 | 28 |
#include <lemon/concepts/digraph.h> |
| 29 | 29 |
#include <lemon/concepts/graph.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-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 |
#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; |
| 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-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 |
#include <iostream> |
| 20 | 20 |
#include <sstream> |
| 21 | 21 |
#include <vector> |
| 22 | 22 |
#include <queue> |
| 23 | 23 |
#include <lemon/math.h> |
| 24 | 24 |
#include <cstdlib> |
| 25 | 25 |
|
| 26 | 26 |
#include <lemon/max_matching.h> |
| 27 | 27 |
#include <lemon/smart_graph.h> |
| 28 | 28 |
#include <lemon/lgf_reader.h> |
| 29 | 29 |
| 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-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 |
#include <string> |
| 20 | 20 |
#include <iostream> |
| 21 | 21 |
|
| 22 | 22 |
#include <lemon/concepts/path.h> |
| 23 | 23 |
#include <lemon/concepts/digraph.h> |
| 24 | 24 |
|
| 25 | 25 |
#include <lemon/path.h> |
| 26 | 26 |
#include <lemon/list_graph.h> |
| 27 | 27 |
|
| 28 | 28 |
#include "test_tools.h" |
| 29 | 29 |
| 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-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 |
#include <iostream> |
| 20 | 20 |
|
| 21 | 21 |
#include "test_tools.h" |
| 22 | 22 |
#include <lemon/smart_graph.h> |
| 23 | 23 |
#include <lemon/preflow.h> |
| 24 | 24 |
#include <lemon/concepts/digraph.h> |
| 25 | 25 |
#include <lemon/concepts/maps.h> |
| 26 | 26 |
#include <lemon/lgf_reader.h> |
| 27 | 27 |
#include <lemon/elevator.h> |
| 28 | 28 |
|
| 29 | 29 |
using 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-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 |
#include <lemon/random.h> |
| 20 | 20 |
#include "test_tools.h" |
| 21 | 21 |
|
| 22 | 22 |
int seed_array[] = {1, 2};
|
| 23 | 23 |
|
| 24 | 24 |
int main() |
| 25 | 25 |
{
|
| 26 | 26 |
double a=lemon::rnd(); |
| 27 | 27 |
check(a<1.0&&a>0.0,"This should be in [0,1)"); |
| 28 | 28 |
a=lemon::rnd.gauss(); |
| 29 | 29 |
a=lemon::rnd.gamma(3.45,0); |
| 1 |
/* -*- C++ -*- |
|
| 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
|
| 2 | 2 |
* |
| 3 |
* This file is a part of LEMON, a generic C++ optimization library |
|
| 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
|
| 4 | 4 |
* |
| 5 |
* Copyright (C) 2003- |
|
| 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 |
#include <iostream> |
| 20 | 20 |
|
| 21 | 21 |
#include <lemon/list_graph.h> |
| 22 | 22 |
#include <lemon/lgf_reader.h> |
| 23 | 23 |
#include <lemon/path.h> |
| 24 | 24 |
#include <lemon/suurballe.h> |
| 25 | 25 |
|
| 26 | 26 |
#include "test_tools.h" |
| 27 | 27 |
|
| 28 | 28 |
using namespace lemon; |
| 29 | 29 |
|
| ... | ... |
@@ -51,144 +51,144 @@ |
| 51 | 51 |
" 3 5 140 5 0 3\n" |
| 52 | 52 |
" 4 6 60 10 0 1\n" |
| 53 | 53 |
" 4 7 80 2 0 0\n" |
| 54 | 54 |
" 4 8 110 3 0 0\n" |
| 55 | 55 |
" 5 7 60 14 0 0\n" |
| 56 | 56 |
" 5 11 120 12 0 0\n" |
| 57 | 57 |
" 6 3 0 3 0 0\n" |
| 58 | 58 |
" 6 9 140 4 0 0\n" |
| 59 | 59 |
" 6 10 90 8 0 0\n" |
| 60 | 60 |
" 7 1 30 5 0 0\n" |
| 61 | 61 |
" 8 12 60 16 0 4\n" |
| 62 | 62 |
" 9 12 50 6 0 0\n" |
| 63 | 63 |
"10 12 70 13 0 5\n" |
| 64 | 64 |
"10 2 100 7 0 0\n" |
| 65 | 65 |
"10 7 60 10 0 0\n" |
| 66 | 66 |
"11 10 20 14 0 6\n" |
| 67 | 67 |
"12 11 30 10 0 0\n" |
| 68 | 68 |
"@attributes\n" |
| 69 | 69 |
"source 1\n" |
| 70 | 70 |
"target 12\n" |
| 71 | 71 |
"@end\n"; |
| 72 | 72 |
|
| 73 | 73 |
// Check the feasibility of the flow |
| 74 | 74 |
template <typename Digraph, typename FlowMap> |
| 75 |
bool checkFlow( const Digraph& gr, const FlowMap& flow, |
|
| 75 |
bool checkFlow( const Digraph& gr, const FlowMap& flow, |
|
| 76 | 76 |
typename Digraph::Node s, typename Digraph::Node t, |
| 77 | 77 |
int value ) |
| 78 | 78 |
{
|
| 79 | 79 |
TEMPLATE_DIGRAPH_TYPEDEFS(Digraph); |
| 80 | 80 |
for (ArcIt e(gr); e != INVALID; ++e) |
| 81 | 81 |
if (!(flow[e] == 0 || flow[e] == 1)) return false; |
| 82 | 82 |
|
| 83 | 83 |
for (NodeIt n(gr); n != INVALID; ++n) {
|
| 84 | 84 |
int sum = 0; |
| 85 | 85 |
for (OutArcIt e(gr, n); e != INVALID; ++e) |
| 86 | 86 |
sum += flow[e]; |
| 87 | 87 |
for (InArcIt e(gr, n); e != INVALID; ++e) |
| 88 | 88 |
sum -= flow[e]; |
| 89 | 89 |
if (n == s && sum != value) return false; |
| 90 | 90 |
if (n == t && sum != -value) return false; |
| 91 | 91 |
if (n != s && n != t && sum != 0) return false; |
| 92 | 92 |
} |
| 93 | 93 |
|
| 94 | 94 |
return true; |
| 95 | 95 |
} |
| 96 | 96 |
|
| 97 | 97 |
// Check the optimalitiy of the flow |
| 98 |
template < typename Digraph, typename CostMap, |
|
| 98 |
template < typename Digraph, typename CostMap, |
|
| 99 | 99 |
typename FlowMap, typename PotentialMap > |
| 100 | 100 |
bool checkOptimality( const Digraph& gr, const CostMap& cost, |
| 101 | 101 |
const FlowMap& flow, const PotentialMap& pi ) |
| 102 | 102 |
{
|
| 103 | 103 |
// Check the "Complementary Slackness" optimality condition |
| 104 | 104 |
TEMPLATE_DIGRAPH_TYPEDEFS(Digraph); |
| 105 | 105 |
bool opt = true; |
| 106 | 106 |
for (ArcIt e(gr); e != INVALID; ++e) {
|
| 107 | 107 |
typename CostMap::Value red_cost = |
| 108 | 108 |
cost[e] + pi[gr.source(e)] - pi[gr.target(e)]; |
| 109 | 109 |
opt = (flow[e] == 0 && red_cost >= 0) || |
| 110 | 110 |
(flow[e] == 1 && red_cost <= 0); |
| 111 | 111 |
if (!opt) break; |
| 112 | 112 |
} |
| 113 | 113 |
return opt; |
| 114 | 114 |
} |
| 115 | 115 |
|
| 116 | 116 |
// Check a path |
| 117 | 117 |
template <typename Digraph, typename Path> |
| 118 | 118 |
bool checkPath( const Digraph& gr, const Path& path, |
| 119 | 119 |
typename Digraph::Node s, typename Digraph::Node t) |
| 120 | 120 |
{
|
| 121 | 121 |
// Check the "Complementary Slackness" optimality condition |
| 122 | 122 |
TEMPLATE_DIGRAPH_TYPEDEFS(Digraph); |
| 123 | 123 |
Node n = s; |
| 124 | 124 |
for (int i = 0; i < path.length(); ++i) {
|
| 125 | 125 |
if (gr.source(path.nth(i)) != n) return false; |
| 126 | 126 |
n = gr.target(path.nth(i)); |
| 127 | 127 |
} |
| 128 | 128 |
return n == t; |
| 129 | 129 |
} |
| 130 | 130 |
|
| 131 | 131 |
|
| 132 | 132 |
int main() |
| 133 | 133 |
{
|
| 134 | 134 |
DIGRAPH_TYPEDEFS(ListDigraph); |
| 135 | 135 |
|
| 136 | 136 |
// Read the test digraph |
| 137 | 137 |
ListDigraph digraph; |
| 138 | 138 |
ListDigraph::ArcMap<int> length(digraph); |
| 139 | 139 |
Node source, target; |
| 140 | 140 |
|
| 141 | 141 |
std::istringstream input(test_lgf); |
| 142 | 142 |
DigraphReader<ListDigraph>(digraph, input). |
| 143 | 143 |
arcMap("cost", length).
|
| 144 | 144 |
node("source", source).
|
| 145 | 145 |
node("target", target).
|
| 146 | 146 |
run(); |
| 147 |
|
|
| 147 |
|
|
| 148 | 148 |
// Find 2 paths |
| 149 | 149 |
{
|
| 150 | 150 |
Suurballe<ListDigraph> suurballe(digraph, length, source, target); |
| 151 | 151 |
check(suurballe.run(2) == 2, "Wrong number of paths"); |
| 152 | 152 |
check(checkFlow(digraph, suurballe.flowMap(), source, target, 2), |
| 153 | 153 |
"The flow is not feasible"); |
| 154 | 154 |
check(suurballe.totalLength() == 510, "The flow is not optimal"); |
| 155 |
check(checkOptimality(digraph, length, suurballe.flowMap(), |
|
| 155 |
check(checkOptimality(digraph, length, suurballe.flowMap(), |
|
| 156 | 156 |
suurballe.potentialMap()), |
| 157 | 157 |
"Wrong potentials"); |
| 158 | 158 |
for (int i = 0; i < suurballe.pathNum(); ++i) |
| 159 | 159 |
check(checkPath(digraph, suurballe.path(i), source, target), |
| 160 | 160 |
"Wrong path"); |
| 161 | 161 |
} |
| 162 | 162 |
|
| 163 | 163 |
// Find 3 paths |
| 164 | 164 |
{
|
| 165 | 165 |
Suurballe<ListDigraph> suurballe(digraph, length, source, target); |
| 166 | 166 |
check(suurballe.run(3) == 3, "Wrong number of paths"); |
| 167 | 167 |
check(checkFlow(digraph, suurballe.flowMap(), source, target, 3), |
| 168 | 168 |
"The flow is not feasible"); |
| 169 | 169 |
check(suurballe.totalLength() == 1040, "The flow is not optimal"); |
| 170 |
check(checkOptimality(digraph, length, suurballe.flowMap(), |
|
| 170 |
check(checkOptimality(digraph, length, suurballe.flowMap(), |
|
| 171 | 171 |
suurballe.potentialMap()), |
| 172 | 172 |
"Wrong potentials"); |
| 173 | 173 |
for (int i = 0; i < suurballe.pathNum(); ++i) |
| 174 | 174 |
check(checkPath(digraph, suurballe.path(i), source, target), |
| 175 | 175 |
"Wrong path"); |
| 176 | 176 |
} |
| 177 | 177 |
|
| 178 | 178 |
// Find 5 paths (only 3 can be found) |
| 179 | 179 |
{
|
| 180 | 180 |
Suurballe<ListDigraph> suurballe(digraph, length, source, target); |
| 181 | 181 |
check(suurballe.run(5) == 3, "Wrong number of paths"); |
| 182 | 182 |
check(checkFlow(digraph, suurballe.flowMap(), source, target, 3), |
| 183 | 183 |
"The flow is not feasible"); |
| 184 | 184 |
check(suurballe.totalLength() == 1040, "The flow is not optimal"); |
| 185 |
check(checkOptimality(digraph, length, suurballe.flowMap(), |
|
| 185 |
check(checkOptimality(digraph, length, suurballe.flowMap(), |
|
| 186 | 186 |
suurballe.potentialMap()), |
| 187 | 187 |
"Wrong potentials"); |
| 188 | 188 |
for (int i = 0; i < suurballe.pathNum(); ++i) |
| 189 | 189 |
check(checkPath(digraph, suurballe.path(i), source, target), |
| 190 | 190 |
"Wrong path"); |
| 191 | 191 |
} |
| 192 | 192 |
|
| 193 | 193 |
return 0; |
| 194 | 194 |
} |
| 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-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 |
#ifndef LEMON_TEST_TEST_TOOLS_H |
| 20 | 20 |
#define LEMON_TEST_TEST_TOOLS_H |
| 21 | 21 |
|
| 22 | 22 |
///\ingroup misc |
| 23 | 23 |
///\file |
| 24 | 24 |
///\brief Some utilities to write test programs. |
| 25 | 25 |
|
| 26 | 26 |
#include <iostream> |
| 27 | 27 |
#include <stdlib.h> |
| 28 | 28 |
|
| 29 | 29 |
///If \c rc is fail, writes an error message and exits. |
| 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-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 |
#include "test_tools.h" |
| 20 | 20 |
|
| 21 | 21 |
int main() |
| 22 | 22 |
{
|
| 23 | 23 |
check(false, "Don't panic. Failing is the right behaviour here."); |
| 24 | 24 |
return 0; |
| 25 | 25 |
} |
| 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-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 |
#include "test_tools.h" |
| 20 | 20 |
|
| 21 | 21 |
int main() |
| 22 | 22 |
{
|
| 23 | 23 |
check(true, "It should pass."); |
| 24 | 24 |
return 0; |
| 25 | 25 |
} |
| 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-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 |
#include <lemon/time_measure.h> |
| 20 | 20 |
|
| 21 | 21 |
using namespace lemon; |
| 22 | 22 |
|
| 23 | 23 |
void f() |
| 24 | 24 |
{
|
| 25 | 25 |
double d=0; |
| 26 | 26 |
for(int i=0;i<1000;i++) |
| 27 | 27 |
d+=0.1; |
| 28 | 28 |
} |
| 29 | 29 |
| 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-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 |
#include <lemon/list_graph.h> |
| 20 | 20 |
#include <lemon/maps.h> |
| 21 | 21 |
#include <lemon/unionfind.h> |
| 22 | 22 |
#include "test_tools.h" |
| 23 | 23 |
|
| 24 | 24 |
using namespace lemon; |
| 25 | 25 |
using namespace std; |
| 26 | 26 |
|
| 27 | 27 |
typedef UnionFindEnum<ListGraph::NodeMap<int> > UFE; |
| 28 | 28 |
|
| 29 | 29 |
int main() {
|
| 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-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 |
///\ingroup tools |
| 20 | 20 |
///\file |
| 21 | 21 |
///\brief DIMACS to LGF converter. |
| 22 | 22 |
/// |
| 23 | 23 |
/// This program converts various DIMACS formats to the LEMON Digraph Format |
| 24 | 24 |
/// (LGF). |
| 25 | 25 |
/// |
| 26 | 26 |
/// See |
| 27 | 27 |
/// \verbatim |
| 28 | 28 |
/// dimacs-to-lgf --help |
| 29 | 29 |
/// \endverbatim |
0 comments (0 inline)