frepple::SolverMRP Class Reference

This solver implements a heuristic algorithm for planning demands. More...

#include <solver.h>

Inheritance diagram for frepple::SolverMRP:
frepple::Solver frepple::utils::Object frepple::utils::HasName< Solver > frepple::utils::NonCopyable frepple::utils::Tree::TreeNode

List of all members.

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)
short getConstraints () const
TimePeriod getLazyDelay () const
int getMaxParallel () const
virtual size_t getSize () const
virtual const MetaClassgetType () const
bool isCapacityConstrained () const
bool isConstrained () const
bool isFenceConstrained () const
bool isLeadtimeConstrained () const
bool isMaterialConstrained () const
void setConstraints (short i)
void setLazyDelay (TimePeriod l)
void setMaxParallel (int i)
void solve (void *v=NULL)
 SolverMRP (const string &n)
void writeElement (XMLOutput *, const Keyword &, mode=DEFAULT) const
virtual ~SolverMRP ()

Static Public Member Functions

static bool demand_comparison (const Demand *, const Demand *)

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 MetaClassmetadata

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

short constrts

Detailed Description

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 52 of file solver.h.


Constructor & Destructor Documentation

frepple::SolverMRP::SolverMRP ( const string &  n  )  [inline]

Constructor.

Definition at line 189 of file solver.h.

virtual frepple::SolverMRP::~SolverMRP (  )  [inline, virtual]

Destructor.

Definition at line 193 of file solver.h.


Member Function Documentation

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 64 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 34 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 274 of file solveroperation.cpp.

bool frepple::SolverMRP::demand_comparison ( const Demand l1,
const Demand l2 
) [static]

This function defines the order in which the demands are being planned.
The following sorting criteria are appplied in order:

  • demand priority: smaller priorities first
  • demand due date: earlier due dates first
  • demand quantity: smaller quantities first

Definition at line 58 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 209 of file solverplan.cpp.

short frepple::SolverMRP::getConstraints (  )  const [inline]

Returns the constraints considered by the solve.

Definition at line 239 of file solver.h.

TimePeriod frepple::SolverMRP::getLazyDelay (  )  const [inline]

Return the time increment between requests when the answered reply date isn't usable.

Definition at line 291 of file solver.h.

int frepple::SolverMRP::getMaxParallel (  )  const [inline]

Return the number of threads used for planning.

Definition at line 281 of file solver.h.

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

Return the memory size of the object in bytes.

Implements frepple::utils::Object.

Definition at line 200 of file solver.h.

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.

Definition at line 198 of file solver.h.

bool frepple::SolverMRP::isCapacityConstrained (  )  const [inline]

Definition at line 252 of file solver.h.

bool frepple::SolverMRP::isConstrained (  )  const [inline]

Returns true if any constraint is relevant for the solver.

Definition at line 255 of file solver.h.

bool frepple::SolverMRP::isFenceConstrained (  )  const [inline]

Returns true if this solver respects the operation release fences. The solver isn't allowed to create any operation plans within the release fence.

Definition at line 245 of file solver.h.

bool frepple::SolverMRP::isLeadtimeConstrained (  )  const [inline]

Returns true if this solver respects the current time of the plan. The solver isn't allowed to create any operation plans in the past.

Definition at line 250 of file solver.h.

bool frepple::SolverMRP::isMaterialConstrained (  )  const [inline]

Definition at line 251 of file solver.h.

void frepple::SolverMRP::setConstraints ( short  i  )  [inline]

Update the constraints to be considered by this solver. This field may not be applicable for all solvers.

Definition at line 236 of file solver.h.

void frepple::SolverMRP::setLazyDelay ( TimePeriod  l  )  [inline]

Update the time increment between requests when the answered reply date isn't usable.

Definition at line 295 of file solver.h.

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:

  • In normal mode the solver uses as many threads as specified by the environment variable NUMBER_OF_PROCESSORS.
  • In verbose mode the solver runs in a single thread to avoid mangling the debugging output of different threads.

Definition at line 274 of file solver.h.

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 144 of file solverplan.cpp.

void frepple::SolverMRP::solve ( const Demand l,
void *  v = NULL 
) [protected, virtual]

Behavior of this solver method:

  • Respects the following demand planning policies:
    1) Maximum allowed lateness 2) Minimum shipment quantity This method is normally called from within the main solve method, but it can also be called independently to plan a certain demand.
    See also:
    solve

Reimplemented from frepple::Solver.

Definition at line 35 of file solverdemand.cpp.

void frepple::SolverMRP::solve ( const Load l,
void *  v = NULL 
) [protected, virtual]

Behavior of this solver method:

  • This method simply passes on the request to the referenced resource. With the current model structure it could easily be avoided (and thus gain a bit in performance), but we wanted to include it anyway to make the solver as generic and future-proof as possible.
    See also:
    checkOperationCapacity

Reimplemented from frepple::Solver.

Definition at line 34 of file solverresource.cpp.

void frepple::SolverMRP::solve ( const ResourceInfinite res,
void *  v = NULL 
) [protected, virtual]

Behavior of this solver method:

  • Always return OK.

Reimplemented from frepple::Solver.

Definition at line 307 of file solverresource.cpp.

void frepple::SolverMRP::solve ( const Resource res,
void *  v = NULL 
) [protected, virtual]

