Implementation of a stochastic weighted Maximum-a-posteriori WalkSAT algorithm
Definition at line 29 of file logic/sat/weighted/MaxWalkSAT.java.
edu::tum::cs::logic::sat::weighted::MaxWalkSAT::MaxWalkSAT | ( | WeightedClausalKB | kb, | |
PossibleWorld | state, | |||
WorldVariables | vars, | |||
Database | evidence | |||
) | throws Exception [inline] |
Constructor to instantiate an object of MAPMaxWalkSAT
kb | a knowledge base of weighted clauses, which can be instantiated by an Markov Random Field (MRF) | |
state | a possible world containing all variables of the Markov Logic Network (MLN) | |
vars | world variables of the MLN which is needed by the class | |
evidence | an evidence database |
java.lang.Exception |
Definition at line 71 of file logic/sat/weighted/MaxWalkSAT.java.
void edu::tum::cs::logic::sat::weighted::MaxWalkSAT::addBottleneck | ( | GroundAtom | ga, | |
Constraint | c | |||
) | [inline, protected] |
Method adds a groundatom into a vector of bottlenecks for a given constraint (bottlenecks(=groundatoms) are responsible for the negative change of value of a constraint)
ga | groundatom to be added to the bottlenecks | |
c | constraint for which the groundatom a is a bottleneck |
Definition at line 134 of file logic/sat/weighted/MaxWalkSAT.java.
void edu::tum::cs::logic::sat::weighted::MaxWalkSAT::addGAOccurrence | ( | GroundAtom | ga, | |
Constraint | c | |||
) | [inline, protected] |
Method adds a groundatom into a vector of containing groundatom of a constraint
ga | groundatom to be added to the occurence of a constraint | |
c | constraint in which the groundatom occurs |
Definition at line 148 of file logic/sat/weighted/MaxWalkSAT.java.
void edu::tum::cs::logic::sat::weighted::MaxWalkSAT::addUnsatisfiedConstraint | ( | Constraint | c | ) | [inline, protected] |
Method adds a constraint into unsatisfiedConstraints (Vector<Constraint>)
c | constraint which should be added |
Definition at line 125 of file logic/sat/weighted/MaxWalkSAT.java.
double edu::tum::cs::logic::sat::weighted::MaxWalkSAT::deltaCost | ( | GroundAtom | gndAtom | ) | [inline, protected] |
Calculation of the deltacosts per groundatom depending on the weight of the formula devided by its count of constraints. Returns a double value.
gndAtom | groundatom to calculate |
Definition at line 495 of file logic/sat/weighted/MaxWalkSAT.java.
double edu::tum::cs::logic::sat::weighted::MaxWalkSAT::deltaCostConAndForm | ( | GroundAtom | gndAtom | ) | [inline, protected] |
Calculation of deltacosts per groundatom. If the value of the formula would changed through flipping the groundatom then the complete weight are the deltacosts else the weight is devided by the count of the constraints of the formula and returned as the deltacosts. Returns a double value.
gndAtom | groundatom to calculate |
Definition at line 550 of file logic/sat/weighted/MaxWalkSAT.java.
double edu::tum::cs::logic::sat::weighted::MaxWalkSAT::deltaCostFormula | ( | GroundAtom | gndAtom | ) | [inline, protected] |
Calcualtion of deltacosts per groundatom. Only if the value of the complete formula would be changed through flipping. the groundatom the complete weight of the formula is the deltacost of the groundatom. Returns a double value.
gndAtom | groundatom to calculate |
Definition at line 520 of file logic/sat/weighted/MaxWalkSAT.java.
void edu::tum::cs::logic::sat::weighted::MaxWalkSAT::flipGndAtom | ( | GroundAtom | gndAtom | ) | [inline, protected] |
Method flips the given groundatom and refreshs the unsatisfied sum, the state of the constraint and the satisfied clauses of the according formula
gndAtom | groundatom to flip |
Definition at line 456 of file logic/sat/weighted/MaxWalkSAT.java.
PossibleWorld edu::tum::cs::logic::sat::weighted::MaxWalkSAT::getBestState | ( | ) | [inline] |
Method returns an actual state of the algorithm in form of a boolean[].
Definition at line 583 of file logic/sat/weighted/MaxWalkSAT.java.
double edu::tum::cs::logic::sat::weighted::MaxWalkSAT::getP | ( | ) | [inline] |
gets the probability of a greedy move
Definition at line 607 of file logic/sat/weighted/MaxWalkSAT.java.
PossibleWorld edu::tum::cs::logic::sat::weighted::MaxWalkSAT::getState | ( | ) | [inline] |
Returns the actual state of the algorithm
Definition at line 265 of file logic/sat/weighted/MaxWalkSAT.java.
int edu::tum::cs::logic::sat::weighted::MaxWalkSAT::getStep | ( | ) | [inline] |
Method returns an actual count of steps
Definition at line 591 of file logic/sat/weighted/MaxWalkSAT.java.
void edu::tum::cs::logic::sat::weighted::MaxWalkSAT::initFormulaState | ( | ) | [inline, protected] |
Initial mapping of formulas to HashSet of containing satisfied clauses
Definition at line 180 of file logic/sat/weighted/MaxWalkSAT.java.
Vector<Object> edu::tum::cs::logic::sat::weighted::MaxWalkSAT::pickAndFlipVar | ( | Collection< GroundAtom > | candidates | ) | [inline, protected] |
Chooses the "best" groundatom among the given candidates (in relation to the overall unsatisfied sum)
candidates | a collection of groundatoms from which one should be flipped |
Definition at line 375 of file logic/sat/weighted/MaxWalkSAT.java.
void edu::tum::cs::logic::sat::weighted::MaxWalkSAT::printBestState | ( | PrintStream | fr | ) | [inline] |
prints the best state found by the algorithm
Definition at line 272 of file logic/sat/weighted/MaxWalkSAT.java.
void edu::tum::cs::logic::sat::weighted::MaxWalkSAT::printunsCons | ( | ) | [inline] |
Method prints all unsatisfied constraints in combination with an according formula and afterwards the unsatisfied sum on the console
Definition at line 571 of file logic/sat/weighted/MaxWalkSAT.java.
Constraint edu::tum::cs::logic::sat::weighted::MaxWalkSAT::randomlyChosen | ( | ) | [inline, protected] |
Method randomly chooses a constraint among the unsatisfied constraints and returns it
Definition at line 564 of file logic/sat/weighted/MaxWalkSAT.java.
void edu::tum::cs::logic::sat::weighted::MaxWalkSAT::run | ( | ) | [inline] |
Method starts and controls the activities of the algorithm. In this case there will be executed a walkSatMove (greedyMove) with a property of 95% else the SAMove (random Move) will be executed.
Definition at line 197 of file logic/sat/weighted/MaxWalkSAT.java.
void edu::tum::cs::logic::sat::weighted::MaxWalkSAT::SAMove | ( | ) | [inline, protected] |
Randomly chooses and flips a possible groundatom
Reimplemented in edu::tum::cs::logic::sat::weighted::MaxWalkSATRoom.
Definition at line 332 of file logic/sat/weighted/MaxWalkSAT.java.
void edu::tum::cs::logic::sat::weighted::MaxWalkSAT::setDeltaCostCalcMethod | ( | int | deltaCostCalcMethod | ) | [inline] |
With this method one can set the method the daltacosts of a goriundatom are calculated. Possible values are: 1 - Calculation of deltacosts: Always 1/Count of constraints of the according formula 2 - Calculation of deltacosts: Only if value of formula was changed (then complete weight of the formula are the deltacosts of the groundatom) 3 - see 2, if no change of the value of the according formula was made then see 1
deltaCostCalcMethod | 1, 2 or 3 (see above for details) |
Definition at line 618 of file logic/sat/weighted/MaxWalkSAT.java.
void edu::tum::cs::logic::sat::weighted::MaxWalkSAT::setMaxSteps | ( | int | steps | ) | [inline] |
Definition at line 117 of file logic/sat/weighted/MaxWalkSAT.java.
void edu::tum::cs::logic::sat::weighted::MaxWalkSAT::setP | ( | double | p | ) | [inline] |
sets the probability of a greedy move
p |
Definition at line 599 of file logic/sat/weighted/MaxWalkSAT.java.
void edu::tum::cs::logic::sat::weighted::MaxWalkSAT::setState | ( | ) | [inline, protected] |
sets the initial state randomly
Reimplemented in edu::tum::cs::logic::sat::weighted::MaxWalkSATRoom.
Definition at line 289 of file logic/sat/weighted/MaxWalkSAT.java.
void edu::tum::cs::logic::sat::weighted::MaxWalkSAT::unsatisfiedSum | ( | ) | [inline, protected] |
Initial calculation of the sum of weights of unsatisfied formulas and count of unsatisfied hard constraints
Definition at line 160 of file logic/sat/weighted/MaxWalkSAT.java.
void edu::tum::cs::logic::sat::weighted::MaxWalkSAT::walkSATMove | ( | ) | [inline, protected] |
Chooses randomly an unsatisfied constraint and tries to flip the according formula
Reimplemented in edu::tum::cs::logic::sat::weighted::MaxWalkSATRoom.
Definition at line 296 of file logic/sat/weighted/MaxWalkSAT.java.
Definition at line 51 of file logic/sat/weighted/MaxWalkSAT.java.
HashMap<Integer, Vector<Constraint> > edu::tum::cs::logic::sat::weighted::MaxWalkSAT::bottlenecks [protected] |
Definition at line 31 of file logic/sat/weighted/MaxWalkSAT.java.
HashMap<WeightedClause, Formula> edu::tum::cs::logic::sat::weighted::MaxWalkSAT::cl2Formula [protected] |
Definition at line 41 of file logic/sat/weighted/MaxWalkSAT.java.
HashMap<edu.tum.cs.logic.sat.weighted.WeightedClause, Formula> edu::tum::cs::logic::sat::weighted::MaxWalkSAT::clFormula [protected] |
Definition at line 40 of file logic/sat/weighted/MaxWalkSAT.java.
int edu::tum::cs::logic::sat::weighted::MaxWalkSAT::countUnsCon [protected] |
Definition at line 45 of file logic/sat/weighted/MaxWalkSAT.java.
int edu::tum::cs::logic::sat::weighted::MaxWalkSAT::deltaCostCalcMethod = 1 [protected] |
Definition at line 56 of file logic/sat/weighted/MaxWalkSAT.java.
HashMap<Integer, Boolean> edu::tum::cs::logic::sat::weighted::MaxWalkSAT::evidence [protected] |
Definition at line 38 of file logic/sat/weighted/MaxWalkSAT.java.
Definition at line 39 of file logic/sat/weighted/MaxWalkSAT.java.
int edu::tum::cs::logic::sat::weighted::MaxWalkSAT::flips [protected] |
Definition at line 54 of file logic/sat/weighted/MaxWalkSAT.java.
HashMap<Formula, HashSet<WeightedClause> > edu::tum::cs::logic::sat::weighted::MaxWalkSAT::formula2clauses [protected] |
Definition at line 43 of file logic/sat/weighted/MaxWalkSAT.java.
HashMap<Formula, HashSet<WeightedClause> > edu::tum::cs::logic::sat::weighted::MaxWalkSAT::formula2satClause [protected] |
Definition at line 44 of file logic/sat/weighted/MaxWalkSAT.java.
HashMap<Formula, Double> edu::tum::cs::logic::sat::weighted::MaxWalkSAT::formula2weight [protected] |
Definition at line 42 of file logic/sat/weighted/MaxWalkSAT.java.
HashMap<Integer, Vector<Constraint> > edu::tum::cs::logic::sat::weighted::MaxWalkSAT::GAOccurrences [protected] |
Definition at line 32 of file logic/sat/weighted/MaxWalkSAT.java.
int edu::tum::cs::logic::sat::weighted::MaxWalkSAT::greedyMoves [protected] |
Definition at line 52 of file logic/sat/weighted/MaxWalkSAT.java.
int edu::tum::cs::logic::sat::weighted::MaxWalkSAT::lastMinStep [protected] |
Definition at line 46 of file logic/sat/weighted/MaxWalkSAT.java.
int edu::tum::cs::logic::sat::weighted::MaxWalkSAT::maxSteps = 1000 [protected] |
Definition at line 57 of file logic/sat/weighted/MaxWalkSAT.java.
double edu::tum::cs::logic::sat::weighted::MaxWalkSAT::minSum [package] |
Definition at line 55 of file logic/sat/weighted/MaxWalkSAT.java.
Vector<Integer> edu::tum::cs::logic::sat::weighted::MaxWalkSAT::nonEvidenceGndAtomIndices [protected] |
Definition at line 35 of file logic/sat/weighted/MaxWalkSAT.java.
double edu::tum::cs::logic::sat::weighted::MaxWalkSAT::p = 0.999 [protected] |
probability of a greedy move
Definition at line 61 of file logic/sat/weighted/MaxWalkSAT.java.
Random edu::tum::cs::logic::sat::weighted::MaxWalkSAT::rand [protected] |
Definition at line 36 of file logic/sat/weighted/MaxWalkSAT.java.
int edu::tum::cs::logic::sat::weighted::MaxWalkSAT::SAMoves [protected] |
Definition at line 53 of file logic/sat/weighted/MaxWalkSAT.java.
Definition at line 33 of file logic/sat/weighted/MaxWalkSAT.java.
Definition at line 49 of file logic/sat/weighted/MaxWalkSAT.java.
Vector<Constraint> edu::tum::cs::logic::sat::weighted::MaxWalkSAT::unsatisfiedConstraints [protected] |
Definition at line 34 of file logic/sat/weighted/MaxWalkSAT.java.
double edu::tum::cs::logic::sat::weighted::MaxWalkSAT::unsSum [protected] |
Definition at line 47 of file logic/sat/weighted/MaxWalkSAT.java.
double edu::tum::cs::logic::sat::weighted::MaxWalkSAT::unsSumBeta [protected] |
Definition at line 48 of file logic/sat/weighted/MaxWalkSAT.java.
Definition at line 37 of file logic/sat/weighted/MaxWalkSAT.java.
final boolean edu::tum::cs::logic::sat::weighted::MaxWalkSAT::verbose = false [protected] |
Definition at line 50 of file logic/sat/weighted/MaxWalkSAT.java.