# actionrwd.segment

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

The function returns a ranvar that represents the probabilistic demand over a specified probabilistic segment. The function actionrwd.segment() 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)
table S = extend.range(3)

S.Start = dirac(2)
S.Duration = poisson(S.N + 1)

S.D = actionrwd.segment(
TimeIndex: P.N
BaseLine: P.5
Dispersion: 1.0
Alpha: 0.3
Start: S.Start
Duration: S.Duration)

show table "Segments" a1e5 with S.D


See actionrwd.reward.

### Function signature

/// Returns a ranvar that represents the integrated demand - over the segment -
/// associated to the trajectories as generated by 'actionrwd.reward'.
call actionrwd.segment<Items, Periods, Segments>(
/// Defines a non-ambiguous ordering per item (i.e. distinct values required).
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",
/// The inclusive start of the segment expressed in periods (zero indexed).
Segments.Start: ranvar as "Start",
/// The length of the segment expressed in number of periods.
Segments.Duration: ranvar as "Duration",
/// 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,
Items -> Segments) : Segments.ranvar as "actionrwd.segment"