Back to blog

The future is uncertain. Yet, nearly all predictive supply chain solutions make the opposite assumption: they assume that their forecasts are correct, and hence roll out their simulations based on those forecasts. Implicitly, the future is assumed to be certain and complications ensue.

From a historical perspective, software engineers were not making those assumptions without a reason: a deterministic future was the only option that the early - and not so early - computers could process at best. Thus, while dealing with an uncertain future was known to be the best approach in theory, in practice, it was not even an option.

Inoltre, all’inizio del XX secolo furono individuati alcuni espedienti matematici per aggirare questo problema. Per esempio, la classica analisi delle scorte di sicurezza presume che sia i tempi di consegna sia la domanda seguano una distribuzione normale. L’ipotesi della distribuzione normale è conveniente dal punto di vista computazionale perché bastano due variabili per modellare il futuro: la media e la varianza.

Ancora una volta, l’ipotesi della distribuzione normale - sia per i tempi di consegna sia per la domanda - si è rivelata errata in quasi tutti i casi, salvo poche eccezioni, e ne sono derivate complicazioni.

Back in 2012 at Lokad, we realized that the classic inventory forecasting approach was simply not working: mean or median forecasts were not addressing the right problem. No matter how much technology we poured on the case, it was not going to work satisfyingly.

Thus, we shifted to quantile forecasts, which can be interpreted as forecasting the future with an intended bias. Soon we realized that quantiles were invariably superior to the classic safety stock analysis, if only because quantiles were zooming in on where it really mattered from a supply chain perspective.

However, while going quantile, we realized that we had lost quite a few things in the process. Indeed, unlike classic mean forecasts, quantile forecasts are not additive, so it was not possible to make sense of a sum of those quantiles for example. In practice, the loss wasn’t too great because since classic forecasts weren’t making much sense in the first place, summing them up wasn’t a reasonable option anyway.

Over the years, while working with quantiles, we realized that so many of the things we took for granted had become a lot more complicated: demand quantities could no longer be summed or subtracted or linearly adjusted. In short, while moving towards an uncertain future, we had lost the tools to operate on this uncertain future.

Nel 2015 abbiamo introdotto le quantile grids. Sebbene le quantile grids non coincidessero ancora esattamente con le nostre previsioni probabilistiche complete, il nostro motore di previsione stava già iniziando a fornire probabilità invece di stime quantili. Le distribuzioni di probabilità sono molto più espressive delle semplici stime quantili e, a quanto pare, è possibile definire un’algebra sulle distribuzioni.

While the term algebra might sound technical, it’s not that complicated; it means that a simple operation such as the sum, the product, the difference, …, can be defined in ways which are not only mathematically consistent, but also highly relevant from the supply chain perspective.

Di conseguenza, poche settimane fa abbiamo integrato direttamente in Envision, il nostro linguaggio specifico di dominio dedicato all’ottimizzazione del commercio, un’algebra delle distribuzioni. Grazie a questa algebra delle distribuzioni, diventa semplice eseguire operazioni apparentemente semplici come sommare due tempi di consegna incerti (per esempio un tempo di consegna di produzione incerto più un tempo di consegna di trasporto incerto). La somma di questi due tempi di consegna avviene tramite un’operazione nota come convoluzione. Sebbene il calcolo in sé sia piuttosto tecnico, in Envision basta scrivere A = B +* C, dove +* è l’operatore di convoluzione usato per sommare variabili casuali indipendenti (*).

Through this algebra of distributions most of the “intuitive” operations which were possible with classic forecasts are back : random variables can be summed, multiplied, stretched, exponentiated, etc. And while relatively complex calculations are taking place behind the scenes, probabilistic formulas are not more complicated than plain Excel formulas from the Envision perspective.

Invece di augurarci che le previsioni siano perfettamente accurate, questa algebra delle distribuzioni ci permette di abbracciare futuri incerti: i tempi di consegna dei fornitori tendono a variare, le quantità consegnate possono differire da quelle ordinate, la domanda dei clienti cambia, i prodotti vengono restituiti, l’inventario può andare perso o danneggiarsi… Attraverso questa algebra delle distribuzioni diventa molto più semplice modellare la maggior parte di questi eventi incerti con uno sforzo di codifica minimo.

Under the hood, processing distributions is quite intensive; and once again, we would never have ventured into those territories without a cloud computing platform that handles this type of workload - Microsoft Azure in our case. Nevertheless, computing resources have never been cheaper, and your company’s next $100k purchase order is probably well worth spending a few CPU hours - costing less than $1 and executed in just a few minutes - to make sure that the ordered quantities are sound.

(*) A random variable is a distribution that has a mass of 1. It’s a special type of distribution. Envision can process distributions of probabilities (aka random variables), but more general distributions as well.