dlvhex
2.5.0
|
Template for online model building of a ModelGraph based on an EvalGraph. More...
#include <include/dlvhex2/OnlineModelBuilder.h>
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_container * | printEUMBP (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. |
Template for online model building of a ModelGraph based on an EvalGraph.
Definition at line 48 of file OnlineModelBuilder.h.
typedef ModelBuilder<EvalGraphT> OnlineModelBuilder< EvalGraphT >::Base |
Reimplemented in OfflineModelBuilder< EvalGraphT >.
Definition at line 54 of file OnlineModelBuilder.h.
typedef EvalGraphT::Observer OnlineModelBuilder< EvalGraphT >::EvalGraphObserverBase [private] |
Observer.
Definition at line 213 of file OnlineModelBuilder.h.
typedef Base::EvalUnit OnlineModelBuilder< EvalGraphT >::EvalUnit |
Reimplemented from ModelBuilder< EvalGraphT >.
Reimplemented in OfflineModelBuilder< EvalGraphT >.
Definition at line 62 of file OnlineModelBuilder.h.
typedef MyEvalGraph::EvalUnitDep OnlineModelBuilder< EvalGraphT >::EvalUnitDep |
Reimplemented in OfflineModelBuilder< EvalGraphT >.
Definition at line 82 of file OnlineModelBuilder.h.
typedef boost::vector_property_map<EvalUnitModelBuildingProperties> OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingPropertyMap |
Definition at line 156 of file OnlineModelBuilder.h.
typedef MyEvalGraph::PredecessorIterator OnlineModelBuilder< EvalGraphT >::EvalUnitPredecessorIterator |
Definition at line 84 of file OnlineModelBuilder.h.
typedef Base::EvalUnitPropertyBundle OnlineModelBuilder< EvalGraphT >::EvalUnitPropertyBundle |
Reimplemented from ModelBuilder< EvalGraphT >.
Reimplemented in OfflineModelBuilder< EvalGraphT >.
Definition at line 64 of file OnlineModelBuilder.h.
typedef Base::Interpretation OnlineModelBuilder< EvalGraphT >::Interpretation |
Reimplemented from ModelBuilder< EvalGraphT >.
Definition at line 66 of file OnlineModelBuilder.h.
typedef Base::InterpretationPtr OnlineModelBuilder< EvalGraphT >::InterpretationPtr |
Reimplemented from ModelBuilder< EvalGraphT >.
Definition at line 68 of file OnlineModelBuilder.h.
typedef Base::Model OnlineModelBuilder< EvalGraphT >::Model |
Reimplemented from ModelBuilder< EvalGraphT >.
Reimplemented in OfflineModelBuilder< EvalGraphT >.
Definition at line 72 of file OnlineModelBuilder.h.
typedef MyModelGraph::ModelDep OnlineModelBuilder< EvalGraphT >::ModelDep |
Definition at line 87 of file OnlineModelBuilder.h.
typedef MyModelGraph::ModelList OnlineModelBuilder< EvalGraphT >::ModelList |
Reimplemented in OfflineModelBuilder< EvalGraphT >.
Definition at line 91 of file OnlineModelBuilder.h.
typedef MyModelGraph::PredecessorIterator OnlineModelBuilder< EvalGraphT >::ModelPredecessorIterator |
Definition at line 95 of file OnlineModelBuilder.h.
typedef MyModelGraph::ModelPropertyBundle OnlineModelBuilder< EvalGraphT >::ModelPropertyBundle |
Reimplemented in OfflineModelBuilder< EvalGraphT >.
Definition at line 89 of file OnlineModelBuilder.h.
typedef MyModelGraph::SuccessorIterator OnlineModelBuilder< EvalGraphT >::ModelSuccessorIterator |
Definition at line 97 of file OnlineModelBuilder.h.
typedef Base::MyEvalGraph OnlineModelBuilder< EvalGraphT >::MyEvalGraph |
Reimplemented from ModelBuilder< EvalGraphT >.
Definition at line 60 of file OnlineModelBuilder.h.
typedef Base::MyModelGraph OnlineModelBuilder< EvalGraphT >::MyModelGraph |
Reimplemented from ModelBuilder< EvalGraphT >.
Reimplemented in OfflineModelBuilder< EvalGraphT >.
Definition at line 70 of file OnlineModelBuilder.h.
typedef Base::OptionalModel OnlineModelBuilder< EvalGraphT >::OptionalModel |
Reimplemented from ModelBuilder< EvalGraphT >.
Reimplemented in OfflineModelBuilder< EvalGraphT >.
Definition at line 74 of file OnlineModelBuilder.h.
typedef boost::optional<typename MyModelGraph::ModelList::const_iterator> OnlineModelBuilder< EvalGraphT >::OptionalModelListIterator |
Reimplemented in OfflineModelBuilder< EvalGraphT >.
Definition at line 93 of file OnlineModelBuilder.h.
typedef boost::optional<typename MyModelGraph::SuccessorIterator> OnlineModelBuilder< EvalGraphT >::OptionalModelSuccessorIterator |
Definition at line 99 of file OnlineModelBuilder.h.
typedef OnlineModelBuilder<EvalGraphT> OnlineModelBuilder< EvalGraphT >::Self |
Reimplemented from ModelBuilder< EvalGraphT >.
Reimplemented in OfflineModelBuilder< EvalGraphT >.
Definition at line 56 of file OnlineModelBuilder.h.
OnlineModelBuilder< EvalGraphT >::OnlineModelBuilder | ( | ModelBuilderConfig< EvalGraphT > & | cfg | ) | [inline] |
Constructor.
cfg | Configuration. |
Definition at line 260 of file OnlineModelBuilder.h.
References DBGLOG, ModelBuilderConfig< EvalGraphT >::eg, ModelBuilder< EvalGraphT >::eg, OnlineModelBuilder< EvalGraphT >::ego, OnlineModelBuilder< EvalGraphT >::mbp, and OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::needInput.
virtual OnlineModelBuilder< EvalGraphT >::~OnlineModelBuilder | ( | ) | [inline, virtual] |
Destructor.
Definition at line 292 of file OnlineModelBuilder.h.
OnlineModelBuilder< EvalGraphT >::OptionalModel OnlineModelBuilder< EvalGraphT >::advanceOModelForIModel | ( | EvalUnit | u | ) | [protected] |
nonrecursive "get next" wrt.
a mandatory imodel
u | Evaluation unit. |
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().
void OnlineModelBuilder< EvalGraphT >::clearIModel | ( | Model | m | ) | [inline, protected] |
Clears the interpretation of an input model.
m | Input model. |
Definition at line 201 of file OnlineModelBuilder.h.
References ModelBuilder< EvalGraphT >::mg, and ModelGraph< EvalGraphT, ModelPropertyBaseT, ModelDepPropertyBaseT >::propsOf().
void OnlineModelBuilder< EvalGraphT >::clearOModel | ( | ModelSuccessorIterator | msi | ) | [inline, protected] |
Clears the interpretation of an output model.
msi | ModelSuccessorIterator. |
Definition at line 207 of file OnlineModelBuilder.h.
References ModelBuilder< EvalGraphT >::mg, ModelGraph< EvalGraphT, ModelPropertyBaseT, ModelDepPropertyBaseT >::propsOf(), and ModelGraph< EvalGraphT, ModelPropertyBaseT, ModelDepPropertyBaseT >::sourceOf().
OnlineModelBuilder< EvalGraphT >::Model OnlineModelBuilder< EvalGraphT >::createIModelFromPredecessorOModels | ( | EvalUnit | u | ) | [protected] |
Helper for getNextIModel.
u | Evaluation Unit. |
Definition at line 428 of file OnlineModelBuilder.h.
References DBGLOG, LOG, LOG_SCOPE, MT_IN, and printptr().
OnlineModelBuilder< EvalGraphT >::OptionalModel OnlineModelBuilder< EvalGraphT >::createNextModel | ( | EvalUnit | u | ) | [protected] |
Helper for advanceOModelForIModel.
u | Evaluation unit. |
Definition at line 724 of file OnlineModelBuilder.h.
References OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::currentisuccessor, OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::currentmg, DBGLOG, ModelGeneratorBase< InterpretationT >::generateNextModel(), OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::getIModel(), ModelGeneratorBase< InterpretationT >::getInconsistencyCause(), LOG, LOG_VSCOPE, MT_OUT, and OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::orefcount.
boost::optional< typename OnlineModelBuilder< EvalGraphT >::EvalUnitPredecessorIterator > OnlineModelBuilder< EvalGraphT >::ensureModelIncrement | ( | EvalUnit | u, |
EvalUnitPredecessorIterator | cursor | ||
) | [protected] |
Helper for advanceOModelForIModel.
u | Evaluation unit. |
cursor | Cursor. |
Definition at line 499 of file OnlineModelBuilder.h.
References DBGLOG, DBGLOG_SCOPE, OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::hasOModel(), LOG, LOG_VSCOPE, and OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::orefcount.
OnlineModelBuilder< EvalGraphT >::OptionalModel OnlineModelBuilder< EvalGraphT >::getNextIModel | ( | EvalUnit | u | ) | [virtual] |
Get next input model (projected if projection is configured) at e given unit.
u | The unit whose next input model shall be returned. |
u
. Implements ModelBuilder< EvalGraphT >.
Reimplemented in OfflineModelBuilder< EvalGraphT >.
Definition at line 559 of file OnlineModelBuilder.h.
References OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::currentisuccessor, Logger::DBG, DBGLOG, OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::getIModel(), OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::hasOModel(), Logger::Instance(), LOG, LOG_VSCOPE, Logger::MODELB, MT_IN, OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::needInput, OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::orefcount, printopt(), and OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::setIModel().
Referenced by BOOST_FIXTURE_TEST_CASE(), and main().
OnlineModelBuilder< EvalGraphT >::OptionalModel OnlineModelBuilder< EvalGraphT >::getNextOModel | ( | EvalUnit | u | ) | [virtual] |
Get next output model (projected if projection is configured) at e given unit.
u | The unit whose next output model shall be returned. |
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().
Model OnlineModelBuilder< EvalGraphT >::getOModel | ( | const EvalUnitModelBuildingProperties & | p | ) | const [inline] |
Returns the output model.
p | EvalUnitModelBuildingProperties. |
Definition at line 192 of file OnlineModelBuilder.h.
References OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::currentisuccessor, ModelBuilder< EvalGraphT >::mg, and ModelGraph< EvalGraphT, ModelPropertyBaseT, ModelDepPropertyBaseT >::sourceOf().
print_container* OnlineModelBuilder< EvalGraphT >::printEUMBP | ( | const EvalUnitModelBuildingProperties & | p | ) | const [inline] |
Helper for printEUMBP.
p | EvalUnitModelBuildingProperties. |
Definition at line 183 of file OnlineModelBuilder.h.
References print_function(), and OnlineModelBuilder< EvalGraphT >::printEUMBPhelper().
std::ostream& OnlineModelBuilder< EvalGraphT >::printEUMBPhelper | ( | std::ostream & | o, |
const EvalUnitModelBuildingProperties & | p | ||
) | const [inline] |
Helper for printEUMBP.
o | The stream to print to. |
p | EvalUnitModelBuildingProperties. |
o
. Definition at line 162 of file OnlineModelBuilder.h.
References OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::currentisuccessor, OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::currentmg, OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::getIModel(), ModelBuilder< EvalGraphT >::mg, OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::needInput, OnlineModelBuilder< EvalGraphT >::EvalUnitModelBuildingProperties::orefcount, printopt(), printptr(), ModelGraph< EvalGraphT, ModelPropertyBaseT, ModelDepPropertyBaseT >::sourceOf(), and ModelGraph< EvalGraphT, ModelPropertyBaseT, ModelDepPropertyBaseT >::targetOf().
Referenced by OnlineModelBuilder< EvalGraphT >::printEUMBP().
void OnlineModelBuilder< EvalGraphT >::printEvalGraphModelGraph | ( | std::ostream & | o | ) | [virtual] |
Prints both the evaluation and the model graph for debugging purposes.
o | The 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().
void OnlineModelBuilder< EvalGraphT >::printModelBuildingPropertyMap | ( | std::ostream & | o | ) | [virtual] |
Prints the model building properties for debugging purposes.
o | The stream to print to. |
Implements ModelBuilder< EvalGraphT >.
Reimplemented in OfflineModelBuilder< EvalGraphT >.
Definition at line 406 of file OnlineModelBuilder.h.
Referenced by OfflineModelBuilder< EvalGraphT >::printModelBuildingPropertyMap().
void OnlineModelBuilder< EvalGraphT >::removeIModelFromGraphs | ( | Model | m | ) | [protected] |
Removes a model from the model graph to keep the evaluation in constant space.
m | Model to remove. |
bool OnlineModelBuilder< EvalGraphT >::constantSpace [protected] |
See ModelBuilderConfig.
Definition at line 254 of file OnlineModelBuilder.h.
boost::shared_ptr<EvalGraphObserver> OnlineModelBuilder< EvalGraphT >::ego [protected] |
Definition at line 250 of file OnlineModelBuilder.h.
Referenced by OnlineModelBuilder< EvalGraphT >::OnlineModelBuilder().
EvalUnitModelBuildingPropertyMap OnlineModelBuilder< EvalGraphT >::mbp [protected] |
Model building properties.
Definition at line 248 of file OnlineModelBuilder.h.
Referenced by OnlineModelBuilder< EvalGraphT >::OnlineModelBuilder().
bool OnlineModelBuilder< EvalGraphT >::redundancyElimination [protected] |
See ModelBuilderConfig.
Definition at line 252 of file OnlineModelBuilder.h.