public class CustomDistribution
extends java.lang.Object
implements java.io.Serializable
Modifier and Type  Class and Description 

static class 
CustomDistribution.InterpolationType 
Modifier and Type  Field and Description 

static CustomDistribution.InterpolationType 
INTERPOLATION_LINEAR 
static CustomDistribution.InterpolationType 
INTERPOLATION_NONE 
static CustomDistribution.InterpolationType 
INTERPOLATION_STEP 
Constructor and Description 

CustomDistribution(double[] observations)
Constructs a custom empirical distribution from the given array of
observations.

CustomDistribution(double[] intervalStarts,
double[] numberOfObservations)
Constructs a custom empirical distribution from the given arrays of interval starts and number
of observations found in the corresponding intervals.

CustomDistribution(double[] values,
double[] rates,
CustomDistribution.InterpolationType interpolationtype)
Constructs a custom distribution from the given arrays of values and rates, and
a given interpolation type.

CustomDistribution(double[] values,
double[] rates,
CustomDistribution.InterpolationType interpolationtype,
java.util.Random rng)
Constructs a custom distribution from the given arrays of values and rates, and
a given interpolation type.

CustomDistribution(double[] values,
double[] rates,
CustomDistribution.InterpolationType interpolationtype,
Utilities owner)
Constructs a custom distribution from the given arrays of values and rates, and
a given interpolation type.

CustomDistribution(double[] intervalStarts,
double[] numberOfObservations,
java.util.Random rng)
Constructs a custom empirical distribution from the given arrays of interval starts and number
of observations found in the corresponding intervals.

CustomDistribution(double[] intervalStarts,
double[] numberOfObservations,
Utilities owner)
Constructs a custom empirical distribution from the given arrays of interval starts and number
of observations found in the corresponding intervals.

CustomDistribution(double[] intervalStarts,
int[] numberOfObservations)
Constructs a custom empirical distribution from the given arrays of interval starts and number
of observations found in the corresponding intervals.

CustomDistribution(double[] intervalStarts,
int[] numberOfObservations,
java.util.Random rng)
Constructs a custom empirical distribution from the given arrays of interval starts and number
of observations found in the corresponding intervals.

CustomDistribution(double[] intervalStarts,
int[] numberOfObservations,
Utilities owner)
Constructs a custom empirical distribution from the given arrays of interval starts and number
of observations found in the corresponding intervals.

CustomDistribution(double[] observations,
java.util.Random rng)
Constructs a custom empirical distribution from the given array of
observations.

CustomDistribution(double[] observations,
Utilities owner)
Constructs a custom empirical distribution from the given array of
observations.

CustomDistribution(int[] observations)
Constructs a custom discrete empirical distribution from the given array of discrete
observations.

CustomDistribution(int[] intervalStarts,
double[] numberOfObservations)
Constructs a custom empirical distribution from the given arrays of interval starts and number
of observations found in the corresponding intervals.

CustomDistribution(int[] intervalStarts,
double[] numberOfObservations,
java.util.Random rng)
Constructs a custom empirical distribution from the given arrays of interval starts and number
of observations found in the corresponding intervals.

CustomDistribution(int[] intervalStarts,
double[] numberOfObservations,
Utilities owner)
Constructs a custom empirical distribution from the given arrays of interval starts and number
of observations found in the corresponding intervals.

CustomDistribution(int[] intervalStarts,
int[] numberOfObservations)
Constructs a custom empirical distribution from the given arrays of interval starts and number
of observations found in the corresponding intervals.

CustomDistribution(int[] intervalStarts,
int[] numberOfObservations,
java.util.Random rng)
Constructs a custom empirical distribution from the given arrays of interval starts and number
of observations found in the corresponding intervals.

CustomDistribution(int[] intervalStarts,
int[] numberOfObservations,
Utilities owner)
Constructs a custom empirical distribution from the given arrays of interval starts and number
of observations found in the corresponding intervals.

CustomDistribution(int[] observations,
java.util.Random rng)
Constructs a custom discrete empirical distribution from the given array of discrete
observations.

CustomDistribution(int[] observations,
Utilities owner)
Constructs a custom discrete empirical distribution from the given array of discrete
observations.

CustomDistribution(TableFunction table)
Constructs a custom distribution from a given TableFunction.

CustomDistribution(TableFunction table,
java.util.Random rng)
Constructs a custom distribution from a given TableFunction.

Modifier and Type  Method and Description 

double 
get()
Returns a random value distributed according to the given table of (value,rate) pairs.

double 
get(double min,
double max,
double shift,
double stretch)
Generates a sample of truncated custom distribution.
This method uses the random number generator set during construction and throws exception if no RNG was set. This distribution is sketched by sketch coefficient,
then shifted to the right by shift , after that it is
truncated to fit in [min, max] interval. 
double 
get(double min,
double max,
double shift,
double stretch,
java.util.Random rng)
Generates a sample of truncated custom distribution.
This method requires a random number generator. 
double 
get(java.util.Random rng)
Returns a random value distributed according to the given table of (value,rate) pairs.

