An operation represents an activity: these consume and produce material, take time and also require capacity. More...

#include <model.h>

Inheritance diagram for frepple::Operation:

List of all members.

Public Types

typedef Association< Operation,
Buffer, Flow >::ListA 
flowlist
typedef Association< Operation,
Resource, Load >::ListA 
loadlist
typedef list< Operation * > Operationlist

Public Member Functions

void addSuperOperation (Operation *o)
void beginElement (XMLInput &, const Attribute &)
DateRange calculateOperationTime (Date thedate, TimePeriod duration, bool forward, TimePeriod *actualduration=NULL) const
DateRange calculateOperationTime (Date start, Date end, TimePeriod *actualduration=NULL) const
OperationPlancreateOperationPlan (double, Date, Date, Demand *=NULL, OperationPlan *=NULL, unsigned long=0, bool makeflowsloads=true) const
void deleteOperationPlans (bool deleteLockedOpplans=false)
void endElement (XMLInput &, const Attribute &, const DataElement &)
size_t extrasize () const
FlowfindFlow (const Buffer *b, Date d) const
LoadfindLoad (const Resource *r, Date d) const
virtual PyObject * getattro (const Attribute &)
double getCost () const
TimePeriod getFence () const
OperationPlangetFirstOpPlan () const
const flowlistgetFlows () const
bool getHidden () const
const loadlistgetLoads () const
LocationgetLocation () const
TimePeriod getPostTime () const
TimePeriod getPreTime () const
double getSizeMaximum () const
double getSizeMinimum () const
double getSizeMultiple () const
virtual const OperationlistgetSubOperations () const
const OperationlistgetSuperOperations () const
virtual void removeSubOperation (Operation *o)
void removeSuperOperation (Operation *o)
virtual int setattro (const Attribute &, const PythonObject &)
void setCost (const double c)
void setFence (TimePeriod t)
void setHidden (bool b)
void setLocation (Location *l)
virtual OperationPlanState setOperationPlanParameters (OperationPlan *, double, Date, Date, bool=true, bool=true) const =0
void setPostTime (TimePeriod t)
void setPreTime (TimePeriod t)
void setSizeMaximum (double f)
void setSizeMinimum (double f)
void setSizeMultiple (double f)
virtual void solve (Solver &s, void *v=NULL) const
virtual void updateProblems ()
virtual void writeElement (XMLOutput *, const Keyword &, mode=DEFAULT) const
virtual ~Operation ()
- Public Member Functions inherited from frepple::utils::HasName< Operation >
int compare (const PyObject *other) const
 HasName (const string &n)
 HasName (const char *n)
void setName (const string &newname)
virtual PyObject * str () const
 ~HasName ()
- Public Member Functions inherited from frepple::utils::Tree::TreeNode
TreeNodedecrement () const
const string & getName () const
TreeNodeincrement () const
bool operator< (const TreeNode &o)
 TreeNode (const string &n)
virtual ~TreeNode ()
- Public Member Functions inherited from frepple::utils::Object
virtual size_t getSize () const =0
virtual const MetaClassgetType () const =0
 Object ()
virtual ~Object ()
- Public Member Functions inherited from frepple::utils::PythonExtensionBase
virtual PyObject * call (const PythonObject &args, const PythonObject &kwds)
Py_ssize_t getReferenceCount () const
void initType (const MetaClass *t)
void initType (PyTypeObject *t)
virtual PyObject * iternext ()
 PythonExtensionBase ()
void resetReferenceCount ()
virtual ~PythonExtensionBase ()
- Public Member Functions inherited from frepple::HasLevel
unsigned short getCluster () const
short getLevel () const
- Public Member Functions inherited from frepple::Plannable
bool getChanged () const
bool getDetectProblems () const
PlannablegetEntity () const
 Plannable ()
void setChanged (bool b=true)
void setDetectProblems (bool b)
- Public Member Functions inherited from frepple::HasProblems
 HasProblems ()
virtual ~HasProblems ()
- Public Member Functions inherited from frepple::Solvable
virtual ~Solvable ()
- Public Member Functions inherited from frepple::utils::HasDescription
string getCategory () const
string getDescription () const
string getSubCategory () const
void setCategory (const string &f)
void setDescription (const string &f)
void setSubCategory (const string &f)

Static Public Member Functions

