RBNpackage
Class ProbFormConstant

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

public class ProbFormConstant
extends ProbForm

A ProbFormConstant represents a probability constant. The formula can also represent an unknown parameter. In this case, the string paramname contains the name of the parameter. In all cases, a numeric value is associated with the ProbFormConstant, so that it is always a valid probability formula that can be evaluated. When the formula represents a parameter, then this numeric value is a current estimate of the parameter value


Field Summary
 double cval
           
 
Fields inherited from class RBNpackage.ProbForm
RSymbs, SSymbs
 
Constructor Summary
ProbFormConstant()
           
ProbFormConstant(double v)
           
ProbFormConstant(java.lang.String pn)
           
 
Method Summary
 java.lang.String asString()
           
 java.lang.String asString(int depth)
           
 java.lang.String asString(int depth, RelStruc A)
           
 java.lang.String asString(RelStruc A)
           
 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.
 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
 double getCval()
           
 java.lang.String getParamName()
           
 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

cval

public double cval
Constructor Detail

ProbFormConstant

public ProbFormConstant()

ProbFormConstant

public ProbFormConstant(double v)

ProbFormConstant

public ProbFormConstant(java.lang.String pn)
Method Detail

freevars

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

Specified by:
freevars 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

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

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

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

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

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)
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

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

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

getParamName

public java.lang.String getParamName()

getCval

public double getCval()

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

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

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