1.Functional Description
1.1Purpose
The purpose of this program is to forecast using an exponential smoothing technique. The program is
called during a Forecast Generation (P34650) run, when exponential smoothing has been selected as one
of the forecasts to be generated.
1.2Setup Notes and Prerequisites
This program accepts the following parameters
##N= $N= Number of months to forecast
##SIM= Simulated Forecast
##C= $C= LastDateBucketPosition
##D=$D
PntrActualValues= Array of Actual Sales and Actual Amounts
PntrExpoForecast= Array of Expo Forecasts
##ABC= The processing option for P34650 that indicates to summarize by large customer
AlphFactor = The Alpha Factor passed in. Calculate if blank
BetaFactor = The Beta Factor passed in. Calculate if blank
1.3Special Logic
2.Technical Specifications
Houskeeping
1.If SimulatedForecast passed in is not equal to zero
Move MonthsBestFit to NumberOfMonths ($N)
Subtract MonthsBestFit from LastBucketPosition
End
If MonthlyVsWeekly is not equal to '1'
Move 12 to BucketsInYr
Else
Move 52 to BucketsInYr
End
2.If the LastBucketPosition is now greater than or equal to BucketsInYr
Subtract (BucketsInYr - 1) from LastBucketPostion to get $ST
Else
Clear the PntrExpoForecast array
End function
End
If ForecastAmounts = '1'
PntrActuals = PntrActualAmounts
Else
PntrActuals = PntrActualSales
End
3.Move blanks to $24M
If LastBucketPostion is greater than 2 * BucketsInYr
Subtract (2 * BucketsInYr - 1) from LastBucketPostion to get $P
Do BucketsInYr times
Add PntrActuals,$P to $TOT
End
If $TOT is not equal to zeros
Move 1 to $24M
End
EndMainLine
4.Will need the following Arrays to process this program
PntrActualSales= Actual Sales
@AV= Average Value - array with BucketsInYr elements
@AT= Average Trend - array with BucketsInYr elements
@ST= Seasonal Trend - array with BucketsInYr elements
PntrExpoForecast= Expo Forecast - array with NumberOfMonths elements
5.Clear @AV, @AT, @ST, PntrExpoForecast and move zeros to $$TOT and $$SIM
6.Calculate the total actuals for seasonal index
If Seasonality is equal to '1'
Move $ST to $X
Subtract $ST from LastBucketPositions to get $Z
Add 1 to $Z
Do $Z
Add PntrActuals,$X to $$TOT
If $24M is equal to '1'
Subtract BucketsInYr from $X to get $24
Add PntrActuals,$24 to $$TOT
End
Add 1 to $X
EndDo
End
7.Calculate Average
Move $ST to $I
Subtract $ST from LastBucketPositions to get $Z
Add 1 to $Z
Do $Z
Subtract $ST from $I to get $X
Add 1 to $X
Add 1 to $X to get $X1
If AlphaFactor is equal to zeros
If $X1 is less than 13
Divide 2 by $X1 to get $ALPHA
End
Else
If $X is equal to 1
Move 1 to $ALPHA
Else
Move AlphaFactor to $ALPHA
End
End
Subtract $ALPHA from 1 to get $ALPH1
Move zeros to $2
If $X is greater than 1
Subtract 1 from $X to get $1X
Multiply @AV,$1X by $ALPH1 to get $2
End
Multiply PntrActuals,$I by $APLHA to get $1
Add $1 to $2 to get @AV,$X
Add 1 to $I
EndDo
8.Calculate Average Trend
Add 1 to $ST
Move $ST to $I
Subtract $ST from LastBucketPosition to get $Z
Add 1 to $Z
Move Zeros to @AT,01
Do $Z
Subtract $ST from $I to get $X
Add 2 to $X
If BetaFactor is equal to zero
If $X is less than 8
Divide 2 by $X to get $BETA
End
Else
If $X is equal to 1
Move 1 to $BETA
Else
Move BetaFactor to $BETA
End
End
Subtract $BETA from 1 to get $BETA1
Subtract 1 from $X to get $1X
Multiply @AT,$1X by $BETA1 to get $2
Subtract @AV,$1X from @AV,$X to get $AVGD
Multiply $BETA by $AVGD to get $1
Add $1 to $2 to get @AT,$X
Add 1 to $I
EndDo
9.Calculate Seasonal Index
If Seasonality is equal to '1'
Subtract 1 from $ST
Move $ST to $I
Subtract $ST from LastBucketPosition to get $Z
Add 1 to $Z
If $$TOT is not equal to zeros
Do $Z
Subtract $ST from $I to get $X
Add 1 to $X
Move PntrActuals,$I to $ADD
If $24M is equal to 1
Subtract BucketsInYr from $I to get $24
Add PntrActuals,$24 to $ADD
End
Divide $ADD by $$TOT to get @ST,$X
Add 1 to $I
EndDo
End
End
10.Calculate New Average and Forecast for the Desired Months
If LastBucketPostion is greater than zero
Do $N times incrementing $X
Multiply @AT,BucketsInYr by $X to get $2
Add @AV,BucketsInYr to $2 to get $NAVG
If Seasonality is equal to '1'
Multiply $NAVG by BucketsInYr
Multiply $NAVG by @ST,($X mod BucketsInYr)
End
Move $NAVG to get PntrExpoForecast,$X
If ##SIM passed in is not equal to zero
Add PntrExpoForecast,$X to $$SIM
End
EndDo
End
If ##SIM is not equal to zero
Move $$SIM to ##SIM
End
^
D3400880 - Forecast Exponential Smoothing
Parameter Name | Data Item | Data Type | Req/Opt | I/O/Both |
---|---|---|---|---|
mnNumberOfMonths | MATH01 | MATH_NUMERIC | NONE | NONE |
- - - Good Performance Low Value. | ||||
mnSimulatedForecast | MN29D9 | MATH_NUMERIC | NONE | NONE |
This is a generic field used as a work field in Everest. | ||||
mnLastBucketPosition | MATH02 | MATH_NUMERIC | NONE | NONE |
- - - Good Performance High Value. | ||||
idPtrToActualValues | GENLNG | ID | NONE | NONE |
General purpose ID variable. | ||||
idPtrToExpoForecast | GENLNG | ID | NONE | NONE |
General purpose ID variable. | ||||
mnAlphaFactor | MN29D9 | MATH_NUMERIC | NONE | NONE |
This is a generic field used as a work field in Everest. | ||||
mnBetaFactor | MN29D9 | MATH_NUMERIC | NONE | NONE |
This is a generic field used as a work field in Everest. | ||||
mnMonthsBestFit | MATH04 | MATH_NUMERIC | NONE | NONE |
Event point for Math Numeric. | ||||
cForecastAmounts | EV03 | char | NONE | NONE |
A radio button that specifies the level at which trace/track result is to be displayed. Select the Detail to display all transactions except IB, IX,
| ||||
cMonthlyVsWeekly | EV01 | char | NONE | NONE |
An option that specifies the type of processing for an event. | ||||
cSeasonality | EV01 | char | NONE | NONE |
An option that specifies the type of processing for an event. |
B3401050 Forecast Accumulate Actuals |
None |