- Inventory forecasting
- Prioritized ordering report
- Old forecasting input file format
- Old forecasting output file format
- Choosing the service levels
- Managing your inventory settings
- The old Excel forecast report
- Using tags to improve accuracy
- Oddities in classic forecasts
- Oddities in quantile forecasts
- Stock-out's bias on quantile forecasts
- Daily, weekly and monthly aggregations

Home » Resources » Here

Distributions in Envision are practical because they are supported by an entire algebra of distributions. However, in order to generate inventory decisions, it is usually required to transform those distributions back into a

`extend.distrib()`

can be used for this purpose.`Id`

which identifies the item`Min`

, the lower inclusive boundary of the histogram bucket`Max`

, the higher inclusive boundary of the histogram bucket`Value`

, the value associated to the histogram bucket

For a given item, the grid may contains a series of buckets that represent the entire histogram of the distribution. If the distribution is a

Grids are not as flexible as distributions. For performance, it is frequently not possible to maintain buckets having a width of 1. Instead, larger buckets are used instead in order to keep the memory requirements of the grid manageable within Lokad. Non-unit buckets complicate calculations done on grids. Also, by design, grids have

On the other hand, grids are plain

`extend.distrib()`

turns a vector of distributions into a table, as illustrated by the following syntax:
table T = extend.distrib(D) show table "Distribution details" with Id T.Min T.Max T.ProbabilityThe argument

`D`

is expected to be a vector of distributions, as typically produced by Lokad's probabilistic forecasting engine. Table `T`

is typed as an extension of the originating tables, the implicit `Items`

table in the script above. Table `T`

is populated with three fields:`T.Min`

: the inclusive integral lower boundary of the segment`T.Max`

: the inclusive integral higher boundary of the segment`T.Probability`

: the sum of the distribution over the inclusive range

Despite its name, the

`Probability`

field actually refers to the sum of the distribution over the bucket range which is returned.For relatively compact distributions, segments have a length of 1, and hence

`T.Min == T.Max`

. However, if the distribution spreads over higher values, segments of length equal to 1 would end up generating possibly millions of lines, which becomes unmanageable. Hence, when facing such large-valued distributions, Envision auto-aggregates the distributions around larger segments. Algorithms are therefore fine-tuned to keep the size of the generated tables manageable.By design,

`extend.distrib()`

always singles out the zero segment. As a result, the [0;0] segment always gets its own line in the generated table. This behavior is indeed helpful in many business situations where zero demand represents an edge case - such as infinite stock cover - which requires some dedicated logic.Then, three additional overloads for

`extend.distrib()`

are provided in order to gain more control over the specific granularity of the generated table.table T = extend.distrib(D, S)The first argument

`D`

is as defined above. The second argument `S`

is expected to be an integral number. When this second argument is present, the generated table always includes two lines dedicated to the two segments [0;0] and [1;S]. Further segments are auto-generated starting from S+1 as detailed above. The default value for this argument when left unspecified is zero.In practice, argument

`S`

is frequently defined as the sum of the stock available plus the stock on order. Indeed, when reordering, only the demand probabilities which exceed the current stock level should be considered.table T = extend.distrib(D, S, M)The arguments

`D`

and `S`

are as defined above. The third argument `M`

is expected to be an integral number. It represents the desired segment length. Thus, the table includes the list of segments [0;0], [1;S], [S+1;S+M] [S+M+1;S+2M] … If `M`

is zero, then the function falls back on auto-sizing the segments.In practice, forcing segments whose length is equal to 1 would possibly lead to performance issues as the size of the table can be arbitrarily large. Thus, Envision can fall back on a

`M`

instead. Using a multiple ensures that a As a rule of thumb, we suggest not to use this overload unless lot multipliers are involved; and when they are involved, it is suggested to keep

`M`

at zero for any item that does not have a specific lot multiplier.table T = extend.distrib(D, S, M, R)The arguments

`D`

, `S`

and `M`

are as defined above. The fourth argument `R`

is expected to be a non-negative integral number. It represents the desired `T.Max`

is greater or equal to `R`

. The default value for this argument when left unspecified is zero.In practice, this argument is used to cope with large minimal order quantities (MOQs) constraints that can only be satisfied with the generated table iterates far each to cover the MOQ values.

As a rule of thumb, we suggest not to use this overload unless there are MOQs to be reached; and when they are involved, it is suggested to keep

`R`

as small as possible. A small `R`

value does not prevent the table `T`

from reaching higher values, it only ensure that larger values are reached.