int 
getInt()
Returns a random value distributed according to the given table of (value,rate) pairs.

int 
getInt(java.util.Random rng)
Returns a random value distributed according to the given table of (value,rate) pairs.

java.lang.String 
toString()
Returns the textual representation of the custom distribution.

public static final CustomDistribution.InterpolationType INTERPOLATION_NONE
public static final CustomDistribution.InterpolationType INTERPOLATION_STEP
public static final CustomDistribution.InterpolationType INTERPOLATION_LINEAR
public CustomDistribution(int[] intervalStarts, int[] numberOfObservations)
intervalStarts
 the array of interval starts (2 or more, no duplicates, can be sorted or not),
the last number is the end of the last intervalnumberOfObservations
 the array of observation counters (same size as values, no negative rates),
the last number isn't actually used, it is assumed to be zero.public CustomDistribution(int[] intervalStarts, int[] numberOfObservations, java.util.Random rng)
Agent
or Experiment
.intervalStarts
 the array of interval starts (2 or more, no duplicates, can be sorted or not),
the last number is the end of the last intervalnumberOfObservations
 the array of observation counters (same size as values, no negative rates),
the last number isn't actually used, it is assumed to be zero.rng
 the random number generator that will be usedpublic CustomDistribution(int[] intervalStarts, int[] numberOfObservations, Utilities owner)
owner
(agent/experiment).intervalStarts
 the array of interval starts (2 or more, no duplicates, can be sorted or not),
the last number is the end of the last intervalnumberOfObservations
 the array of observation counters (same size as values, no negative rates),
the last number isn't actually used, it is assumed to be zero.owner
 owner of distribution, will be used as a source of random number generationpublic CustomDistribution(int[] intervalStarts, double[] numberOfObservations)
intervalStarts
 the array of interval starts (2 or more, no duplicates, can be sorted or not),
the last number is the end of the last intervalnumberOfObservations
 the array of observation counters (same size as values, no negative rates),
the last number isn't actually used, it is assumed to be zero.public CustomDistribution(int[] intervalStarts, double[] numberOfObservations, java.util.Random rng)
Agent
or Experiment
.intervalStarts
 the array of interval starts (2 or more, no duplicates, can be sorted or not),
the last number is the end of the last intervalnumberOfObservations
 the array of observation counters (same size as values, no negative rates),
the last number isn't actually used, it is assumed to be zero.rng
 the random number generator that will be usedpublic CustomDistribution(int[] intervalStarts, double[] numberOfObservations, Utilities owner)
owner
(agent/experiment).intervalStarts
 the array of interval starts (2 or more, no duplicates, can be sorted or not),
the last number is the end of the last intervalnumberOfObservations
 the array of observation counters (same size as values, no negative rates),
the last number isn't actually used, it is assumed to be zero.owner
 owner of distribution, will be used as a source of random number generationpublic CustomDistribution(double[] intervalStarts, int[] numberOfObservations)
intervalStarts
 the array of interval starts (2 or more, no duplicates, can be sorted or not),
the last number is the end of the last intervalnumberOfObservations
 the array of observation counters (same size as values, no negative rates),
the last number isn't actually used, it is assumed to be zero.public CustomDistribution(double[] intervalStarts, int[] numberOfObservations, java.util.Random rng)
Agent
or Experiment
.intervalStarts
 the array of interval starts (2 or more, no duplicates, can be sorted or not),
the last number is the end of the last intervalnumberOfObservations
 the array of observation counters (same size as values, no negative rates),
the last number isn't actually used, it is assumed to be zero.rng
 the random number generator that will be usedpublic CustomDistribution(double[] intervalStarts, int[] numberOfObservations, Utilities owner)
owner
(agent/experiment).intervalStarts
 the array of interval starts (2 or more, no duplicates, can be sorted or not),
the last number is the end of the last intervalnumberOfObservations
 the array of observation counters (same size as values, no negative rates),
the last number isn't actually used, it is assumed to be zero.owner
 owner of distribution, will be used as a source of random number generationpublic CustomDistribution(double[] intervalStarts, double[] numberOfObservations)
intervalStarts
 the array of interval starts (2 or more, no duplicates, can be sorted or not),
the last number is the end of the last intervalnumberOfObservations
 the array of observation counters (same size as values, no negative rates),
the last number isn't actually used, it is assumed to be zero.public CustomDistribution(double[] intervalStarts, double[] numberOfObservations, java.util.Random rng)
Agent
or Experiment
.intervalStarts
 the array of interval starts (2 or more, no duplicates, can be sorted or not),
the last number is the end of the last intervalnumberOfObservations
 the array of observation counters (same size as values, no negative rates),
the last number isn't actually used, it is assumed to be zero.rng
 the random number generator that will be usedpublic CustomDistribution(double[] intervalStarts, double[] numberOfObservations, Utilities owner)
owner
(agent/experiment).intervalStarts
 the array of interval starts (2 or more, no duplicates, can be sorted or not),
