template<typename GR, typename CM, typename TR>
class lemon::HowardMmc< GR, CM, TR >
This class implements Howard's policy iteration algorithm for finding a directed cycle of minimum mean cost in a digraph [9], [10]. This class provides the most efficient algorithm for the minimum mean cycle problem, though the best known theoretical bound on its running time is exponential.
- Template Parameters
-
GR | The type of the digraph the algorithm runs on. |
CM | The type of the cost map. The default map type is GR::ArcMap<int>. |
TR | The traits class that defines various types used by the algorithm. By default, it is HowardMmcDefaultTraits<GR, CM>. In most cases, this parameter should not be set directly, consider to use the named template parameters instead. |
|
| HowardMmc (const Digraph &digraph, const CostMap &cost) |
| Constructor.
|
|
| ~HowardMmc () |
| Destructor.
|
|
HowardMmc & | cycle (Path &path) |
| Set the path structure for storing the found cycle.
|
|
HowardMmc & | tolerance (const Tolerance &tolerance) |
| Set the tolerance used by the algorithm.
|
|
const Tolerance & | tolerance () const |
| Return a const reference to the tolerance.
|
|
|
The simplest way to execute the algorithm is to call the run() function.
If you only need the minimum mean cost, you may call findCycleMean().
|
bool | run () |
| Run the algorithm.
|
|
TerminationCause | findCycleMean (int limit=std::numeric_limits< int >::max()) |
| Find the minimum cycle mean (or an upper bound).
|
|
bool | findCycle () |
| Find a minimum mean directed cycle.
|
|
|
The results of the algorithm can be obtained using these functions.
The algorithm should be executed before using them.
|
Cost | cycleCost () const |
| Return the total cost of the found cycle.
|
|
int | cycleSize () const |
| Return the number of arcs on the found cycle.
|
|
double | cycleMean () const |
| Return the mean cost of the found cycle.
|
|
const Path & | cycle () const |
| Return the found cycle.
|
|
This function finds the minimum mean cost of the directed cycles in the digraph (or an upper bound for it).
By default, the function finds the exact minimum cycle mean, but an optional limit can also be specified for the number of iterations performed during the search process. The return value indicates if the optimal solution is found or the iteration limit is reached. In the latter case, an approximate solution is provided, which corresponds to a directed cycle whose mean cost is relatively small, but not necessarily minimal.
- Parameters
-
limit | The maximum allowed number of iterations during the search process. Its default value implies that the algorithm runs until it finds the exact optimal solution. |
- Returns
- The termination cause of the search process. For more information, see TerminationCause.