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>
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 Member Functions | |
virtual void | addSubOperationPlan (OperationPlan *) |
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 *) |
virtual PyObject * | getattro (const Attribute &) |
const DateRange & | getDates () const |
Demand * | getDemand () const |
Plannable * | getEntity () const |
bool | getHidden () const |
unsigned long | getIdentifier () const |
bool | getLocked () const |
Operation * | getOperation () const |
OperationPlan * | getOwner () const |
double | getPenalty () const |
double | getQuantity () const |
virtual size_t | getSize () const |
const OperationPlan * | getTopOwner () const |
const MetaClass & | getType () const |
TimePeriod | getUnavailable () const |
void | insertInOperationplanList () |
virtual bool | instantiate () |
bool | operator< (const OperationPlan &a) const |
void | restore (const OperationPlanState &x) |
virtual int | setattro (const Attribute &, const PythonObject &) |
virtual void | setChanged (bool b=true) |
void | setDemand (Demand *l) |
virtual void | setEnd (Date) |
virtual void | setLocked (bool b=true) |
void | setOwner (OperationPlan *o) |
virtual double | setQuantity (double f, bool roundDown=false, bool update=true, bool execute=true) |
virtual void | setStart (Date) |
void | setStartAndEnd (Date st, Date nd) |
int | sizeFlowPlans () const |
int | sizeLoadPlans () const |
PyObject * | str () const |
virtual void | updateProblems () |
virtual void | writeElement (XMLOutput *, const Keyword &, mode=DEFAULT) const |
virtual | ~OperationPlan () |
Static Public Member Functions | |
static iterator | begin () |
static PyObject * | create (PyTypeObject *, PyObject *, PyObject *) |
static Object * | createOperationPlan (const MetaClass *, const AttributeList &) |
static void | deleteOperationPlans (Operation *o, bool deleteLocked=false) |
static bool | empty () |
static iterator | end () |
static OperationPlan * | findId (unsigned long l) |
static int | initialize () |
static unsigned long | size () |
static void | writer (const MetaCategory *, XMLOutput *) |
Static Public Attributes | |
static const MetaCategory * | metacategory |
static const MetaClass * | metadata |
Friends | |
class | Demand |
class | FlowPlan |
class | iterator |
class | LoadPlan |
class | Operation |
class | OperationAlternate |
class | OperationRouting |
class | ProblemPrecedence |
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:
reading suboperationplans can be improved
Definition at line 1823 of file model.h.
frepple::OperationPlan::~OperationPlan | ( | ) | [virtual] |
Destructor.
Definition at line 428 of file operationplan.cpp.
void frepple::OperationPlan::addSubOperationPlan | ( | OperationPlan * | o | ) | [virtual] |
Add a sub-operationplan to the list.
Definition at line 325 of file operationplan.cpp.
static iterator frepple::OperationPlan::begin | ( | ) | [inline, static] |
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 786 of file operationplan.cpp.
OperationPlan::FlowPlanIterator frepple::OperationPlan::beginFlowPlans | ( | ) | const [inline] |
OperationPlan::LoadPlanIterator frepple::OperationPlan::beginLoadPlans | ( | ) | const [inline] |
PyObject * frepple::OperationPlan::create | ( | PyTypeObject * | pytype, | |
PyObject * | args, | |||
PyObject * | kwds | |||
) | [static] |
Template function that generates a factory method callable from Python.
Reimplemented from frepple::utils::Object.
Definition at line 858 of file operationplan.cpp.
void frepple::OperationPlan::createFlowLoads | ( | ) |
This function is used to create the proper loadplan and flowplan objects associated with the operation.
Definition at line 405 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 73 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 697 of file operationplan.cpp.
static bool frepple::OperationPlan::empty | ( | ) | [inline, static] |
static iterator frepple::OperationPlan::end | ( | ) | [inline, static] |
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 797 of file operationplan.cpp.
OperationPlan::FlowPlanIterator frepple::OperationPlan::endFlowPlans | ( | ) | const [inline] |
OperationPlan::LoadPlanIterator frepple::OperationPlan::endLoadPlans | ( | ) | const [inline] |
void frepple::OperationPlan::eraseSubOperationPlan | ( | OperationPlan * | o | ) | [virtual] |
Remove a sub-operation_plan from the list.
Definition at line 366 of file operationplan.cpp.
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 179 of file operationplan.cpp.
PyObject * frepple::OperationPlan::getattro | ( | const Attribute & | attr | ) | [virtual] |
Default getattro method.
Subclasses are expected to implement an override if the type supports gettattro.
Reimplemented from frepple::utils::PythonExtensionBase.
Definition at line 898 of file operationplan.cpp.
const DateRange& frepple::OperationPlan::getDates | ( | ) | const [inline] |
Demand* frepple::OperationPlan::getDemand | ( | ) | const [inline] |
Plannable* frepple::OperationPlan::getEntity | ( | ) | const [inline, virtual] |
Implement the pure virtual function from the HasProblem class.
Implements frepple::HasProblems.
bool frepple::OperationPlan::getHidden | ( | ) | const [inline, virtual] |
Returns whether an entity is real or dummy.
Reimplemented from frepple::utils::Object.
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 instantiate() function. The numbering starts with the highest identifier read in from the input and is then incremented for every operationplan that is registered.
bool frepple::OperationPlan::getLocked | ( | ) | const [inline] |
Operation* frepple::OperationPlan::getOperation | ( | ) | const [inline] |
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.
double frepple::OperationPlan::getPenalty | ( | ) | const |
Calculate the penalty of an operationplan.
Definition at line 710 of file operationplan.cpp.
double frepple::OperationPlan::getQuantity | ( | ) | const [inline] |
virtual size_t frepple::OperationPlan::getSize | ( | ) | const [inline, virtual] |
Return the memory size of the object in bytes.
Implements frepple::utils::Object.
const OperationPlan* frepple::OperationPlan::getTopOwner | ( | ) | const [inline] |
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.
TimePeriod frepple::OperationPlan::getUnavailable | ( | ) | const |
Calculate the unavailable time during the operationplan. The regular duration is extended with this amount.
Definition at line 725 of file operationplan.cpp.
int frepple::OperationPlan::initialize | ( | ) | [static] |
Definition at line 39 of file operationplan.cpp.
void frepple::OperationPlan::insertInOperationplanList | ( | ) |
This method links the operationplan in the list of all operationplans maintained on the operation.
In most cases calling this method is not required since it included in the instantiate method. In exceptional cases the solver already needs to see uncommitted operationplans in the list - eg for the procurement buffer.
Definition at line 281 of file operationplan.cpp.
bool frepple::OperationPlan::instantiate | ( | ) | [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:
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'.
Definition at line 195 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):
Multiple operationplans for the same values of the above keys can exist.
Definition at line 390 of file operationplan.cpp.
void frepple::OperationPlan::restore | ( | const OperationPlanState & | x | ) | [inline] |
int frepple::OperationPlan::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::utils::PythonExtensionBase.
Definition at line 930 of file operationplan.cpp.
void frepple::OperationPlan::setChanged | ( | bool | b = true |
) | [virtual] |
Definition at line 60 of file operationplan.cpp.
void frepple::OperationPlan::setDemand | ( | Demand * | l | ) |
Updates the demand to which this operationplan is a solution.
Definition at line 844 of file operationplan.cpp.
void frepple::OperationPlan::setEnd | ( | Date | d | ) | [virtual] |
Updates the end date of the operationplan and compute the start date.
Locked operationplans are not updated by this function.
Slack can be introduced between sub operationaplans by this method, i.e. the sub operationplans are only moved if required to meet the end date.
Definition at line 524 of file operationplan.cpp.
void frepple::OperationPlan::setLocked | ( | bool | b = true |
) | [virtual] |
Locks/unlocks an operationplan. A locked operationplan is never changed.
Definition at line 832 of file operationplan.cpp.
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 481 of file operationplan.cpp.
double frepple::OperationPlan::setQuantity | ( | double | f, | |
bool | roundDown = false , |
|||
bool | update = true , |
|||
bool | execute = true | |||
) | [virtual] |
Updates the quantity.
The operationplan quantity is subject to the following rules:
Definition at line 556 of file operationplan.cpp.
void frepple::OperationPlan::setStart | ( | Date | d | ) | [virtual] |
Updates the start date of the operationplan and compute the end date.
Locked operation_plans are not updated by this function.
Slack can be introduced between sub operationaplans by this method, i.e. the sub operationplans are only moved if required to meet the start date.
Definition at line 492 of file operationplan.cpp.
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.
static unsigned long frepple::OperationPlan::size | ( | ) | [inline, static] |
int frepple::OperationPlan::sizeFlowPlans | ( | ) | const [inline] |
int frepple::OperationPlan::sizeLoadPlans | ( | ) | const [inline] |
PyObject* frepple::OperationPlan::str | ( | ) | const [inline, virtual] |
Default str method.
Subclasses are expected to implement an override if the type supports conversion to a string.
Reimplemented from frepple::utils::PythonExtensionBase.
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.
Definition at line 46 of file problems_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 745 of file operationplan.cpp.
void frepple::OperationPlan::writer | ( | const MetaCategory * | c, | |
XMLOutput * | o | |||
) | [static] |
Handles the persistence of operationplan objects.
Definition at line 733 of file operationplan.cpp.
friend class OperationAlternate [friend] |
friend class OperationRouting [friend] |
friend class ProblemPrecedence [friend] |
const MetaCategory * frepple::OperationPlan::metacategory [static] |
const MetaClass * frepple::OperationPlan::metadata [static] |