#ifndef __WALKSAT_H__ #define __WALKSAT_H__ #include "Formula.h" #include "Assignment.h" //----------------------------------------------------------------------------- // class WalkSatRestart // Encapsulation of the WalkSAT algorithm for solving CNF formulae //----------------------------------------------------------------------------- class WalkSatRestart { protected: float fProbability; // Probability of a random flip int iMaxFlips; // Maximum number of flips int iMaxRestarts; // Maximum number of restarts public: // Get or set the probability with which WalkSAT will flip at random // or with a purpose void SetProbability( float p ) { this->fProbability = p; } float GetProbability() { return this->fProbability; } // Get or set the number of flips that the WalkSAT algorithm will // perform void SetMaxFlips( int max ) { this->iMaxFlips = max; } int GetMaxFlips() { return this->iMaxFlips; } // Get or set the maximum number of restarts void SetMaxRestarts( int max ) { this->iMaxRestarts = max; } int GetMaxRestarts() { return this->iMaxRestarts; } // Solve the given formula using WalkSAT Assignment* Solve( Formula* f ); }; #endif