frepple::OperationPlan Class Reference

An operationplan is the key dynamic element of a plan. It represents a certain quantity being planned along a certain operation during a certain date range. More...

#include <model.h>

Inheritance diagram for frepple::OperationPlan:
frepple::utils::Object frepple::HasProblems frepple::utils::NonCopyable frepple::OperationPlanAlternate frepple::OperationPlanRouting

List of all members.

Classes

class  FlowPlanIterator
 An iterator class to go through all flowplans of an operationplan. More...
class  iterator
 This class models an STL-like iterator that allows us to iterate over the operationplans in a simple and safe way. More...
class  LoadPlanIterator
 An iterator class to go through all loadplans of an operationplan. More...

Public Types

typedef list< OperationPlan * > OperationPlanList

Public Member Functions

virtual void addSubOperationPlan (OperationPlan *o)
void beginElement (XMLInput &, const Attribute &)
FlowPlanIterator beginFlowPlans () const
LoadPlanIterator beginLoadPlans () const
void createFlowLoads ()
void endElement (XMLInput &, const Attribute &, const DataElement &)
FlowPlanIterator endFlowPlans () const
LoadPlanIterator endLoadPlans () const
virtual void eraseSubOperationPlan (OperationPlan *o)
const DateRangegetDates () const
DemandgetDemand () const
PlannablegetEntity () const
Date getEpst () const
bool getHidden () const
unsigned long getIdentifier () const
bool getLocked () const
Date getLpst () const
OperationgetOperation () const
OperationPlangetOwner () const
double getQuantity () const
virtual size_t getSize () const
virtual OperationPlangetSubOperationPlan () const
virtual const OperationPlanListgetSubOperationPlans () const
const OperationPlangetTopOwner () const
const MetaClassgetType () const
virtual bool initialize ()
bool operator< (const OperationPlan &a) const
virtual void setChanged (bool b=true)
void setDemand (Demand *l)
virtual void setEnd (Date)
void setEpst (Date d)
virtual void setLocked (bool b=true)
void setLpst (Date d)
void setOwner (OperationPlan *o)
virtual void setQuantity (double f, bool roundDown=false, bool update=true)
virtual void setStart (Date)
void setStartAndEnd (Date st, Date nd)
int sizeFlowPlans () const
int sizeLoadPlans () const
virtual void updateProblems ()
void updateSorting ()
virtual void writeElement (XMLOutput *, const Keyword &, mode=DEFAULT) const
virtual ~OperationPlan ()

Static Public Member Functions

static iterator begin ()
static ObjectcreateOperationPlan (const MetaClass *, const AttributeList &)
static void deleteOperationPlans (Operation *o, bool deleteLocked=false)
static bool empty ()
static iterator end ()
static OperationPlanfindId (unsigned long l)
static unsigned long size ()
static void writer (const MetaCategory *, XMLOutput *)

Static Public Attributes

static const MetaCategorymetacategory
static const MetaClassmetadata

Protected Member Functions

 OperationPlan ()
void resizeFlowLoadPlans ()
virtual void update ()

Protected Attributes

OperationPlanowner
double quantity

Friends

class Demand
class FlowPlan
class iterator
class LoadPlan
class Operation
class OperationPlanAlternate
class OperationPlanRouting

Detailed Description

An operationplan is the key dynamic element of a plan. It represents a certain quantity being planned along a certain operation during a certain date range.

From a coding perspective:

Definition at line 1756 of file model.h.


Member Typedef Documentation

Definition at line 1767 of file model.h.


Constructor & Destructor Documentation

frepple::OperationPlan::~OperationPlan (  )  [virtual]

Destructor.

Definition at line 396 of file operationplan.cpp.

frepple::OperationPlan::OperationPlan (  )  [inline, protected]

Default constructor. This way of creating operationplan objects is not intended for use by any client applications. Client applications should use the factory method on the operation class instead.
Subclasses of the Operation class may use this constructor in their own override of the createOperationPlan method.

See also:
Operation::createOperationPlan

Definition at line 2174 of file model.h.


Member Function Documentation

virtual void frepple::OperationPlan::addSubOperationPlan ( OperationPlan o  )  [inline, virtual]

Add a sub-operationplan to the list. For normal operationplans this is only a dummy function. For alternates and routing operationplans it does have a meaning.

Definition at line 2083 of file model.h.

static iterator frepple::OperationPlan::begin (  )  [inline, static]

Definition at line 1900 of file model.h.

void frepple::OperationPlan::beginElement ( XMLInput ,
const Attribute  
) [virtual]

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::utils::Object.

