A problem represents infeasibilities, alerts and warnings in the plan. More...
#include <model.h>
Classes | |
class | const_iterator |
This class models an STL-like iterator that allows us to iterate over the named entities in a simple and safe way. More... | |
class | List |
This auxilary class is used to maintain a list of problem models. More... | |
Public Member Functions | |
void | endElement (XMLInput &, const Attribute &, const DataElement &) |
PyObject * | getattro (const Attribute &) |
virtual const DateRange | getDates () const =0 |
virtual string | getDescription () const =0 |
virtual string | getEntity () const =0 |
virtual Object * | getOwner () const =0 |
virtual const MetaClass & | getType () const |
virtual double | getWeight () const =0 |
virtual bool | isFeasible () const =0 |
Problem (HasProblems *p=NULL) | |
PyObject * | str () const |
virtual void | writeElement (XMLOutput *, const Keyword &, mode=DEFAULT) const |
virtual | ~Problem () |
![]() | |
virtual void | beginElement (XMLInput &, const Attribute &) |
virtual bool | getHidden () const |
virtual size_t | getSize () const =0 |
Object () | |
virtual void | setHidden (bool b) |
virtual | ~Object () |
![]() | |
virtual PyObject * | call (const PythonObject &args, const PythonObject &kwds) |
virtual int | compare (const PyObject *other) const |
Py_ssize_t | getReferenceCount () const |
void | initType (const MetaClass *t) |
void | initType (PyTypeObject *t) |
virtual PyObject * | iternext () |
PythonExtensionBase () | |
void | resetReferenceCount () |
virtual int | setattro (const Attribute &attr, const PythonObject &field) |
virtual | ~PythonExtensionBase () |
Static Public Member Functions | |
static const_iterator | begin () |
static const_iterator | begin (HasProblems *, bool=true) |
static void | clearProblems () |
static void | clearProblems (HasProblems &p, bool setchanged=true) |
static const const_iterator | end () |
static int | initialize () |
static void | writer (const MetaCategory *, XMLOutput *) |
![]() | |
template<class T > | |
static PyObject * | create (PyTypeObject *pytype, PyObject *args, PyObject *kwds) |
template<class T > | |
static Object * | createDefault () |
template<class T > | |
static Object * | createString (const string &n) |
static PyObject * | toXML (PyObject *, PyObject *) |
Static Public Attributes | |
static const MetaCategory * | metadata |
Protected Member Functions | |
void | addProblem () |
bool | operator< (const Problem &a) const |
void | removeProblem () |
![]() | |
NonCopyable () | |
~NonCopyable () | |
Protected Attributes | |
Problem * | nextProblem |
HasProblems * | owner |
Friends | |
class | const_iterator |
class | List |
Additional Inherited Members | |
![]() | |
static PythonType * | registerPythonType (int, const type_info *) |
![]() | |
static vector< PythonType * > | table |
A problem represents infeasibilities, alerts and warnings in the plan.
Problems are maintained internally by the system. They are thus only exported, meaning that you can't directly import or create problems.
This class is the pure virtual base class for all problem types.
The usage of the problem objects is based on the following principles:
|
inlineexplicit |
Constructor.
Note that this method can't manipulate the problem container, since the problem objects aren't fully constructed yet.
|
inlinevirtual |
|
protected |
Adds a newly created problem to the problem container. This method needs to be called in the constructor of a problem subclass. It can't be called from the constructor of the base Problem class, since the object isn't fully created yet and thus misses the proper information used by the compare method.
Definition at line 102 of file problem.cpp.
|
static |
Returns an iterator to the very first problem. The iterator can be incremented till it points past the very last problem.
Definition at line 505 of file problem.cpp.
|
static |
Return an iterator to the first problem of this entity. The iterator can be incremented till it points past the last problem of this plannable entity.
The boolean argument specifies whether the problems need to be recomputed as part of this method.
Definition at line 512 of file problem.cpp.
|
static |
Erases the list of all problems. This methods can be used reduce the memory consumption at critical points. The list of problems will be recreated when the problem detection is triggered again.
Definition at line 231 of file problem.cpp.
|
static |
Erases the list of problems linked with a certain plannable object.
If the second parameter is set to true, the problems will be recreated when the next problem detection round is triggered.
Definition at line 243 of file problem.cpp.
|
static |
Return an iterator pointing beyond the last problem.
Definition at line 523 of file problem.cpp.
|
inlinevirtual |
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.
|
virtual |
Default getattro method.
Subclasses are expected to implement an override if the type supports gettattro.
Reimplemented from frepple::utils::PythonExtensionBase.
Definition at line 529 of file problem.cpp.
|
pure virtual |
Returns the duration of this problem.
Implemented in frepple::ProblemMaterialExcess, frepple::ProblemMaterialShortage, frepple::ProblemCapacityUnderload, frepple::ProblemCapacityOverload, frepple::ProblemExcess, frepple::ProblemShort, frepple::ProblemInvalidData, frepple::ProblemEarly, frepple::ProblemLate, frepple::ProblemDemandNotPlanned, frepple::ProblemPrecedence, frepple::ProblemBeforeFence, and frepple::ProblemBeforeCurrent.
|
pure virtual |
Returns a text description of this problem.
Implemented in frepple::ProblemMaterialExcess, frepple::ProblemMaterialShortage, frepple::ProblemCapacityUnderload, frepple::ProblemCapacityOverload, frepple::ProblemExcess, frepple::ProblemShort, frepple::ProblemInvalidData, frepple::ProblemEarly, frepple::ProblemLate, frepple::ProblemDemandNotPlanned, frepple::ProblemPrecedence, frepple::ProblemBeforeFence, and frepple::ProblemBeforeCurrent.
|
pure virtual |
Returns the object type having this problem.
Implemented in frepple::ProblemMaterialExcess, frepple::ProblemMaterialShortage, frepple::ProblemCapacityUnderload, frepple::ProblemCapacityOverload, frepple::ProblemExcess, frepple::ProblemShort, frepple::ProblemInvalidData, frepple::ProblemEarly, frepple::ProblemLate, frepple::ProblemDemandNotPlanned, frepple::ProblemPrecedence, frepple::ProblemBeforeFence, and frepple::ProblemBeforeCurrent.
|
pure virtual |
Returns a pointer to the object that owns this problem.
Implemented in frepple::ProblemMaterialExcess, frepple::ProblemMaterialShortage, frepple::ProblemCapacityUnderload, frepple::ProblemCapacityOverload, frepple::ProblemExcess, frepple::ProblemShort, frepple::ProblemInvalidData, frepple::ProblemEarly, frepple::ProblemLate, frepple::ProblemDemandNotPlanned, frepple::ProblemPrecedence, frepple::ProblemBeforeFence, and frepple::ProblemBeforeCurrent.
|
inlinevirtual |
Return a reference to the metadata structure.
Implements frepple::utils::Object.
Reimplemented in frepple::ProblemMaterialExcess, frepple::ProblemMaterialShortage, frepple::ProblemCapacityUnderload, frepple::ProblemCapacityOverload, frepple::ProblemExcess, frepple::ProblemShort, frepple::ProblemInvalidData, frepple::ProblemEarly, frepple::ProblemLate, frepple::ProblemDemandNotPlanned, frepple::ProblemPrecedence, frepple::ProblemBeforeFence, and frepple::ProblemBeforeCurrent.
|
pure virtual |
Returns a double number reflecting the magnitude of the problem. This allows us to focus on the significant problems and filter out the small ones.
Implemented in frepple::ProblemMaterialExcess, frepple::ProblemMaterialShortage, frepple::ProblemCapacityUnderload, frepple::ProblemCapacityOverload, frepple::ProblemExcess, frepple::ProblemShort, frepple::ProblemInvalidData, frepple::ProblemEarly, frepple::ProblemLate, frepple::ProblemDemandNotPlanned, frepple::ProblemPrecedence, frepple::ProblemBeforeFence, and frepple::ProblemBeforeCurrent.
|
static |
Initialize the class.
Definition at line 45 of file problem.cpp.
|
pure virtual |
Returns true if the plan remains feasible even if it contains this problem, i.e. if the problems flags only a warning. Returns false if a certain problem points at an infeasibility of the plan.
Implemented in frepple::ProblemMaterialExcess, frepple::ProblemMaterialShortage, frepple::ProblemCapacityUnderload, frepple::ProblemCapacityOverload, frepple::ProblemExcess, frepple::ProblemShort, frepple::ProblemInvalidData, frepple::ProblemEarly, frepple::ProblemLate, frepple::ProblemDemandNotPlanned, frepple::ProblemPrecedence, frepple::ProblemBeforeFence, and frepple::ProblemBeforeCurrent.
|
protected |
Comparison of 2 problems.
To garantuee that the problems are sorted in a consistent and stable way, the following sorting criteria are used (in order of priority):
The sorting is expected such that it can be used as a key, i.e. no two problems of will ever evaluate to be identical.
Definition at line 89 of file problem.cpp.
|
protected |
Removes a problem from the problem container. This method needs to be called from the destructor of a problem subclass.
Due to the single linked list data structure, this methods' performance is linear with the number of problems of an entity. This is acceptable since we don't expect entities with a huge amount of problems.
Definition at line 128 of file problem.cpp.
|
inlinevirtual |
Default str method.
Subclasses are expected to implement an override if the type supports conversion to a string.
Reimplemented from frepple::utils::PythonExtensionBase.
|
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 279 of file problem.cpp.
|
static |
Definition at line 263 of file problem.cpp.
|
friend |
|
static |
|
protected |
|
protected |