Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Initial revision
[simgrid.git] / src / nws_portability / Forecast / forecasters.c
1 /* $Id$ */
2
3 /*
4  * Forecaster Configuration File
5  * 
6  * FORECASTER(name,init,params,free,update,forecaster)
7  *      name -- a print string to be associated with the forecaster
8  *      init -- initialization function
9  *      params -- string to be passed to init as initial parameters
10  *      free -- free routine to be called to release forecaster spec. state
11  *      update -- update routine for forecaster
12  *      forecaster -- forecaster routine
13  *      
14  *      To add a forecaster to the system, both a FORECASTER specifier and
15  *      an include file need to be specified.  forecasters.h contains include
16  *      files for each forecasting package.
17  *      
18  *      Each forecaster consists of a (char *)init() routine, a (void)free()
19  *      routine, a (void)update() routine, and an (int)forecaster()
20  *      routine.
21  *      
22  *      char * Init(fbuff series,
23  *                  fbuff time_stamps,
24  *                  char *params)
25  *                  
26  *              series -- a pointer to the actual data series 
27  *              time_stamps -- a pointer to the time stamp series
28  *              params -- string passed as initial parameters
29  *              
30  *              returns a local state record that will be passed to
31  *                      all subsequent calls
32  *                      
33  *      void Free(char *state)
34  *      
35  *              state -- local state to be deallocated when forecaster]
36  *                       is shut down
37  *                       
38  *      void Update(char *state,
39  *                  double ts,
40  *                  doubel value)
41  *                  
42  *              state -- local forecaster state
43  *              ts -- time stamp for new value to be added
44  *              value -- value to be added to the forecaster state
45  *              
46  *      int Forecaster(char *state,
47  *                     double *forecast)
48  *                     
49  *              state -- local forecaster state
50  *              forecast -- out parameter through which forecast is passed
51  *              
52  *              returns a 1 if forecast can be made and a 0 if the
53  *                      foreacster fails for some reason
54  *                      
55  * a header file for each package shoould include external definitions
56  * for each routine
57  */
58
59 /*
60  * last value predictor
61  */
62 FORECASTER("Last Value", 
63             InitLastValue, 
64             NULL, 
65             FreeLastValue, 
66             UpdateLastValue, 
67             ForcLastValue);
68
69 /*
70  * running tabulation of the mean
71  */
72 FORECASTER("Running Mean", 
73             InitRunMean, 
74             NULL, 
75             FreeRunMean, 
76             UpdateRunMean, 
77             ForcRunMean);
78
79 /*
80  * exp smooth predictor with 0.05 gain
81  */
82 FORECASTER("5% Exp Smooth",
83            InitExpSmooth,
84            "0.05",
85            FreeExpSmooth,
86            UpdateExpSmooth,
87            ForcExpSmooth);
88
89 /*
90  * exp smooth predictor with 0.10 gain
91  */
92 FORECASTER("10% Exp Smooth",
93            InitExpSmooth,
94            "0.10",
95            FreeExpSmooth,
96            UpdateExpSmooth,
97            ForcExpSmooth);
98
99 /*
100  * exp smooth predictor with 0.15 gain
101  */
102 FORECASTER("15% Exp Smooth",
103            InitExpSmooth,
104            "0.15",
105            FreeExpSmooth,
106            UpdateExpSmooth,
107            ForcExpSmooth);
108
109 /*
110  * exp smooth predictor with 0.20 gain
111  */
112 FORECASTER("20% Exp Smooth",
113            InitExpSmooth,
114            "0.20",
115            FreeExpSmooth,
116            UpdateExpSmooth,
117            ForcExpSmooth);
118
119 /*
120  * exp smooth predictor with 0.30 gain
121  */
122 FORECASTER("30% Exp Smooth",
123            InitExpSmooth,
124            "0.30",
125            FreeExpSmooth,
126            UpdateExpSmooth,
127            ForcExpSmooth);
128
129 /*
130  * exp smooth predictor with 0.40 gain
131  */
132 FORECASTER("40% Exp Smooth",
133            InitExpSmooth,
134            "0.40",
135            FreeExpSmooth,
136            UpdateExpSmooth,
137            ForcExpSmooth);
138
139 /*
140  * exp smooth predictor with 0.50 gain
141  */
142 FORECASTER("50% Exp Smooth",
143            InitExpSmooth,
144            "0.50",
145            FreeExpSmooth,
146            UpdateExpSmooth,
147            ForcExpSmooth);
148
149 /*
150  * exp smooth predictor with 0.75 gain
151  */
152 FORECASTER("75% Exp Smooth",
153            InitExpSmooth,
154            "0.75",
155            FreeExpSmooth,
156            UpdateExpSmooth,
157            ForcExpSmooth);
158
159 /*
160  * median predictor with window = 31
161  */
162 FORECASTER("Median Window 31",
163            InitMedian,
164            "31.0",
165            FreeMedian,
166            UpdateMedian,
167            ForcMedian);
168
169 /*
170  * median predictor with window = 5
171  */
172 FORECASTER("Median Window 5",
173            InitMedian,
174            "5.0",
175            FreeMedian,
176            UpdateMedian,
177            ForcMedian);
178
179 /*
180  * sliding window with window = 31 -- Trim Median with alpha = 0.0
181  */
182 FORECASTER("Sliding Median Window 31",
183            InitTrimMedian,
184            "31.0 0.0",
185            FreeTrimMedian,
186            UpdateTrimMedian,
187            ForcTrimMedian);
188
189 /*
190  * sliding window with window = 5 -- Trim Median with alpha = 0.0
191  */
192 FORECASTER("Sliding Median Window 5",
193            InitTrimMedian,
194            "5.0 0.0",
195            FreeTrimMedian,
196            UpdateTrimMedian,
197            ForcTrimMedian);
198
199 /*
200  * trimmed median with window = 31, alpha = 0.30
201  */
202 FORECASTER("30% Trimmed Median Window 31",
203            InitTrimMedian,
204            "31.0 0.30",
205            FreeTrimMedian,
206            UpdateTrimMedian,
207            ForcTrimMedian);
208
209 /*
210  * trimmed median with window = 51, alpha = 0.30
211  */
212 FORECASTER("30% Trimmed Median Window 51",
213            InitTrimMedian,
214            "51.0 0.30",
215            FreeTrimMedian,
216            UpdateTrimMedian,
217            ForcTrimMedian);
218
219 /*
220  * adaptive median with win=10, min_win=5, max_win=21, and a adjustment
221  * value of 1
222  */
223 FORECASTER("Adaptive Median Window 5-21",
224            InitAdMedian,
225            "10.0 5.0 21.0 1.0",
226            FreeAdMedian,
227            UpdateAdMedian,
228            ForcAdMedian);
229
230 /*
231  * adaptive median with win=30, min_win=21, max_win=51, and a adjustment
232  * value of 5
233  */
234 FORECASTER("Adaptive Median Window 21-51",
235            InitAdMedian,
236            "30.0 21.0 51.0 5.0",
237            FreeAdMedian,
238            UpdateAdMedian,
239            ForcAdMedian);