static int initialize ()
- Static Public Member Functions inherited from frepple::utils::HasName< Operation >
static Operationadd (const string &k, const MetaClass &cls)
static Operationadd (Operation *t)
static Operationadd (Operation *t, Operation *hint)
static iterator begin ()
static void clear ()
static bool empty ()
static iterator end ()
static Operationfind (const string &k)
static OperationfindLowerBound (const string &k, bool *f=NULL)
static Objectreader (const MetaClass *cat, const AttributeList &in)
static size_t size ()
static void verify ()
static void writer (const MetaCategory *c, XMLOutput *o)
- Static Public Member Functions inherited from frepple::utils::Object
template<class T >
static PyObject * create (PyTypeObject *pytype, PyObject *args, PyObject *kwds)
template<class T >
static ObjectcreateDefault ()
template<class T >
static ObjectcreateString (const string &n)
static PyObject * toXML (PyObject *, PyObject *)
- Static Public Member Functions inherited from frepple::HasLevel
static unsigned short getNumberOfClusters ()
static unsigned short getNumberOfHangingClusters ()
static void triggerLazyRecomputation ()
- Static Public Member Functions inherited from frepple::Plannable
static void computeProblems ()
- Static Public Member Functions inherited from frepple::HasProblems
static EntityIterator beginEntity ()
static EntityIterator endEntity ()

Static Public Attributes

static const MetaCategorymetadata

Protected Member Functions

virtual bool extraInstantiate (OperationPlan *o)
void initOperationPlan (OperationPlan *, double, const Date &, const Date &, Demand *, OperationPlan *, unsigned long, bool=true) const
 Operation (const string &str)
- Protected Member Functions inherited from frepple::HasLevel
 HasLevel ()
 HasLevel (const HasLevel &o)
 ~HasLevel ()

Friends

class Flow
class Load
class OperationAlternate
class OperationPlan
class OperationRouting

Additional Inherited Members

- Static Protected Member Functions inherited from frepple::HasLevel
static void computeLevels ()

Detailed Description

An operation represents an activity: these consume and produce material, take time and also require capacity.

An operation consumes and produces material, modeled through flows.
An operation requires capacity, modeled through loads.

This is an abstract base class for all different operation types.

Definition at line 1213 of file model.h.


Member Typedef Documentation

Definition at line 1295 of file model.h.

Definition at line 1296 of file model.h.

Definition at line 1462 of file model.h.


Constructor & Destructor Documentation

frepple::Operation::Operation ( const string &  str)
inlineexplicitprotected

Constructor. Don't use it directly.

Definition at line 1224 of file model.h.

frepple::Operation::~Operation ( )
virtual

Destructor.

Definition at line 111 of file operation.cpp.


Member Function Documentation

void frepple::Operation::addSuperOperation ( Operation o)
inline

Register a super-operation, i.e. an operation having this one as a sub-operation.

Definition at line 1474 of file model.h.

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

Reimplemented in frepple::OperationAlternate, and frepple::OperationRouting.

Definition at line 521 of file operation.cpp.

DateRange frepple::Operation::calculateOperationTime ( Date  thedate,
TimePeriod  duration,
bool  forward,
TimePeriod actualduration = NULL 
) const

Calculates the daterange starting from (or ending at) a certain date and using a certain amount of effective available time on the operation.

This calculation considers the availability calendars of:

  • the availability calendar of the operation's location
  • the availability calendar of all resources loaded by the operation
Parameters:
[in]thedateThe date from which to start searching.
[in]durationThe amount of available time we are looking for.
[in]forwardThe search direction
[out]actualdurationThis variable is updated with the actual amount of available time found.

Definition at line 171 of file operation.cpp.

DateRange frepple::Operation::calculateOperationTime ( Date  start,
Date  end,
TimePeriod actualduration = NULL 
) const

Calculates the effective, available time between two dates.

This calculation considers the availability calendars of:

  • the availability calendar of the operation's location
  • the availability calendar of all resources loaded by the operation
Parameters:
[in]startThe date from which to start searching.
[in]endThe date where to stop searching.
[out]actualdurationThis variable is updated with the actual amount of available time found.

Definition at line 325 of file operation.cpp.

OperationPlan * frepple::Operation::createOperationPlan ( double  q,
Date  s,
Date  e,
Demand l = NULL,
OperationPlan ow = NULL,
unsigned long  i = 0,
bool  makeflowsloads = true 
) const

This is the factory method which creates all operationplans of the operation.

Definition at line 160 of file operation.cpp.

void frepple::Operation::deleteOperationPlans ( bool  deleteLockedOpplans = false)

Deletes all operationplans of this operation. The boolean parameter controls whether we delete also locked operationplans or not.

Definition at line 477 of file operation.cpp.

void frepple::Operation::endElement ( XMLInput pIn,
const Attribute pAttr,
const DataElement pElement 
)
virtual
virtual bool frepple::Operation::extraInstantiate ( OperationPlan o)
inlineprotectedvirtual

