public class BoltzmannDistribution
extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
protected boolean | 
needsUpdate
Indicates whether the probabilities need to be recomputed 
 | 
protected double[] | 
preferences
The preference values to turn into probabilities 
 | 
protected double[] | 
probs
The output probabilities 
 | 
protected java.util.Random | 
rand
The random object to use for sampling. 
 | 
protected double | 
temperature
The temperature value. 
 | 
protected double[] | 
tempNormalized
The preference values normalized by the temperature 
 | 
| Constructor and Description | 
|---|
BoltzmannDistribution(double[] preferences)
Initializes the distribution with the preference values that are to be turned into a soft max probability distribution. 
 | 
BoltzmannDistribution(double[] preferences,
                     double temperature)
Initializes the distribution with the preference values that are to be turned into a soft max probability distribution and
 a temperature value to control how deterministic the probability output is. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
protected void | 
computeProbs()
Computes the probability distribution. 
 | 
protected void | 
computeTempNormalized()
Computes the temperature normalized preference values 
 | 
double[] | 
getPreferences()
Returns the input preferences 
 | 
double[] | 
getProbabilities()
Returns the output probability distribution. 
 | 
double | 
getTemperature()
Returns the temperature parameter 
 | 
protected double | 
maxTNormed()
Returns the maximum temperature normalized preference 
 | 
int | 
preferenceLength()
Returns the number of elements on which there are preferences 
 | 
int | 
sample()
Samples the output probability distribution. 
 | 
void | 
setPreference(int i,
             double p)
Sets the preference for the ith elemnt 
 | 
void | 
setPreferences(double[] preferences)
Sets the input preferences 
 | 
void | 
setTemperature(double t)
Sets the temperature value to use. 
 | 
protected double[] preferences
protected double temperature
protected double[] tempNormalized
protected double[] probs
protected boolean needsUpdate
protected java.util.Random rand
public BoltzmannDistribution(double[] preferences)
preferences - the preference values to turn into a probability distributionpublic BoltzmannDistribution(double[] preferences,
                             double temperature)
preferences - the preference values to turn into a probability distributiontemperature - a value on 0 < temperature < +infinitypublic double[] getPreferences()
public double getTemperature()
public int preferenceLength()
public double[] getProbabilities()
public void setTemperature(double t)
t - a value on 0 < temperature < +infinitypublic void setPreference(int i,
                          double p)
i - which element to setp - the preference for that elementpublic void setPreferences(double[] preferences)
preferences - the input preferencespublic int sample()
protected void computeProbs()
protected void computeTempNormalized()
protected double maxTNormed()