+#' @title Forecaster (abstract class)
+#'
+#' @description Abstract class to represent a forecaster (they all inherit this)
+#'
+#' @field params List of computed parameters, for post-run analysis (dev)
+#' @field data Dataset, object of class Data
+#' @field pjump Function: how to predict the jump at day interface ?
+Forecaster = setRefClass(
+ Class = "Forecaster",
+
+ fields = list(
+ params = "list",
+ data = "Data",
+ pjump = "function"
+ ),
+
+ methods = list(
+ initialize = function(...)
+ {
+ "Initialize (generic) Forecaster object"
+
+ callSuper(...)
+ if (!hasArg(data))
+ stop("Forecaster must be initialized with a Data object")
+ params <<- list()
+ },
+ predict = function(today, memory, horizon, ...)
+ {
+ "Obtain a new forecasted time-serie"
+
+ # Parameters (potentially) computed during shape prediction stage
+ predicted_shape = predictShape(today, memory, horizon, ...)
+ predicted_delta = pjump(data, today, memory, horizon, params, ...)
+ # Predicted shape is aligned it on the end of current day + jump
+ predicted_shape + tail(data$getSerie(today),1) - predicted_shape[1] + predicted_delta
+ },
+ predictShape = function(today, memory, horizon, ...)
+ {
+ "Shape prediction (centered curve)"
+
+ #empty default implementation: to implement in inherited classes
+ },
+ getParameters = function()
+ {
+ params
+ }
+ )
+)