Definition at line 613 of file operationplan.cpp.

OperationPlan::FlowPlanIterator frepple::OperationPlan::beginFlowPlans (  )  const [inline]

Returns an iterator pointing to the first flowplan.

Definition at line 5301 of file model.h.

OperationPlan::LoadPlanIterator frepple::OperationPlan::beginLoadPlans (  )  const [inline]

Returns an iterator pointing to the first loadplan.

Definition at line 5358 of file model.h.

void frepple::OperationPlan::createFlowLoads (  ) 

This function is used to create the proper loadplan and flowplan objects associated with the operation.

Definition at line 379 of file operationplan.cpp.

Object * frepple::OperationPlan::createOperationPlan ( const MetaClass cat,
const AttributeList in 
) [static]

This is a factory method that creates an operationplan pointer based on the name and id, which are passed as an array of character pointers. This method is intended to be used to create objects when reading XML input data.

Definition at line 51 of file operationplan.cpp.

void frepple::OperationPlan::deleteOperationPlans ( Operation o,
bool  deleteLocked = false 
) [static]

Deletes all operationplans of a certain operation. A boolean flag allows to specify whether locked operationplans are to be deleted too.

Definition at line 545 of file operationplan.cpp.

static bool frepple::OperationPlan::empty (  )  [inline, static]

Returns true when not a single operationplan object exists.

Definition at line 1903 of file model.h.

static iterator frepple::OperationPlan::end (  )  [inline, static]

Definition at line 1898 of file model.h.

void frepple::OperationPlan::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.

Implements frepple::utils::Object.

Definition at line 624 of file operationplan.cpp.

OperationPlan::FlowPlanIterator frepple::OperationPlan::endFlowPlans (  )  const [inline]

Returns an iterator pointing beyond the last flowplan.

Definition at line 5304 of file model.h.

OperationPlan::LoadPlanIterator frepple::OperationPlan::endLoadPlans (  )  const [inline]

Returns an iterator pointing beyond the last loadplan.

Definition at line 5361 of file model.h.

virtual void frepple::OperationPlan::eraseSubOperationPlan ( OperationPlan o  )  [inline, virtual]

Remove a sub-operation_plan from the list. For normal operation_plans this is only a dummy function. For alternates and routing operationplans it does have a meaning.

Definition at line 2093 of file model.h.

OperationPlan * frepple::OperationPlan::findId ( unsigned long  l  )  [static]

Searches for an OperationPlan with a given identifier.
Returns a NULL pointer if no such OperationPlan can be found.
The method is of complexity O(n), i.e. involves a LINEAR search through the existing operationplans, and can thus be quite slow in big models.
The method is O(1), i.e. constant time regardless of the model size, when the parameter passed is bigger than the operationplan counter.

Definition at line 157 of file operationplan.cpp.

const DateRange& frepple::OperationPlan::getDates (  )  const [inline]

Returns the start and end date of this operationplan.

Definition at line 2033 of file model.h.

Demand* frepple::OperationPlan::getDemand (  )  const [inline]

Returns a pointer to the demand for which this operation is a delivery. If the operationplan isn't a delivery operation, this is a NULL pointer.

Definition at line 1950 of file model.h.

Plannable* frepple::OperationPlan::getEntity (  )  const [inline, virtual]

Implement the pure virtual function from the HasProblem class.

Implements frepple::HasProblems.

Definition at line 2120 of file model.h.

Date frepple::OperationPlan::getEpst (  )  const [inline]

Returns the earliest possible start time (epst) of the operationplan.

Definition at line 1977 of file model.h.

bool frepple::OperationPlan::getHidden (  )  const [inline, virtual]

Returns whether an entity is real or dummy.

Reimplemented from frepple::utils::Object.

Definition at line 2103 of file model.h.

unsigned long frepple::OperationPlan::getIdentifier (  )  const [inline]

Returns a unique identifier of the operationplan.
The identifier can be specified in the data input (in which case we check for the uniqueness during the read operation).
For operationplans created during a solver run, the identifier is assigned in the initialize() function. The numbering starts with the highest identifier read in from the input and is then incremented for every operationplan that is registered.

Definition at line 2043 of file model.h.

bool frepple::OperationPlan::getLocked (  )  const [inline]

Returns whether the operationplan is locked. A locked operationplan is never changed.

Definition at line 1958 of file model.h.

Date frepple::OperationPlan::getLpst (  )  const [inline]

Returns the latest possible start time (lpst) of the operationplan.

Definition at line 1983 of file model.h.

