dlvhex
2.5.0
|
Program context class. More...
#include <include/dlvhex2/ProgramCtx.h>
Data Structures | |
class | SubprogramAnswerSetCallback |
Class for subprogram handling. More... | |
Public Member Functions | |
const RegistryPtr & | registry () const |
Retrieve main Registry. | |
const PluginContainerPtr & | pluginContainer () const |
Retrieve plugin container. | |
PluginAtomMap & | pluginAtomMap () |
Retrieve pluginatom map. | |
void | setupRegistry (RegistryPtr registry) |
Setup the registry. | |
void | changeRegistry (RegistryPtr registry) |
Change registry . | |
void | setupPluginContainer (PluginContainerPtr pluginContainer) |
Setup plugin container. | |
template<typename PluginT > | |
PluginT::CtxData & | getPluginData () |
template<typename PluginT > | |
PluginT::Environment & | getPluginEnvironment () |
Used by plugins to store specific plugin data in ProgramCtx. | |
template<typename PluginT > | |
const PluginT::Environment & | getPluginEnvironment () const |
void | changeState (const boost::shared_ptr< State > &s) |
Change reasoner state. | |
ProgramCtx () | |
Constructor. | |
~ProgramCtx () | |
Destructor. | |
ASPSolverManager::SoftwareConfigurationPtr | getASPSoftware () const |
Retrieves the configuration of the ASP solver backend being used. | |
void | setASPSoftware (ASPSolverManager::SoftwareConfigurationPtr c) |
Configures the ASP solver backend being used. | |
void | processPluginOptions (std::list< const char * > &pluginOptions) |
Processes options for each plugin loaded in this ProgramCtx. | |
void | addPluginAtomsFromPluginContainer () |
Goes through _pluginContainer to get plugin atoms and adds them. | |
void | addPluginAtom (PluginAtomPtr atom) |
Add atom to this ProgramCtx and link it to registry of this ProgramCtx. | |
void | associateExtAtomsWithPluginAtoms (const Tuple &idb, bool failOnUnknownAtom=true) |
Associates external atoms in registry of this ProgramCtx with plugin atoms in given idb . | |
void | setupByPlugins () |
Setup this ProgramCtx (using setupProgramCtx() for of all plugins). | |
void | resetCacheOfPlugins (bool resetOnlyIfUsesEnvironment=true) |
Resets the cache of Plugins (either all, or only those that use Environment). | |
void | showPlugins () |
See State. | |
void | convert () |
See State. | |
void | parse () |
See State. | |
void | moduleSyntaxCheck () |
See State. | |
void | mlpSolver () |
See State. | |
void | rewriteEDBIDB () |
See State. | |
void | safetyCheck () |
See State. | |
void | createDependencyGraph () |
See State. | |
void | liberalSafetyCheck () |
See State. | |
void | optimizeEDBDependencyGraph () |
See State. | |
void | createComponentGraph () |
See State. | |
void | strongSafetyCheck () |
See State. | |
void | createEvalGraph () |
See State. | |
void | setupProgramCtx () |
See State. | |
void | evaluate () |
See State. | |
void | postProcess () |
See State. | |
std::vector< InterpretationPtr > | evaluateSubprogram (InterpretationConstPtr edb, std::vector< ID > &idb) |
Evaluates an already parsed subprogram. | |
std::vector< InterpretationPtr > | evaluateSubprogram (InputProviderPtr &ip, InterpretationConstPtr addFacts) |
Evaluates a subprogram which still needs to be parsed. | |
std::vector< InterpretationPtr > | evaluateSubprogram (ProgramCtx &pc, bool parse) |
Evaluates a subprogram given by a ProgramCtx. | |
Data Fields | |
Configuration | config |
dlvhex settings, previously globals. | |
EvalHeuristicPtr | evalHeuristic |
Factory for eval heuristics. | |
ModelBuilderFactory | modelBuilderFactory |
Factory for model builders. | |
ExternalAtomEvaluationHeuristicsFactoryPtr | defaultExternalAtomEvaluationHeuristicsFactory |
Factory for external atom evaluation heuristic and ufs check heuristic. | |
UnfoundedSetCheckHeuristicsFactoryPtr | unfoundedSetCheckHeuristicsFactory |
Factory for the unfounded set check heuristics. | |
ASPSolverManager::SoftwareConfigurationPtr | aspsoftware |
ASP solver backend. | |
InputProviderPtr | inputProvider |
Program input provider (if a converter is used, the converter consumes this input and replaces it by another input). | |
HexParserPtr | parser |
The input parser. | |
std::vector< ID > | idb |
Program IDB. | |
std::vector< std::vector< ID > > | idbList |
Interpretation::Ptr | edb |
Program EDB as Interpretation. | |
std::vector< InterpretationPtr > | edbList |
Program EDB as vector. | |
uint32_t | maxint |
maxint setting, this is ID_FAIL if it is not specified, an integer term otherwise. | |
PluginInterfacePtr | customModelGeneratorProvider |
Might be set to a plugin which provides a custom model generator factoy. | |
std::vector< int > | currentOptimum |
Stores the weight vector of the best known model. | |
unsigned | currentOptimumRelevantLevels |
Stores how many weight/optimization levels are present in weak constraints. | |
DependencyGraphPtr | depgraph |
DependencyGraph. | |
ComponentGraphPtr | compgraph |
ComponentGraph. | |
std::vector < LiberalSafetyPluginFactoryPtr > | liberalSafetyPlugins |
Plugins to LiberalSafetyChecker. | |
LiberalSafetyCheckerPtr | liberalSafetyChecker |
LiberalSafetyChecker. | |
FinalEvalGraphPtr | evalgraph |
FinalEvaluationGraph. | |
FinalEvalGraph::EvalUnit | ufinal |
Final unit in ProgramCtx::evalgraph. | |
std::list< ModelCallbackPtr > | modelCallbacks |
Callbacks for models. | |
std::list< FinalCallbackPtr > | finalCallbacks |
FinalCallback. | |
ModelBuilderPtr | modelBuilder |
ModelBuilder being used, may be online or offline. | |
std::map< std::string, std::string > | benchmarksToSnapshotAtFirstModel |
Stores which benchmarks shall be preserved at first model. | |
StatePtr | state |
Current reasoner state. | |
bool | terminationRequest |
Set to true if all processing on this ProgramCtx shall be aborted (e.g., because of a global timeout). | |
Protected Types | |
typedef std::map< std::string, boost::shared_ptr< PluginData > > | PluginDataContainer |
typedef std::map< std::string, boost::shared_ptr < PluginEnvironment > > | PluginEnvironmentContainer |
Protected Attributes | |
RegistryPtr | _registry |
Symbol storage of this program context. | |
PluginContainerPtr | _pluginContainer |
Plugin container (this must be initialized with above registry!). | |
PluginDataContainer | pluginData |
Data associated with one specific plugin. | |
PluginEnvironmentContainer | pluginEnvironment |
Environment associated with one specific plugin. | |
PluginAtomMap | pluginAtoms |
Atoms usable for evaluation (loaded from plugins or manually added). |
Program context class.
A facade/state context for the subcomponents of dlvhex.
Definition at line 81 of file ProgramCtx.h.
typedef std::map<std::string, boost::shared_ptr<PluginData> > ProgramCtx::PluginDataContainer [protected] |
Definition at line 359 of file ProgramCtx.h.
typedef std::map<std::string, boost::shared_ptr<PluginEnvironment> > ProgramCtx::PluginEnvironmentContainer [protected] |
Definition at line 365 of file ProgramCtx.h.
Constructor.
Definition at line 58 of file ProgramCtx.cpp.
References config, Configuration::setOption(), Configuration::setStringOption(), and WARNING().
Destructor.
Not virtual, we do not want to derive from this!
Definition at line 176 of file ProgramCtx.cpp.
References _pluginContainer, _registry, aspsoftware, compgraph, customModelGeneratorProvider, DBGLOG, depgraph, edb, edbList, evalgraph, finalCallbacks, inputProvider, modelBuilder, modelCallbacks, parser, pluginAtoms, pluginData, pluginEnvironment, and state.
void ProgramCtx::addPluginAtom | ( | PluginAtomPtr | atom | ) |
Add atom
to this ProgramCtx and link it to registry of this ProgramCtx.
atom | The PluginInterface::PluginAtom to be added. |
Definition at line 464 of file ProgramCtx.cpp.
References _registry, LOG, pluginAtoms, and WARNING().
Referenced by main().
Goes through _pluginContainer to get plugin atoms and adds them.
Definition at line 493 of file ProgramCtx.cpp.
References LOG, pluginAtoms, pluginContainer(), registry(), and WARNING().
Referenced by changeRegistry(), and main().
void ProgramCtx::associateExtAtomsWithPluginAtoms | ( | const Tuple & | idb, |
bool | failOnUnknownAtom = true |
||
) |
Associates external atoms in registry of this ProgramCtx with plugin atoms in given idb
.
idb | Program IDB. |
failOnUnknownAtom | Throws on unknown atom iff failOnUnknownAtom is true. |
Definition at line 519 of file ProgramCtx.cpp.
References _registry, Rule::body, DBGLOG, DBGLOG_SCOPE, pluginAtoms, and toString().
Referenced by evaluateSubprogram(), and main().
void ProgramCtx::changeRegistry | ( | RegistryPtr | registry | ) |
Change registry .
This method may also be used if there is already something stored. However, this might invaliddate the IDs used elsewhere!
registry | New registry. |
Definition at line 261 of file ProgramCtx.cpp.
References addPluginAtomsFromPluginContainer(), edb, edbList, idb, idbList, pluginAtoms, and setupRegistry().
void ProgramCtx::changeState | ( | const boost::shared_ptr< State > & | s | ) |
Change reasoner state.
s | New state. |
Definition at line 238 of file ProgramCtx.cpp.
References state.
Referenced by State::changeState(), evaluateSubprogram(), and main().
void ProgramCtx::convert | ( | ) |
See State.
Optional.
Definition at line 308 of file ProgramCtx.cpp.
References state.
Referenced by evaluateSubprogram(), and main().
void ProgramCtx::createComponentGraph | ( | ) |
See State.
Definition at line 317 of file ProgramCtx.cpp.
References state.
Referenced by evaluateSubprogram(), and main().
void ProgramCtx::createDependencyGraph | ( | ) |
See State.
Definition at line 314 of file ProgramCtx.cpp.
References state.
Referenced by evaluateSubprogram(), and main().
void ProgramCtx::createEvalGraph | ( | ) |
See State.
Definition at line 319 of file ProgramCtx.cpp.
References state.
Referenced by evaluateSubprogram(), and main().
void ProgramCtx::evaluate | ( | ) |
See State.
Definition at line 321 of file ProgramCtx.cpp.
References state.
Referenced by evaluateSubprogram(), and main().
std::vector< InterpretationPtr > ProgramCtx::evaluateSubprogram | ( | InterpretationConstPtr | edb, |
std::vector< ID > & | idb | ||
) |
Evaluates an already parsed subprogram.
edb | EDB of the subprogram. |
idb | IDB of the subprogram. |
Definition at line 335 of file ProgramCtx.cpp.
References currentOptimum, currentOptimumRelevantLevels, edb, and idb.
Referenced by evaluateSubprogram().
std::vector< InterpretationPtr > ProgramCtx::evaluateSubprogram | ( | InputProviderPtr & | ip, |
InterpretationConstPtr | addFacts | ||
) |
Evaluates a subprogram which still needs to be parsed.
ip | InputProvider which specifies the subprogram. |
addFacts | Facts to be added to the subprogram before it is evaluated. |
Definition at line 347 of file ProgramCtx.cpp.
References config, currentOptimum, currentOptimumRelevantLevels, edb, evaluateSubprogram(), idb, inputProvider, registry(), and Configuration::setOption().
std::vector< InterpretationPtr > ProgramCtx::evaluateSubprogram | ( | ProgramCtx & | pc, |
bool | parse | ||
) |
Evaluates a subprogram given by a ProgramCtx.
parse | True to read the program from ProgramCtx::inputProvider (pc ), false to read it from ProgramCtx::edb and ProgramCtx::idb (pc ). |
Definition at line 365 of file ProgramCtx.cpp.
References ProgramCtx::SubprogramAnswerSetCallback::answersets, associateExtAtomsWithPluginAtoms(), changeState(), compgraph, config, convert(), createComponentGraph(), createDependencyGraph(), createEvalGraph(), DBGLOG, depgraph, evalgraph, evalHeuristic, evaluate(), finalCallbacks, Configuration::getOption(), idb, liberalSafetyCheck(), modelBuilder, modelCallbacks, optimizeEDBDependencyGraph(), parse(), parser, rewriteEDBIDB(), safetyCheck(), Configuration::setOption(), setupProgramCtx(), state, strongSafetyCheck(), and terminationRequest.
Retrieves the configuration of the ASP solver backend being used.
Definition at line 294 of file ProgramCtx.cpp.
References aspsoftware.
Referenced by processOptionsPrePlugin().
PluginT::CtxData & ProgramCtx::getPluginData | ( | ) |
Definition at line 378 of file ProgramCtx.h.
References pluginData.
Referenced by DLVHEX_NAMESPACE_BEGIN::EvalHeuristicFromHEXSourcecode::build(), FunctionPlugin::createAtoms(), AggregatePlugin::createAtoms(), ConditionalLiteralPlugin::createParserModules(), ChoicePlugin::createParserModules(), FunctionPlugin::createParserModules(), HigherOrderPlugin::createParserModules(), StrongNegationPlugin::createParserModules(), ManualEvalHeuristicsPlugin::createParserModules(), QueryPlugin::createParserModules(), WeakConstraintPlugin::createRewriter(), FunctionPlugin::createRewriter(), AggregatePlugin::createRewriter(), StrongNegationPlugin::createRewriter(), ManualEvalHeuristicsPlugin::createRewriter(), HigherOrderPlugin::createRewriter(), QueryPlugin::createRewriter(), ConditionalLiteralPlugin::processOptions(), ChoicePlugin::processOptions(), WeakConstraintPlugin::processOptions(), FunctionPlugin::processOptions(), AggregatePlugin::processOptions(), StrongNegationPlugin::processOptions(), HigherOrderPlugin::processOptions(), ManualEvalHeuristicsPlugin::processOptions(), QueryPlugin::processOptions(), TestPlugin::processOptions(), WeakConstraintPlugin::setupProgramCtx(), ConditionalLiteralPlugin::setupProgramCtx(), ChoicePlugin::setupProgramCtx(), FunctionPlugin::setupProgramCtx(), AggregatePlugin::setupProgramCtx(), StrongNegationPlugin::setupProgramCtx(), HigherOrderPlugin::setupProgramCtx(), QueryPlugin::setupProgramCtx(), and TestPlugin::setupProgramCtx().
PluginT::Environment & ProgramCtx::getPluginEnvironment | ( | ) |
Used by plugins to store specific plugin data in ProgramCtx.
Default constructs PluginT::Environment if it is not yet stored in ProgramCtx.
Definition at line 399 of file ProgramCtx.h.
References pluginEnvironment.
const PluginT::Environment & ProgramCtx::getPluginEnvironment | ( | ) | const |
Definition at line 418 of file ProgramCtx.h.
References pluginEnvironment.
void ProgramCtx::liberalSafetyCheck | ( | ) |
See State.
Definition at line 315 of file ProgramCtx.cpp.
References state.
Referenced by evaluateSubprogram(), and main().
void ProgramCtx::mlpSolver | ( | ) |
void ProgramCtx::moduleSyntaxCheck | ( | ) |
See State.
Optional.
Definition at line 316 of file ProgramCtx.cpp.
References state.
Referenced by evaluateSubprogram(), and main().
void ProgramCtx::parse | ( | ) |
See State.
Definition at line 309 of file ProgramCtx.cpp.
References state.
Referenced by evaluateSubprogram(), and main().
PluginAtomMap& ProgramCtx::pluginAtomMap | ( | ) | [inline] |
Retrieve pluginatom map.
Definition at line 99 of file ProgramCtx.h.
Referenced by FunctionInterprete::retrieve().
const PluginContainerPtr& ProgramCtx::pluginContainer | ( | ) | const [inline] |
Retrieve plugin container.
Definition at line 94 of file ProgramCtx.h.
Referenced by addPluginAtomsFromPluginContainer(), ConvertState::convert(), main(), OptimizeEDBDependencyGraphState::optimizeEDBDependencyGraph(), ParseState::parse(), processPluginOptions(), RewriteEDBIDBState::rewriteEDBIDB(), setupByPlugins(), setupPluginContainer(), and ShowPluginsState::showPlugins().
void ProgramCtx::postProcess | ( | ) |
void ProgramCtx::processPluginOptions | ( | std::list< const char * > & | pluginOptions | ) |
Processes options for each plugin loaded in this ProgramCtx.
This is supposed to remove "recognized" options from pluginOptions.
pluginOptions | Options not recognized by the dlvhex core. |
Definition at line 482 of file ProgramCtx.cpp.
References LOG, pluginContainer(), and printrange().
Referenced by main().
const RegistryPtr& ProgramCtx::registry | ( | ) | const [inline] |
Retrieve main Registry.
Definition at line 89 of file ProgramCtx.h.
Referenced by BaseModelGeneratorFactory::addDomainPredicatesAndCreateDomainExplorationProgram(), GenuineGuessAndCheckModelGeneratorFactory::addInconsistencyCauseFromSuccessor(), GenuineGuessAndCheckModelGenerator::addNogood(), ExternalAtomMask::addOutputAtoms(), addPluginAtomsFromPluginContainer(), AnswerSetPrinterCallback::AnswerSetPrinterCallback(), PluginAtom::Query::assign(), AssumptionBasedUnfoundedSetChecker::AssumptionBasedUnfoundedSetChecker(), BOOST_AUTO_TEST_CASE(), CDNLSolver::CDNLSolver(), CheckLiberalSafetyState::checkLiberalSafety(), FunctionRewriter::composeTerm(), AnnotatedGroundProgram::computeAtomDependencyGraph(), BaseModelGenerator::computeExtensionOfDomainPredicates(), BaseModelGeneratorFactory::convertRule(), BaseModelGeneratorFactory::convertRuleBody(), CreateComponentGraphState::createComponentGraph(), CreateDependencyGraphState::createDependencyGraph(), CSVAnswerSetPrinterCallback::CSVAnswerSetPrinterCallback(), FunctionRewriter::decomposeTerm(), BaseModelGenerator::evaluateExternalAtom(), BaseModelGenerator::evaluateExternalAtomQuery(), evaluateSubprogram(), PluginAtom::generalizeNogood(), GenuineWellfoundedModelGenerator::generateNextModel(), WellfoundedModelGenerator::generateNextModel(), PlainModelGenerator::generateNextModel(), GenuinePlainModelGenerator::generateNextModel(), GenuineGuessAndCheckModelGenerator::generateNextModel(), GenuineGuessAndCheckModelGenerator::GenuineGuessAndCheckModelGenerator(), GenuinePlainModelGenerator::GenuinePlainModelGenerator(), GenuinePlainModelGeneratorFactory::GenuinePlainModelGeneratorFactory(), GenuineWellfoundedModelGeneratorFactory::GenuineWellfoundedModelGeneratorFactory(), MLPSyntaxChecker::getArity(), ExternalLearningHelper::getIDOfLearningRule(), ExternalLearningHelper::getOutputAtom(), ExternalLearningHelper::getOutputAtoms(), AnnotatedGroundProgram::hasECycles(), GenuineGuessAndCheckModelGenerator::identifyInconsistencyCause(), GenuineGuessAndCheckModelGenerator::initializeExplanationAtoms(), GenuineGuessAndCheckModelGenerator::initializeInconsistencyAnalysis(), GenuineGuessAndCheckModelGenerator::inlineExternalAtoms(), InternalGroundASPSolver::InternalGroundASPSolver(), InternalGrounder::InternalGrounder(), FLPModelGeneratorBase::isSubsetMinimalFLPModel(), ExternalLearningHelper::learnFromFunctionality(), ExternalLearningHelper::learnFromGroundRule(), ExternalLearningHelper::learnFromInputOutputBehavior(), ExternalLearningHelper::learnFromNegativeAtoms(), ExternalLearningHelper::learnFromRule(), GenuineGuessAndCheckModelGenerator::learnSupportSets(), BaseModelGenerator::learnSupportSetsForExternalAtom(), main(), sem< HexGrammarSemantics::termFromCIdent >::operator()(), ExternalLearningHelper::DefaultInputNogoodProvider::operator()(), StrongSafetyChecker::operator()(), sem< HexGrammarSemantics::termFromFunctionTerm >::operator()(), sem< HexGrammarSemantics::termFromRange >::operator()(), sem< HexGrammarSemantics::termFromString >::operator()(), sem< HexGrammarSemantics::termFromVariable >::operator()(), sem< HigherOrderParserModuleSemantics::higherOrderAtom >::operator()(), sem< ConditionalParserModuleSemantics::conditionalLieral >::operator()(), sem< ChoiceParserModuleSemantics::choiceRule >::operator()(), sem< StrongNegationParserModuleSemantics::stronglyNegatedPrefixAtom >::operator()(), sem< QueryParserModuleSemantics::queryBody >::operator()(), sem< HexGrammarSemantics::predFromPredDecl >::operator()(), sem< ChoiceParserModuleSemantics::choiceHead >::operator()(), sem< HexGrammarSemantics::predFromNameOnly >::operator()(), sem< HexGrammarSemantics::predFromString >::operator()(), sem< HexGrammarSemantics::classicalAtomFromPrefix >::operator()(), sem< ChoiceParserModuleSemantics::choiceElement >::operator()(), sem< HexGrammarSemantics::classicalAtomFromTuple >::operator()(), sem< HexGrammarSemantics::builtinTernaryInfix >::operator()(), sem< HexGrammarSemantics::builtinBinaryInfix >::operator()(), sem< HexGrammarSemantics::builtinUnaryPrefix >::operator()(), sem< HexGrammarSemantics::builtinBinaryPrefix >::operator()(), sem< HexGrammarSemantics::builtinTernaryPrefix >::operator()(), sem< HexGrammarSemantics::aggregateAtom >::operator()(), sem< HexGrammarSemantics::externalAtom >::operator()(), sem< FunctionParserModuleTermSemantics::functionTermConstruct >::operator()(), sem< ManualEvalHeuristicsParserModuleSemantics::evalUnit >::operator()(), sem< HexGrammarSemantics::mlpModuleAtom >::operator()(), sem< FunctionParserModuleAtomSemantics::functionTermEval >::operator()(), sem< HexGrammarSemantics::rule >::operator()(), sem< HexGrammarSemantics::ruleVariableDisjunction >::operator()(), sem< HexGrammarSemantics::constraint >::operator()(), sem< HexGrammarSemantics::weakconstraint >::operator()(), sem< HexGrammarSemantics::weakconstraintaspcore2 >::operator()(), sem< HexGrammarSemantics::addMLPModuleHeader >::operator()(), sem< HexGrammarSemantics::add >::operator()(), ModuleHexParser::parse(), ParseState::parse(), PlainModelGeneratorFactory::PlainModelGeneratorFactory(), PostProcessState::postProcess(), GuessAndCheckModelGeneratorFactory::print(), WellfoundedModelGeneratorFactory::print(), PlainModelGeneratorFactory::print(), GenuineWellfoundedModelGeneratorFactory::print(), GenuinePlainModelGeneratorFactory::print(), GenuineGuessAndCheckModelGeneratorFactory::print(), EvalGraphBuilder::registry(), GenuineGuessAndCheckModelGenerator::replacePredForInlinedEAs(), CDNLSolver::resizeVectors(), CDNLSolver::restartWithAssumptions(), PluginAtom::retrieveCached(), FunctionRewriter::rewrite(), RewriteEDBIDBState::rewriteEDBIDB(), ConditionalLiteralPlugin::setupProgramCtx(), ChoicePlugin::setupProgramCtx(), AggregatePlugin::setupProgramCtx(), FunctionPlugin::setupProgramCtx(), StrongNegationPlugin::setupProgramCtx(), HigherOrderPlugin::setupProgramCtx(), QueryPlugin::setupProgramCtx(), SetupProgramCtxState::setupProgramCtx(), setupRegistry(), PluginAtom::splitQuery(), storePredicate(), testSimple(), UnfoundedSetChecker::UnfoundedSetChecker(), MLPSyntaxChecker::verifyAllModuleCalls(), UnfoundedSetChecker::verifyExternalAtomByEvaluation(), GenuineGuessAndCheckModelGenerator::verifyExternalAtomByEvaluation(), MLPSyntaxChecker::verifyPredInputsArityModuleCall(), MLPSyntaxChecker::verifyPredOutputArityModuleCall(), and WellfoundedModelGeneratorFactory::WellfoundedModelGeneratorFactory().
void ProgramCtx::resetCacheOfPlugins | ( | bool | resetOnlyIfUsesEnvironment = true | ) |
Resets the cache of Plugins (either all, or only those that use Environment).
The default value is for backwards-compatibility with ActHex).
resetOnlyIfUsesEnvironment | If true, only the caches of external atom are resetted which actually depend on the environment. |
Definition at line 587 of file ProgramCtx.cpp.
References pluginAtoms.
void ProgramCtx::rewriteEDBIDB | ( | ) |
See State.
Optional.
Definition at line 312 of file ProgramCtx.cpp.
References state.
Referenced by evaluateSubprogram(), and main().
void ProgramCtx::safetyCheck | ( | ) |
See State.
Optional if we know that the program is safe.
Definition at line 313 of file ProgramCtx.cpp.
References state.
Referenced by evaluateSubprogram(), and main().
Configures the ASP solver backend being used.
See | SoftwareConfiguration. |
Definition at line 301 of file ProgramCtx.cpp.
References aspsoftware.
Referenced by main(), processOptionsPrePlugin(), testABBAProgram(), testAFinProgram(), testCardinalityProgram(), testComplexProgram(), testCsProgram(), testDisjunctionProgram(), testHanoiProgram(), testInconsistentProgram(), testIndirectionProgram(), testIStratified2Program(), testIStratifiedProgram(), testNegationProgram(), testNoticStratifiedProgram(), testOneMainModules(), testReachabilityNonGroundProgram(), testTwoMainModules(), testTwoModuleCalls1(), and testTwoModuleCalls2().
void ProgramCtx::setupByPlugins | ( | ) |
Setup this ProgramCtx (using setupProgramCtx() for of all plugins).
Definition at line 577 of file ProgramCtx.cpp.
References LOG, and pluginContainer().
Referenced by SetupProgramCtxState::setupProgramCtx().
void ProgramCtx::setupPluginContainer | ( | PluginContainerPtr | pluginContainer | ) |
Setup plugin container.
pluginContainer | New plugin container. |
Definition at line 278 of file ProgramCtx.cpp.
References _pluginContainer, pluginAtoms, pluginContainer(), and WARNING().
Referenced by main().
void ProgramCtx::setupProgramCtx | ( | ) |
See State.
Definition at line 320 of file ProgramCtx.cpp.
References state.
Referenced by evaluateSubprogram(), and main().
void ProgramCtx::setupRegistry | ( | RegistryPtr | registry | ) |
Setup the registry.
It cannot bechanged if something is already stored here!
registry | New registry. |
Definition at line 245 of file ProgramCtx.cpp.
References _registry, edb, edbList, idb, idbList, pluginAtoms, and registry().
Referenced by BOOST_AUTO_TEST_CASE(), changeRegistry(), LiberalSafetyChecker::ensureOrdinarySafety(), main(), testABBAProgram(), testAFinProgram(), testCardinalityProgram(), testComplexProgram(), testCsProgram(), testDisjunctionProgram(), testHanoiProgram(), testInconsistentProgram(), testIndirectionProgram(), testIStratified2Program(), testIStratifiedProgram(), testNegationProgram(), testNoticStratifiedProgram(), testOneMainModules(), testReachabilityNonGroundProgram(), testSimple(), testTwoMainModules(), testTwoModuleCalls1(), and testTwoModuleCalls2().
void ProgramCtx::showPlugins | ( | ) |
See State.
Optional.
Definition at line 307 of file ProgramCtx.cpp.
References state.
Referenced by main().
void ProgramCtx::strongSafetyCheck | ( | ) |
See State.
Optional if we know that the program is strongly safe.
Definition at line 318 of file ProgramCtx.cpp.
References state.
Referenced by evaluateSubprogram(), and main().
PluginContainerPtr ProgramCtx::_pluginContainer [protected] |
Plugin container (this must be initialized with above registry!).
Definition at line 357 of file ProgramCtx.h.
Referenced by setupPluginContainer(), and ~ProgramCtx().
RegistryPtr ProgramCtx::_registry [protected] |
Symbol storage of this program context.
This is a shared ptr because we might want to have multiple program contexts sharing the same registry).
Definition at line 354 of file ProgramCtx.h.
Referenced by addPluginAtom(), associateExtAtomsWithPluginAtoms(), setupRegistry(), and ~ProgramCtx().
ASP solver backend.
Definition at line 129 of file ProgramCtx.h.
Referenced by DLVHEX_NAMESPACE_BEGIN::ASMOrdinaryASPSolver::ASMOrdinaryASPSolver(), CreateEvalGraphState::createEvalGraph(), getASPSoftware(), setASPSoftware(), and ~ProgramCtx().
std::map<std::string, std::string> ProgramCtx::benchmarksToSnapshotAtFirstModel |
Stores which benchmarks shall be preserved at first model.
Definition at line 202 of file ProgramCtx.h.
Referenced by SetupProgramCtxState::setupProgramCtx().
Definition at line 183 of file ProgramCtx.h.
Referenced by CreateComponentGraphState::createComponentGraph(), CreateEvalGraphState::createEvalGraph(), evaluateSubprogram(), StrongSafetyChecker::operator()(), and ~ProgramCtx().
dlvhex settings, previously globals.
Definition at line 85 of file ProgramCtx.h.
Referenced by BaseModelGeneratorFactory::addDomainPredicatesAndCreateDomainExplorationProgram(), GenuineGuessAndCheckModelGenerator::addNogood(), AnswerSetPrinterCallback::AnswerSetPrinterCallback(), EvalHeuristicGreedy::build(), ComponentGraph::calculateComponents(), CheckLiberalSafetyState::checkLiberalSafety(), AnnotatedGroundProgram::computeAdditionalDependencies(), AnnotatedGroundProgram::computeAtomDependencyGraph(), AnnotatedGroundProgram::computeECycles(), EncodingBasedUnfoundedSetChecker::constructUFSDetectionProblemNecessaryPart(), AssumptionBasedUnfoundedSetChecker::constructUFSDetectionProblemRule(), ConvertState::convert(), BaseModelGeneratorFactory::convertRuleBody(), CreateComponentGraphState::createComponentGraph(), CreateDependencyGraphState::createDependencyGraph(), FLPModelGeneratorFactoryBase::createEatomGuessingRule(), CreateEvalGraphState::createEvalGraph(), EvalGraphBuilder::createEvalUnit(), FLPModelGeneratorFactoryBase::createFLPRules(), EvaluateState::evaluate(), BaseModelGenerator::evaluateExternalAtomQuery(), evaluateSubprogram(), GenuineGuessAndCheckModelGenerator::finalCompatibilityCheck(), GenuineWellfoundedModelGenerator::generateNextModel(), GenuinePlainModelGenerator::generateNextModel(), GuessAndCheckModelGenerator::generateNextModel(), GenuineGuessAndCheckModelGenerator::generateNextModel(), GenuineGuessAndCheckModelGenerator::GenuineGuessAndCheckModelGenerator(), GenuineGuessAndCheckModelGeneratorFactory::GenuineGuessAndCheckModelGeneratorFactory(), GenuineWellfoundedModelGeneratorFactory::GenuineWellfoundedModelGeneratorFactory(), GenuineGuessAndCheckModelGenerator::getInconsistencyCause(), GenuineGrounder::getInstance(), SATSolver::getInstance(), GenuineGroundSolver::getInstance(), ExternalLearningHelper::getOutputAtom(), ExternalLearningHelper::getOutputAtoms(), UnfoundedSetChecker::getUFSNogood(), UnfoundedSetCheckerManager::getUnfoundedSet(), GenuineGuessAndCheckModelGenerator::initializeExplanationAtoms(), GenuineGuessAndCheckModelGenerator::initializeInconsistencyAnalysis(), UnfoundedSetCheckerManager::initializeUnfoundedSetCheckers(), UnfoundedSetCheckerManager::instantiateUnfoundedSetChecker(), FLPModelGeneratorBase::isCompatibleSet(), GenuineGuessAndCheckModelGenerator::isModel(), UnfoundedSetChecker::isUnfoundedSet(), ExternalLearningHelper::learnFromInputOutputBehavior(), ExternalLearningHelper::learnFromNegativeAtoms(), AssumptionBasedUnfoundedSetChecker::learnNogoodsFromMainSearch(), GenuineGuessAndCheckModelGenerator::learnSupportSets(), main(), ExternalAtomMask::matchOutputAtom(), EvalHeuristicGreedy::mergeComponents(), MLPSolverState::mlpSolver(), AnswerSetPrinterCallback::operator()(), ExternalLearningHelper::DefaultInputNogoodProvider::operator()(), StrongSafetyChecker::operator()(), sem< QueryParserModuleSemantics::queryBody >::operator()(), TestFinalCallback::operator()(), OptimizeEDBDependencyGraphState::optimizeEDBDependencyGraph(), ParseState::parse(), PostProcessState::postProcess(), AggregatePlugin::processOptions(), processOptionsPrePlugin(), ProgramCtx(), GenuineGuessAndCheckModelGenerator::propagate(), TestSetMinusNogoodBasedLearningAtom::retrieve(), TestSetMinusNongroundNogoodBasedLearningAtom::retrieve(), PluginAtom::retrieveFacade(), TestASPQueryAtom::retrieveOrLearnSupportSets(), RewriteEDBIDBState::rewriteEDBIDB(), ExternalAtomMask::setEAtom(), HigherOrderPlugin::setupProgramCtx(), QueryPlugin::setupProgramCtx(), SetupProgramCtxState::setupProgramCtx(), ShowPluginsState::showPlugins(), PluginAtom::splitQuery(), GenuineGuessAndCheckModelGenerator::unfoundedSetCheck(), UnfoundedSetCheckerManager::UnfoundedSetCheckerManager(), GenuineGuessAndCheckModelGenerator::updateEANogoods(), GenuineGuessAndCheckModelGenerator::verifyExternalAtom(), UnfoundedSetChecker::verifyExternalAtomByEvaluation(), GenuineGuessAndCheckModelGenerator::verifyExternalAtomByEvaluation(), and GenuineGuessAndCheckModelGenerator::verifyExternalAtomBySupportSets().
std::vector<int> ProgramCtx::currentOptimum |
Stores the weight vector of the best known model.
If the vector is empty, then there was no solution so far. This vector will always be updated, independent of the optimization settings, and also has statistical purpose. It does not directly influence the algorithms.
Definition at line 158 of file ProgramCtx.h.
Referenced by evaluateSubprogram(), GenuineWellfoundedModelGenerator::generateNextModel(), GenuinePlainModelGenerator::generateNextModel(), GenuineGuessAndCheckModelGenerator::generateNextModel(), and TestASPQueryAtom::retrieveOrLearnSupportSets().
Stores how many weight/optimization levels are present in weak constraints.
We need to know this because in case some of these constraints are never violated while searching for the first model, we never see the respective level and cannot set a weight bound for enumeration.
Definition at line 164 of file ProgramCtx.h.
Referenced by evaluateSubprogram().
Might be set to a plugin which provides a custom model generator factoy.
If set to 0, then the default algorithms are used.
Definition at line 152 of file ProgramCtx.h.
Referenced by EvalGraphBuilder::createEvalUnit(), main(), and ~ProgramCtx().
ExternalAtomEvaluationHeuristicsFactoryPtr ProgramCtx::defaultExternalAtomEvaluationHeuristicsFactory |
Factory for external atom evaluation heuristic and ufs check heuristic.
Definition at line 124 of file ProgramCtx.h.
Referenced by GenuineGuessAndCheckModelGenerator::initializeHeuristics(), and processOptionsPrePlugin().
Definition at line 181 of file ProgramCtx.h.
Referenced by CreateComponentGraphState::createComponentGraph(), CreateDependencyGraphState::createDependencyGraph(), evaluateSubprogram(), OptimizeEDBDependencyGraphState::optimizeEDBDependencyGraph(), and ~ProgramCtx().
Program EDB as Interpretation.
Definition at line 142 of file ProgramCtx.h.
Referenced by BOOST_AUTO_TEST_CASE(), changeRegistry(), evaluateSubprogram(), GenuineWellfoundedModelGenerator::generateNextModel(), WellfoundedModelGenerator::generateNextModel(), PlainModelGenerator::generateNextModel(), GenuineGuessAndCheckModelGenerator::GenuineGuessAndCheckModelGenerator(), GenuinePlainModelGenerator::GenuinePlainModelGenerator(), ExternalLearningHelper::getIDOfLearningRule(), GuessAndCheckModelGenerator::GuessAndCheckModelGenerator(), sem< HexGrammarSemantics::add >::operator()(), OptimizeEDBDependencyGraphState::optimizeEDBDependencyGraph(), ModuleHexParser::parse(), ParseState::parse(), TestASPQueryAtom::retrieveOrLearnSupportSets(), RewriteEDBIDBState::rewriteEDBIDB(), HigherOrderPlugin::setupProgramCtx(), setupRegistry(), testSimple(), and ~ProgramCtx().
std::vector<InterpretationPtr> ProgramCtx::edbList |
Program EDB as vector.
Definition at line 144 of file ProgramCtx.h.
Referenced by changeRegistry(), sem< HexGrammarSemantics::addMLPModuleHeader >::operator()(), sem< HexGrammarSemantics::add >::operator()(), setupRegistry(), and ~ProgramCtx().
FinalEvaluationGraph.
Definition at line 189 of file ProgramCtx.h.
Referenced by CreateEvalGraphState::createEvalGraph(), evaluateSubprogram(), and ~ProgramCtx().
Factory for eval heuristics.
Definition at line 120 of file ProgramCtx.h.
Referenced by CreateEvalGraphState::createEvalGraph(), evaluateSubprogram(), main(), ManualEvalHeuristicsPlugin::processOptions(), and processOptionsPrePlugin().
std::list<FinalCallbackPtr> ProgramCtx::finalCallbacks |
Definition at line 195 of file ProgramCtx.h.
Referenced by EvaluateState::evaluate(), evaluateSubprogram(), QueryPlugin::setupProgramCtx(), TestPlugin::setupProgramCtx(), and ~ProgramCtx().
std::vector<ID> ProgramCtx::idb |
Program IDB.
Definition at line 138 of file ProgramCtx.h.
Referenced by BOOST_AUTO_TEST_CASE(), changeRegistry(), CheckLiberalSafetyState::checkLiberalSafety(), CreateDependencyGraphState::createDependencyGraph(), LiberalSafetyChecker::ensureOrdinarySafety(), evaluateSubprogram(), ExternalLearningHelper::getIDOfLearningRule(), main(), sem< ChoiceParserModuleSemantics::choiceRule >::operator()(), sem< HexGrammarSemantics::add >::operator()(), ModuleHexParser::parse(), ParseState::parse(), TestASPQueryAtom::retrieveOrLearnSupportSets(), FunctionRewriter::rewrite(), RewriteEDBIDBState::rewriteEDBIDB(), setupRegistry(), and testSimple().
std::vector<std::vector<ID> > ProgramCtx::idbList |
Definition at line 139 of file ProgramCtx.h.
Referenced by BOOST_AUTO_TEST_CASE(), changeRegistry(), sem< ChoiceParserModuleSemantics::choiceRule >::operator()(), sem< HexGrammarSemantics::addMLPModuleHeader >::operator()(), sem< HexGrammarSemantics::add >::operator()(), and setupRegistry().
Program input provider (if a converter is used, the converter consumes this input and replaces it by another input).
Definition at line 132 of file ProgramCtx.h.
Referenced by ConvertState::convert(), evaluateSubprogram(), main(), ParseState::parse(), processOptionsPrePlugin(), TestASPQueryAtom::retrieveOrLearnSupportSets(), and ~ProgramCtx().
Plugins to LiberalSafetyChecker.
Definition at line 185 of file ProgramCtx.h.
Referenced by CheckLiberalSafetyState::checkLiberalSafety().
uint32_t ProgramCtx::maxint |
maxint setting, this is ID_FAIL if it is not specified, an integer term otherwise.
Definition at line 147 of file ProgramCtx.h.
Referenced by BaseModelGenerator::computeExtensionOfDomainPredicates(), GenuineWellfoundedModelGenerator::generateNextModel(), WellfoundedModelGenerator::generateNextModel(), PlainModelGenerator::generateNextModel(), GenuineGuessAndCheckModelGenerator::GenuineGuessAndCheckModelGenerator(), GenuinePlainModelGenerator::GenuinePlainModelGenerator(), GuessAndCheckModelGenerator::GuessAndCheckModelGenerator(), GenuineGuessAndCheckModelGenerator::inlineExternalAtoms(), FLPModelGeneratorBase::isSubsetMinimalFLPModel(), InternalGrounder::matchNextFromExtensionBuiltinTernary(), InternalGrounder::matchNextFromExtensionBuiltinUnary(), sem< HexGrammarSemantics::termFromInteger >::operator()(), sem< HexGrammarSemantics::maxint >::operator()(), and processOptionsPrePlugin().
ModelBuilder being used, may be online or offline.
Definition at line 197 of file ProgramCtx.h.
Referenced by evaluateSubprogram(), main(), PostProcessState::postProcess(), and ~ProgramCtx().
Factory for model builders.
Definition at line 122 of file ProgramCtx.h.
Referenced by main(), and processOptionsPrePlugin().
std::list<ModelCallbackPtr> ProgramCtx::modelCallbacks |
Callbacks for models.
Definition at line 193 of file ProgramCtx.h.
Referenced by evaluateSubprogram(), processOptionsPrePlugin(), QueryPlugin::setupProgramCtx(), SetupProgramCtxState::setupProgramCtx(), and ~ProgramCtx().
The input parser.
Definition at line 135 of file ProgramCtx.h.
Referenced by evaluateSubprogram(), ParseState::parse(), and ~ProgramCtx().
PluginAtomMap ProgramCtx::pluginAtoms [protected] |
Atoms usable for evaluation (loaded from plugins or manually added).
Definition at line 372 of file ProgramCtx.h.
Referenced by addPluginAtom(), addPluginAtomsFromPluginContainer(), associateExtAtomsWithPluginAtoms(), changeRegistry(), resetCacheOfPlugins(), setupPluginContainer(), setupRegistry(), and ~ProgramCtx().
PluginDataContainer ProgramCtx::pluginData [protected] |
Data associated with one specific plugin.
Externally we see this as a non-const reference, the shared_ptr is totally internal.
Definition at line 363 of file ProgramCtx.h.
Referenced by getPluginData(), and ~ProgramCtx().
Environment associated with one specific plugin.
Externally we see this as a non-const reference, the shared_ptr is totally internal.
Definition at line 369 of file ProgramCtx.h.
Referenced by getPluginEnvironment(), and ~ProgramCtx().
Current reasoner state.
Definition at line 205 of file ProgramCtx.h.
Referenced by State::changeState(), changeState(), convert(), createComponentGraph(), createDependencyGraph(), createEvalGraph(), evaluate(), evaluateSubprogram(), liberalSafetyCheck(), mlpSolver(), moduleSyntaxCheck(), optimizeEDBDependencyGraph(), parse(), postProcess(), rewriteEDBIDB(), safetyCheck(), setupProgramCtx(), showPlugins(), strongSafetyCheck(), and ~ProgramCtx().
Set to true if all processing on this ProgramCtx shall be aborted (e.g., because of a global timeout).
We currently use this to shutdown cleanly if signalled, but it could become important for solving with multiple contexts where some must be aborted.
Definition at line 213 of file ProgramCtx.h.
Referenced by evaluateSubprogram(), and main().
Final unit in ProgramCtx::evalgraph.
Definition at line 191 of file ProgramCtx.h.
Referenced by CreateEvalGraphState::createEvalGraph().
Factory for the unfounded set check heuristics.
Definition at line 126 of file ProgramCtx.h.
Referenced by GenuineGuessAndCheckModelGenerator::initializeHeuristics(), and processOptionsPrePlugin().