common
Class PermutationDistrib

java.lang.Object
  extended by common.PermutationDistrib
All Implemented Interfaces:
java.io.Serializable

public class PermutationDistrib
extends java.lang.Object
implements java.io.Serializable

Defines, for each n, a distribution over the permutations of the sequence 0,...,n-1. The probability of a permutation depends on how many inversions it has (see the comments in Permutation.java). The distribution over the number of inversions is a geometric distribution, truncated at the maximum number of inversions that a permutation of 0,...,n-1 can have. Among permutations with a given number of inversions, the distribution is uniform. A PermutationDistrib has one parameter, the parameter alpha of the geometric distribution over the number of inversions. One way to think about how to set this parameter is to note that the probability of getting a permutation with no inversions (namely the original sequence 0,...n-1) is 1 - alpha.

See Also:
Serialized Form

Constructor Summary
PermutationDistrib()
          Creates a PermutationDistrib with alpha = 0.5.
PermutationDistrib(double alpha)
          Creates a PermutationDistrib with the given alpha parameter.
 
Method Summary
 double getLogProb(int[] pi)
          Returns the log probability of the given permutation.
 double getProb(int[] pi)
          Returns the probability of the given permutation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PermutationDistrib

public PermutationDistrib()
Creates a PermutationDistrib with alpha = 0.5.


PermutationDistrib

public PermutationDistrib(double alpha)
Creates a PermutationDistrib with the given alpha parameter.

Method Detail

getProb

public double getProb(int[] pi)
Returns the probability of the given permutation.


getLogProb

public double getLogProb(int[] pi)
Returns the log probability of the given permutation.