dlvhex  2.5.0
OnlineModelBuilder< EvalGraphT > Class Template Reference

Template for online model building of a ModelGraph based on an EvalGraph. More...

#include <include/dlvhex2/OnlineModelBuilder.h>

Inheritance diagram for OnlineModelBuilder< EvalGraphT >:
Collaboration diagram for OnlineModelBuilder< EvalGraphT >:

Data Structures

class  EvalGraphObserver
struct  EvalUnitModelBuildingProperties
 Properties required at each eval unit for model building: * model generator factory * current models and refcount. More...

Public Types

typedef ModelBuilder< EvalGraphT > Base
typedef OnlineModelBuilder
< EvalGraphT > 
Self
typedef Base::MyEvalGraph MyEvalGraph
typedef Base::EvalUnit EvalUnit
typedef
Base::EvalUnitPropertyBundle 
EvalUnitPropertyBundle
typedef Base::Interpretation Interpretation
typedef Base::InterpretationPtr InterpretationPtr
typedef Base::MyModelGraph MyModelGraph
typedef Base::Model Model
typedef Base::OptionalModel OptionalModel
typedef MyEvalGraph::EvalUnitDep EvalUnitDep
typedef
MyEvalGraph::PredecessorIterator 
EvalUnitPredecessorIterator
typedef MyModelGraph::ModelDep ModelDep
typedef
MyModelGraph::ModelPropertyBundle 
ModelPropertyBundle
typedef MyModelGraph::ModelList ModelList
typedef boost::optional
< typename
MyModelGraph::ModelList::const_iterator > 
OptionalModelListIterator
typedef
MyModelGraph::PredecessorIterator 
ModelPredecessorIterator
typedef
MyModelGraph::SuccessorIterator 
ModelSuccessorIterator
typedef boost::optional
< typename
MyModelGraph::SuccessorIterator
OptionalModelSuccessorIterator
typedef
boost::vector_property_map
< EvalUnitModelBuildingProperties
EvalUnitModelBuildingPropertyMap

Public Member Functions

std::ostream & printEUMBPhelper (std::ostream &o, const EvalUnitModelBuildingProperties &p) const
 Helper for printEUMBP.
print_containerprintEUMBP (const EvalUnitModelBuildingProperties &p) const
 Helper for printEUMBP.
Model getOModel (const EvalUnitModelBuildingProperties &p) const
 Returns the output model.
 OnlineModelBuilder (ModelBuilderConfig< EvalGraphT > &cfg)
 Constructor.
virtual ~OnlineModelBuilder ()
 Destructor.
virtual OptionalModel getNextIModel (EvalUnit u)
 Get next input model (projected if projection is configured) at e given unit.
virtual OptionalModel getNextOModel (EvalUnit u)
 Get next output model (projected if projection is configured) at e given unit.
virtual void printEvalGraphModelGraph (std::ostream &)
 Prints both the evaluation and the model graph for debugging purposes.
virtual void printModelBuildingPropertyMap (std::ostream &)
 Prints the model building properties for debugging purposes.

Protected Member Functions

void clearIModel (Model m)
 Clears the interpretation of an input model.
void clearOModel (ModelSuccessorIterator msi)
 Clears the interpretation of an output model.
Model createIModelFromPredecessorOModels (EvalUnit u)
 Helper for getNextIModel.
OptionalModel advanceOModelForIModel (EvalUnit u)
 nonrecursive "get next" wrt.
OptionalModel createNextModel (EvalUnit u)
 Helper for advanceOModelForIModel.
boost::optional
< EvalUnitPredecessorIterator
ensureModelIncrement (EvalUnit u, EvalUnitPredecessorIterator cursor)
 Helper for advanceOModelForIModel.
void removeIModelFromGraphs (Model m)
 Removes a model from the model graph to keep the evaluation in constant space.

Protected Attributes

EvalUnitModelBuildingPropertyMap mbp
 Model building properties.
boost::shared_ptr
< EvalGraphObserver
ego
 EvalGraphObserver.
bool redundancyElimination
 See ModelBuilderConfig.
bool constantSpace
 See ModelBuilderConfig.

Private Types

typedef EvalGraphT::Observer EvalGraphObserverBase
 Observer.

Detailed Description

template<typename EvalGraphT>
class OnlineModelBuilder< EvalGraphT >

Template for online model building of a ModelGraph based on an EvalGraph.

Definition at line 48 of file OnlineModelBuilder.h.


Member Typedef Documentation

template<typename EvalGraphT>
typedef ModelBuilder<EvalGraphT> OnlineModelBuilder< EvalGraphT >::Base

Reimplemented in OfflineModelBuilder< EvalGraphT >.

Definition at line 54 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
typedef EvalGraphT::Observer OnlineModelBuilder< EvalGraphT >::EvalGraphObserverBase [private]

Observer.

Definition at line 213 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
typedef Base::EvalUnit OnlineModelBuilder< EvalGraphT >::EvalUnit

Reimplemented from ModelBuilder< EvalGraphT >.

Reimplemented in OfflineModelBuilder< EvalGraphT >.

