dlvhex
2.5.0
|
This template provides a framework for building an evaluation graph. More...
#include <include/dlvhex2/EvalGraphBuilder.h>
Data Structures | |
struct | identity |
Identity function. More... | |
struct | UnusedEdgeFilter |
Edges of component graph that still need to be put into eval units. More... | |
struct | UnusedVertexFilter |
For subgraph of component graph that still needs to be put into eval units. More... | |
Public Types | |
typedef FinalEvalGraph | EvalGraphT |
typedef EvalGraphT::EvalUnit | EvalUnit |
typedef ComponentGraph::Component | Component |
typedef ComponentGraph::Dependency | Dependency |
typedef boost::filtered_graph < ComponentGraph::Graph, UnusedEdgeFilter, UnusedVertexFilter > | ComponentGraphRest |
Public Member Functions | |
EvalGraphBuilder (ProgramCtx &ctx, ComponentGraph &cg, EvalGraphT &eg, ASPSolverManager::SoftwareConfigurationPtr externalEvalConfig) | |
Constructor. | |
virtual | ~EvalGraphBuilder () |
Destructor. | |
const EvalGraphT & | getEvalGraph () const |
Retrieve internal evaluation graph. | |
ComponentGraph & | getComponentGraph () |
Retrieve internal component graph. | |
const ComponentGraphRest & | getComponentGraphRest () const |
Returns a graph consisting of all components that still need to be built into some evaluation unit. | |
Component | getComponentForUnit (EvalUnit u) const |
Get component corresponding to given unit (previously generated using createEvalUnit). | |
RegistryPtr | registry () |
Returns the registry (useful for printing, cannot do this inline as ProgramCtx depends on this header). | |
ProgramCtx & | getProgramCtx () |
Returns the ProgramCtx. | |
virtual EvalUnit | createEvalUnit (const std::list< Component > &comps, const std::list< Component > &ccomps) |
This methods modifies the eval graph. | |
Protected Types | |
typedef boost::bimaps::bimap < boost::bimaps::unordered_set_of < Component > , boost::bimaps::unordered_set_of < EvalUnit > > | ComponentEvalUnitMapping |
Protected Member Functions | |
BOOST_CONCEPT_ASSERT ((boost::Convertible< Component, void * >)) | |
BOOST_CONCEPT_ASSERT ((boost::Convertible< EvalUnit, unsigned >)) | |
Protected Attributes | |
ProgramCtx & | ctx |
Overall program context. | |
boost::scoped_ptr< ComponentGraph > | clonedcgptr |
Component graph (we clone it and store it here in the constructor). | |
ComponentGraph & | cg |
Component graph (reference to cloned storage). | |
EvalGraphT & | eg |
Eval graph. | |
ASPSolverManager::SoftwareConfigurationPtr | externalEvalConfig |
Configuration for model generator factory. | |
ComponentEvalUnitMapping | mapping |
Mapping of nonshared components to eval units. | |
UnusedEdgeFilter | unusedEdgeFilter |
Subgraph of component graph that still needs to be put into eval units. | |
UnusedVertexFilter | unusedVertexFilter |
Edges of component graph that still need to be put into eval units. | |
ComponentGraphRest | cgrest |
Induced subgraph of cg: * Nodes not in mapping are part of this graph * Edges where both nodes are not in mapping are part of this graph. |
This template provides a framework for building an evaluation graph.
It provides one modifier method createEvalUnit() for creating an evaluation unit; this method does all necessary checks.
All evaluation planning heuristics must use this builder for creating evaluation units and evaluation graphs.
Definition at line 66 of file EvalGraphBuilder.h.
Definition at line 74 of file EvalGraphBuilder.h.
typedef boost::bimaps::bimap< boost::bimaps::unordered_set_of<Component>, boost::bimaps::unordered_set_of<EvalUnit> > EvalGraphBuilder::ComponentEvalUnitMapping [protected] |
Definition at line 100 of file EvalGraphBuilder.h.
typedef boost::filtered_graph<ComponentGraph::Graph, UnusedEdgeFilter, UnusedVertexFilter> EvalGraphBuilder::ComponentGraphRest |
Definition at line 165 of file EvalGraphBuilder.h.
Definition at line 75 of file EvalGraphBuilder.h.
Definition at line 72 of file EvalGraphBuilder.h.
Definition at line 73 of file EvalGraphBuilder.h.
EvalGraphBuilder::EvalGraphBuilder | ( | ProgramCtx & | ctx, |
ComponentGraph & | cg, | ||
EvalGraphT & | eg, | ||
ASPSolverManager::SoftwareConfigurationPtr | externalEvalConfig | ||
) |
Constructor.
ctx | See EvalGraphBuilder::ctx. |
cg | See EvalGraphBuilder::cg. |
eg | Evaluation graph to write the result to. |
externalEvalConfig | See ASPSolverManager::SoftwareConfiguration. |
Definition at line 65 of file EvalGraphBuilder.cpp.
EvalGraphBuilder::~EvalGraphBuilder | ( | ) | [virtual] |
Destructor.
Definition at line 83 of file EvalGraphBuilder.cpp.
EvalGraphBuilder::BOOST_CONCEPT_ASSERT | ( | (boost::Convertible< Component, void * >) | ) | [protected] |
EvalGraphBuilder::BOOST_CONCEPT_ASSERT | ( | (boost::Convertible< EvalUnit, unsigned >) | ) | [protected] |
EvalGraphBuilder::EvalUnit EvalGraphBuilder::createEvalUnit | ( | const std::list< Component > & | comps, |
const std::list< Component > & | ccomps | ||
) | [virtual] |
This methods modifies the eval graph.
It asserts that all requirements for evaluation units are fulfilled it adds an evaluation unit created from given nodes, including dependencies.
add ordered unit dependencies
ComponentRange
comps | List of components to directly put into eval unit. |
ccomps | List of components to copy into eval unit (these copied components may only contain constraints, and these must obey the constraint pushing restrictions (this will be asserted by createEvalUnit)). |
Reimplemented in DumpingEvalGraphBuilder.
Definition at line 114 of file EvalGraphBuilder.cpp.
References EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::addDependency(), EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::addUnit(), cg, ComponentGraph::collapseComponents(), ProgramCtx::config, ctx, ProgramCtx::customModelGeneratorProvider, Logger::DBG, DBGLOG, ComponentGraph::ComponentInfo::disjunctiveHeads, eg, externalEvalConfig, ComponentGraph::getDependencies(), Configuration::getOption(), ComponentGraph::ComponentInfo::innerEatoms, ComponentGraph::ComponentInfo::innerEatomsNonmonotonic, Logger::Instance(), LOG, LOG_SCOPE, mapping, ComponentGraph::ComponentInfo::negativeDependencyBetweenRules, printrange(), EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::propsOf(), ComponentGraph::propsOf(), ComponentGraph::ComponentInfo::recursiveAggregates, registry(), and ComponentGraph::targetOf().
Referenced by EvalHeuristicEasy::build(), EvalHeuristicMonolithic::build(), EvalHeuristicTrivial::build(), EvalHeuristicOldDlvhex::build(), EvalHeuristicFromFile::build(), EvalHeuristicGreedy::build(), DLVHEX_NAMESPACE_BEGIN::EvalHeuristicFromHEXSourcecode::build(), DumpingEvalGraphBuilder::createEvalUnit(), and evalheur::executeBuildCommands().
EvalGraphBuilder::Component EvalGraphBuilder::getComponentForUnit | ( | EvalGraphBuilder::EvalUnit | u | ) | const |
Get component corresponding to given unit (previously generated using createEvalUnit).
u | Evaluation unit. u as Component. |
Definition at line 103 of file EvalGraphBuilder.cpp.
References mapping.
Referenced by EvalHeuristicOldDlvhex::build().
ComponentGraph& EvalGraphBuilder::getComponentGraph | ( | ) | [inline] |
Retrieve internal component graph.
Definition at line 225 of file EvalGraphBuilder.h.
Referenced by EvalHeuristicASP::build(), EvalHeuristicEasy::build(), EvalHeuristicTrivial::build(), EvalHeuristicMonolithic::build(), EvalHeuristicOldDlvhex::build(), EvalHeuristicFromFile::build(), EvalHeuristicGreedy::build(), DLVHEX_NAMESPACE_BEGIN::EvalHeuristicFromHEXSourcecode::build(), evalheur::executeBuildCommands(), and DLVHEX_NAMESPACE_BEGIN::EvalHeuristicFromHEXSourcecode::preprocessComponents().
const ComponentGraphRest& EvalGraphBuilder::getComponentGraphRest | ( | ) | const [inline] |
Returns a graph consisting of all components that still need to be built into some evaluation unit.
Definition at line 228 of file EvalGraphBuilder.h.
Referenced by EvalHeuristicFromFile::build(), and DumpingEvalGraphBuilder::createEvalUnit().
const EvalGraphT& EvalGraphBuilder::getEvalGraph | ( | ) | const [inline] |
Retrieve internal evaluation graph.
Definition at line 222 of file EvalGraphBuilder.h.
ProgramCtx& EvalGraphBuilder::getProgramCtx | ( | ) | [inline] |
Returns the ProgramCtx.
Definition at line 240 of file EvalGraphBuilder.h.
Referenced by EvalHeuristicGreedy::build(), and DLVHEX_NAMESPACE_BEGIN::EvalHeuristicFromHEXSourcecode::build().
Returns the registry (useful for printing, cannot do this inline as ProgramCtx depends on this header).
Definition at line 88 of file EvalGraphBuilder.cpp.
References ctx, and ProgramCtx::registry().
Referenced by EvalHeuristicASP::build(), DLVHEX_NAMESPACE_BEGIN::EvalHeuristicFromHEXSourcecode::build(), createEvalUnit(), and DLVHEX_NAMESPACE_BEGIN::EvalHeuristicFromHEXSourcecode::preprocessComponents().
ComponentGraph& EvalGraphBuilder::cg [protected] |
Component graph (reference to cloned storage).
Definition at line 176 of file EvalGraphBuilder.h.
Referenced by DumpingEvalGraphBuilder::createEvalUnit(), and createEvalUnit().
ComponentGraphRest EvalGraphBuilder::cgrest [protected] |
Induced subgraph of cg: * Nodes not in mapping are part of this graph * Edges where both nodes are not in mapping are part of this graph.
The sources of boost::filtered_graph suggest that after an update to usedNodes, iterators of cgrest should not be reused, but the graph need not be reconstructed.
Definition at line 200 of file EvalGraphBuilder.h.
Referenced by DumpingEvalGraphBuilder::createEvalUnit().
boost::scoped_ptr<ComponentGraph> EvalGraphBuilder::clonedcgptr [protected] |
Component graph (we clone it and store it here in the constructor).
Definition at line 174 of file EvalGraphBuilder.h.
ProgramCtx& EvalGraphBuilder::ctx [protected] |
Overall program context.
Definition at line 172 of file EvalGraphBuilder.h.
Referenced by createEvalUnit(), and registry().
EvalGraphT& EvalGraphBuilder::eg [protected] |
Configuration for model generator factory.
Definition at line 180 of file EvalGraphBuilder.h.
Referenced by createEvalUnit().
ComponentEvalUnitMapping EvalGraphBuilder::mapping [protected] |
Mapping of nonshared components to eval units.
Definition at line 183 of file EvalGraphBuilder.h.
Referenced by createEvalUnit(), and getComponentForUnit().
UnusedEdgeFilter EvalGraphBuilder::unusedEdgeFilter [protected] |
Subgraph of component graph that still needs to be put into eval units.
See comment UnusedVertexFilter.
Definition at line 188 of file EvalGraphBuilder.h.
Edges of component graph that still need to be put into eval units.
See comment UnusedEdgeFilter.
Definition at line 192 of file EvalGraphBuilder.h.