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) |
virtual PyObject * | getattro (const Attribute &) |
Calendar * | getCalendar () const |
bool | getDiscrete () const |
virtual size_t | getSize () const |
virtual const MetaClass & | getType () const |
virtual int | setattro (const Attribute &, const PythonObject &) |
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 int | initialize () |
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 PyObject * | timeseries (PyObject *, PyObject *) |
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 229 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 653 of file forecast.h.
module_forecast::Forecast::Forecast | ( | const string & | nm | ) | [inline, explicit] |
Constructor.
Definition at line 490 of file forecast.h.
module_forecast::Forecast::~Forecast | ( | ) |
Destructor.
Definition at line 86 of file forecast.cpp.
Called while restoring the model from an XML-file.
This is called for each element within the "this" element, for which the "this" element is immediate parent.
It is called when the open element tag is encountered.
Reimplemented from frepple::Demand.
Definition at line 371 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 72 of file forecast.cpp.
void module_forecast::Forecast::endElement | ( | XMLInput & | pIn, | |
const Attribute & | pAttr, | |||
const DataElement & | pElement | |||
) | [virtual] |
Reimplemented from frepple::Demand.
Definition at line 300 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 35 of file timeseries.cpp.
PyObject * module_forecast::Forecast::getattro | ( | const Attribute & | attr | ) | [virtual] |
Default getattro method.
Subclasses are expected to implement an override if the type supports gettattro.
Reimplemented from frepple::Demand.
Definition at line 34 of file pythonforecast.cpp.
Calendar* module_forecast::Forecast::getCalendar | ( | ) | const [inline] |
Returns a reference to the calendar used for this forecast.
Definition at line 550 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 589 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 527 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 636 of file forecast.h.
static double module_forecast::Forecast::getForecastMadAlfa | ( | ) | [inline, static] |
Returns the value of the Forecast_Iterations module parameter.
Definition at line 624 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 660 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 650 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 599 of file forecast.h.
static TimePeriod module_forecast::Forecast::getNetEarly | ( | ) | [inline, static] |
Returns the value of the Net_Early module parameter.
Definition at line 606 of file forecast.h.
static TimePeriod module_forecast::Forecast::getNetLate | ( | ) | [inline, static] |
Returns the value of the Net_Late module parameter.
Definition at line 612 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 576 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 574 of file forecast.h.
int module_forecast::Forecast::initialize | ( | ) | [static] |
Reimplemented from frepple::Demand.
Definition at line 38 of file forecast.cpp.
int module_forecast::Forecast::setattro | ( | const Attribute & | attr, | |
const PythonObject & | field | |||
) | [virtual] |
Default setattro method.
Subclasses are expected to implement an override if the type supports settattro.
Reimplemented from frepple::Demand.
Definition at line 44 of file pythonforecast.cpp.
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 380 of file forecast.cpp.
void module_forecast::Forecast::setCustomer | ( | Customer * | i | ) | [virtual] |
Update the customer.
Reimplemented from frepple::Demand.
Definition at line 416 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 584 of file forecast.h.
void module_forecast::Forecast::setDiscrete | ( | const bool | b | ) |
Updates forecast discreteness flag.
Definition at line 182 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 571 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 627 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 615 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 639 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 389 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 594 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 443 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 452 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 603 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 609 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 470 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 461 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 497 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 194 of file forecast.cpp.
PyObject * module_forecast::Forecast::timeseries | ( | PyObject * | self, | |
PyObject * | args | |||
) | [static] |
Definition at line 64 of file pythonforecast.cpp.
void module_forecast::Forecast::writeElement | ( | XMLOutput * | o, | |
const Keyword & | tag, | |||
mode | m = DEFAULT | |||
) | const [virtual] |
Reimplemented from frepple::Demand.
Definition at line 263 of file forecast.cpp.
friend class ForecastSolver [friend] |
Definition at line 231 of file forecast.h.
const MetaClass * module_forecast::Forecast::metadata [static] |
Reimplemented from frepple::Demand.
Definition at line 575 of file forecast.h.
const Keyword module_forecast::Forecast::tag_consumed [static] |
Definition at line 236 of file forecast.h.
const Keyword module_forecast::Forecast::tag_net [static] |
Definition at line 235 of file forecast.h.
const Keyword module_forecast::Forecast::tag_total [static] |
Definition at line 234 of file forecast.h.