#include <groundclause.h>
Public Member Functions | |
| GroundClause (const Clause *const &c, GroundPredicateHashArray *const &gndPredHashArray) | |
| ~GroundClause () | |
| void | deleteParentWtPtrs () |
| void | deleteFoClauseFrequencies () |
| void | addWt (const double &wt) |
| void | setWt (const double &wt) |
| double | getWt () const |
| void | setWtToHardWt () |
| bool | isHardClause () const |
| int | getNumGroundPredicates () const |
| const GroundPredicate * | getGroundPredicate (const int &i, GroundPredicateHashArray *const &gndPredHashArray) const |
| void | appendToGndPreds (GroundPredicateHashArray *const &gndPredHashArray) |
| Appends this GroundClause to all GroundPredicates in it. | |
| bool | getGroundPredicateSense (const int &i) const |
| void | setGroundPredicateIndex (const int &i, const int &gndPredIdx) |
| int | getGroundPredicateIndex (const int &i) const |
| const Array< int > * | getGndPredIndexes () const |
| void | appendParentWtPtr (const double *const &wtPtr) |
| void | setWtToSumOfParentWts () |
| IntPair * | getClauseFrequencies () |
| int | getClauseFrequency (int clauseno) |
| void | incrementClauseFrequency (int clauseno, int increment) |
| void | removeGndPred (const int &gndPred) |
| Removes a ground predicate from this ground clause. | |
| void | changeGndPredIndex (const int &oldIdx, const int &newIdx) |
| Changes the index of a ground predicate in this ground clause. | |
| size_t | hashCode () |
| bool | same (const GroundClause *const &gc) |
| void | printWithoutWt (ostream &out) const |
| void | print (ostream &out) const |
| ostream & | print (ostream &out, const Domain *const &domain, const bool &withWt, const bool &asInt, const bool &withStrVar, const GroundPredicateHashArray *const &predHashArray) const |
| ostream & | printWithoutWt (ostream &out, const Domain *const &domain, const GroundPredicateHashArray *const &predHashArray) const |
| ostream & | printWithoutWtWithStrVar (ostream &out, const Domain *const &domain, const GroundPredicateHashArray *const &predHashArray) const |
| ostream & | printWithWtAndStrVar (ostream &out, const Domain *const &domain, const GroundPredicateHashArray *const &predHashArray) const |
| ostream & | print (ostream &out, const Domain *const &domain, const GroundPredicateHashArray *const &predHashArray) const |
| ostream & | printWithoutWtWithStrVarAndPeriod (ostream &out, const Domain *const &domain, const GroundPredicateHashArray *const &predHashArray) const |
| double | sizeKB () |
| Computes and returns the size of this ground clause. | |
Definition at line 101 of file groundclause.h.
| void GroundClause::appendToGndPreds | ( | GroundPredicateHashArray *const & | gndPredHashArray | ) |
Appends this GroundClause to all GroundPredicates in it.
| gndPredHashArray | Reference HashArray containing the GroundPredicates indexed in the GroundClause. |
Definition at line 124 of file groundclause.cpp.
References Array< Type >::size().
Referenced by MRF::addUnknownGndClause(), and VariableState::getActiveClauses().
00126 { 00127 // For each ground pred in this clause 00128 for (int i = 0; i < gndPredIndexes_->size(); i++) 00129 { 00130 bool sense = ((*gndPredIndexes_)[i] > 0); 00131 int index = abs((*gndPredIndexes_)[i]) - 1; 00132 // Tell the ground pred that it occurs in this ground clause 00133 bool ok = (*gndPredHashArray)[index]->appendGndClause(this, sense); 00134 assert(ok); ok = true; // avoid compilation warning 00135 } 00136 }
| void GroundClause::removeGndPred | ( | const int & | gndPred | ) | [inline] |
Removes a ground predicate from this ground clause.
The ground predicate at the given index is removed and the new hash code is stored.
| gndPred | The ground predicate to be removed. |
Definition at line 220 of file groundclause.h.
References Array< Type >::compress(), Array< Type >::removeItem(), and Array< Type >::size().
00221 { 00222 for (int i = 0; i < gndPredIndexes_->size(); i++) 00223 { 00224 if (gndPred == (*gndPredIndexes_)[i]) 00225 { 00226 gndPredIndexes_->removeItem(i); 00227 gndPredIndexes_->compress(); 00228 rehash(); 00229 break; 00230 } 00231 } 00232 }
| void GroundClause::changeGndPredIndex | ( | const int & | oldIdx, | |
| const int & | newIdx | |||
| ) | [inline] |
Changes the index of a ground predicate in this ground clause.
The new hash code is stored.
| oldIdx | Index of the ground predicate to be changed. | |
| newIdx | New index of the ground predicate. |
Definition at line 241 of file groundclause.h.
References Array< Type >::size().
00242 { 00243 for (int i = 0; i < gndPredIndexes_->size(); i++) 00244 { 00245 if (oldIdx == (*gndPredIndexes_)[i]) 00246 { 00247 (*gndPredIndexes_)[i] = newIdx; 00248 rehash(); 00249 break; 00250 } 00251 } 00252 }
1.5.1