sdsu.algorithms.data
Class GeneralizedEightyTwenty

java.lang.Object
  |
  +--sdsu.algorithms.data.ProbabilityDistribution
        |
        +--sdsu.algorithms.data.DiscreteProbability
              |
              +--sdsu.algorithms.data.NoInverseDistribution
                    |
                    +--sdsu.algorithms.data.GeneralizedEightyTwenty

public class GeneralizedEightyTwenty
extends NoInverseDistribution

The 80%-20% rule states that 80% of the programs resources are consumed by 20% of the code. Computing folklore contains claims that this rule applies to various aspects of computing. To generalize the rule assume we have N consumers (lines of code, etc). Label the consumers 1, 2, ..., N, ordered by percent of resources ( time, memory, etc) by the consumer. So consumer 1 consumes the most resources, consumer N consumes the least resources. The generalized rule states that alpha per cent of the resources are consumed by the first (100% - alpha) % of the consumers, and so on recursively, where .5 <= alpha <= 1. Reference: Handbook of Algorithms and Data Structures, G. H. Gonnet, Addison-Wesley, 1984, pp 207-208.

Version:
1.0 12 June 1997
Author:
Roger Whitney (whitney@cs.sdsu.edu)

Constructor Summary
GeneralizedEightyTwenty(double percentConsumed, int numberOfConsumers)
          Returns a GeneralizedEightyTwenty distribution.
 
Method Summary
 double density(double indexOfConsumer)
          Returns the probability of an item in the sample space will occur.
 double mean()
          Returns the aproximate mean of the probability distribution.
 double variance()
          Returns the variance of the probability distribution.
 
Methods inherited from class sdsu.algorithms.data.NoInverseDistribution
nextElement
 
Methods inherited from class sdsu.algorithms.data.DiscreteProbability
distribution
 
Methods inherited from class sdsu.algorithms.data.ProbabilityDistribution
density
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeneralizedEightyTwenty

public GeneralizedEightyTwenty(double percentConsumed,
                               int numberOfConsumers)
Returns a GeneralizedEightyTwenty distribution.
Parameters:
percentConsumed - Percent of resources consumed by 100 - percentConsumed of consumer.
Throws:
OutOfBoundsException - thrown if percentConsumed is not greater in the interval [.5, 1].
Method Detail

density

public double density(double indexOfConsumer)
               throws OutOfBoundsException
Returns the probability of an item in the sample space will occur. sampleSpaceItem must be either 0 or 1.
Parameters:
sampleSpaceItem - an integer value in the interval [1, populationSize]. Is cast to int in density.
Throws:
OutOfBoundsException - thrown if sampleSpaceItem is not either 0 or 1.
Overrides:
density in class ProbabilityDistribution

mean

public double mean()
Returns the aproximate mean of the probability distribution. The value is off by O(1/N), N = numberOfConsumers.
Overrides:
mean in class ProbabilityDistribution

variance

public double variance()
Returns the variance of the probability distribution. The value is off by O(N^(1-theta), theta = ln(percentConsumed)/ ln( 1 - percentConsumed), and N = numberOfConsumers.
Overrides:
variance in class ProbabilityDistribution