Operation* frepple::OperationPlan::getOperation (  )  const [inline]

Returns a pointer to the operation being instantiated.

Definition at line 1971 of file model.h.

OperationPlan* frepple::OperationPlan::getOwner (  )  const [inline]

Returns a pointer to the operationplan for which this operationplan a sub-operationplan.
The method returns NULL if there is no owner defined.
E.g. Sub-operationplans of a routing refer to the overall routing operationplan.
E.g. An alternate sub-operationplan refers to its parent.

See also:
getTopOwner

Definition at line 2011 of file model.h.

double frepple::OperationPlan::getQuantity (  )  const [inline]

Returns the quantity.

Definition at line 1929 of file model.h.

virtual size_t frepple::OperationPlan::getSize (  )  const [inline, virtual]

Return the memory size of the object in bytes.

Implements frepple::utils::Object.

Reimplemented in frepple::OperationPlanRouting.

Definition at line 2131 of file model.h.

virtual OperationPlan* frepple::OperationPlan::getSubOperationPlan (  )  const [inline, virtual]

Returns a reference to the list of sub-operationplans.
Subclasses having only a single sub-operationplan must override this method.

See also:
getSubOperationPlans

Reimplemented in frepple::OperationPlanAlternate.

Definition at line 1784 of file model.h.

virtual const OperationPlanList& frepple::OperationPlan::getSubOperationPlans (  )  const [inline, virtual]

Returns a reference to the list of sub-operationplans.
Subclasses where multiple sub-operationplans exist must override this method.

See also:
getSubOperationPlan

Reimplemented in frepple::OperationPlanRouting.

Definition at line 1776 of file model.h.

const OperationPlan* frepple::OperationPlan::getTopOwner (  )  const [inline]

Returns a pointer to the operationplan owning a set of sub-operationplans. There can be multiple levels of suboperations.
If no owner exists the method returns the current operationplan.

See also:
getOwner

Definition at line 2018 of file model.h.

const MetaClass& frepple::OperationPlan::getType (  )  const [inline, virtual]

Return the metadata. We return the metadata of the operation class, not the one of the operationplan class!

Implements frepple::utils::Object.

Definition at line 2125 of file model.h.

bool frepple::OperationPlan::initialize (  )  [virtual]

Initialize the operationplan. The initialization function should be called when the operationplan is ready to be 'officially' added. The initialization performs the following actions:

  1. assign an identifier
  2. create the flow and loadplans if these hadn't been created before
  3. add the operationplan to the global list of operationplans
  4. create a link with a demand object if this is a delivery operationplan

Every operationplan subclass that has sub-operations will normally need to create an override of this function.

The return value indicates whether the initialization was successfull. If the operationplan is invalid, it will be DELETED and the return value is 'false'.

Reimplemented in frepple::OperationPlanRouting, and frepple::OperationPlanAlternate.

Definition at line 173 of file operationplan.cpp.

bool frepple::OperationPlan::operator< ( const OperationPlan a  )  const

Comparison of 2 OperationPlans. To garantuee that the problems are sorted in a consistent and stable way, the following sorting criteria are used (in order of priority):

  1. Operation
  2. Start date (earliest dates first)
  3. Quantity (biggest quantities first)

Multiple operationplans for the same values of the above keys can exist.

Definition at line 320 of file operationplan.cpp.

void frepple::OperationPlan::resizeFlowLoadPlans (  )  [protected]

Definition at line 508 of file operationplan.cpp.

void frepple::OperationPlan::setChanged ( bool  b = true  )  [virtual]

Definition at line 38 of file operationplan.cpp.

void frepple::OperationPlan::setDemand ( Demand l  ) 

Updates the demand to which this operationplan is a solution.

Definition at line 670 of file operationplan.cpp.

void frepple::OperationPlan::setEnd ( Date  d  )  [virtual]

Updates the end date of the operationplan. The start date is computed. Locked operationplans are not updated by this function.

Reimplemented in frepple::OperationPlanRouting, and frepple::OperationPlanAlternate.

Definition at line 454 of file operationplan.cpp.

void frepple::OperationPlan::setEpst ( Date  d  )  [inline]

Sets the earliest possible start time (epst) of the operationplan.

Definition at line 1974 of file model.h.

void frepple::OperationPlan::setLocked ( bool  b = true  )  [virtual]

Locks/unlocks an operationplan. A locked operationplan is never changed.

Reimplemented in frepple::OperationPlanRouting, and frepple::OperationPlanAlternate.

Definition at line 663 of file operationplan.cpp.