the last number is the end of the last intervalnumberOfObservations
 the array of observation counters (same size as values, no negative rates),
the last number isn't actually used, it is assumed to be zero.owner
 owner of distribution, will be used as a source of random number generationpublic CustomDistribution(double[] values, double[] rates, CustomDistribution.InterpolationType interpolationtype)
values
 the array of values (2 or more, no duplicates, can be sorted or not)rates
 the array of probability rates (same size as values, no negative rates)interpolationtype
 the interpolation type: INTERPOLATION_NONE, INTERPOLATION_STEP, or INTERPOLATION_LINEARpublic CustomDistribution(TableFunction table)
table
 the table functionpublic CustomDistribution(double[] values, double[] rates, CustomDistribution.InterpolationType interpolationtype, java.util.Random rng)
Agent
or Experiment
.values
 the array of values (2 or more, no duplicates, can be sorted or not)rates
 the array of probability rates (same size as values, no negative rates)interpolationtype
 the interpolation type: INTERPOLATION_NONE, INTERPOLATION_STEP, or INTERPOLATION_LINEARrng
 the random number generator that will be usedpublic CustomDistribution(double[] values, double[] rates, CustomDistribution.InterpolationType interpolationtype, Utilities owner)
owner
(agent/experiment).values
 the array of values (2 or more, no duplicates, can be sorted or not)rates
 the array of probability rates (same size as values, no negative rates)interpolationtype
 the interpolation type: INTERPOLATION_NONE, INTERPOLATION_STEP, or INTERPOLATION_LINEARowner
 owner of distribution, will be used as a source of random number generationpublic CustomDistribution(TableFunction table, java.util.Random rng)
Agent
or Experiment
.table
 the table functionrng
 the random number generator that will be usedpublic CustomDistribution(double[] observations)
observations
 the array of observed values (at least one value, can be sorted or not)public CustomDistribution(double[] observations, Utilities owner)
owner
(agent/experiment).observations
 the array of observed values (at least one value, can be sorted or not)owner
 owner of distribution, will be used as a source of random number generationpublic CustomDistribution(double[] observations, java.util.Random rng)
Agent
or Experiment
.observations
 the array of observed values (at least one value, can be sorted or not)rng
 the random number generator that will be usedpublic CustomDistribution(int[] observations)
observations
 the array of observed values (at least one value, can be sorted or not)public CustomDistribution(int[] observations, java.util.Random rng)
Agent
or Experiment
.observations
 the array of observed values (at least one value, can be sorted or not)public CustomDistribution(int[] observations, Utilities owner)
owner
(agent/experiment).observations
 the array of observed values (at least one value, can be sorted or not)owner
 owner of distribution, will be used as a source of random number generationpublic int getInt(java.util.Random rng)
Agent
or an Experiment
and wish to use the default RNG of the
simulation engine you may write get( getDefaultRandomGenerator() ).rng
 the random number generator to be used.public double get(java.util.Random rng)
Agent
or an Experiment
and wish to use the default RNG of the
simulation engine you may write get( getDefaultRandomGenerator() ).rng
 the random number generator to be used.public double get()
public int getInt()
public double get(double min, double max, double shift, double stretch, java.util.Random rng)
Agent
or an Experiment
and wish to use the default RNG of the
simulation engine you may write get( getDefaultRandomGenerator() ).sketch
coefficient,
then shifted to the right by shift
, after that it is
truncated to fit in [min, max]
interval.
Truncation is performed by discarding
every sample outside this interval and taking subsequent try.get(Random)
min
 the minimum value that this function will return.
The distribution is truncated to return values above this.
If the sample (stretched and shifted) is below this value
it will be discarded and another sample will be drawn.
Use infinity
for "No limit".max
 the maximum value that this function will return.
The distribution is truncated to return values below this.
If the sample (stretched and shifted) is bigger than this value
it will be discarded and another sample will be drawn.
Use +infinity
for "No limit".shift
 the shift parameter that indicates how much the
(stretched) distribution will shifted to the rightstretch
 the stretch parameter that indicates how much the
distribution will be stretchedrng
 the random number generator.public double get(double min, double max, double shift, double stretch)
sketch
coefficient,
then shifted to the right by shift
, after that it is
truncated to fit in [min, max]
interval.
Truncation is performed by discarding
every sample outside this interval and taking subsequent try.get()
min
 the minimum value that this function will return.
The distribution is truncated to return values above this.
If the sample (stretched and shifted) is below this value
it will be discarded and another sample will be drawn.
Use infinity
for "No limit".max
 the maximum value that this function will return.
The distribution is truncated to return values below this.
If the sample (stretched and shifted) is bigger than this value
it will be discarded and another sample will be drawn.
Use +infinity
for "No limit".shift
 the shift parameter that indicates how much the
(stretched) distribution will shifted to the rightstretch
 the stretch parameter that indicates how much the
distribution will be stretchedpublic java.lang.String toString()
toString
in class java.lang.Object
Copyright © AnyLogic North America, LLC. All Rights Reserved.