#include <sat.h>
Inheritance diagram for SAT:
Public Member Functions | |
SAT (VariableState *state, long int seed, const bool &trackClauseTrueCnts) | |
virtual | ~SAT () |
const int | getNumSolutions () |
void | setNumSolutions (const int &numSolutions) |
const long double | getTargetCost () |
void | setTargetCost (const long double &targetCost) |
void | printProbabilities (ostream &out) |
Prints the best state found. | |
void | getPredsWithNonZeroProb (vector< string > &nonZeroPreds, vector< float > &probs) |
Puts the predicates non-zero probability (those set to true) in string form and the corresponding probabilities of each predicate (the number 1) in two vectors. | |
double | getProbability (GroundPredicate *const &gndPred) |
Gets the truth value of a ground predicate in the best state found. | |
void | printTruePreds (ostream &out) |
Prints the predicates set to true in the best state to a stream. | |
Protected Attributes | |
int | maxTries_ |
int | maxSteps_ |
long double | targetCost_ |
int | numSolutions_ |
Array< int > | changed_ |
int | numFlips_ |
This class does not implement all pure virtual functions of Inference and is thus an abstract class.
Definition at line 75 of file sat.h.
void SAT::getPredsWithNonZeroProb | ( | vector< string > & | nonZeroPreds, | |
vector< float > & | probs | |||
) | [inline, virtual] |
Puts the predicates non-zero probability (those set to true) in string form and the corresponding probabilities of each predicate (the number 1) in two vectors.
nonZeroPreds | Predicates set to true are put here. | |
probs | The probabilities corresponding to the predicates in nonZeroPreds are put here (the number 1). |
Implements Inference.
Definition at line 125 of file sat.h.
References VariableState::getNumAtoms(), VariableState::getValueOfLowAtom(), VariableState::printGndPred(), and Inference::state_.
00127 { 00128 nonZeroPreds.clear(); 00129 probs.clear(); 00130 for (int i = 0; i < state_->getNumAtoms(); i++) 00131 { 00132 if (state_->getValueOfLowAtom(i + 1)) 00133 { 00134 ostringstream oss(ostringstream::out); 00135 state_->printGndPred(i, oss); 00136 nonZeroPreds.push_back(oss.str()); 00137 probs.push_back(1); 00138 } 00139 } 00140 }