Definition at line 62 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
typedef MyEvalGraph::EvalUnitDep OnlineModelBuilder< EvalGraphT >::EvalUnitDep

Reimplemented in OfflineModelBuilder< EvalGraphT >.

Definition at line 82 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
typedef boost::vector_property_map<EvalUnitModelBuildingProperties> OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingPropertyMap

Definition at line 156 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
typedef MyEvalGraph::PredecessorIterator OnlineModelBuilder< EvalGraphT >::EvalUnitPredecessorIterator

Definition at line 84 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
typedef Base::EvalUnitPropertyBundle OnlineModelBuilder< EvalGraphT >::EvalUnitPropertyBundle

Reimplemented from ModelBuilder< EvalGraphT >.

Reimplemented in OfflineModelBuilder< EvalGraphT >.

Definition at line 64 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
typedef Base::Interpretation OnlineModelBuilder< EvalGraphT >::Interpretation

Reimplemented from ModelBuilder< EvalGraphT >.

Definition at line 66 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
typedef Base::InterpretationPtr OnlineModelBuilder< EvalGraphT >::InterpretationPtr

Reimplemented from ModelBuilder< EvalGraphT >.

Definition at line 68 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
typedef Base::Model OnlineModelBuilder< EvalGraphT >::Model

Reimplemented from ModelBuilder< EvalGraphT >.

Reimplemented in OfflineModelBuilder< EvalGraphT >.

Definition at line 72 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
typedef MyModelGraph::ModelDep OnlineModelBuilder< EvalGraphT >::ModelDep

Definition at line 87 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
typedef MyModelGraph::ModelList OnlineModelBuilder< EvalGraphT >::ModelList

Reimplemented in OfflineModelBuilder< EvalGraphT >.

Definition at line 91 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
typedef MyModelGraph::PredecessorIterator OnlineModelBuilder< EvalGraphT >::ModelPredecessorIterator

Definition at line 95 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
typedef MyModelGraph::ModelPropertyBundle OnlineModelBuilder< EvalGraphT >::ModelPropertyBundle

Reimplemented in OfflineModelBuilder< EvalGraphT >.

Definition at line 89 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
typedef MyModelGraph::SuccessorIterator OnlineModelBuilder< EvalGraphT >::ModelSuccessorIterator

Definition at line 97 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
typedef Base::MyEvalGraph OnlineModelBuilder< EvalGraphT >::MyEvalGraph

Reimplemented from ModelBuilder< EvalGraphT >.

Definition at line 60 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
typedef Base::MyModelGraph OnlineModelBuilder< EvalGraphT >::MyModelGraph

Reimplemented from ModelBuilder< EvalGraphT >.

Reimplemented in OfflineModelBuilder< EvalGraphT >.

Definition at line 70 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
typedef Base::OptionalModel OnlineModelBuilder< EvalGraphT >::OptionalModel

Reimplemented from ModelBuilder< EvalGraphT >.

Reimplemented in OfflineModelBuilder< EvalGraphT >.

Definition at line 74 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
typedef boost::optional<typename MyModelGraph::ModelList::const_iterator> OnlineModelBuilder< EvalGraphT >::OptionalModelListIterator

Reimplemented in OfflineModelBuilder< EvalGraphT >.

Definition at line 93 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
typedef boost::optional<typename MyModelGraph::SuccessorIterator> OnlineModelBuilder< EvalGraphT >::OptionalModelSuccessorIterator

Definition at line 99 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
typedef OnlineModelBuilder<EvalGraphT> OnlineModelBuilder< EvalGraphT >::Self

Reimplemented from ModelBuilder< EvalGraphT >.

Reimplemented in OfflineModelBuilder< EvalGraphT >.

Definition at line 56 of file OnlineModelBuilder.h.


Constructor & Destructor Documentation

template<typename EvalGraphT>
virtual OnlineModelBuilder< EvalGraphT >::~OnlineModelBuilder ( ) [inline, virtual]

Destructor.

Definition at line 292 of file OnlineModelBuilder.h.


Member Function Documentation

template<typename EvalGraphT >
OnlineModelBuilder< EvalGraphT >::OptionalModel OnlineModelBuilder< EvalGraphT >::advanceOModelForIModel ( EvalUnit  u) [protected]

nonrecursive "get next" wrt.

a mandatory imodel

Parameters:
uEvaluation unit.
Returns:
OptionalModel.

a mandatory imodel

two situations: 1) all omodels for that imodel have been generated -> use model graph only 2) otherwise: a) no model has been generated (-> no currentmg) -> start model generator and get first model b) some models have been generated (-> currentmg) -> continue to use model generator currentmg

our strategy is as follows: advance on model graph if possible if this yields no model and not all models have been generated if no model generator is running, start one use model generator

Definition at line 846 of file OnlineModelBuilder.h.

References OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::currentisuccessor, DBGLOG, OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::getIModel(), LOG, LOG_VSCOPE, OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::orefcount, print_method(), and printopt().

template<typename EvalGraphT>
void OnlineModelBuilder< EvalGraphT >::clearIModel ( Model  m) [inline, protected]

