|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.graph.analysis.strategy.Strategy
ptolemy.graph.analysis.strategy.CachedStrategy
ptolemy.graph.analysis.strategy.KarpCycleMeanStrategy
public class KarpCycleMeanStrategy
An analyzer for computing the maximum/minimum cycle mean of a graph. This implementation uses the Karp's algorithm described in:
A.Dasdan, R.K. Gupta, "Faster Maximum and Minimum Mean Cycle Algorithms for System Performance".
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.
CycleMeanAnalysis
Red (ssb) |
Red (shahrooz) |
Field Summary | |
---|---|
private java.util.ArrayList |
_cycle
|
private ToDoubleMapping |
_edgeLengths
|
private boolean |
_maximumAnalysis
|
private java.util.ArrayList |
_nodesOnCycle
|
Constructor Summary | |
---|---|
KarpCycleMeanStrategy(Graph graph,
ToDoubleMapping edgeLengths)
Construct a maximum cycle mean analyzer for a given graph, using the Karp's algorithm. |
Method Summary | |
---|---|
protected java.lang.Object |
_compute()
Perform the graph analysis and return the resulting value. |
private double |
_computeMCMOfSCC(DirectedGraph directedCyclicGraph)
|
private double |
_getCost(Node u,
Node v)
|
java.util.List |
cycle()
Return the nodes on the cycle that corresponds to the maximum/minimum cycle mean as an ordered list. |
double |
cycleMean(boolean maximum)
Finds the cycle mean for a given directed graph. |
double |
maximumCycleMean()
Return the maximum cycle mean. |
double |
minimumCycleMean()
Return minimum cycle mean. |
java.lang.String |
toString()
Return a description of the analyzer. |
boolean |
valid()
Check for compatibility between the analysis and the given graph. |
Methods inherited from class ptolemy.graph.analysis.strategy.CachedStrategy |
---|
_convertResult, _result, cachingStatus, disableCaching, enableCaching, getCachedResult, graph, obsolete, reset, setCachedResult |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface ptolemy.graph.analysis.analyzer.GraphAnalyzer |
---|
graph |
Field Detail |
---|
private boolean _maximumAnalysis
private java.util.ArrayList _nodesOnCycle
private java.util.ArrayList _cycle
private ToDoubleMapping _edgeLengths
Constructor Detail |
---|
public KarpCycleMeanStrategy(Graph graph, ToDoubleMapping edgeLengths)
graph
- The given graph.edgeLengths
- The lengths associated with the edges of the given
graph.Method Detail |
---|
public java.util.List cycle()
cycle
in interface CycleMeanAnalyzer
public double cycleMean(boolean maximum)
maximum
- True if the maximum cycle mean is requested.
public double maximumCycleMean()
maximumCycleMean
in interface CycleMeanAnalyzer
public double minimumCycleMean()
minimumCycleMean
in interface CycleMeanAnalyzer
public java.lang.String toString()
toString
in interface Analyzer
toString
in class CachedStrategy
public boolean valid()
valid
in interface Analyzer
protected java.lang.Object _compute()
CachedStrategy
CachedStrategy.getCachedResult()
provides the result of the
previous invocation of the analysis; this value can be
used, for example, to facilitate incremental analyses.
This method just returns null, and will typically be overridden
in each derived class to perform the appropriate graph analysis.
_compute
in class CachedStrategy
private double _computeMCMOfSCC(DirectedGraph directedCyclicGraph)
private double _getCost(Node u, Node v)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |