RBNpackage
Class ProbFormCombFunc

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

public class ProbFormCombFunc
extends ProbForm


Field Summary
 CConstr cconstr
           
static int ESUM
           
static int INVSUM
           
static int MEAN
           
 CombFunc mycomb
           
 int mycombInt
           
static int NOR
           
 ProbForm[] pfargs
           
 java.lang.String[] quantvars
           
 
Fields inherited from class RBNpackage.ProbForm
RSymbs, SSymbs
 
Constructor Summary
ProbFormCombFunc()
           
ProbFormCombFunc(CombFunc mc, ProbForm[] pfa, java.lang.String[] qvars, CConstr cc)
          Creates new ProbFormCombFunc
ProbFormCombFunc(java.lang.String mc, ProbForm[] pfa, java.lang.String[] qvars, CConstr cc)
           
 
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
 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
 int myCombInt()
          Returns the combination function used in this probform according to the integer encoding: N-or = 1 (= static int ProbFormCombFunc.NOR); Mean = 2 (= static int ProbFormCombFunc.MEAN); InvSum = 3 (= static int ProbFormCombFunc.INVSUM); ESUM = 3 (= static int ProbFormCombFunc.INVSUM);
 int numPFargs()
          Returns the number of probability formulas in the argument of this formula's combination function
 java.lang.String[] parameters()
          Returns all the parameters that this ProbForm depends on
 ProbForm probformAt(int i)
          Returns the i'th probability formula in the argument of this formula's combination function
 java.lang.String[] quantvars()
          Returns the quantvars of this combination function
 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)
           
 int[][] tuplesSatisfyingCConstr(RelStruc A, java.lang.String[] vars, int[] tuple)
          Returns the set of all tuples in A that satisfy the CConstr of this formula after the substituion vars/tuple has been performed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mycomb

public CombFunc mycomb

pfargs

public ProbForm[] pfargs

quantvars

public java.lang.String[] quantvars

cconstr

public CConstr cconstr

mycombInt

public int mycombInt

NOR

public static final int NOR
See Also:
Constant Field Values

MEAN

public static final int MEAN
See Also:
Constant Field Values

INVSUM

public static final int INVSUM
See Also:
Constant Field Values

ESUM

public static final int ESUM
See Also:
Constant Field Values
Constructor Detail

ProbFormCombFunc

public ProbFormCombFunc()

ProbFormCombFunc

public ProbFormCombFunc(CombFunc mc,
                        ProbForm[] pfa,
                        java.lang.String[] qvars,
                        CConstr cc)
                 throws java.lang.IllegalArgumentException
Creates new ProbFormCombFunc

Throws:
java.lang.IllegalArgumentException

ProbFormCombFunc

public ProbFormCombFunc(java.lang.String mc,
                        ProbForm[] pfa,
                        java.lang.String[] qvars,
                        CConstr cc)
                 throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException
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

makeParentVec

public java.util.Vector makeParentVec(RelStruc A)
                               throws RBNCompatibilityException
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
Throws:
RBNCompatibilityException

makeParentVec

public java.util.Vector makeParentVec(RelStruc A,
                                      Instantiation inst)
                               throws RBNCompatibilityException
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
Throws:
RBNCompatibilityException

conditionEvidence

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

conditionEvidence

public ProbForm conditionEvidence(RelStruc A,
                                  Instantiation inst)
                           throws RBNCompatibilityException
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
Throws:
RBNCompatibilityException

dependsOn

public boolean dependsOn(java.lang.String variable,
                         RelStruc A,
                         Instantiation data)
                  throws RBNCompatibilityException
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
Throws:
RBNCompatibilityException

evaluate

public double evaluate(RelStruc A,
                       Instantiation inst,
                       java.lang.String[] vars,
                       int[] tuple,
                       boolean useCurrentCvals)
                throws RBNCompatibilityException
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
Throws:
RBNCompatibilityException

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,
                       Instantiation inst,
                       boolean usesampleinst,
                       java.util.Hashtable atomhasht)
                throws RBNCompatibilityException
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
Throws:
RBNCompatibilityException

evaluatesTo

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

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

myCombInt

public int myCombInt()
Returns the combination function used in this probform according to the integer encoding: N-or = 1 (= static int ProbFormCombFunc.NOR); Mean = 2 (= static int ProbFormCombFunc.MEAN); InvSum = 3 (= static int ProbFormCombFunc.INVSUM); ESUM = 3 (= static int ProbFormCombFunc.INVSUM);


numPFargs

public int numPFargs()
Returns the number of probability formulas in the argument of this formula's combination function


probformAt

public ProbForm probformAt(int i)
Returns the i'th probability formula in the argument of this formula's combination function


quantvars

public java.lang.String[] quantvars()
Returns the quantvars of this combination function


sEval

public ProbForm sEval(RelStruc A)
               throws RBNCompatibilityException
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
Throws:
RBNCompatibilityException

tuplesSatisfyingCConstr

public int[][] tuplesSatisfyingCConstr(RelStruc A,
                                       java.lang.String[] vars,
                                       int[] tuple)
                                throws RBNCompatibilityException
Returns the set of all tuples in A that satisfy the CConstr of this formula after the substituion vars/tuple has been performed

Throws:
RBNCompatibilityException

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