Public Member Functions | |
MLN () | |
~MLN () | |
int | getNumClauses () const |
int | getNumHardClauses () const |
bool | containsClause (const Clause *const &c) const |
bool | appendExternalClause (const string &formulaString, const bool &hasExist, Clause *const &c, const Domain *const &domain, const bool &tiedClauses) |
Append a clause to the mln and mark it as external. | |
bool | appendClause (const string &formulaString, const bool &hasExist, Clause *const &c, const double &wt, const bool &isHardClause, int &retClauseIdx, const bool &tiedClauses) |
Clause * | removeClause (const int &remIdx) |
Clause * | removeClause (const Clause *const &c) |
void | removeAllClauses (Array< Clause * > *const &clauses) |
void | rehashClauses () |
double | getMaxAbsSoftWt () |
int | findClauseIdx (const Clause *const &c) const |
const Clause * | findClause (const Clause *const &c) const |
const Clause * | getClause (const int &i) const |
bool | isExternalClause (const int &i) const |
bool | isExternalClause (const Clause *const &c) const |
bool | isExistClause (const int &i) const |
bool | isExistClause (const Clause *const &c) const |
bool | isExistUniqueClause (const int &i) const |
bool | isExistUniqueClause (const Clause *const &c) const |
bool | clauseInNonExistAndNonExistUniqueFormulaCNF (const int &i) const |
bool | clauseInNonExistAndNonExistUniqueFormulaCNF (const Clause *const &c) const |
const ClauseHashArray * | getClauses () const |
int | getSoftClauseSize () |
void | getClauses (Array< Clause * > *const &clauses) const |
void | setClauses (ClauseHashArray *const &clauses) |
void | replaceClauses (ClauseHashArray *const &clauses) |
const MLNClauseInfo * | getMLNClauseInfo (const int &i) const |
int * | getMLNClauseInfoIndexPtr (const int &i) const |
const Array< MLNClauseInfo * > * | getMLNClauseInfos () const |
void | setMLNClauseInfos (Array< MLNClauseInfo * > *const &clauseInfos) |
void | replaceMLNClauseInfos (Array< MLNClauseInfo * > *const &clauseInfos) |
const Array< Array< IndexClause * > * > * | getPredIdToClausesMap () const |
void | setPredIdToClausesMap (Array< Array< IndexClause * > * > *const &predIdToClausesMap) |
void | replacePredIdToClausesMap (Array< Array< IndexClause * > * > *const &predIdToClausesMap) |
const FormulaAndClausesArray * | getFormulaAndClausesArray () const |
void | setFormulaAndClausesArray (FormulaAndClausesArray *const &formAndClausesArray) |
void | replaceFormulaAndClausesArray (FormulaAndClausesArray *const &formAndClausesArray) |
const Array< bool > * | getExternalClause () const |
void | setExternalClause (Array< bool > *const &externalClause) |
void | replaceExternalClause (Array< bool > *const &externalClause) |
void | setClauseInfoPriorMeansToClauseWts () |
void | getClauseWts (Array< double > &wts) const |
void | setClauseWts (Array< double > &wts) |
const IndexClauseHashArray * | getClausesOfFormula (const string &formulaStr) const |
bool | setFormulaNumPreds (const string &formulaStr, const int &numPreds) |
bool | setFormulaIsHard (const string &formulaStr, const bool &isHard) |
bool | setFormulaPriorMean (const string &formulaStr, const double &priorMean) |
bool | setFormulaWt (const string &formulaStr, const double &wt) |
bool | setFormulaIsExistUnique (const string &formulaStr, const bool &isExistUnique) |
double | getFormulaWt (const string &formulaStr) |
const Array< IndexClause * > * | getClausesContainingPred (const int &predId) const |
const string | getParentFormula (const int &clauseIdx, const int &formulaIdx) const |
Returns a parent formula of a clause. | |
const string | getParentFormula (const Clause *const &c, const int &formulaIdx) const |
Returns a parent formula of a clause. | |
void | compress () |
void | printMLN (ostream &out, const Domain *const &domain) |
void | printMLNNonExistFormulas (ostream &out, const Domain *const &domain) |
void | printMLNClausesFormulas (ostream &out, const Domain *const &domain, const bool &includeIdx) |
void | printClausesWithWeights (ostream &out, const Domain *const &domain, int *const &startIdx=NULL, const bool &includeExistClauses=true, const bool &sortByLen=false, const bool &divWtAmongExistFormulas=false) const |
void | printClausePriorMeans (ostream &out, const Domain *const &domain) |
void | printFormulaPriorMeans (ostream &out) |
Definition at line 79 of file mln.h.
bool MLN::appendExternalClause | ( | const string & | formulaString, | |
const bool & | hasExist, | |||
Clause *const & | c, | |||
const Domain *const & | domain, | |||
const bool & | tiedClauses | |||
) | [inline] |
Append a clause to the mln and mark it as external.
It is assumed that the clause is in CNF.
Definition at line 141 of file mln.h.
References appendClause(), Clause::getNumPredicates(), Clause::getWt(), Clause::isHardClause(), setFormulaIsHard(), setFormulaNumPreds(), and setFormulaPriorMean().
00144 { 00145 int idx; 00146 bool app = appendClause(formulaString, hasExist, c, c->getWt(), 00147 c->isHardClause(), idx, tiedClauses); 00148 if (app) 00149 { 00150 setFormulaNumPreds(formulaString, c->getNumPredicates()); 00151 setFormulaIsHard(formulaString, c->isHardClause()); 00152 setFormulaPriorMean(formulaString, c->getWt()); 00153 (*externalClause_)[idx] = true; 00154 } 00155 return app; 00156 }
const string MLN::getParentFormula | ( | const int & | clauseIdx, | |
const int & | formulaIdx | |||
) | const [inline] |
Returns a parent formula of a clause.
clauseIdx | Index of clause for which parent formula is returned | |
formulaIdx | Index of parent formula which is returned |
Definition at line 735 of file mln.h.
References FormulaClauseIndexes::formulaIndex.
Referenced by getParentFormula().
00736 { 00737 FormulaClauseIndexes* fcIdxs = 00738 (*clauseInfos_)[clauseIdx]->formulaClauseIndexes[formulaIdx]; 00739 return (*formAndClausesArray_)[*fcIdxs->formulaIndex]->formula; 00740 }
const string MLN::getParentFormula | ( | const Clause *const & | c, | |
const int & | formulaIdx | |||
) | const [inline] |
Returns a parent formula of a clause.
c | Clause for which parent formula is returned | |
formulaIdx | Index of parent formula which is returned |
Definition at line 750 of file mln.h.
References findClauseIdx(), and getParentFormula().
00751 { 00752 int i = findClauseIdx(c); 00753 if (i < 0) return NULL; 00754 return getParentFormula(i, formulaIdx); 00755 }