void frepple::OperationPlan::setLpst ( Date  d  )  [inline]

Sets the latest possible start time (lpst) of the operationplan.

Definition at line 1980 of file model.h.

void frepple::OperationPlan::setOwner ( OperationPlan o  ) 

Updates the operationplan owning this operationplan. In case of a OperationRouting steps this will be the operationplan representing the complete routing.

Definition at line 431 of file operationplan.cpp.

void frepple::OperationPlan::setQuantity ( double  f,
bool  roundDown = false,
bool  update = true 
) [virtual]

Updates the quantity.
The operationplan quantity is subject to the following rules:

  • The quantity must be greater than the minimum size.
    The value is rounded up to the minimum size ir required, or rounded down to 0.
  • The quantity must be a multiple of the multiple_size field.
    The value is rounded up or down to meet this constraint.
  • There is no maximum size to an operationplan.
  • Setting the quantity of an operationplan to 0 is always possible, regardless of the minimum and multiples values. This method can only be called on top operationplans. Sub operation plans should pass on a call to the parent operationplan.

Reimplemented in frepple::OperationPlanRouting, and frepple::OperationPlanAlternate.

Definition at line 464 of file operationplan.cpp.

void frepple::OperationPlan::setStart ( Date  d  )  [virtual]

Updates the start date of the operationplan. The end date is computed. Locked operation_plans are not updated by this function.

Reimplemented in frepple::OperationPlanRouting, and frepple::OperationPlanAlternate.

Definition at line 444 of file operationplan.cpp.

void frepple::OperationPlan::setStartAndEnd ( Date  st,
Date  nd 
) [inline]

Fixes the start and end Date of an operationplan. Note that this overrules the standard duration given on the operation, i.e. no logic kicks in to verify the data makes sense. This is up to the user to take care of.
The methods setStart(Date) and setEnd(Date) are therefore preferred since they properly apply all appropriate logic.

Definition at line 1992 of file model.h.

static unsigned long frepple::OperationPlan::size (  )  [inline, static]

Returns the number of operationplans in the system. This method is linear with the number of operationplans in the model, and should therefore be used only with care.

Definition at line 1909 of file model.h.

int frepple::OperationPlan::sizeFlowPlans (  )  const [inline]

Returns how many flowplans are created on an operationplan.

Definition at line 5307 of file model.h.

int frepple::OperationPlan::sizeLoadPlans (  )  const [inline]

Returns how many loadplans are created on an operationplan.

Definition at line 5364 of file model.h.

void frepple::OperationPlan::update (  )  [protected, virtual]

Updates the operationplan based on the latest information of quantity, date and locked flag.

Reimplemented in frepple::OperationPlanRouting, and frepple::OperationPlanAlternate.

Definition at line 532 of file operationplan.cpp.

void frepple::OperationPlan::updateProblems (  )  [virtual]

Problem detection is actually done by the Operation class. That class actually "delegates" the responsability to this class, for efficiency.

Implements frepple::HasProblems.

Reimplemented in frepple::OperationPlanRouting.

Definition at line 45 of file problems_operationplan.cpp.

void frepple::OperationPlan::updateSorting (  ) 

This method should be called when an operationplan is updated in a way that can affect it's position in the sorted list: ie changes of the start date or quantity.
The method will verify the correct sorting an update it if necessary.

Definition at line 335 of file operationplan.cpp.

void frepple::OperationPlan::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::utils::Object.

Definition at line 570 of file operationplan.cpp.

void frepple::OperationPlan::writer ( const MetaCategory c,
XMLOutput o 
) [static]

Handles the persistence of operationplan objects.

Definition at line 558 of file operationplan.cpp.


Friends And Related Function Documentation

friend class Demand [friend]

Definition at line 1761 of file model.h.

friend class FlowPlan [friend]

Definition at line 1759 of file model.h.

friend class iterator [friend]

Definition at line 1896 of file model.h.

friend class LoadPlan [friend]

Definition at line 1760 of file model.h.

friend class Operation [friend]

Definition at line 1762 of file model.h.

friend class OperationPlanAlternate [friend]

Definition at line 1763 of file model.h.

friend class OperationPlanRouting [friend]

Definition at line 1764 of file model.h.


Member Data Documentation

Definition at line 2129 of file model.h.

Definition at line 2127 of file model.h.

Pointer to a higher level OperationPlan.

Definition at line 2161 of file model.h.

Quantity.

Definition at line 2164 of file model.h.


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

Generated on 25 Sep 2009 for frePPLe by  doxygen 1.6.1