This class represents a bucketized demand signal. More...
#include <forecast.h>
Classes | |
class | DoubleExponential |
A class to perform double exponential smoothing on a time series. More... | |
class | ForecastMethod |
Abstract base class for all forecasting methods. More... | |
class | MovingAverage |
A class to calculate a forecast based on a moving average. More... | |
class | SingleExponential |
A class to perform single exponential smoothing on a time series. More... | |
Public Types | |
typedef multimap< pair< const Item *, const Customer * > , Forecast * > | MapOfForecasts |
Public Member Functions | |
void | beginElement (XMLInput &pIn, const Attribute &pAttr) |
void | endElement (XMLInput &pIn, const Attribute &pAttr, const DataElement &pElement) |
Forecast (const string &nm) | |
void | generateFutureValues (const double[], unsigned int, const Date[], unsigned int, bool=false) |
Calendar * | getCalendar () const |
bool | getDiscrete () const |
virtual size_t | getSize () const |
virtual const MetaClass & | getType () const |
virtual void | setCalendar (Calendar *) |
virtual void | setCustomer (Customer *) |
void | setDiscrete (const bool b) |
virtual void | setDue (const Date &d) |
virtual void | setItem (Item *) |
void | setMaxLateness (TimePeriod) |
void | setMinShipment (double) |
virtual void | setOperation (Operation *) |
virtual void | setPriority (int) |
virtual void | setQuantity (double f) |
virtual void | setTotalQuantity (const DateRange &, double) |
void | writeElement (XMLOutput *, const Keyword &, mode=DEFAULT) const |
~Forecast () | |
Static Public Member Functions | |
static bool | callback (Calendar *, const Signal) |
static bool | getCustomerThenItemHierarchy () |
static unsigned long | getForecastIterations () |
static double | getForecastMadAlfa () |
static const MapOfForecasts & | getForecasts () |
static unsigned int | getForecastSkip () |
static bool | getMatchUsingDeliveryOperation () |
static TimePeriod | getNetEarly () |
static TimePeriod | getNetLate () |
static void | setCustomerThenItemHierarchy (bool b) |
static void | setForecastIterations (unsigned long t) |
static void | setForecastMadAlfa (double t) |
static void | setForecastSkip (unsigned int t) |
static void | setMatchUsingDeliveryOperation (bool b) |
static void | setNetEarly (TimePeriod t) |
static void | setNetLate (TimePeriod t) |
Static Public Attributes | |
static const MetaClass * | metadata |
static const Keyword | tag_consumed |
static const Keyword | tag_net |
static const Keyword | tag_total |
Friends | |
class | ForecastSolver |
This class represents a bucketized demand signal.
The forecast object defines the item and priority of the demands.
A calendar (of type void, double, integer or boolean) divides the time horizon in individual time buckets. The calendar value is used to assign priorities to the time buckets.
The class basically works as an interface for a hierarchy of demands, where the lower level demands represent forecasting time buckets.
Definition at line 228 of file forecast.h.
typedef multimap< pair<const Item*, const Customer*>, Forecast* > module_forecast::Forecast::MapOfForecasts |
A data type to maintain a dictionary of all forecasts.
Definition at line 651 of file forecast.h.
module_forecast::Forecast::Forecast | ( | const string & | nm | ) | [inline, explicit] |
Constructor.
Definition at line 489 of file forecast.h.
module_forecast::Forecast::~Forecast | ( | ) |
Destructor.
Definition at line 51 of file forecast.cpp.
Reimplemented from frepple::Demand.
Definition at line 336 of file forecast.cpp.
Callback function, used for prevent a calendar from being deleted when it is used for an uninitialized forecast.
Definition at line 37 of file forecast.cpp.
void module_forecast::Forecast::endElement | ( | XMLInput & | , | |
const Attribute & | , | |||
const DataElement & | ||||
) | [virtual] |
Called while restoring the model from an XML-file.
This is called when the corresponding close element tag is encountered, and the Data() member of pElement is valid.
Reimplemented from frepple::Demand.
Definition at line 265 of file forecast.cpp.
void module_forecast::Forecast::generateFutureValues | ( | const double | history[], | |
unsigned int | historycount, | |||
const Date | buckets[], | |||
unsigned int | bucketcount, | |||
bool | debug = false | |||
) |
Generate a forecast value based on historical demand data.
This method will call the different forecasting methods and select the method with the lowest mad-error.
It then asks the selected forecast method to generate a value for each of the time buckets passed.
Definition at line 34 of file timeseries.cpp.
Calendar* module_forecast::Forecast::getCalendar | ( | ) | const [inline] |
Returns a reference to the calendar used for this forecast.
Definition at line 548 of file forecast.h.
static bool module_forecast::Forecast::getCustomerThenItemHierarchy | ( | ) | [inline, static] |
Returns the value of the Customer_Then_Item_Hierarchy module parameter.
Definition at line 587 of file forecast.h.
bool module_forecast::Forecast::getDiscrete | ( | ) | const [inline] |
Returns whether fractional forecasts are allowed or not.
The default is true.
Definition at line 525 of file forecast.h.
static unsigned long module_forecast::Forecast::getForecastIterations | ( | ) | [inline, static] |
Returns the value of the Forecast_Iterations module parameter.
Definition at line 634 of file forecast.h.
static double module_forecast::Forecast::getForecastMadAlfa | ( | ) | [inline, static] |
Returns the value of the Forecast_Iterations module parameter.
Definition at line 622 of file forecast.h.
static const MapOfForecasts& module_forecast::Forecast::getForecasts | ( | ) | [inline, static] |
Return a reference to a dictionary with all forecast objects.
Definition at line 658 of file forecast.h.
static unsigned int module_forecast::Forecast::getForecastSkip | ( | ) | [inline, static] |
Return the number of timeseries values used to initialize the algorithm. The forecast error is not counted for these buckets.
Definition at line 648 of file forecast.h.
static bool module_forecast::Forecast::getMatchUsingDeliveryOperation | ( | ) | [inline, static] |
Returns the value of the Match_Using_Delivery_Operation module parameter.
Definition at line 597 of file forecast.h.
static TimePeriod module_forecast::Forecast::getNetEarly | ( | ) | [inline, static] |
Returns the value of the Net_Early module parameter.
Definition at line 604 of file forecast.h.
static TimePeriod module_forecast::Forecast::getNetLate | ( | ) | [inline, static] |
Returns the value of the Net_Late module parameter.
Definition at line 610 of file forecast.h.
virtual size_t module_forecast::Forecast::getSize | ( | ) | const [inline, virtual] |
Return the memory size of the object in bytes.
Implements frepple::utils::Object.
Definition at line 574 of file forecast.h.
virtual const MetaClass& module_forecast::Forecast::getType | ( | ) | const [inline, virtual] |
This returns the type information on the object, a bit similar to the standard type_info information.
Reimplemented from frepple::Demand.
Definition at line 572 of file forecast.h.
void module_forecast::Forecast::setCalendar | ( | Calendar * | c | ) | [virtual] |
Specify a bucket calendar for the forecast. Once forecasted quantities have been entered for the forecast, the calendar can't be updated any more.
Definition at line 345 of file forecast.cpp.
void module_forecast::Forecast::setCustomer | ( | Customer * | i | ) | [virtual] |
Update the customer.
Reimplemented from frepple::Demand.
Definition at line 381 of file forecast.cpp.
static void module_forecast::Forecast::setCustomerThenItemHierarchy | ( | bool | b | ) | [inline, static] |
Updates the value of the Customer_Then_Item_Hierarchy module parameter.
Definition at line 582 of file forecast.h.
void module_forecast::Forecast::setDiscrete | ( | const bool | b | ) |
Updates forecast discreteness flag.
Definition at line 147 of file forecast.cpp.
virtual void module_forecast::Forecast::setDue | ( | const Date & | d | ) | [inline, virtual] |
Updates the due date of the demand.
Definition at line 569 of file forecast.h.
static void module_forecast::Forecast::setForecastIterations | ( | unsigned long | t | ) | [inline, static] |
Updates the value of the Forecast_Iterations module parameter.
Definition at line 625 of file forecast.h.
static void module_forecast::Forecast::setForecastMadAlfa | ( | double | t | ) | [inline, static] |
Updates the value of the Forecast.madAlfa module parameter.
Definition at line 613 of file forecast.h.
static void module_forecast::Forecast::setForecastSkip | ( | unsigned int | t | ) | [inline, static] |
Updates the value of the Forecast_Skip module parameter.
Definition at line 637 of file forecast.h.
void module_forecast::Forecast::setItem | ( | Item * | i | ) | [virtual] |
Update the item to be planned.
Reimplemented from frepple::Demand.
Definition at line 354 of file forecast.cpp.
static void module_forecast::Forecast::setMatchUsingDeliveryOperation | ( | bool | b | ) | [inline, static] |
Updates the value of the Match_Using_Delivery_Operation module parameter.
Definition at line 592 of file forecast.h.
void module_forecast::Forecast::setMaxLateness | ( | TimePeriod | m | ) | [virtual] |
Updates the maximum allowed lateness for this demand.
The default value is infinite.
The argument must be a positive time period.
Reimplemented from frepple::Demand.
Definition at line 408 of file forecast.cpp.
void module_forecast::Forecast::setMinShipment | ( | double | m | ) | [virtual] |
Updates the maximum allowed lateness for this demand.
The default value is infinite.
The argument must be a positive time period.
Reimplemented from frepple::Demand.
Definition at line 417 of file forecast.cpp.
static void module_forecast::Forecast::setNetEarly | ( | TimePeriod | t | ) | [inline, static] |
Updates the value of the Net_Early module parameter.
Definition at line 601 of file forecast.h.
static void module_forecast::Forecast::setNetLate | ( | TimePeriod | t | ) | [inline, static] |
Updates the value of the Net_Late module parameter.
Definition at line 607 of file forecast.h.
void module_forecast::Forecast::setOperation | ( | Operation * | o | ) | [virtual] |
Updates the operation being used to plan the demands.
Reimplemented from frepple::Demand.
Definition at line 435 of file forecast.cpp.
void module_forecast::Forecast::setPriority | ( | int | i | ) | [virtual] |
Updates the due date of the demand. Lower numbers indicate a higher priority level. The method also updates the priority in all buckets.
Reimplemented from frepple::Demand.
Definition at line 426 of file forecast.cpp.
virtual void module_forecast::Forecast::setQuantity | ( | double | f | ) | [inline, virtual] |
Updates the quantity of the forecast. This method is empty.
Reimplemented from frepple::Demand.
Definition at line 496 of file forecast.h.
void module_forecast::Forecast::setTotalQuantity | ( | const DateRange & | d, | |
double | f | |||
) | [virtual] |
Update the forecast quantity.
The forecast quantity will be distributed equally among the buckets available between the two dates, taking into account also the bucket weights.
The logic applied is briefly summarized as follows:
Definition at line 159 of file forecast.cpp.
void module_forecast::Forecast::writeElement | ( | XMLOutput * | , | |
const Keyword & | , | |||
mode | = DEFAULT | |||
) | const [virtual] |
Called while writing the model into an XML-file. The user class should write itself out, using the IOutStream members for its "simple" members and calling writeElement recursively for any contained objects. Not all classes are expected to implement this method. In instances of such a class can be created but can't be persisted. E.g. Command
Reimplemented from frepple::Demand.
Definition at line 228 of file forecast.cpp.
friend class ForecastSolver [friend] |
Definition at line 230 of file forecast.h.
const MetaClass * module_forecast::Forecast::metadata [static] |
Reimplemented from frepple::Demand.
Definition at line 573 of file forecast.h.
const Keyword module_forecast::Forecast::tag_consumed [static] |
Definition at line 235 of file forecast.h.
const Keyword module_forecast::Forecast::tag_net [static] |
Definition at line 234 of file forecast.h.
const Keyword module_forecast::Forecast::tag_total [static] |
Definition at line 233 of file forecast.h.