RBNpackage
Class ProbFormIndicator

java.lang.Object
  extended by RBNpackage.ProbForm
      extended by RBNpackage.ProbFormIndicator

public class ProbFormIndicator
extends ProbForm


Field Summary
 java.lang.String[] arguments
           
 Rel relation
           
 
Fields inherited from class RBNpackage.ProbForm
RSymbs, SSymbs
 
Constructor Summary
ProbFormIndicator()
           
ProbFormIndicator(Rel r)
           
ProbFormIndicator(Rel r, int[] args)
           
ProbFormIndicator(Rel r, java.lang.String[] args)
          Creates new ProbFormIndicator
 
Method Summary
 int[] argsIfGround()
          Returns the arguments as an array of integers if formula represents a ground atom.
 java.lang.String asString()
           
 java.lang.String asString(int depth)
           
 java.lang.String asString(int depth, RelStruc A)
           
 java.lang.String asString(RelStruc A)
           
 Atom atom()
          Returns the ground atom if this ProbForm represents a ground atom; otherwise returns null;
 ProbForm conditionEvidence(Instantiation inst)
           
 ProbForm conditionEvidence(RelStruc A, Instantiation inst)
          Simplify ProbForm by substituting values of instantiated R-atoms and evaluating subformulas no longer dependent on any uninstantiated R-atom.
 boolean dependsOn(java.lang.String variable, RelStruc A, Instantiation data)
          Checks whether this prob.form depends on the unknown parameter 'variable' when prob.form is evaluated over input structure A and relative to instantiation (data) data.
 boolean equals(ProbFormIndicator pfi)
           
 double evalSample(RelStruc A, java.util.Hashtable atomhasht, Instantiation inst, long[] timers)
          Evaluate this probform over RelStruc A.
 double evaluate(RelStruc A, Instantiation inst, java.lang.String[] vars, int[] tuple, boolean useCurrentCvals)
          Evaluate this ProbForm for input structure A, instantiation inst, under the substitution tuple for vars.
 int evaluatesTo(RelStruc A)
           
 int evaluatesTo(RelStruc A, Instantiation inst, boolean usesampleinst, java.util.Hashtable atomhasht)
          Returns 0 if this probform evaluates to zero over structure A and with respect to instantiation inst, but irrespective of any instantiation of other probabilistic atoms.
 java.lang.String[] freevars()
          returns the free variables of the formula
 boolean isGround()
           
 java.util.Vector makeParentVec(RelStruc A)
          returns the vector of (ground!) Atoms on which the evaluation of the probform depends
 java.util.Vector makeParentVec(RelStruc A, Instantiation inst)
          same as previous but with respect to the given truth values in the Instantiation argument
 boolean multlinOnly()
          returns true if ProbForm only contains multilinear combination functions
 java.lang.String[] parameters()
          Returns all the parameters that this ProbForm depends on
 void setParameters(java.lang.String[] params, double[] values)
          Sets all occurrences of parameters appearing in params to their corresponding value in values.
 ProbForm sEval(RelStruc A)
          Returns a ProbForm in which the dependence on A is already pre-evaluated (substitution lists in combination functions, and values of ProbFormSFormula)
 ProbForm substitute(java.lang.String[] vars, int[] args)
          returns the formula obtained by substituting args for the vars in the formula.
 ProbForm substitute(java.lang.String[] vars, java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

relation

public Rel relation

arguments

public java.lang.String[] arguments
Constructor Detail

ProbFormIndicator

public ProbFormIndicator()

ProbFormIndicator

public ProbFormIndicator(Rel r)

ProbFormIndicator

public ProbFormIndicator(Rel r,
                         java.lang.String[] args)
                  throws java.lang.IllegalArgumentException
Creates new ProbFormIndicator

Throws:
java.lang.IllegalArgumentException

ProbFormIndicator

public ProbFormIndicator(Rel r,
                         int[] args)
                  throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException
Method Detail

argsIfGround

public int[] argsIfGround()
                   throws java.lang.RuntimeException
Returns the arguments as an array of integers if formula represents a ground atom. Throws an exception if formula not ground

Throws:
java.lang.RuntimeException

asString

public java.lang.String asString(int depth)
Specified by:
asString in class ProbForm

asString

public java.lang.String asString()
Specified by:
asString in class ProbForm

asString

public java.lang.String asString(int depth,
                                 RelStruc A)
Specified by:
asString in class ProbForm

asString

public java.lang.String asString(RelStruc A)
Specified by:
asString in class ProbForm

atom

public Atom atom()
Returns the ground atom if this ProbForm represents a ground atom; otherwise returns null;


conditionEvidence

public ProbForm conditionEvidence(RelStruc A,
                                  Instantiation inst)
Description copied from class: ProbForm
Simplify ProbForm by substituting values of instantiated R-atoms and evaluating subformulas no longer dependent on any uninstantiated R-atom.

Specified by:
conditionEvidence in class ProbForm

conditionEvidence

public ProbForm conditionEvidence(Instantiation inst)
Specified by:
conditionEvidence in class ProbForm

dependsOn

public boolean dependsOn(java.lang.String variable,
                         RelStruc A,
                         Instantiation data)
Description copied from class: ProbForm
Checks whether this prob.form depends on the unknown parameter 'variable' when prob.form is evaluated over input structure A and relative to instantiation (data) data. Only for ground probforms! For argument variable = "unknown_atom" the method returns true if this ProbForm depends on a ground atom not instantiated in data

Specified by:
dependsOn in class ProbForm

equals

public boolean equals(ProbFormIndicator pfi)

evaluate

public double evaluate(RelStruc A,
                       Instantiation inst,
                       java.lang.String[] vars,
                       int[] tuple,
                       boolean useCurrentCvals)
Description copied from class: ProbForm
Evaluate this ProbForm for input structure A, instantiation inst, under the substitution tuple for vars. Returns -1 if the value of probform is not defined because it depends on a probabilistic atom not instantiated in inst. If useCurrentCvals=false then also returns -1 if value depends on an unknown parameter. If useCurrentCvals=true, then evaluation at ProbFormConstant's is done with regard to their cval field, even when their paramname != "".

Specified by:
evaluate in class ProbForm

evalSample

public double evalSample(RelStruc A,
                         java.util.Hashtable atomhasht,
                         Instantiation inst,
                         long[] timers)
                  throws RBNCompatibilityException
Description copied from class: ProbForm
Evaluate this probform over RelStruc A. For ground atoms on which probform depends, a ComplexBNGroundAtomNode is accessible via atomhasht (using Atom.asString() as hashcode) If this ComplexBNGroundAtomNode is not instantiated, then the sample method of that node has to be called

Specified by:
evalSample in class ProbForm
Throws:
RBNCompatibilityException

evaluatesTo

public int evaluatesTo(RelStruc A)
Specified by:
evaluatesTo in class ProbForm

evaluatesTo

public int evaluatesTo(RelStruc A,
                       Instantiation inst,
                       boolean usesampleinst,
                       java.util.Hashtable atomhasht)
Description copied from class: ProbForm
Returns 0 if this probform evaluates to zero over structure A and with respect to instantiation inst, but irrespective of any instantiation of other probabilistic atoms. When probform contains unknown parameters, then evaluatesTo is computed with regard to the current setting of cval at the parameter ProbFormConstants. Returns 1 if ... evaluates to one .... Returns -1 if neither of the above When usesampleinst = true, then evaluation is not w.r.t. instantiation inst, but w.r.t. to sampleinst fields at PFNetworkNodes which are accessible via atomhasht

Specified by:
evaluatesTo in class ProbForm

freevars

public java.lang.String[] freevars()
Description copied from class: ProbForm
returns the free variables of the formula

Specified by:
freevars in class ProbForm

isGround

public boolean isGround()

makeParentVec

public java.util.Vector makeParentVec(RelStruc A)
Description copied from class: ProbForm
returns the vector of (ground!) Atoms on which the evaluation of the probform depends

Specified by:
makeParentVec in class ProbForm

makeParentVec

public java.util.Vector makeParentVec(RelStruc A,
                                      Instantiation inst)
Description copied from class: ProbForm
same as previous but with respect to the given truth values in the Instantiation argument

Specified by:
makeParentVec in class ProbForm

multlinOnly

public boolean multlinOnly()
Description copied from class: ProbForm
returns true if ProbForm only contains multilinear combination functions

Specified by:
multlinOnly in class ProbForm

parameters

public java.lang.String[] parameters()
Description copied from class: ProbForm
Returns all the parameters that this ProbForm depends on

Specified by:
parameters in class ProbForm

sEval

public ProbForm sEval(RelStruc A)
Description copied from class: ProbForm
Returns a ProbForm in which the dependence on A is already pre-evaluated (substitution lists in combination functions, and values of ProbFormSFormula)

Specified by:
sEval in class ProbForm

substitute

public ProbForm substitute(java.lang.String[] vars,
                           int[] args)
Description copied from class: ProbForm
returns the formula obtained by substituting args for the vars in the formula. Produces an error if vars are not among the free variables of the formula

Specified by:
substitute in class ProbForm

substitute

public ProbForm substitute(java.lang.String[] vars,
                           java.lang.String[] args)
Specified by:
substitute in class ProbForm

setParameters

public void setParameters(java.lang.String[] params,
                          double[] values)
Description copied from class: ProbForm
Sets all occurrences of parameters appearing in params to their corresponding value in values. params and values must be arrays of the same length

Specified by:
setParameters in class ProbForm