This solver implements a heuristic algorithm for planning demands. More...
#include <solver.h>
Classes | |
class | SolverMRPdata |
This class is a helper class of the SolverMRP class. More... | |
struct | State |
This class is used to store the solver status during the ask-reply calls of the solver. More... | |
Public Member Functions | |
void | endElement (XMLInput &pIn, const Attribute &pAttr, const DataElement &pElement) |
virtual PyObject * | getattro (const Attribute &) |
bool | getAutocommit () const |
short | getConstraints () const |
TimePeriod | getLazyDelay () const |
int | getMaxParallel () const |
short | getPlanType () const |
virtual size_t | getSize () const |
virtual const MetaClass & | getType () const |
PythonFunction | getUserExitBuffer () const |
PythonFunction | getUserExitDemand () const |
PythonFunction | getUserExitFlow () const |
PythonFunction | getUserExitOperation () const |
PythonFunction | getUserExitResource () const |
bool | isCapacityConstrained () const |
bool | isConstrained () const |
bool | isFenceConstrained () const |
bool | isLeadtimeConstrained () const |
bool | isMaterialConstrained () const |
virtual int | setattro (const Attribute &, const PythonObject &) |
void | setAutocommit (const bool b) |
void | setConstraints (short i) |
void | setLazyDelay (TimePeriod l) |
void | setMaxParallel (int i) |
void | setPlanType (short b) |
void | setUserExitBuffer (PyObject *p) |
void | setUserExitBuffer (const string &n) |
void | setUserExitDemand (PyObject *p) |
void | setUserExitDemand (const string &n) |
void | setUserExitFlow (PyObject *p) |
void | setUserExitFlow (const string &n) |
void | setUserExitOperation (PyObject *p) |
void | setUserExitOperation (const string &n) |
void | setUserExitResource (PyObject *p) |
void | setUserExitResource (const string &n) |
void | solve (void *v=NULL) |
SolverMRP (const string &n) | |
void | writeElement (XMLOutput *, const Keyword &, mode=DEFAULT) const |
virtual | ~SolverMRP () |
Static Public Member Functions | |
static PyObject * | commit (PyObject *, PyObject *) |
static bool | demand_comparison (const Demand *, const Demand *) |
static int | initialize () |
static PyObject * | solve (PyObject *, PyObject *) |
static PyObject * | undo (PyObject *, PyObject *) |
Static Public Attributes | |
static const short | CAPACITY = 4 |
static const short | FENCE = 8 |
static const short | LEADTIME = 1 |
static const short | MATERIAL = 2 |
static const MetaClass * | metadata |
Protected Member Functions | |
bool | checkOperation (OperationPlan *, SolverMRPdata &data) |
void | checkOperationCapacity (OperationPlan *, SolverMRPdata &) |
bool | checkOperationLeadtime (OperationPlan *, SolverMRPdata &, bool) |
void | solve (const Demand *, void *=NULL) |
void | solve (const Load *, void *=NULL) |
void | solve (const ResourceInfinite *, void *=NULL) |
void | solve (const Resource *, void *=NULL) |
void | solve (const Flow *, void *=NULL) |
void | solve (const BufferProcure *, void *=NULL) |
void | solve (const Buffer *, void *=NULL) |
void | solve (const BufferInfinite *, void *=NULL) |
void | solve (const OperationAlternate *, void *=NULL) |
void | solve (const OperationRouting *, void *=NULL) |
void | solve (const Operation *, void *=NULL) |
Protected Attributes | |
SolverMRPdata | commands |
short | constrts |
This solver implements a heuristic algorithm for planning demands.
One by one the demands are processed. The demand will consume step by step any upstream materials, respecting all constraints on its path.
The solver supports all planning constraints as defined in Solver class.
See the documentation of the different solve methods to understand the functionality in more detail.
The logging levels have the following meaning:
Definition at line 55 of file solver.h.
frepple::SolverMRP::SolverMRP | ( | const string & | n | ) | [inline] |
virtual frepple::SolverMRP::~SolverMRP | ( | ) | [inline, virtual] |
bool frepple::SolverMRP::checkOperation | ( | OperationPlan * | opplan, | |
SolverMRP::SolverMRPdata & | data | |||
) | [protected] |
This function will check all constraints for an operationplan and propagate it upstream. The check does NOT check eventual sub operationplans.
The return value is a flag whether the operationplan is acceptable (sometimes in reduced quantity) or not.
Definition at line 73 of file solveroperation.cpp.
void frepple::SolverMRP::checkOperationCapacity | ( | OperationPlan * | opplan, | |
SolverMRP::SolverMRPdata & | data | |||
) | [protected] |
Verifies whether this operationplan violates the capacity constraint.
In case it does the operationplan is moved to an earlier or later feasible date.
Definition at line 35 of file solveroperation.cpp.
bool frepple::SolverMRP::checkOperationLeadtime | ( | OperationPlan * | opplan, | |
SolverMRP::SolverMRPdata & | data, | |||
bool | extra | |||
) | [protected] |
Verifies whether this operationplan violates the leadtime constraints.
Definition at line 306 of file solveroperation.cpp.
PyObject * frepple::SolverMRP::commit | ( | PyObject * | self, | |
PyObject * | args | |||
) | [static] |
Python method for commiting the plan changes.
Definition at line 362 of file solverplan.cpp.
This function defines the order in which the demands are being planned.
The following sorting criteria are appplied in order:
Definition at line 68 of file solverplan.cpp.
void frepple::SolverMRP::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.
Reimplemented from frepple::Solver.
Definition at line 250 of file solverplan.cpp.
PyObject * frepple::SolverMRP::getattro | ( | const Attribute & | attr | ) | [virtual] |
Default getattro method.
Subclasses are expected to implement an override if the type supports gettattro.
Reimplemented from frepple::Solver.
Definition at line 275 of file solverplan.cpp.
bool frepple::SolverMRP::getAutocommit | ( | ) | const [inline] |
short frepple::SolverMRP::getConstraints | ( | ) | const [inline] |
TimePeriod frepple::SolverMRP::getLazyDelay | ( | ) | const [inline] |
int frepple::SolverMRP::getMaxParallel | ( | ) | const [inline] |
short frepple::SolverMRP::getPlanType | ( | ) | const [inline] |
Returns the plan type:
virtual size_t frepple::SolverMRP::getSize | ( | ) | const [inline, virtual] |
Return the memory size of the object in bytes.
Implements frepple::utils::Object.
virtual const MetaClass& frepple::SolverMRP::getType | ( | ) | const [inline, virtual] |
This returns the type information on the object, a bit similar to the standard type_info information.
Reimplemented from frepple::Solver.
PythonFunction frepple::SolverMRP::getUserExitBuffer | ( | ) | const [inline] |
PythonFunction frepple::SolverMRP::getUserExitDemand | ( | ) | const [inline] |
PythonFunction frepple::SolverMRP::getUserExitFlow | ( | ) | const [inline] |
PythonFunction frepple::SolverMRP::getUserExitOperation | ( | ) | const [inline] |
PythonFunction frepple::SolverMRP::getUserExitResource | ( | ) | const [inline] |
int frepple::SolverMRP::initialize | ( | ) | [static] |
Reimplemented from frepple::Solver.
Definition at line 54 of file solverplan.cpp.
bool frepple::SolverMRP::isCapacityConstrained | ( | ) | const [inline] |
bool frepple::SolverMRP::isConstrained | ( | ) | const [inline] |
bool frepple::SolverMRP::isFenceConstrained | ( | ) | const [inline] |
bool frepple::SolverMRP::isLeadtimeConstrained | ( | ) | const [inline] |
bool frepple::SolverMRP::isMaterialConstrained | ( | ) | const [inline] |
int frepple::SolverMRP::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::Solver.
Definition at line 299 of file solverplan.cpp.
void frepple::SolverMRP::setAutocommit | ( | const bool | b | ) | [inline] |
void frepple::SolverMRP::setConstraints | ( | short | i | ) | [inline] |
void frepple::SolverMRP::setLazyDelay | ( | TimePeriod | l | ) | [inline] |
void frepple::SolverMRP::setMaxParallel | ( | int | i | ) | [inline] |
Update the number of parallel solver threads.
The default value depends on whether the solver is run in verbose mode or not:
void frepple::SolverMRP::setUserExitBuffer | ( | PyObject * | p | ) | [inline] |
void frepple::SolverMRP::setUserExitBuffer | ( | const string & | n | ) | [inline] |
void frepple::SolverMRP::setUserExitDemand | ( | PyObject * | p | ) | [inline] |
void frepple::SolverMRP::setUserExitDemand | ( | const string & | n | ) | [inline] |
void frepple::SolverMRP::setUserExitFlow | ( | PyObject * | p | ) | [inline] |
void frepple::SolverMRP::setUserExitFlow | ( | const string & | n | ) | [inline] |
void frepple::SolverMRP::setUserExitOperation | ( | PyObject * | p | ) | [inline] |
void frepple::SolverMRP::setUserExitOperation | ( | const string & | n | ) | [inline] |
void frepple::SolverMRP::setUserExitResource | ( | PyObject * | p | ) | [inline] |
void frepple::SolverMRP::setUserExitResource | ( | const string & | n | ) | [inline] |
PyObject * frepple::SolverMRP::solve | ( | PyObject * | self, | |
PyObject * | args | |||
) | [static] |
Python method for running the solver.
Reimplemented from frepple::Solver.
Definition at line 325 of file solverplan.cpp.
void frepple::SolverMRP::solve | ( | void * | v = NULL |
) | [virtual] |
This is the main solver method that will appropriately call the other solve methods.
The demands in the model will all be sorted with the criteria defined in the demand_comparison() method. For each of demand the solve(Demand*) method is called to plan it.
Implements frepple::Solver.
Definition at line 165 of file solverplan.cpp.
void frepple::SolverMRP::solve | ( | const Demand * | l, | |
void * | v = NULL | |||
) | [protected, virtual] |
Behavior of this solver method:
Reimplemented from frepple::Solver.
Definition at line 36 of file solverdemand.cpp.
void frepple::SolverMRP::solve | ( | const Load * | l, | |
void * | v = NULL | |||
) | [protected, virtual] |
Behavior of this solver method:
Reimplemented from frepple::Solver.
Definition at line 41 of file solverload.cpp.
void frepple::SolverMRP::solve | ( | const ResourceInfinite * | res, | |
void * | v = NULL | |||
) | [protected, virtual] |
Behavior of this solver method:
Reimplemented from frepple::Solver.
Definition at line 452 of file solverresource.cpp.
void frepple::SolverMRP::solve | ( | const Resource * | res, | |
void * | v = NULL | |||
) | [protected, virtual] |
Behavior of this solver method:
Reimplemented from frepple::Solver.
Definition at line 36 of file solverresource.cpp.
void frepple::SolverMRP::solve | ( | const Flow * | fl, | |
void * | v = NULL | |||
) | [protected, virtual] |
Behavior of this solver method:
Reimplemented from frepple::Solver.
Definition at line 40 of file solverflow.cpp.
void frepple::SolverMRP::solve | ( | const BufferProcure * | b, | |
void * | v = NULL | |||
) | [protected, virtual] |
Behavior of this solver method:
Reimplemented from frepple::Solver.
Definition at line 84 of file solverprocure.cpp.
void frepple::SolverMRP::solve | ( | const Buffer * | b, | |
void * | v = NULL | |||
) | [protected, virtual] |
Behavior of this solver method:
Reimplemented from frepple::Solver.
Definition at line 42 of file solverbuffer.cpp.
void frepple::SolverMRP::solve | ( | const BufferInfinite * | b, | |
void * | v = NULL | |||
) | [protected, virtual] |
Behavior of this solver method:
Reimplemented from frepple::Solver.
Definition at line 279 of file solverbuffer.cpp.
void frepple::SolverMRP::solve | ( | const OperationAlternate * | oper, | |
void * | v = NULL | |||
) | [protected, virtual] |
Behavior of this solver method is:
Reimplemented from frepple::Solver.
Definition at line 620 of file solveroperation.cpp.
void frepple::SolverMRP::solve | ( | const OperationRouting * | oper, | |
void * | v = NULL | |||
) | [protected, virtual] |
Behavior of this solver method is:
Reimplemented from frepple::Solver.
Definition at line 494 of file solveroperation.cpp.
void frepple::SolverMRP::solve | ( | const Operation * | oper, | |
void * | v = NULL | |||
) | [protected, virtual] |
Behavior of this solver method is:
Reimplemented from frepple::Solver.
Definition at line 409 of file solveroperation.cpp.
PyObject * frepple::SolverMRP::undo | ( | PyObject * | self, | |
PyObject * | args | |||
) | [static] |
Python method for undoing the plan changes.
Definition at line 380 of file solverplan.cpp.
void frepple::SolverMRP::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::Solver.
Definition at line 215 of file solverplan.cpp.
const short frepple::SolverMRP::CAPACITY = 4 [static] |
SolverMRPdata frepple::SolverMRP::commands [protected] |
short frepple::SolverMRP::constrts [protected] |
const short frepple::SolverMRP::FENCE = 8 [static] |
const short frepple::SolverMRP::LEADTIME = 1 [static] |
const short frepple::SolverMRP::MATERIAL = 2 [static] |
const MetaClass * frepple::SolverMRP::metadata [static] |
Reimplemented from frepple::Solver.