Extra logic called when instantiating an operationplan.
When the function returns false the creation of the operationplan is denied and it is deleted.

Reimplemented in frepple::OperationAlternate, frepple::OperationRouting, and frepple::OperationFixedTime.

Definition at line 1232 of file model.h.

size_t frepple::Operation::extrasize ( ) const
inline

Returns the memory size in bytes.

Reimplemented from frepple::utils::HasDescription.

Definition at line 1457 of file model.h.

Flow* frepple::Operation::findFlow ( const Buffer b,
Date  d 
) const
inline

Return the flow that is associates a given buffer with this operation. Returns NULL is no such flow exists.

Definition at line 1397 of file model.h.

Load* frepple::Operation::findLoad ( const Resource r,
Date  d 
) const
inline

Return the load that is associates a given resource with this operation. Returns NULL is no such load exists.

Definition at line 1402 of file model.h.

PyObject * frepple::Operation::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.

Reimplemented in frepple::OperationAlternate, frepple::OperationRouting, frepple::OperationTimePer, and frepple::OperationFixedTime.

Definition at line 1389 of file operation.cpp.

double frepple::Operation::getCost ( ) const
inline

Return the operation cost.
The cost of executing this operation, per unit of the operation_plan.
The default value is 0.0.

Definition at line 1284 of file model.h.

TimePeriod frepple::Operation::getFence ( ) const
inline

Return the release fence of this operation.

Definition at line 1485 of file model.h.

OperationPlan* frepple::Operation::getFirstOpPlan ( ) const
inline

Returns a pointer to the operationplan being instantiated.

Definition at line 1239 of file model.h.

const flowlist& frepple::Operation::getFlows ( ) const
inline

Returns an reference to the list of flows.

Definition at line 1390 of file model.h.

bool frepple::Operation::getHidden ( ) const
inlinevirtual

Returns whether an entity is real or dummy.

Reimplemented from frepple::utils::Object.

Definition at line 1493 of file model.h.

const loadlist& frepple::Operation::getLoads ( ) const
inline

Returns an reference to the list of loads.

Definition at line 1393 of file model.h.

Location* frepple::Operation::getLocation ( ) const
inline

Returns the location of the operation, which is used to model the working hours and holidays.

Definition at line 1383 of file model.h.

TimePeriod frepple::Operation::getPostTime ( ) const
inline

Returns the delay after this operation.

See also:
setPostTime

Definition at line 1263 of file model.h.

TimePeriod frepple::Operation::getPreTime ( ) const
inline

Returns the delay before this operation.

See also:
setPreTime

Definition at line 1244 of file model.h.

double frepple::Operation::getSizeMaximum ( ) const
inline

Returns the maximum size for operationplans.

Definition at line 1448 of file model.h.

double frepple::Operation::getSizeMinimum ( ) const
inline

Returns the minimum size for operationplans.

Definition at line 1422 of file model.h.

double frepple::Operation::getSizeMultiple ( ) const
inline

Returns the mutiple size for operationplans.

Definition at line 1434 of file model.h.

virtual const Operationlist& frepple::Operation::getSubOperations ( ) const
inlinevirtual

Returns a reference to the list of sub operations of this operation.

Reimplemented in frepple::OperationAlternate, and frepple::OperationRouting.

Definition at line 1465 of file model.h.

const Operationlist& frepple::Operation::getSuperOperations ( ) const
inline

Returns a reference to the list of super-operations, i.e. operations using the current Operation as a sub-Operation.

Definition at line 1470 of file model.h.

int frepple::Operation::initialize ( )
static
void frepple::Operation::initOperationPlan ( OperationPlan opplan,
double  q,
const Date s,
const Date e,
Demand l,
OperationPlan ow,
unsigned long  i,
bool  makeflowsloads = true 
) const
protected

Definition at line 454 of file operation.cpp.

virtual void frepple::Operation::removeSubOperation ( Operation o)
inlinevirtual

Removes a sub-operation from the list. This method will need to be overridden by all operation types that acts as a super-operation.

Reimplemented in frepple::OperationAlternate, and frepple::OperationRouting.

Definition at line 1478 of file model.h.

void frepple::Operation::removeSuperOperation ( Operation o)
inline

Removes a super-operation from the list.

Definition at line 1481 of file model.h.

int frepple::Operation::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.

Reimplemented in frepple::OperationAlternate, frepple::OperationTimePer, and frepple::OperationFixedTime.

Definition at line 1431 of file operation.cpp.

void frepple::Operation::setCost ( const double  c)
inline

Update the operation cost.
The cost of executing this operation, per unit of the operation_plan.

