tuffy.mln
Class Atom

java.lang.Object
  extended by tuffy.mln.Atom

public class Atom
extends java.lang.Object

An atomic formula. It's designed as a light-weight construct, hence all fields are transparent (public).


Nested Class Summary
static class Atom.AtomType
          Enumerated type of Atoms.
 
Field Summary
 Tuple args
          The argument list represented as a tuple of integers: constant as positive number and variable as negative number.
 Predicate pred
          The predicate of this Atom.
 java.lang.Double prior
          Probability of "soft evidence".
 java.util.ArrayList<java.lang.String> sargs
           
 java.lang.Boolean truth
          Truth value of this atom.
 Atom.AtomType type
          Type of this atom.
 
Constructor Summary
Atom(java.util.ArrayList<java.lang.String> as, boolean t)
           
Atom(java.util.ArrayList<java.lang.String> as, double prior)
           
Atom(Predicate p, java.util.ArrayList<java.lang.Integer> as, boolean t)
          Create an evidence atom.
Atom(Predicate p, java.util.ArrayList<java.lang.Integer> as, double prior)
          Create a soft evidence atom.
Atom(Predicate p, Tuple at)
          Create an atom of type NONE.
 
Method Summary
 int club()
          Map the Atom.AtomType value of this atom into an integer, which is used internally by the DB.
 long groundSize()
          Return the number of grounded atoms when grounding this atom.
 boolean isSoftEvidence()
          Test if this atom is soft evidence.
 java.lang.String toString()
          Returns this atom's human-friendly string representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pred

public Predicate pred
The predicate of this Atom.


args

public Tuple args
The argument list represented as a tuple of integers: constant as positive number and variable as negative number.


sargs

public java.util.ArrayList<java.lang.String> sargs

truth

public java.lang.Boolean truth
Truth value of this atom.


prior

public java.lang.Double prior
Probability of "soft evidence".


type

public Atom.AtomType type
Type of this atom. Values are enumerated by Atom.AtomType.

Constructor Detail

Atom

public Atom(Predicate p,
            java.util.ArrayList<java.lang.Integer> as,
            boolean t)
Create an evidence atom.

Parameters:
p - the predicate
as - the arguments
t - the truth value

Atom

public Atom(Predicate p,
            java.util.ArrayList<java.lang.Integer> as,
            double prior)
Create a soft evidence atom. Note that the type of 'soft evidence' atoms is NONE, as opposed to EVIDENCE.

Parameters:
p - the predicate
as - the arguments
prior - the prior probability

Atom

public Atom(java.util.ArrayList<java.lang.String> as,
            double prior)

Atom

public Atom(java.util.ArrayList<java.lang.String> as,
            boolean t)

Atom

public Atom(Predicate p,
            Tuple at)
Create an atom of type NONE. The default truth value of unknown is null.

Parameters:
p - the predicate
at - the arguments in the form of a tuple
See Also:
KBMC.run()
Method Detail

club

public int club()
Map the Atom.AtomType value of this atom into an integer, which is used internally by the DB.


isSoftEvidence

public boolean isSoftEvidence()
Test if this atom is soft evidence.


groundSize

public long groundSize()
Return the number of grounded atoms when grounding this atom. This number equals to the multiplication of the domain size of each distinct variable appearing in this atom. That is, we assume cross product is used.


toString

public java.lang.String toString()
Returns this atom's human-friendly string representation.

Overrides:
toString in class java.lang.Object