Clears the interpretation of an input model.

Parameters:
mInput model.

Definition at line 201 of file OnlineModelBuilder.h.

References ModelBuilder< EvalGraphT >::mg, and ModelGraph< EvalGraphT, ModelPropertyBaseT, ModelDepPropertyBaseT >::propsOf().

template<typename EvalGraphT>
void OnlineModelBuilder< EvalGraphT >::clearOModel ( ModelSuccessorIterator  msi) [inline, protected]
template<typename EvalGraphT >
OnlineModelBuilder< EvalGraphT >::Model OnlineModelBuilder< EvalGraphT >::createIModelFromPredecessorOModels ( EvalUnit  u) [protected]

Helper for getNextIModel.

Parameters:
uEvaluation Unit.
Returns:
Model.

Definition at line 428 of file OnlineModelBuilder.h.

References DBGLOG, LOG, LOG_SCOPE, MT_IN, and printptr().

template<typename EvalGraphT>
boost::optional< typename OnlineModelBuilder< EvalGraphT >::EvalUnitPredecessorIterator > OnlineModelBuilder< EvalGraphT >::ensureModelIncrement ( EvalUnit  u,
EvalUnitPredecessorIterator  cursor 
) [protected]

Helper for advanceOModelForIModel.

Parameters:
uEvaluation unit.
cursorCursor.
Returns:
EvalUnitPredecessorIterator or nothing.

Definition at line 499 of file OnlineModelBuilder.h.

References DBGLOG, DBGLOG_SCOPE, OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::hasOModel(), LOG, LOG_VSCOPE, and OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::orefcount.

template<typename EvalGraphT >
OnlineModelBuilder< EvalGraphT >::OptionalModel OnlineModelBuilder< EvalGraphT >::getNextOModel ( EvalUnit  u) [virtual]

Get next output model (projected if projection is configured) at e given unit.

Parameters:
uThe unit whose next output model shall be returned.
Returns:
Next output model at unit u.

Implements ModelBuilder< EvalGraphT >.

Definition at line 933 of file OnlineModelBuilder.h.

References OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::currentisuccessor, Logger::DBG, DBGLOG, OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::getIModel(), Logger::Instance(), LOG, LOG_VSCOPE, Logger::MODELB, OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::orefcount, and printopt().

template<typename EvalGraphT>
print_container* OnlineModelBuilder< EvalGraphT >::printEUMBP ( const EvalUnitModelBuildingProperties p) const [inline]

Helper for printEUMBP.

Parameters:
pEvalUnitModelBuildingProperties.
Returns:
print_container pointer.

Definition at line 183 of file OnlineModelBuilder.h.

References print_function(), and OnlineModelBuilder< EvalGraphT >::printEUMBPhelper().

template<typename EvalGraphT >
void OnlineModelBuilder< EvalGraphT >::printEvalGraphModelGraph ( std::ostream &  o) [virtual]

Prints both the evaluation and the model graph for debugging purposes.

Parameters:
oThe stream to print to.

Implements ModelBuilder< EvalGraphT >.

Reimplemented in OfflineModelBuilder< EvalGraphT >.

Definition at line 336 of file OnlineModelBuilder.h.

References MT_IN, printptr(), and toString().

Referenced by BOOST_FIXTURE_TEST_CASE(), main(), and OfflineModelBuilder< EvalGraphT >::printEvalGraphModelGraph().

template<typename EvalGraphT >
void OnlineModelBuilder< EvalGraphT >::printModelBuildingPropertyMap ( std::ostream &  o) [virtual]

Prints the model building properties for debugging purposes.

Parameters:
oThe stream to print to.

Implements ModelBuilder< EvalGraphT >.

Reimplemented in OfflineModelBuilder< EvalGraphT >.

Definition at line 406 of file OnlineModelBuilder.h.

Referenced by OfflineModelBuilder< EvalGraphT >::printModelBuildingPropertyMap().

template<typename EvalGraphT>
void OnlineModelBuilder< EvalGraphT >::removeIModelFromGraphs ( Model  m) [protected]

Removes a model from the model graph to keep the evaluation in constant space.

Parameters:
mModel to remove.

Field Documentation

template<typename EvalGraphT>
bool OnlineModelBuilder< EvalGraphT >::constantSpace [protected]

See ModelBuilderConfig.

Definition at line 254 of file OnlineModelBuilder.h.

template<typename EvalGraphT>
boost::shared_ptr<EvalGraphObserver> OnlineModelBuilder< EvalGraphT >::ego [protected]
template<typename EvalGraphT>
EvalUnitModelBuildingPropertyMap OnlineModelBuilder< EvalGraphT >::mbp [protected]

Model building properties.

Definition at line 248 of file OnlineModelBuilder.h.

Referenced by OnlineModelBuilder< EvalGraphT >::OnlineModelBuilder().

template<typename EvalGraphT>
bool OnlineModelBuilder< EvalGraphT >::redundancyElimination [protected]

See ModelBuilderConfig.

Definition at line 252 of file OnlineModelBuilder.h.


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