Algebra of Zedfuncs

Within Envision, the term zedfunc is used to define a function $f: \mathbb{Z} \to \mathbb{R}$.

In the context of supply chains, zedfuncs allow to represent unit-dependent quantities such as the buy price determined by price breaks and the incremental reward function (reward produced by each additional unit in stock).

The zedfunc data type

Zedfuncs are included in the data type named distribution. Similarly to ranvars, a zedfunc corresponds to a whole function rather than a single value. For example, below, we generate a uniform function, taking the value 1 between 5 and 8 (inclusive boundaries) and 0 elsewhere:

Z := uniform(5,8)

Several other Envision functions allow to generate zedfuncs, as it will be discussed in the following.

The zedfunc data-type can be displayed and exported in the form of a number vector in a previously generated grid:

Table G = extend.distrib(poisson(5), 0, 0, 10)
G.Z = int(Z, G.Min, G.Max)
show table "My first zedfunc!"  with

Plotting a zedfunc

The graph of a zedfunc can be obtained using a plot tile, once the values of a zedfunc are introduced in a grid:

Table G = extend.distrib(poisson(5), 0, 0, 10)
G.Z = int(Z, G.Min, G.Max)
show plot "My first zedfunc!" with G.Min, G.Z


Please note that the histogram tile expects a single scalar distribution to be provided after the with keyword.

Generating zedfuncs

Specific Envision functions allow to generate parametric zedfuncs of the type identity and uniform. Zedfuncs are also the result of Envision functions such as stock reward and price breaks. In this case, the zedfunc is built based on the ranvar representing the demand forecast.

Extending a zedfunc into a table

As anticipated above, zedfuncs can be visualized in a table, using an already existing or especially generated grid. Once a the G.Min and G.Max columns are available, the zedfunc can be integrated between such inclusive boundaries:

Table G = extend.distrib(Demand)
RM = stockrwd.m(Demand, AM) * M // margin reward component with vector parameters AM and M
G.RM = int(RM, G.Min, G.Max)
show table "Margin reward component" with 

Point-wise operations

Envision supports point-wise operations on zedfuncs. For example, let $V$ and $Z$ represent two zedfuncs $\mathbb{Z} \to \mathbb{R}$. Then, we can define the addition as $V+Z: k \mapsto V(k) + Z(k)$. Within Envision, this is simply written as:

U = V + Z

It must be noted that in this example a vector zedfunc is created. Indeed, within Envision we are typically not processing a single zedfunc at a time, but a whole vector of zedfuncs at once, one for each item. However, the same operation can be as well performed on scalar zedfuncs:

U := V + Z

Then, the point-wise subtraction and multiplication, respectively defined by $V-Z: k \mapsto V(k) - Z(k)$ and $V \times Z: k \mapsto V(k) \times Z(k)$ are translated quite transparently into the following Envision syntax:

U = V - Z   
U = V * Z   

Finally, considered that a number $a$ can be implicitly assimilated to a constant function $T: k \mapsto a$, where $a \in \mathbb{R}$, Envision allows to perform the same point-wise operations, with the addition of the division operation, combining numbers and zedfuncs:

U = V + a
U = V - a
U = V * a
U = V / a

Transformation of zedfuncs

Envision supports the possibility of tuning zedfuncs by applying specific transformation functions and operator.

The zoz() function allows to replace the zedfunc value in 0 with 0.

The operators >> and << apply instead a rigid translation toward respectively $+ {\infty}$ or $- {\infty}$. The syntax is the following:

U = Z << n // left shift
U = Z >> n // right shift   

where $n$ is an integer (a real number is approximated by Envision to its nearest integer). Naturally, if n is negative, then the shift operators keep working, but the left shift becomes a right shift, and vice versa.