Definition at line 1289 of file model.h.

void frepple::Operation::setFence ( TimePeriod  t)
inline

Update the release fence of this operation.

Definition at line 1488 of file model.h.

void frepple::Operation::setHidden ( bool  b)
inlinevirtual

Mark the object as hidden or not. Hidden objects are not exported and are used only as dummy constructs.

Reimplemented from frepple::utils::Object.

Definition at line 1492 of file model.h.

void frepple::Operation::setLocation ( Location l)
inline

Updates the location of the operation, which is used to model the working hours and holidays.

Definition at line 1387 of file model.h.

virtual OperationPlanState frepple::Operation::setOperationPlanParameters ( OperationPlan ,
double  ,
Date  ,
Date  ,
bool  = true,
bool  = true 
) const
pure virtual

This method stores ALL logic the operation needs to compute the correct relationship between the quantity, startdate and enddate of an operationplan.

The parameters "startdate", "enddate" and "quantity" can be conflicting if all are specified together. Typically, one would use one of the following combinations:

  • specify quantity and start date, and let the operation compute the end date.
  • specify quantity and end date, and let the operation compute the start date.
  • specify both the start and end date, and let the operation compute the quantity.
  • specify quantity, start and end date. In this case, you need to be aware that the operationplan that is created can be different from the parameters you requested.

The following priority rules apply upon conflicts.

  • respecting the end date has the first priority.
  • respecting the start date has second priority.
  • respecting the quantity should be done if the specified dates can be respected.
  • if the quantity is being computed to meet the specified dates, the quantity being passed as argument is to be treated as a maximum limit. The created operationplan can have a smaller quantity, but not bigger...
  • at all times, we expect to have an operationplan that is respecting the constraints set by the operation. If required, some of the specified parameters may need to be violated. In case of such a violation we expect the operationplan quantity to be 0.

The pre- and post-operation times are NOT considered in this method. This method only enforces "hard" constraints. "Soft" constraints are considered as 'hints' by the solver.

Subclasses need to override this method to implement the correct logic.

Implemented in frepple::OperationAlternate, frepple::OperationRouting, frepple::OperationTimePer, frepple::OperationSetup, and frepple::OperationFixedTime.

void frepple::Operation::setPostTime ( TimePeriod  t)
inline

Updates the delay after this operation.
This delay is a soft constraint. This means that solvers should try to respect this waiting time but can choose to leave a shorter time delay if required.

See also:
setPreTime

Definition at line 1271 of file model.h.

void frepple::Operation::setPreTime ( TimePeriod  t)
inline

Updates the delay before this operation.
This delay is a soft constraint. This means that solvers should try to respect this waiting time but can choose to leave a shorter time delay if required.

See also:
setPostTime

Definition at line 1252 of file model.h.

void frepple::Operation::setSizeMaximum ( double  f)
inline

Sets the maximum size of operationplans.

Definition at line 1437 of file model.h.

void frepple::Operation::setSizeMinimum ( double  f)
inline

Sets the minimum size of operationplans.
The default value is 1.0

Definition at line 1413 of file model.h.

void frepple::Operation::setSizeMultiple ( double  f)
inline

Sets the multiple size of operationplans.

Definition at line 1425 of file model.h.

virtual void frepple::Operation::solve ( Solver s,
void *  v = NULL 
) const
inlinevirtual

This method is called by solver classes. The implementation of this class simply calls the solve method on the solver class. Using the polymorphism the solver can implement seperate methods for different plannable subclasses.

Reimplemented from frepple::Solvable.

Reimplemented in frepple::OperationAlternate, frepple::OperationRouting, frepple::OperationTimePer, frepple::OperationSetup, and frepple::OperationFixedTime.

Definition at line 1460 of file model.h.

void frepple::Operation::updateProblems ( )
virtual

Called to update the list of problems. The function will only be called when:

  • the list of problems is being recomputed
  • AND, problem detection is enabled for this object
  • AND, the object has changed since the last problem computation

Implements frepple::HasProblems.

Definition at line 27 of file problems_operationplan.cpp.

void frepple::Operation::writeElement ( XMLOutput o,
const Keyword tag,
mode  m = DEFAULT 
) const
virtual

Friends And Related Function Documentation

friend class Flow
friend

Definition at line 1216 of file model.h.

friend class Load
friend

Definition at line 1217 of file model.h.

friend class OperationAlternate
friend

Definition at line 1220 of file model.h.

friend class OperationPlan
friend

Definition at line 1218 of file model.h.

friend class OperationRouting
friend

Definition at line 1219 of file model.h.


Member Data Documentation

const MetaCategory * frepple::Operation::metadata
static

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