Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends

module_forecast::Forecast Class Reference

This class represents a bucketized demand signal. More...

#include <forecast.h>

Inheritance diagram for module_forecast::Forecast:
frepple::Demand frepple::utils::HasHierarchy< Demand > frepple::Plannable frepple::utils::HasDescription frepple::utils::HasName< Demand > frepple::HasProblems frepple::Solvable frepple::utils::NonCopyable frepple::utils::Tree::TreeNode frepple::utils::Object frepple::utils::PythonExtensionBase

List of all members.

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 &)
CalendargetCalendar () const
bool getDiscrete () const
virtual size_t getSize () const
virtual const MetaClassgetType () 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 MapOfForecastsgetForecasts ()
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 MetaClassmetadata
static const Keyword tag_consumed
static const Keyword tag_net
static const Keyword tag_total

Friends

class ForecastSolver

Detailed Description

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.


Member Typedef Documentation

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.


Constructor & Destructor Documentation

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.


Member Function Documentation

void module_forecast::Forecast::beginElement ( XMLInput pIn,
const Attribute pAttr 
) [virtual]

Reimplemented from frepple::Demand.

Definition at line 371 of file forecast.cpp.

bool module_forecast::Forecast::callback ( Calendar l,
const Signal  a 
) [static]

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]

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]

Definition at line 576 of file forecast.h.

virtual const MetaClass& module_forecast::Forecast::getType (  )  const [inline, virtual]

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]

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:

  • If the daterange has its start and end dates equal, we find the matching forecast bucket and update the quantity.
  • Otherwise the quantity is distributed among all intersecting forecast buckets. This distribution is considering the weigth of the bucket and the time duration of the bucket.
    The bucket weight is the value specified on the calendar.
    If a forecast bucket only partially overlaps with the daterange only the overlapping time is used as the duration.
  • If only buckets with zero weigth are found in the daterange a dataexception is thrown. It indicates a situation where forecast is specified for a date where no values are allowed.

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.


Friends And Related Function Documentation

friend class ForecastSolver [friend]

Definition at line 231 of file forecast.h.


Member Data Documentation

Reimplemented from frepple::Demand.

Definition at line 575 of file forecast.h.

Definition at line 236 of file forecast.h.

Definition at line 235 of file forecast.h.

Definition at line 234 of file forecast.h.


The documentation for this class was generated from the following files: