This class is an implementation of the "visitor" design pattern. It is intended as a basis for different algorithms processing the frePPLe data. More...

#include <model.h>

Inheritance diagram for frepple::Solver:

Public Member Functions

virtual void endElement (XMLInput &, const Attribute &, const DataElement &)
 
virtual PyObject * getattro (const Attribute &)
 
unsigned short getLogLevel () const
 
virtual const MetaClassgetType () const
 
virtual int setattro (const Attribute &, const PythonObject &)
 
void setLogLevel (unsigned short v)
 
virtual void solve (void *=NULL)=0
 
virtual void solve (const Demand *, void *=NULL)
 
virtual void solve (const Operation *, void *=NULL)
 
virtual void solve (const OperationFixedTime *o, void *v=NULL)
 
virtual void solve (const OperationTimePer *o, void *v=NULL)
 
virtual void solve (const OperationRouting *o, void *v=NULL)
 
virtual void solve (const OperationAlternate *o, void *v=NULL)
 
virtual void solve (const Resource *, void *=NULL)
 
virtual void solve (const ResourceInfinite *r, void *v=NULL)
 
virtual void solve (const Buffer *, void *=NULL)
 
virtual void solve (const BufferInfinite *b, void *v=NULL)
 
virtual void solve (const BufferProcure *b, void *v=NULL)
 
virtual void solve (const Load *b, void *v=NULL)
 
virtual void solve (const Flow *b, void *v=NULL)
 
virtual void solve (const FlowEnd *b, void *v=NULL)
 
virtual void solve (const Solvable *, void *=NULL)
 
 Solver (const string &n)
 
virtual void writeElement (XMLOutput *, const Keyword &, mode=DEFAULT) const
 
virtual ~Solver ()
 
- Public Member Functions inherited from frepple::utils::HasName< Solver >
int compare (const PyObject *other) const
 
void endElement (XMLInput &pIn, const Attribute &pAttr, const DataElement &pElement)
 
 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 void beginElement (XMLInput &, const Attribute &)
 
virtual bool getHidden () const
 
virtual size_t getSize () const =0
 
 Object ()
 
virtual void setHidden (bool b)
 
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 ()
 

Static Public Member Functions

static int initialize ()
 
static PyObject * solve (PyObject *, PyObject *)
 
- Static Public Member Functions inherited from frepple::utils::HasName< Solver >
static Solveradd (const string &k, const MetaClass &cls)
 
static Solveradd (Solver *t)
 
static Solveradd (Solver *t, Solver *hint)
 
static iterator begin ()
 
static void clear ()
 
static bool empty ()
 
static iterator end ()
 
static Solverfind (const string &k)
 
static SolverfindLowerBound (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 Attributes

static const MetaCategorymetadata
 

Additional Inherited Members

- Protected Member Functions inherited from frepple::utils::NonCopyable
 NonCopyable ()
 
 ~NonCopyable ()
 
- Static Protected Member Functions inherited from frepple::utils::PythonExtensionBase
static PythonTyperegisterPythonType (int, const type_info *)
 
- Static Protected Attributes inherited from frepple::utils::PythonExtensionBase
static vector< PythonType * > table
 

Detailed Description

This class is an implementation of the "visitor" design pattern. It is intended as a basis for different algorithms processing the frePPLe data.

The goal is to decouple the solver/algorithms from the model/data representation. Different solvers can be easily be plugged in to work on the same data.

Definition at line 837 of file model.h.

Constructor & Destructor Documentation

frepple::Solver::Solver ( const string &  n)
inlineexplicit

Definition at line 840 of file model.h.

virtual frepple::Solver::~Solver ( )
inlinevirtual

Definition at line 841 of file model.h.

Member Function Documentation

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

Reimplemented in frepple::SolverMRP, and module_lp_solver::LPSolver.

Definition at line 56 of file solver.cpp.

PyObject * frepple::Solver::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::SolverMRP, and module_lp_solver::LPSolver.

Definition at line 68 of file solver.cpp.

unsigned short frepple::Solver::getLogLevel ( ) const
inline

Returns how elaborate and verbose output is requested.
As a guideline solvers should respect the following guidelines:

  • 0:
    Completely silent.
    This is the default value.
  • 1:
    Minimal and high-level messages on the progress that are sufficient for logging normal operation.
  • 2:
    Higher numbers are solver dependent. These levels are typically used for debugging and tracing, and provide more detail on the solver's progress.

Definition at line 896 of file model.h.

virtual const MetaClass& frepple::Solver::getType ( ) const
inlinevirtual

This returns the type information on the object, a bit similar to the standard type_info information.

Implements frepple::utils::Object.

Reimplemented in frepple::SolverMRP, and module_lp_solver::LPSolver.

Definition at line 901 of file model.h.

int frepple::Solver::initialize ( )
static

Definition at line 31 of file solver.cpp.

int frepple::Solver::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::SolverMRP, and module_lp_solver::LPSolver.

Definition at line 78 of file solver.cpp.

void frepple::Solver::setLogLevel ( unsigned short  v)
inline

Controls whether verbose output will be generated.

Definition at line 899 of file model.h.

PyObject * frepple::Solver::solve ( PyObject *  self,
PyObject *  args 
)
static

Definition at line 90 of file solver.cpp.

virtual void frepple::Solver::solve ( void *  = NULL)
pure virtual
virtual void frepple::Solver::solve ( const Demand ,
void *  = NULL 
)
inlinevirtual

Reimplemented in frepple::SolverMRP.

Definition at line 852 of file model.h.

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

Reimplemented in frepple::SolverMRP.

Definition at line 854 of file model.h.

virtual void frepple::Solver::solve ( const OperationFixedTime o,
void *  v = NULL 
)
inlinevirtual

Definition at line 856 of file model.h.

virtual void frepple::Solver::solve ( const OperationTimePer o,
void *  v = NULL 
)
inlinevirtual

Definition at line 858 of file model.h.

virtual void frepple::Solver::solve ( const OperationRouting o,
void *  v = NULL 
)
inlinevirtual

Reimplemented in frepple::SolverMRP.

Definition at line 860 of file model.h.

virtual void frepple::Solver::solve ( const OperationAlternate o,
void *  v = NULL 
)
inlinevirtual

Reimplemented in frepple::SolverMRP.

Definition at line 862 of file model.h.

virtual void frepple::Solver::solve ( const Resource ,
void *  = NULL 
)
inlinevirtual

Reimplemented in frepple::SolverMRP.

Definition at line 864 of file model.h.

virtual void frepple::Solver::solve ( const ResourceInfinite r,
void *  v = NULL 
)
inlinevirtual

Reimplemented in frepple::SolverMRP.

Definition at line 866 of file model.h.

virtual void frepple::Solver::solve ( const Buffer ,
void *  = NULL 
)
inlinevirtual

Reimplemented in frepple::SolverMRP.

Definition at line 868 of file model.h.

virtual void frepple::Solver::solve ( const BufferInfinite b,
void *  v = NULL 
)
inlinevirtual

Reimplemented in frepple::SolverMRP.

Definition at line 870 of file model.h.

virtual void frepple::Solver::solve ( const BufferProcure b,
void *  v = NULL 
)
inlinevirtual

Reimplemented in frepple::SolverMRP.

Definition at line 872 of file model.h.

virtual void frepple::Solver::solve ( const Load b,
void *  v = NULL 
)
inlinevirtual

Reimplemented in frepple::SolverMRP.

Definition at line 874 of file model.h.

virtual void frepple::Solver::solve ( const Flow b,
void *  v = NULL 
)
inlinevirtual

Reimplemented in frepple::SolverMRP.

Definition at line 876 of file model.h.

virtual void frepple::Solver::solve ( const FlowEnd b,
void *  v = NULL 
)
inlinevirtual

Definition at line 878 of file model.h.

virtual void frepple::Solver::solve ( const Solvable ,
void *  = NULL 
)
inlinevirtual

Definition at line 880 of file model.h.

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

Reimplemented in frepple::SolverMRP, and module_lp_solver::LPSolver.

Definition at line 43 of file solver.cpp.

Member Data Documentation

const MetaCategory * frepple::Solver::metadata
static

Definition at line 902 of file model.h.


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