Behavior of this solver method:

  • The operationplan is checked for a capacity overload. When detected it is moved to an earlier date.
  • This move can be repeated until no capacity is found till a suitable time slot is found. If the fence and/or leadtime constraints are enabled they can restrict the feasible moving time.
    If a feasible timeslot is found, the method exits here.
  • If no suitable time slot can be found at all, the operation plan is put on its original date and we now try to move it to a feasible later date. Again, successive moves are possible till a suitable slot is found or till we reach the end of the horizon. The result of the search is returned as the answer-date to the solver.

Reimplemented from frepple::Solver.

Definition at line 52 of file solverresource.cpp.

void frepple::SolverMRP::solve ( const Flow fl,
void *  v = NULL 
) [protected, virtual]

Behavior of this solver method:

  • This method simply passes on the request to the referenced buffer. It is called from a solve(Operation*) method and passes on the control to a solve(Buffer*) method.
    See also:
    checkOperationMaterial

Reimplemented from frepple::Solver.

Definition at line 262 of file solverbuffer.cpp.

void frepple::SolverMRP::solve ( const BufferProcure b,
void *  v = NULL 
) [protected, virtual]

Behavior of this solver method:

  • When the inventory drops below the minimum inventory level, a new replenishment is triggered. The replenishment brings the inventory to the maximum level again.
  • The minimum and maximum inventory are soft-constraints. The actual inventory can go lower than the minimum or exceed the maximum.
  • The minimum, maximum and multiple size of the replenishment are hard constraints, and will always be respected.
  • A minimum and maximum interval between replenishment is also respected as a hard constraint.
  • No propagation to upstream buffers at all, even if a producing operation has been specified.
  • The minimum calendar isn't used by the solver.

Reimplemented from frepple::Solver.

Definition at line 83 of file solverprocure.cpp.

void frepple::SolverMRP::solve ( const Buffer b,
void *  v = NULL 
) [protected, virtual]

Behavior of this solver method:

  • Consider 0 as the hard minimum limit. It is not possible to plan with a 'hard' safety stock reservation.
  • Minimum inventory is treated as a 'wish' inventory. When replenishing a buffer we try to satisfy the minimum target. If that turns out not to be possible we use whatever available supply for satisfying the demand first.
  • Planning for the minimum target is part of planning a demand. There is no planning run independent of demand to satisfy the minimum target.
    E.g. If a buffer has no demand on it, the solver won't try to replenish to the minimum target.
    E.g. If the minimum target increases after the latest date required for satisfying a certain demand that change will not be considered.
  • The solver completely ignores the maximum target.

Reimplemented from frepple::Solver.

Definition at line 41 of file solverbuffer.cpp.

void frepple::SolverMRP::solve ( const BufferInfinite b,
void *  v = NULL 
) [protected, virtual]

Behavior of this solver method:

  • No propagation to upstream buffers at all, even if a producing operation has been specified.
  • Always give an answer for the full quantity on the requested date.

Reimplemented from frepple::Solver.

Definition at line 292 of file solverbuffer.cpp.

void frepple::SolverMRP::solve ( const OperationAlternate oper,
void *  v = NULL 
) [protected, virtual]

Behavior of this solver method is:

  • The solver loops through each alternate operation in order of priority. On each alternate operation, the solver will try to plan the quantity that hasn't been planned on higher priority alternates.
  • As a special case, operations with zero priority are skipped in the loop. These operations are considered to be temporarily unavailable.
  • The requested operation can be planned over multiple alternates. We don't garantuee that a request is planned using a single alternate operation.
  • The solver properly considers the quantity_per of all flows producing into the requested buffer, if such a buffer is specified.

Reimplemented from frepple::Solver.

Definition at line 542 of file solveroperation.cpp.

void frepple::SolverMRP::solve ( const OperationRouting oper,
void *  v = NULL 
) [protected, virtual]

Behavior of this solver method is:

  • Asks each of the routing steps for the requested quantity, starting with the last routing step.
    The time requested for the operation is based on the start date of the next routing step.

Reimplemented from frepple::Solver.

Definition at line 430 of file solveroperation.cpp.

void frepple::SolverMRP::solve ( const Operation oper,
void *  v = NULL 
) [protected, virtual]

Behavior of this solver method is:

  • It will ask the consuming flows for the required quantity.
  • The quantity asked for takes into account the quantity_per of the producing flow.
  • The date asked for takes into account the post-operation time of the operation.

Reimplemented from frepple::Solver.

Definition at line 348 of file solveroperation.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 186 of file solverplan.cpp.


Member Data Documentation

const short frepple::SolverMRP::CAPACITY = 4 [static]

Static constant for the CAPACITY constraint type.
The numeric value is 4.

See also:
MATERIAL
LEADTIME
FENCE

Definition at line 224 of file solver.h.

short frepple::SolverMRP::constrts [protected]

This variable stores the constraint which the solver should respect. By default no constraints are enabled.

Definition at line 57 of file solver.h.

const short frepple::SolverMRP::FENCE = 8 [static]

Static constant for the FENCE constraint type.
The numeric value is 8.

See also:
MATERIAL
CAPACITY
LEADTIME

Definition at line 232 of file solver.h.

const short frepple::SolverMRP::LEADTIME = 1 [static]

Static constant for the LEADTIME constraint type.
The numeric value is 1.

See also:
MATERIAL
CAPACITY
FENCE

Definition at line 208 of file solver.h.

const short frepple::SolverMRP::MATERIAL = 2 [static]

Static constant for the MATERIAL constraint type.
The numeric value is 2.

See also:
LEADTIME
CAPACITY
FENCE

Definition at line 216 of file solver.h.

Reimplemented from frepple::Solver.

Definition at line 199 of file solver.h.


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

Generated on 25 Feb 2010 for frePPLe by  doxygen 1.6.1