- Increased max. number of iteration
- Better tests.
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2006
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
19 #ifndef LEMON_TRAITS_H
20 #define LEMON_TRAITS_H
22 #include <lemon/utility.h>
25 ///\brief Traits for graphs and maps
29 template <typename _Graph, typename _Item>
30 class ItemSetTraits {};
32 template <typename _Graph>
33 class ItemSetTraits<_Graph, typename _Graph::Node> {
38 typedef typename Graph::Node Item;
39 typedef typename Graph::NodeIt ItemIt;
41 template <typename _Value>
42 class Map : public Graph::template NodeMap<_Value> {
44 typedef typename Graph::template NodeMap<_Value> Parent;
45 typedef typename Parent::Value Value;
47 Map(const Graph& _graph) : Parent(_graph) {}
48 Map(const Graph& _graph, const Value& _value)
49 : Parent(_graph, _value) {}
54 template <typename _Graph>
55 class ItemSetTraits<_Graph, typename _Graph::Edge> {
60 typedef typename Graph::Edge Item;
61 typedef typename Graph::EdgeIt ItemIt;
63 template <typename _Value>
64 class Map : public Graph::template EdgeMap<_Value> {
66 typedef typename Graph::template EdgeMap<_Value> Parent;
67 typedef typename Parent::Value Value;
69 Map(const Graph& _graph) : Parent(_graph) {}
70 Map(const Graph& _graph, const Value& _value)
71 : Parent(_graph, _value) {}
76 template <typename _Graph>
77 class ItemSetTraits<_Graph, typename _Graph::UEdge> {
82 typedef typename Graph::UEdge Item;
83 typedef typename Graph::UEdgeIt ItemIt;
85 template <typename _Value>
86 class Map : public Graph::template UEdgeMap<_Value> {
88 typedef typename Graph::template UEdgeMap<_Value> Parent;
89 typedef typename Parent::Value Value;
91 Map(const Graph& _graph) : Parent(_graph) {}
92 Map(const Graph& _graph, const Value& _value)
93 : Parent(_graph, _value) {}
99 template <typename _Graph>
100 class ItemSetTraits<_Graph, typename _Graph::ANode> {
103 typedef _Graph Graph;
105 typedef typename Graph::ANode Item;
106 typedef typename Graph::ANodeIt ItemIt;
108 template <typename _Value>
109 class Map : public Graph::template ANodeMap<_Value> {
111 typedef typename Graph::template ANodeMap<_Value> Parent;
112 typedef typename Parent::Value Value;
114 Map(const Graph& _graph) : Parent(_graph) {}
115 Map(const Graph& _graph, const Value& _value)
116 : Parent(_graph, _value) {}
121 template <typename _Graph>
122 class ItemSetTraits<_Graph, typename _Graph::BNode> {
125 typedef _Graph Graph;
127 typedef typename Graph::BNode Item;
128 typedef typename Graph::BNodeIt ItemIt;
130 template <typename _Value>
131 class Map : public Graph::template BNodeMap<_Value> {
133 typedef typename Graph::template BNodeMap<_Value> Parent;
134 typedef typename Parent::Value Value;
136 Map(const Graph& _graph) : Parent(_graph) {}
137 Map(const Graph& _graph, const Value& _value)
138 : Parent(_graph, _value) {}
144 template <typename Map, typename Enable = void>
146 typedef False ReferenceMapTag;
148 typedef typename Map::Key Key;
149 typedef typename Map::Value Value;
151 typedef const Value ConstReturnValue;
152 typedef const Value ReturnValue;
155 template <typename Map>
157 Map, typename enable_if<typename Map::ReferenceMapTag, void>::type >
159 typedef True ReferenceMapTag;
161 typedef typename Map::Key Key;
162 typedef typename Map::Value Value;
164 typedef typename Map::ConstReference ConstReturnValue;
165 typedef typename Map::Reference ReturnValue;
167 typedef typename Map::ConstReference ConstReference;
168 typedef typename Map::Reference Reference;
171 // Indicators for the tags
173 template <typename Graph, typename Enable = void>
174 struct NodeNumTagIndicator {
175 static const bool value = false;
178 template <typename Graph>
179 struct NodeNumTagIndicator<
181 typename enable_if<typename Graph::NodeNumTag, void>::type
183 static const bool value = true;
186 template <typename Graph, typename Enable = void>
187 struct EdgeNumTagIndicator {
188 static const bool value = false;
191 template <typename Graph>
192 struct EdgeNumTagIndicator<
194 typename enable_if<typename Graph::EdgeNumTag, void>::type
196 static const bool value = true;
199 template <typename Graph, typename Enable = void>
200 struct FindEdgeTagIndicator {
201 static const bool value = false;
204 template <typename Graph>
205 struct FindEdgeTagIndicator<
207 typename enable_if<typename Graph::FindEdgeTag, void>::type
209 static const bool value = true;
216 #endif // LEMON_MAPS_H