All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sdsu.algorithms.data.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 Index

 o GeneralizedEightyTwenty(double, int)
Returns a GeneralizedEightyTwenty distribution.

Method Index

 o density(double)
Returns the probability of an item in the sample space will occur.
 o mean()
Returns the aproximate mean of the probability distribution.
 o variance()
Returns the variance of the probability distribution.

Constructors

 o 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].

Methods

 o 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
 o 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
 o 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

All Packages  Class Hierarchy  This Package  Previous  Next  Index