dlvhex
2.5.0
|
A NogoodContainer based on NogoodSet. More...
#include <include/dlvhex2/Nogood.h>
Public Types | |
typedef boost::shared_ptr < SimpleNogoodContainer > | Ptr |
typedef boost::shared_ptr < const SimpleNogoodContainer > | ConstPtr |
Public Member Functions | |
void | addNogood (Nogood ng) |
Adds a nogood to the container. | |
void | removeNogood (Nogood ng) |
Nogood & | getNogood (int index) |
int | getNogoodCount () |
void | clear () |
void | addAllResolvents (RegistryPtr reg, int maxSize=-1) |
void | forgetLeastFrequentlyAdded () |
void | defragment () |
Private Attributes | |
boost::mutex | mutex |
Exclusive access to the nogood container. | |
NogoodSet | ngg |
Internal nogood storage. |
A NogoodContainer based on NogoodSet.
typedef boost::shared_ptr<const SimpleNogoodContainer> SimpleNogoodContainer::ConstPtr |
Reimplemented from NogoodContainer.
typedef boost::shared_ptr<SimpleNogoodContainer> SimpleNogoodContainer::Ptr |
Reimplemented from NogoodContainer.
void SimpleNogoodContainer::addAllResolvents | ( | RegistryPtr | reg, |
int | maxSize = -1 |
||
) |
Definition at line 593 of file Nogood.cpp.
References addNogood(), ID::address, Nogood::applyVariableSubstitution(), DBGLOG, getNogood(), getNogoodCount(), Nogood::getStringRepresentation(), ID_FAIL(), ID::isAnonymousVariable(), ID::isNaf(), ID::kind, RawPrinter::print(), ID::PROPERTY_VAR_ANONYMOUS, Nogood::resolve(), and Atom::tuple.
void SimpleNogoodContainer::addNogood | ( | Nogood | ng | ) | [virtual] |
Adds a nogood to the container.
ng | The nogood to add. |
Implements NogoodContainer.
Definition at line 558 of file Nogood.cpp.
References NogoodSet::addNogood(), mutex, and ngg.
Referenced by addAllResolvents(), CDNLSolver::addNogood(), ExternalLearningHelper::learnFromInputOutputBehavior(), and ExternalLearningHelper::learnFromNegativeAtoms().
void SimpleNogoodContainer::clear | ( | ) |
Definition at line 586 of file Nogood.cpp.
Referenced by CDNLSolver::loadAddedNogoods().
void SimpleNogoodContainer::defragment | ( | ) |
Definition at line 699 of file Nogood.cpp.
References NogoodSet::defragment(), and ngg.
Definition at line 689 of file Nogood.cpp.
References DBGLOG, NogoodSet::defragment(), NogoodSet::forgetLeastFrequentlyAdded(), NogoodSet::getNogoodCount(), mutex, and ngg.
Nogood & SimpleNogoodContainer::getNogood | ( | int | index | ) |
Definition at line 572 of file Nogood.cpp.
References NogoodSet::getNogood(), mutex, and ngg.
Referenced by addAllResolvents(), ExternalLearningHelper::learnFromInputOutputBehavior(), ExternalLearningHelper::learnFromNegativeAtoms(), and CDNLSolver::loadAddedNogoods().
Definition at line 579 of file Nogood.cpp.
References NogoodSet::getNogoodCount(), mutex, and ngg.
Referenced by addAllResolvents(), ExternalLearningHelper::learnFromInputOutputBehavior(), ExternalLearningHelper::learnFromNegativeAtoms(), and CDNLSolver::loadAddedNogoods().
void SimpleNogoodContainer::removeNogood | ( | Nogood | ng | ) |
Definition at line 565 of file Nogood.cpp.
References mutex, ngg, and NogoodSet::removeNogood().
boost::mutex SimpleNogoodContainer::mutex [private] |
Exclusive access to the nogood container.
Definition at line 351 of file Nogood.h.
Referenced by addNogood(), clear(), forgetLeastFrequentlyAdded(), getNogood(), getNogoodCount(), and removeNogood().
NogoodSet SimpleNogoodContainer::ngg [private] |
Internal nogood storage.
Definition at line 354 of file Nogood.h.
Referenced by addNogood(), clear(), defragment(), forgetLeastFrequentlyAdded(), getNogood(), getNogoodCount(), and removeNogood().