SAT Class Reference

Superclass of all satisfiability solvers. More...

#include <sat.h>

Inheritance diagram for SAT:

Inference HMaxWalkSat MaxWalkSat List of all members.

Public Member Functions

 SAT (VariableState *state, long int seed, const bool &trackClauseTrueCnts)
 SAT (HVariableState *state, long int seed, const bool &trackClauseTrueCnts)
virtual ~SAT ()
virtual void printNetwork (ostream &out)
 Prints out the network.
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 getChangedPreds (vector< string > &changedPreds, vector< float > &probs, vector< float > &oldProbs, const float &probDelta)
 Puts the predicates whose truth value has changed with respect to the reference vector oldProbs in string form and the corresponding probabilities of each predicate (1 or 0) in two vectors.
double getProbability (GroundPredicate *const &gndPred)
 Gets the truth value of a ground predicate in the best state found.
double getProbabilityH (GroundPredicate *const &gndPred)
void printTruePreds (ostream &out)
 Prints the predicates set to true in the best state to a stream.
void printTruePredsH (ostream &out)

Protected Attributes

int maxTries_
int maxSteps_
long double targetCost_
int numSolutions_
Array< int > changed_
int numFlips_

Detailed Description

Superclass of all satisfiability solvers.

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.


Member Function Documentation

void SAT::getChangedPreds ( vector< string > &  changedPreds,
vector< float > &  probs,
vector< float > &  oldProbs,
const float &  probDelta 
) [inline, virtual]

Puts the predicates whose truth value has changed with respect to the reference vector oldProbs in string form and the corresponding probabilities of each predicate (1 or 0) in two vectors.

Parameters:
changedPreds Predicates whose truth values have changed are put here.
probs The probabilities corresponding to the predicates in nonZeroPreds are put here (the number 1 or 0).
oldProbs Reference truth values for checking for changes.
probDelta This parameter is ignored for MAP inference (either the truth value has changed or it hasn't).

Implements Inference.

Definition at line 139 of file sat.h.

References VariableState::getNumAtoms(), VariableState::getValueOfLowAtom(), VariableState::printGndPred(), and Inference::state_.

00141   {
00142     changedPreds.clear();
00143     probs.clear();
00144     int numAtoms = state_->getNumAtoms();
00145       // Atoms may have been added to the state, previous tv was 0
00146     oldProbs.resize(numAtoms, 0);
00147     for (int i = 0; i < numAtoms; i++)
00148     {
00149       int tv = state_->getValueOfLowAtom(i + 1);
00150       if (tv != oldProbs[i])
00151       {
00152           // Truth value has changed: Store new value in oldProbs and add to
00153           // two return vectors
00154         oldProbs[i] = tv;
00155         ostringstream oss(ostringstream::out);
00156         state_->printGndPred(i, oss);
00157         changedPreds.push_back(oss.str());
00158         probs.push_back(tv);
00159       }
00160     }
00161   }


The documentation for this class was generated from the following file:
Generated on Sun Jun 7 11:55:28 2009 for Alchemy by  doxygen 1.5.1