ptolemy.graph.analysis
Class CycleMeanAnalysis

java.lang.Object
  extended by ptolemy.graph.analysis.Analysis
      extended by ptolemy.graph.analysis.CycleMeanAnalysis

public class CycleMeanAnalysis
extends Analysis

An analysis to calculate the maximum/minimum cycle mean of a directed cyclic graph.

The analyzer associated to this analysis, adds up the cost of the edges on different cycles and divides it by the number of edges in that cycle, then picks the maximum/minimum of them.

Strongly connected components are being processed separately, and the cycle mean has the maximum/minimum value among them. When there are multiple edges between two nodes, the edge with the maximum/minimum weight is considered for the cycle that gives the maximum/minimum cycle mean.

Note that the mathematical definition of maximum cycle mean and maximum profit to cost are different, though some time the name "maximum cycle mean" is used to refer to the maximum profit to cost ratio.

For a detailed mathematical description of the problem, refer to:

Ali Dasdan , Sandy S. Irani , Rajesh K. Gupta, Efficient algorithms for optimum cycle mean and optimum cost to time ratio problems, Proceedings of the 36th ACM/IEEE conference on Design automation conference, p.37-42, June 21-25, 1999, New Orleans, Louisiana, United States

Since:
Ptolemy II 4.0
Version:
$Id: CycleMeanAnalysis.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Shahrooz Shahparnia
See Also:
MaximumProfitToCostRatioAnalysis
Accepted Rating:
Red (ssb)
Proposed Rating:
Red (shahrooz)

Constructor Summary
CycleMeanAnalysis(CycleMeanAnalyzer analyzer)
          Construct a maximum cycle mean analysis associated with a graph with a given analyzer.
CycleMeanAnalysis(Graph graph, ToDoubleMapping edgeLengths)
          Construct a maximum cycle mean analysis associated with a graph with a default analyzer.
 
Method Summary
 java.util.List cycle()
          Return the nodes on the cycle that corresponds to the maximum/minimum cycle mean as an ordered list.
 double maximumCycleMean()
          Return the maximum cycle mean value.
 double minimumCycleMean()
          Return minimum cycle mean value.
 java.lang.String toString()
          Return a description of the analysis and the associated analyzer.
 boolean validAnalyzerInterface(Analyzer analyzer)
          Check if a given analyzer is compatible with this analysis.
 
Methods inherited from class ptolemy.graph.analysis.Analysis
analyzer, changeAnalyzer, graph, valid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CycleMeanAnalysis

public CycleMeanAnalysis(Graph graph,
                         ToDoubleMapping edgeLengths)
Construct a maximum cycle mean analysis associated with a graph with a default analyzer.

Parameters:
graph - The given graph.
edgeLengths - The lengths associated with the edges of the graph.

CycleMeanAnalysis

public CycleMeanAnalysis(CycleMeanAnalyzer analyzer)
Construct a maximum cycle mean analysis associated with a graph with a given analyzer.

Parameters:
analyzer - The given analyzer.
Method Detail

cycle

public java.util.List cycle()
Return the nodes on the cycle that corresponds to the maximum/minimum cycle mean as an ordered list. If there is more than one cycle with the same maximal/minimal cycle mean, one of them is returned randomly, but the same cycle is returned by different invocations of the method, unless the graph changes.

Returns:
The nodes on the cycle that corresponds to one of the maximum/minimum cycle means as an ordered list.

maximumCycleMean

public double maximumCycleMean()
Return the maximum cycle mean value.

Returns:
The maximum cycle mean value.

minimumCycleMean

public double minimumCycleMean()
Return minimum cycle mean value.

Returns:
The minimum cycle mean value.

toString

public java.lang.String toString()
Return a description of the analysis and the associated analyzer.

Overrides:
toString in class Analysis
Returns:
A description of the analysis and the associated analyzer.

validAnalyzerInterface

public boolean validAnalyzerInterface(Analyzer analyzer)
Check if a given analyzer is compatible with this analysis. In other words if it is possible to use it to compute the computation associated with this analysis.

Overrides:
validAnalyzerInterface in class Analysis
Parameters:
analyzer - The given analyzer.
Returns:
True if the given analyzer is valid for this analysis.