# actionrwd.demand

## actionrwd.demand(..) 🡒 ranvar, process

The function returns a ranvar that represents the probabilistic cumulative demand, period per period, as obtained from the underlying demand generator used for the action reward function. The function actionrwd.demand() is intended as a support function for actionrwd.reward() to visualize the demand trajectories internally used by the action reward function.

Example:

table P = extend.range(20)

P.D = actionrwd.demand(
TimeIndex: P.N
BaseLine: P.5
Dispersion: 1.0
Alpha: 0.3)

show plot "Cumulative trajectories" a1e5 with
P.N
quantile(P.D, 0.90) as "Q95" { color: red }
mean(P.D) as "Avg"
quantile(P.D, 0.10) as "Q05" { color: blue }


See actionrwd.reward.

### Function signature

/// Returns a ranvar that represents the cumulative demand
/// associated to the trajectories as generated by 'actionrwd.reward'.
call actionrwd.demand<Items, Periods>(
/// Time index of the period. Links the table to the time. Starts at one.
Periods.TimeIndex: number as "TimeIndex",
/// The baseline of the average demand over each period.
Periods.Baseline: number as "Baseline",
/// The dispersion parameter (variance divided by mean) of the demand for each item.
Items.Dispersion: number as "Dispersion",
/// The update speed parameter of the ISSM model for each item.
Items.Alpha: number as "Alpha",
/// Number of trajectories used to evaluate the cumulative demand.
scalar.Samples?: number as "Samples",
/// Seed used for the trajectory generator.
scalar.Seed?: number as "Seed",
Items -> Periods) : Periods.ranvar as "actionrwd.demand"