dlvhex  2.5.0
EvalGraphBuilder Class Reference

This template provides a framework for building an evaluation graph. More...

#include <include/dlvhex2/EvalGraphBuilder.h>

Inheritance diagram for EvalGraphBuilder:
Collaboration diagram for EvalGraphBuilder:

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 EvalGraphTgetEvalGraph () const
 Retrieve internal evaluation graph.
ComponentGraphgetComponentGraph ()
 Retrieve internal component graph.
const ComponentGraphRestgetComponentGraphRest () 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).
ProgramCtxgetProgramCtx ()
 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

ProgramCtxctx
 Overall program context.
boost::scoped_ptr< ComponentGraphclonedcgptr
 Component graph (we clone it and store it here in the constructor).
ComponentGraphcg
 Component graph (reference to cloned storage).
EvalGraphTeg
 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.

Detailed Description

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.


Member Typedef Documentation

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.


Constructor & Destructor Documentation

Constructor.

Parameters:
ctxSee EvalGraphBuilder::ctx.
cgSee EvalGraphBuilder::cg.
egEvaluation graph to write the result to.
externalEvalConfigSee ASPSolverManager::SoftwareConfiguration.

Definition at line 65 of file EvalGraphBuilder.cpp.

Destructor.

Definition at line 83 of file EvalGraphBuilder.cpp.


Member Function Documentation

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.

Todo:

add ordered unit dependencies

ComponentRange

Parameters:
compsList of components to directly put into eval unit.
ccompsList 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)).
Returns:
Evaluation unit.

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().

Get component corresponding to given unit (previously generated using createEvalUnit).

Parameters:
uEvaluation unit. u as Component.

Definition at line 103 of file EvalGraphBuilder.cpp.

References mapping.

Referenced by EvalHeuristicOldDlvhex::build().

Returns a graph consisting of all components that still need to be built into some evaluation unit.

Returns:
Remaining components.

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.

Returns:
Evaluation graph.

Definition at line 222 of file EvalGraphBuilder.h.


Field Documentation

Component graph (reference to cloned storage).

Definition at line 176 of file EvalGraphBuilder.h.

Referenced by DumpingEvalGraphBuilder::createEvalUnit(), and createEvalUnit().

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.

Overall program context.

Definition at line 172 of file EvalGraphBuilder.h.

Referenced by createEvalUnit(), and registry().

Eval graph.

Definition at line 178 of file EvalGraphBuilder.h.

Referenced by createEvalUnit().

Configuration for model generator factory.

Definition at line 180 of file EvalGraphBuilder.h.

Referenced by createEvalUnit().

Mapping of nonshared components to eval units.

Definition at line 183 of file EvalGraphBuilder.h.

Referenced by createEvalUnit(), and getComponentForUnit().

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.


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