# List of Supported Distributions¶

Ciw allows a number continuous service and inter-arrival time distributions, as well as empirical, user defined, time dependent, and custom discrete distributions. Note that when choosing parameters for these distributions, ensure that no negative numbers may be sampled. The following are currently supported:

- The Uniform Distribution
- The Deterministic Distribution
- The Triangular Distribution
- The Exponential Distribution
- The Gamma Distribution
- The Truncated Normal Distribution
- The Lognormal Distribution
- The Weibull Distribution
- Empirical Distributions
- Sequential Distributions
- Custom PDFs
- User Defined Distributions
- Time Dependent Distributions
- No Arrivals

## The Uniform Distribution¶

The uniform distribution samples a random number between two numbers a and b. Write a uniform distribution between 4 and 9 as follows:

```
['Uniform', 4.0, 9.0]
```

## The Deterministic Distribution¶

The deterministic distribution is non-stochastic, and produces the same service time repeatedly. Write a deterministic distribution that repeatedly gives a value of 18.2 as follows:

```
['Deterministic', 18.2]
```

## The Triangular Distribution¶

The triangular distribution samples a continuous pdf that rises linearly from its minimum value low to its mode value mode, and then decreases linearly to its highest attainable value high. Write a triangular distribution between 2.1 and 7.6 with mode of 3.4 as follows:

```
['Triangular', 2.1, 7.6, 3.4]
```

## The Exponential Distribution¶

The exponential distribution samples a random number from the negative exponential distribution with mean \(1 / \lambda\). Write an exponential distribution with mean 0.2 as follows:

```
['Exponential', 5]
```

## The Gamma Distribution¶

The gamma distribution samples a random number from the gamma distribution with shape parameter \(\alpha\) and scale parameter \(\beta\). Write a gamma distribution with parameters \(\alpha = 0.6\) and \(\beta = 1.2\) as follows:

```
['Gamma', 0.6, 1.2]
```

## The Truncated Normal Distribution¶

The truncated normal distribution samples a random number from the normal distribution with mean \(\mu\) and standard deviation \(\sigma\). The distribution is truncated at 0, thus if negative numbers are sampled then that observation is resampled until a positive value is sampled. Write a normal distribution with parameters \(\mu = 0.7\) and \(\sigma = 0.4\) as follows:

```
['Normal', 0.7, 0.4]
```

## The Lognormal Distribution¶

The lognormal distribution samples a random number from the log of the normal distribution with mean \(\mu\) and standard deviation \(\sigma\). Write a lognomal distribution, that is a log of the normal distribution with \(\mu = 4.5\) and \(\sigma = 2.0\), as follows:

```
['Lognormal', 4.5, 2.0]
```

## The Weibull Distribution¶

The Weibull distribution samples a random number from the Weibull distribution with scale parameter \(\alpha\) and shape parameter \(\beta\). Write a Weibull distribution with \(\alpha = 0.9\) and \(\beta = 0.8\) as follows:

```
['Weibull', 0.9, 0.8]
```

## Empirical Distributions¶

There are two methods of defining empirical distributions in Ciw, either by inputting a list of observations, or through giving a path to a `.csv`

file containing observations:

Input list of observations:

```
['Empirical', [0.3, 0.3, 0.3, 0.4, 0.5, 0.6, 0.8, 0.9, 1.1, 1.1, 1.1, 1.1]]
```

Input path to `.csv`

file:

```
['Empirical', '<path_to_file>']
```

## Sequential Distributions¶

The sequential distribution takes a list, and iteratively returns the next observation in that list over time. The distribution is cyclic, and so once all elements of the list have been sampled, the sequence of sampled values begins again from the beginning of the list:

```
['Sequential', [0.1, 0.1, 0.2, 0.1, 0.3, 0.2]]
```

## Custom PDFs¶

Ciw allows users to define their own custom PDFs to sample from. This distribution samples from a set of values given a probability for each value, that is sampling the value \(x\) with probability \(P(x)\). For example, if \(P(1.4) = 0.2\), \(P(1.7) = 0.5\), and \(P(1.9) = 0.3\), this is defined in the following way:

```
['Custom', [1.4, 1.7, 1.9], [0.2, 0.5, 0.3]]
```

## User Defined Distributions¶

Ciw allows users to input their own function to generate service and inter-arrival times. This is done by feeding in a function in the following way:

```
['UserDefined', random.random]
```

## Time Dependent Distributions¶

Similar to adding `UserDefined`

functions, Ciw allows for time dependent functions.
These are lambda functions that take in a time parameter.
Ciw uses the simulation’s current time to sample a new service or inter-arrival time:

```
['TimeDependent', time_dependent_function]
```

## No Arrivals¶

If a node does not have any arrivals of a certain class, then the following may be input instead of a distribution:

```
'NoArrivals'
```

Note the lack of square brackets here. Also note that this is only valid for arrivals, and shouldn’t be input into the `Service_distributions`

option.