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.
- Version:
- $Id: $Id
- Author:
- josephramsey
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionProposition(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 SummaryModifier and TypeMethodDescriptionvoidaddCategory(int variable, int category) addCategory.voiddisallowComplement(int variable, int category) Without changing the status of the specified category, disallows all other categories for the given variable.booleanbooleanexistsCombination.intgetCategoryIndex(String nodeName, String category) getCategoryIndex.intgetNodeIndex(String name) getNodeIndex.intgetNumAllowed(int variable) getNumAllowed.intgetNumAllowedCategories(int i) getNumAllowedCategories.intgetNumCategories(int variable) getNumCategories.intgetNumVariables.intgetSingleCategory(int variable) getSingleCategory.Getter for the fieldvariableSource.inthashCode()hashCode.booleanisAllowed(int variable, int category) isAllowed.booleanisConditioned(int variable) isConditioned.booleanisPermissibleCombination(int[] point) isPermissibleCombination.voidremoveCategory(int variable, int category) removeCategory.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) tautology.toString()toString.
- 
Constructor Details- 
PropositionCopies the info out of the old proposition into a new proposition for the new BayesIm.- Parameters:
- variableSource- a- VariableSourceobject
- proposition- a- Propositionobject
 
- 
PropositionCopies the info out of the old proposition into a new proposition for the new BayesIm.- Parameters:
- proposition- a- Propositionobject
 
 
- 
- 
Method Details- 
tautologytautology. - Parameters:
- variableSource- a- VariableSourceobject
- Returns:
- a Propositionobject
 
- 
serializableInstanceGenerates a simple exemplar of this class to test serialization.- Returns:
- a Propositionobject
 
- 
getNumAllowedCategoriespublic int getNumAllowedCategories(int i) getNumAllowedCategories. - Parameters:
- i- a int
- Returns:
- a int
 
- 
removeCategorypublic void removeCategory(int variable, int category) removeCategory. - Parameters:
- variable- a int
- category- a int
 
- 
disallowComplementpublic void disallowComplement(int variable, int category) Without changing the status of the specified category, disallows all other categories for the given variable.- Parameters:
- variable- a int
- category- a int
 
- 
setCategorypublic void setCategory(int variable, int category) Sets the given value to true and all other values to false for the given variable.- Parameters:
- variable- a int
- category- a int
 
- 
isPermissibleCombinationpublic boolean isPermissibleCombination(int[] point) isPermissibleCombination. - Parameters:
- point- an array of objects
- Returns:
- true iff the given point is true for this proposition.
 
- 
existsCombinationpublic boolean existsCombination()existsCombination. - Returns:
- true iff there is some combination of categories for all the variables of the proposition that is allowed.
 
- 
getNumAllowedpublic int getNumAllowed(int variable) getNumAllowed. - Parameters:
- variable- a int
- Returns:
- a int
 
- 
getSingleCategorypublic int getSingleCategory(int variable) getSingleCategory. - Parameters:
- variable- a int
- Returns:
- the single category selected for the given variable, or -1 if it is not the case that a single value is selected.
 
- 
restrictToPropositionRestricts this proposition to the categories for each variable that are true in the given proposition.- Parameters:
- proposition- a- Propositionobject
 
- 
getNodeIndexgetNodeIndex. - Parameters:
- name- a- Stringobject
- Returns:
- the index of the variable with the given name, or -1 if such a variable does not exist.
 
- 
getCategoryIndexgetCategoryIndex. 
- 
addCategorypublic void addCategory(int variable, int category) addCategory. - Parameters:
- variable- a int
- category- a int
 
- 
getVariableSourceGetter for the field variableSource.- Returns:
- the Bayes IM that this is a proposition for.
 
- 
getNumVariablespublic int getNumVariables()getNumVariables. - Returns:
- the number of variables for the proposition.
 
- 
getNumCategoriespublic int getNumCategories(int variable) getNumCategories. - Parameters:
- variable- a int
- Returns:
- the number of categories for the given variable.
 
- 
setVariablepublic void setVariable(int variable, boolean allowed) Specifies that all categories for the given variable are either all allowed (true) or all disallowed (false).- Parameters:
- variable- a int
- allowed- a boolean
 
- 
setToTautologypublic void setToTautology()Specifies that all variables in the proposition are either completely allowed (true) or completely disallowed (false) for all of their categories.
- 
isAllowedpublic boolean isAllowed(int variable, int category) isAllowed. - Parameters:
- variable- a int
- category- a int
- Returns:
- true iff the given category for the given variable is allowed.
 
- 
isConditionedpublic boolean isConditioned(int variable) isConditioned. - Parameters:
- variable- a int
- Returns:
- true iff some category for the given variable is disallowed.
 
- 
equals
- 
hashCodepublic int hashCode()hashCode. 
- 
toStringtoString. 
 
-