Package edu.cmu.tetrad.bayes
Class Proposition
java.lang.Object
edu.cmu.tetrad.bayes.Proposition
- All Implemented Interfaces:
TetradSerializable,Serializable
Represents propositions over the variables of a particular BayesIm describing
an event of a fairly general sort--namely, conjunctions of propositions that
particular variables take on values from a particular disjunctive list of
categories. For example, X1 = 1 or 2 and X2 = 3 and X3 = 1 or 3 and X4 = 2 or 3 or
5. The proposition is created by allowing or disallowing particular
categories. Notice that "knowing nothing" about a variable is the same as
saying that all categories for that variable are allowed, so the proposition
by default allows all categories for all variables--i.e. it is a tautology.
- Author:
- Joseph Ramsey
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionProposition(Proposition proposition) Copies the info out of the old proposition into a new proposition for the new BayesIm.Proposition(VariableSource variableSource, Proposition proposition) Copies the info out of the old proposition into a new proposition for the new BayesIm. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCategory(int variable, int category) voiddisallowComplement(int variable, int category) Without changing the status of the specified category, disallows all other categories for the given variable.booleanbooleanintgetCategoryIndex(String nodeName, String category) intgetNodeIndex(String name) intgetNumAllowed(int variable) intgetNumAllowedCategories(int i) intgetNumCategories(int variable) intintgetSingleCategory(int variable) inthashCode()booleanisAllowed(int variable, int category) booleanisConditioned(int variable) booleanisPermissibleCombination(int[] point) voidremoveCategory(int variable, int category) voidrestrictToProposition(Proposition proposition) Restricts this proposition to the categories for each variable that are true in the given proposition.static PropositionGenerates a simple exemplar of this class to test serialization.voidsetCategory(int variable, int category) Sets the given value to true and all other values to false for the given variable.voidSpecifies that all variables in the proposition are either completely allowed (true) or completely disallowed (false) for all of their categories.voidsetVariable(int variable, boolean allowed) Specifies that all categories for the given variable are either all allowed (true) or all disallowed (false).static Propositiontautology(VariableSource variableSource) toString()
-
Constructor Details
-
Proposition
Copies the info out of the old proposition into a new proposition for the new BayesIm. -
Proposition
Copies the info out of the old proposition into a new proposition for the new BayesIm.
-
-
Method Details
-
tautology
-
serializableInstance
Generates a simple exemplar of this class to test serialization. -
getNumAllowedCategories
public int getNumAllowedCategories(int i) -
removeCategory
public void removeCategory(int variable, int category) -
disallowComplement
public void disallowComplement(int variable, int category) Without changing the status of the specified category, disallows all other categories for the given variable. -
setCategory
public void setCategory(int variable, int category) Sets the given value to true and all other values to false for the given variable. -
isPermissibleCombination
public boolean isPermissibleCombination(int[] point) - Returns:
- true iff the given point is true for this proposition.
-
existsCombination
public boolean existsCombination()- Returns:
- true iff there is some combination of categories for all the variables of the proposition that is allowed.
-
getNumAllowed
public int getNumAllowed(int variable) -
getSingleCategory
public int getSingleCategory(int variable) - Returns:
- the single category selected for the given variable, or -1 if it is not the case that a single value is selected.
-
restrictToProposition
Restricts this proposition to the categories for each variable that are true in the given proposition. -
getNodeIndex
- Returns:
- the index of the variable with the given name, or -1 if such a variable does not exist.
-
getCategoryIndex
-
addCategory
public void addCategory(int variable, int category) -
getVariableSource
- Returns:
- the Bayes IM that this is a proposition for.
-
getNumVariables
public int getNumVariables()- Returns:
- the number of variables for the proposition.
-
getNumCategories
public int getNumCategories(int variable) - Returns:
- the number of categories for the given variable.
-
setVariable
public void setVariable(int variable, boolean allowed) Specifies that all categories for the given variable are either all allowed (true) or all disallowed (false). -
setToTautology
public void setToTautology()Specifies that all variables in the proposition are either completely allowed (true) or completely disallowed (false) for all of their categories. -
isAllowed
public boolean isAllowed(int variable, int category) - Returns:
- true iff the given category for the given variable is allowed.
-
isConditioned
public boolean isConditioned(int variable) - Returns:
- true iff some category for the given variable is disallowed.
-
equals
-
hashCode
public int hashCode() -
toString
-