Public Member Functions | |
Domain () | |
~Domain () | |
void | replaceTypeDualMap (DualMap *const &map) |
void | setTypeDualMap (DualMap *const &map) |
const DualMap * | getTypeDualMap () const |
void | replaceStrToPredTemplateMapAndPredDualMap (StrToPredTemplateMap *const &m, DualMap *const &predDualMap) |
void | setStrToPredTemplateMapAndPredDualMap (StrToPredTemplateMap *const &map, DualMap *const &predDualMap) |
const StrToPredTemplateMap * | getStrToPredTemplateMap () const |
const DualMap * | getPredDualMap () const |
void | replaceStrToFuncTemplateMapAndFuncDualMap (StrToFuncTemplateMap *const &m, DualMap *const &funcDualMap) |
void | setStrToFuncTemplateMapAndFuncDualMap (StrToFuncTemplateMap *const &m, DualMap *const &funcDualMap) |
const StrToFuncTemplateMap * | getStrToFuncTemplateMap () const |
const DualMap * | getFuncDualMap () const |
void | replaceEqualPredTemplate (PredicateTemplate *const &t) |
void | setEqualPredTemplate (PredicateTemplate *const &t) |
const PredicateTemplate * | getEqualPredTemplate () const |
void | replaceEmptyPredTemplate (PredicateTemplate *const &t) |
void | setEmptyPredTemplate (PredicateTemplate *const &t) |
const PredicateTemplate * | getEmptyPredTemplate () const |
void | replaceEmptyFuncUnaryTemplate (FunctionTemplate *const &t) |
void | replaceEmptyFuncBinaryTemplate (FunctionTemplate *const &t) |
void | setEmptyFuncUnaryTemplate (FunctionTemplate *const &t) |
void | setEmptyFuncBinaryTemplate (FunctionTemplate *const &t) |
const FunctionTemplate * | getEmptyFuncUnaryTemplate () const |
const FunctionTemplate * | getEmptyFuncBinaryTemplate () const |
void | replaceConstDualMap (ConstDualMap *const &map) |
void | setConstDualMap (ConstDualMap *const &map) |
const ConstDualMap * | getConstDualMap () const |
void | replaceConstantsByType (Array< Array< int > * > *const &cbt) |
void | setConstantsByType (Array< Array< int > * > *const &cbt) |
const Array< Array< int > * > * | getConstantsByType () const |
void | replaceFuncSet (FunctionSet *const &funcSet) |
void | setFuncSet (FunctionSet *const &funcSet) |
const FunctionSet * | getFuncSet () const |
void | deleteDB () |
Database * | getDB () const |
void | setDB (Database *const &db) |
void | newTrueFalseGroundingsStore () |
TrueFalseGroundingsStore * | getTrueFalseGroundingsStore () const |
void | setTrueFalseGroundingsStore (TrueFalseGroundingsStore *const &tfgs) |
void | compress () |
void | reorderConstants (MLN *const &mln, hash_map< int, PredicateHashArray * > &predIdToPredsMap) |
Predicate * | createPredicate (const int &predId, const bool &includeEqualPreds) const |
void | createPredicates (Array< Predicate * > *const &preds, const bool &includeEqualPreds) const |
void | createPredicates (Array< Predicate * > *const &preds, const Array< string > *const &predNames) |
int | addType (const char *const &name) |
int | getNumTypes () const |
const Array< const char * > * | getTypeNames () const |
int | getTypeId (const char *const &name) const |
const char * | getTypeName (const int typeId) const |
bool | isType (const char *const &name) const |
bool | isType (const int &id) const |
const Array< int > * | getConstantsByType (const int &typeId) const |
const Array< int > * | getConstantsByType (const char *const &typeName) const |
int | getConstantIndexInType (const int &constId) const |
int | getNumConstantsByType (const int &typeId) const |
int | getNumConstantsByType (const char *const &typeName) const |
int | addConstant (const char *const &constName, const char *const &typeName) |
int | replaceTypeOfConstant (const char *const &constName, const char *const &oldTypeName, const char *const &newTypeName) |
Replaces the type of a constant from the domain. | |
int | getNumConstants () const |
const Array< const char * > * | getConstantNames () |
const char * | getConstantName (const int &id) const |
int | getConstantId (const char *const &name) const |
bool | isConstant (const char *const &name) const |
bool | isConstant (const int &id) const |
int | getConstantTypeId (const char *const &constName) const |
int | getConstantTypeId (const int &constId) const |
const char * | getConstantTypeName (const int &constId) const |
int | addPredicateTemplate (const PredicateTemplate *const &predTemplate) |
int | getNumPredicates () const |
const Array< const char * > * | getPredicateNames () const |
void | getNonEqualPredicateNames (Array< string > &predNames) const |
int | getPredicateId (const char *const &name) const |
const char * | getPredicateName (const int &id) const |
const Array< int > * | getPredicateTermTypesAsInt (const char *const &name) const |
const Array< int > * | getPredicateTermTypesAsInt (const int &id) const |
const Array< const char * > * | getPredicateTermTypesAsStr (const char *const &name) const |
const Array< const char * > * | getPredicateTermTypesAsStr (const int &id) |
const PredicateTemplate * | getPredicateTemplate (const char *const &name) const |
const PredicateTemplate * | getPredicateTemplate (const int &id) const |
const int | getHighestPredicateArity () const |
Finds the maximum arity of all predicates present in the domain. | |
const PredicateTemplate * | getEqualPredicateTemplate () const |
const PredicateTemplate * | getEmptyPredicateTemplate () const |
const FunctionTemplate * | getEmptyFunctionUnaryTemplate () const |
const FunctionTemplate * | getEmptyFunctionBinaryTemplate () const |
bool | isPredicate (const char *const &name) const |
bool | isPredicate (const int &id) const |
int | addFunctionTemplate (const FunctionTemplate *const &funcTemplate) |
int | getNumFunctions () const |
const Array< const char * > * | getFunctionNames () const |
int | getFunctionId (const char *const &name) const |
const char * | getFunctionName (const int &id) const |
const Array< int > * | getFunctionTermTypesAsInt (const char *const &name) const |
const Array< const char * > * | getFunctionTermTypesAsStr (const char *const &name) const |
const FunctionTemplate * | getFunctionTemplate (const char *const &name) const |
const FunctionTemplate * | getFunctionTemplate (const int &id) const |
bool | isFunction (const char *const &name) const |
bool | isFunction (const int &id) const |
const FunctionSet * | getFunctionMappings () const |
bool | addFunctionMapping (Function *f) |
int | getFunctionRetConstId (Function *const &f) const |
void | printPredicateTemplates (ostream &out) const |
void | printFunctionTemplates (ostream &out) const |
print out the function declarations. | |
int | getNumNonEvidenceAtoms () const |
Predicate * | getNonEvidenceAtom (int index) const |
int | addPredBlock (Array< Predicate * > *const &predBlock) const |
int | getBlock (Predicate *pred) const |
int | getNumPredBlocks () const |
const Array< Array< Predicate * > * > * | getPredBlocks () const |
const Array< Predicate * > * | getPredBlock (const int index) const |
const Array< bool > * | getBlockEvidenceArray () const |
const bool | getBlockEvidence (const int index) const |
void | setBlockEvidence (const int index, const bool value) const |
int | getEvidenceIdxInBlock (const int index) const |
Definition at line 89 of file domain.h.
int Domain::replaceTypeOfConstant | ( | const char *const & | constName, | |
const char *const & | oldTypeName, | |||
const char *const & | newTypeName | |||
) | [inline] |
Replaces the type of a constant from the domain.
constName | Name of constant being changed. | |
oldTypeName | Type of constant being chnaged. | |
newTypeName | New type of the constant. |
Definition at line 451 of file domain.h.
References DualMap::getInt(), and ConstDualMap::insert().
00454 { 00455 int oldTypeId = typeDualMap_->getInt(oldTypeName); 00456 if (oldTypeId < 0) 00457 { 00458 cout << "Warning: failed to replace type of constant " << constName 00459 << " because its type of " << oldTypeName << " doesn't exist" << endl; 00460 return oldTypeId; 00461 } 00462 int newTypeId = typeDualMap_->getInt(newTypeName); 00463 if (newTypeId < 0) 00464 { 00465 cout << "Warning: failed to replace type of constant " << constName 00466 << " because its type of " << newTypeName << " doesn't exist" << endl; 00467 return newTypeId; 00468 } 00469 00470 int constId 00471 = constDualMap_->insert(constName, newTypeId); 00472 if (constId < 0) 00473 { 00474 cout << "Warning: failed to remove constant " << constName << " of type " 00475 << oldTypeName << endl; 00476 return constId; 00477 } 00478 00479 (*constantsByType_)[oldTypeId]->append(constId); 00480 (*constantsByType_)[newTypeId]->append(constId); 00481 return constId; 00482 }
const int Domain::getHighestPredicateArity | ( | ) | const [inline] |
Finds the maximum arity of all predicates present in the domain.
Definition at line 647 of file domain.h.
References getNumPredicates(), PredicateTemplate::getNumTerms(), and getPredicateTemplate().
00648 { 00649 int highestArity = 1; 00650 int arity; 00651 for (int i = 0; i < getNumPredicates(); i++) 00652 { 00653 arity = getPredicateTemplate(i)->getNumTerms(); 00654 if (arity > highestArity) highestArity = arity; 00655 } 00656 00657 return highestArity; 00658 }
void Domain::printFunctionTemplates | ( | ostream & | out | ) | const [inline] |
print out the function declarations.
output stream to which the declarations are written
Definition at line 834 of file domain.h.
00835 { 00836 StrToFuncTemplateMap::iterator it = strToFuncTemplateMap_->begin(); 00837 for (; it != strToFuncTemplateMap_->end(); it++) 00838 { 00839 if (!(*it).second->isInternalFunctionTemplate()) 00840 out << *((*it).second) << endl; 00841 } 00842 }