[Lemon-commits] Alpar Juttner: Merge
Lemon HG
hg at lemon.cs.elte.hu
Mon Jan 10 09:35:33 CET 2011
details: http://lemon.cs.elte.hu/hg/lemon/rev/9312d6c89d02
changeset: 1026:9312d6c89d02
user: Alpar Juttner <alpar [at] cs.elte.hu>
date: Mon Jan 10 09:34:50 2011 +0100
description:
Merge
diffstat:
doc/coding_style.dox | 4 +-
doc/groups.dox | 10 +-
lemon/capacity_scaling.h | 6 +-
lemon/core.h | 2 +-
lemon/cost_scaling.h | 11 +-
lemon/cycle_canceling.h | 9 +-
lemon/euler.h | 2 +-
lemon/grosso_locatelli_pullan_mc.h | 228 ++++++++++++++++++++++++++++++++-----
lemon/network_simplex.h | 16 +-
lemon/path.h | 28 ++--
test/max_clique_test.cc | 50 +++++---
11 files changed, 271 insertions(+), 95 deletions(-)
diffs (truncated from 808 to 300 lines):
diff --git a/doc/coding_style.dox b/doc/coding_style.dox
--- a/doc/coding_style.dox
+++ b/doc/coding_style.dox
@@ -98,10 +98,10 @@
\subsection pri-loc-var Private member variables
-Private member variables should start with underscore
+Private member variables should start with underscore.
\code
-_start_with_underscores
+_start_with_underscore
\endcode
\subsection cs-excep Exceptions
diff --git a/doc/groups.dox b/doc/groups.dox
--- a/doc/groups.dox
+++ b/doc/groups.dox
@@ -406,10 +406,10 @@
- \ref CycleCanceling Cycle-Canceling algorithms, two of which are
strongly polynomial \ref klein67primal, \ref goldberg89cyclecanceling.
-In general NetworkSimplex is the most efficient implementation,
-but in special cases other algorithms could be faster.
+In general, \ref NetworkSimplex and \ref CostScaling are the most efficient
+implementations, but the other two algorithms could be faster in special cases.
For example, if the total supply and/or capacities are rather small,
-CapacityScaling is usually the fastest algorithm (without effective scaling).
+\ref CapacityScaling is usually the fastest algorithm (without effective scaling).
*/
/**
@@ -471,7 +471,7 @@
- \ref HowardMmc Howard's policy iteration algorithm
\ref dasdan98minmeancycle.
-In practice, the \ref HowardMmc "Howard" algorithm proved to be by far the
+In practice, the \ref HowardMmc "Howard" algorithm turned out to be by far the
most efficient one, though the best known theoretical bound on its running
time is exponential.
Both \ref KarpMmc "Karp" and \ref HartmannOrlinMmc "Hartmann-Orlin" algorithms
@@ -539,7 +539,7 @@
*/
/**
- at defgroup planar Planarity Embedding and Drawing
+ at defgroup planar Planar Embedding and Drawing
@ingroup algs
\brief Algorithms for planarity checking, embedding and drawing
diff --git a/lemon/capacity_scaling.h b/lemon/capacity_scaling.h
--- a/lemon/capacity_scaling.h
+++ b/lemon/capacity_scaling.h
@@ -89,8 +89,8 @@
/// \warning Both \c V and \c C must be signed number types.
/// \warning All input data (capacities, supply values, and costs) must
/// be integer.
- /// \warning This algorithm does not support negative costs for such
- /// arcs that have infinite upper bound.
+ /// \warning This algorithm does not support negative costs for
+ /// arcs having infinite upper bound.
#ifdef DOXYGEN
template <typename GR, typename V, typename C, typename TR>
#else
@@ -423,7 +423,7 @@
/// calling \ref run(), the supply of each node will be set to zero.
///
/// Using this function has the same effect as using \ref supplyMap()
- /// with such a map in which \c k is assigned to \c s, \c -k is
+ /// with a map in which \c k is assigned to \c s, \c -k is
/// assigned to \c t and all other nodes have zero supply value.
///
/// \param s The source node.
diff --git a/lemon/core.h b/lemon/core.h
--- a/lemon/core.h
+++ b/lemon/core.h
@@ -447,7 +447,7 @@
}
- /// Check whether a graph is undirected.
+ /// \brief Check whether a graph is undirected.
///
/// This function returns \c true if the given graph is undirected.
#ifdef DOXYGEN
diff --git a/lemon/cost_scaling.h b/lemon/cost_scaling.h
--- a/lemon/cost_scaling.h
+++ b/lemon/cost_scaling.h
@@ -97,6 +97,9 @@
/// can be viewed as the generalization of the \ref Preflow
/// "preflow push-relabel" algorithm for the maximum flow problem.
///
+ /// In general, \ref NetworkSimplex and \ref CostScaling are the fastest
+ /// implementations available in LEMON for this problem.
+ ///
/// Most of the parameters of the problem (except for the digraph)
/// can be given using separate functions, and the algorithm can be
/// executed using the \ref run() function. If some parameters are not
@@ -116,8 +119,8 @@
/// \warning Both \c V and \c C must be signed number types.
/// \warning All input data (capacities, supply values, and costs) must
/// be integer.
- /// \warning This algorithm does not support negative costs for such
- /// arcs that have infinite upper bound.
+ /// \warning This algorithm does not support negative costs for
+ /// arcs having infinite upper bound.
///
/// \note %CostScaling provides three different internal methods,
/// from which the most efficient one is used by default.
@@ -179,7 +182,7 @@
/// in their base operations, which are used in conjunction with the
/// relabel operation.
/// By default, the so called \ref PARTIAL_AUGMENT
- /// "Partial Augment-Relabel" method is used, which proved to be
+ /// "Partial Augment-Relabel" method is used, which turned out to be
/// the most efficient and the most robust on various test inputs.
/// However, the other methods can be selected using the \ref run()
/// function with the proper parameter.
@@ -448,7 +451,7 @@
/// calling \ref run(), the supply of each node will be set to zero.
///
/// Using this function has the same effect as using \ref supplyMap()
- /// with such a map in which \c k is assigned to \c s, \c -k is
+ /// with a map in which \c k is assigned to \c s, \c -k is
/// assigned to \c t and all other nodes have zero supply value.
///
/// \param s The source node.
diff --git a/lemon/cycle_canceling.h b/lemon/cycle_canceling.h
--- a/lemon/cycle_canceling.h
+++ b/lemon/cycle_canceling.h
@@ -68,8 +68,8 @@
/// \warning Both \c V and \c C must be signed number types.
/// \warning All input data (capacities, supply values, and costs) must
/// be integer.
- /// \warning This algorithm does not support negative costs for such
- /// arcs that have infinite upper bound.
+ /// \warning This algorithm does not support negative costs for
+ /// arcs having infinite upper bound.
///
/// \note For more information about the three available methods,
/// see \ref Method.
@@ -117,8 +117,7 @@
///
/// \ref CycleCanceling provides three different cycle-canceling
/// methods. By default, \ref CANCEL_AND_TIGHTEN "Cancel and Tighten"
- /// is used, which proved to be the most efficient and the most robust
- /// on various test inputs.
+ /// is used, which is by far the most efficient and the most robust.
/// However, the other methods can be selected using the \ref run()
/// function with the proper parameter.
enum Method {
@@ -350,7 +349,7 @@
/// calling \ref run(), the supply of each node will be set to zero.
///
/// Using this function has the same effect as using \ref supplyMap()
- /// with such a map in which \c k is assigned to \c s, \c -k is
+ /// with a map in which \c k is assigned to \c s, \c -k is
/// assigned to \c t and all other nodes have zero supply value.
///
/// \param s The source node.
diff --git a/lemon/euler.h b/lemon/euler.h
--- a/lemon/euler.h
+++ b/lemon/euler.h
@@ -36,7 +36,7 @@
///Euler tour iterator for digraphs.
- /// \ingroup graph_prop
+ /// \ingroup graph_properties
///This iterator provides an Euler tour (Eulerian circuit) of a \e directed
///graph (if there exists) and it converts to the \c Arc type of the digraph.
///
diff --git a/lemon/grosso_locatelli_pullan_mc.h b/lemon/grosso_locatelli_pullan_mc.h
--- a/lemon/grosso_locatelli_pullan_mc.h
+++ b/lemon/grosso_locatelli_pullan_mc.h
@@ -46,8 +46,12 @@
/// pair of nodes is connected.
///
/// This class provides a simple but highly efficient and robust heuristic
- /// method that quickly finds a large clique, but not necessarily the
+ /// method that quickly finds a quite large clique, but not necessarily the
/// largest one.
+ /// The algorithm performs a certain number of iterations to find several
+ /// cliques and selects the largest one among them. Various limits can be
+ /// specified to control the running time and the effectiveness of the
+ /// search process.
///
/// \tparam GR The undirected graph type the algorithm runs on.
///
@@ -84,6 +88,22 @@
PENALTY_BASED
};
+ /// \brief Constants for the causes of search termination.
+ ///
+ /// Enum type containing constants for the different causes of search
+ /// termination. The \ref run() function returns one of these values.
+ enum TerminationCause {
+
+ /// The iteration count limit is reached.
+ ITERATION_LIMIT,
+
+ /// The step count limit is reached.
+ STEP_LIMIT,
+
+ /// The clique size limit is reached.
+ SIZE_LIMIT
+ };
+
private:
TEMPLATE_GRAPH_TYPEDEFS(GR);
@@ -93,12 +113,22 @@
typedef std::vector<BoolVector> BoolMatrix;
// Note: vector<char> is used instead of vector<bool> for efficiency reasons
+ // The underlying graph
const GR &_graph;
IntNodeMap _id;
// Internal matrix representation of the graph
BoolMatrix _gr;
int _n;
+
+ // Search options
+ bool _delta_based_restart;
+ int _restart_delta_limit;
+
+ // Search limits
+ int _iteration_limit;
+ int _step_limit;
+ int _size_limit;
// The current clique
BoolVector _clique;
@@ -380,7 +410,9 @@
/// \param graph The undirected graph the algorithm runs on.
GrossoLocatelliPullanMc(const GR& graph) :
_graph(graph), _id(_graph), _rnd(rnd)
- {}
+ {
+ initOptions();
+ }
/// \brief Constructor with random seed.
///
@@ -391,7 +423,9 @@
/// that is used during the algorithm.
GrossoLocatelliPullanMc(const GR& graph, int seed) :
_graph(graph), _id(_graph), _rnd(seed)
- {}
+ {
+ initOptions();
+ }
/// \brief Constructor with random number generator.
///
@@ -402,43 +436,155 @@
/// algorithm.
GrossoLocatelliPullanMc(const GR& graph, const Random& random) :
_graph(graph), _id(_graph), _rnd(random)
- {}
+ {
+ initOptions();
+ }
/// \name Execution Control
+ /// The \ref run() function can be used to execute the algorithm.\n
+ /// The functions \ref iterationLimit(int), \ref stepLimit(int), and
+ /// \ref sizeLimit(int) can be used to specify various limits for the
+ /// search process.
+
/// @{
+
+ /// \brief Sets the maximum number of iterations.
+ ///
+ /// This function sets the maximum number of iterations.
+ /// Each iteration of the algorithm finds a maximal clique (but not
+ /// necessarily the largest one) by performing several search steps
+ /// (node selections).
+ ///
+ /// This limit controls the running time and the success of the
+ /// algorithm. For larger values, the algorithm runs slower, but it more
+ /// likely finds larger cliques. For smaller values, the algorithm is
+ /// faster but probably gives worse results.
+ ///
+ /// The default value is \c 1000.
+ /// \c -1 means that number of iterations is not limited.
+ ///
+ /// \warning You should specify a reasonable limit for the number of
+ /// iterations and/or the number of search steps.
+ ///
+ /// \return <tt>(*this)</tt>
+ ///
+ /// \sa stepLimit(int)
+ /// \sa sizeLimit(int)
+ GrossoLocatelliPullanMc& iterationLimit(int limit) {
+ _iteration_limit = limit;
+ return *this;
More information about the Lemon-commits
mailing list