Class CausalModel
java.lang.Object
org.tweetyproject.commons.BeliefSet<PlFormula,PlSignature>
org.tweetyproject.logics.pl.syntax.PlBeliefSet
org.tweetyproject.arg.dung.causal.syntax.CausalModel
- All Implemented Interfaces:
Iterable<PlFormula>,Collection<PlFormula>,BeliefBase
This class describes a causal model.
Reference: "Argumentation-based Causal and Counterfactual Reasoning" by
Lars Bengel, Lydia Blümel, Tjitze Rienstra and Matthias Thimm, published at 1st International Workshop on Argumentation
for eXplainable AI (ArgXAI, co-located with COMMA ’22), September 12, 2022
- Version:
- TweetyProject 1.23
- Author:
- Julian Sander
-
Field Summary
Fields inherited from class org.tweetyproject.commons.BeliefSet
EQUALS_USES_SIGNATURE -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty causal modelCausalModel(Set<Equivalence> structuralEquations) Creates a causal modelCausalModel(Set<Proposition> backGroundAtoms, Set<Proposition> explainableAtoms, Set<Equivalence> structuralEquations) Creates a causal model -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanAdds the specified elements to the end of this collection (optional operation).booleanaddAll(Collection<? extends PlFormula> formulas) booleanaddBackgroundAtom(Proposition atom) Adds a specified atom to the background atoms of this instance.booleanaddExplainableAtom(Proposition atom, Equivalence structuralEquation) Adds a specified atom to the explainable atoms of this instance and the specified equivalence as a structural equation for this atom.booleanaddStructuralEquation(Equivalence equation) Adds a specified equivalence to the structural equations of this instance.clone()booleanRetrieves a copy of the set of background atoms currently defined in the causal model.Retrieves a copy of the set of explainable atoms currently defined in the causal model.Retrieves a copy of the set of structural equations currently defined in the causal model.inthashCode()voidintervene(Proposition v, boolean x) This method implements the interventional statement, by replacing all structural equations for the specified explainable atom "v" of this causal model with a formula "v = x".Methods inherited from class org.tweetyproject.logics.pl.syntax.PlBeliefSet
getCanonicalOrdering, getMinimalSignature, getSyntaxComponents, toCnfMethods inherited from class org.tweetyproject.commons.BeliefSet
clear, contains, containsAll, getSignature, isEmpty, iterator, remove, removeAll, retainAll, setSignature, size, toArray, toArray, toString, toStringMethods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
Constructor Details
-
CausalModel
public CausalModel()Creates an empty causal model -
CausalModel
Creates a causal model- Parameters:
structuralEquations- Set of boolean structural equations; One equation for each explainable atom, which only occurs on the left side of the equation
-
CausalModel
public CausalModel(Set<Proposition> backGroundAtoms, Set<Proposition> explainableAtoms, Set<Equivalence> structuralEquations) Creates a causal model- Parameters:
backGroundAtoms- Set of background atomsexplainableAtoms- Set of explainable atomsstructuralEquations- Set of boolean structural equations; One equation for each explainable atom, which only occurs on the left side of the equation
-
-
Method Details
-
add
- Specified by:
addin interfaceCollection<PlFormula>- Overrides:
addin classBeliefSet<PlFormula,PlSignature>
-
add
Description copied from class:BeliefSetAdds the specified elements to the end of this collection (optional operation).- Overrides:
addin classBeliefSet<PlFormula,PlSignature> - Parameters:
formulas- to be appended to collection- Returns:
- true if all elements were added, false otherwise
-
addAll
- Specified by:
addAllin interfaceCollection<PlFormula>- Overrides:
addAllin classBeliefSet<PlFormula,PlSignature>
-
addBackgroundAtom
Adds a specified atom to the background atoms of this instance.- Parameters:
atom- Atom to add to the background atoms of this instance.- Returns:
- TRUE iff the atom was successfully added as a background atom to this instance. FALSE if the atom was already contained and leaves the set unchanged.
- Throws:
IllegalArgumentException- if adding the specified atom would violate the definition of a causal model
-
addExplainableAtom
Adds a specified atom to the explainable atoms of this instance and the specified equivalence as a structural equation for this atom.- Parameters:
atom- Atom to add to the explainable atoms of this instance.structuralEquation- Equation, having only the specified atom on the left side and a formula consisting only of atoms different than the specified atom on the right hand side of this equivalence- Returns:
- TRUE iff the atom and the formula were successfully added to this instance. FALSE if the atom or the equation were already contained and leaves at least one of the sets unchanged.
- Throws:
IllegalArgumentException- if adding the specified atom and or equation would violate the definition of a causal model
-
addStructuralEquation
Adds a specified equivalence to the structural equations of this instance. To this instance unknown explainable or background atoms are created and added in this process.- Parameters:
equation- Equation, having only one explainable atom on the left side and a formula on the right hand side of this equivalence consisting only of atoms different than the atom on the left- Returns:
- TRUE iff the formula and all therein contained atoms were successfully added to this instance. FALSE if the equation was already contained and leaves the set unchanged.
- Throws:
IllegalArgumentException- if adding the specified equation would violate the definition of a causal model
-
equals
- Specified by:
equalsin interfaceCollection<PlFormula>- Overrides:
equalsin classBeliefSet<PlFormula,PlSignature>
-
getBackGroundAtoms
Retrieves a copy of the set of background atoms currently defined in the causal model. Background atoms are those elements that are used in the model's equations but are not directly explainable. Returning a copy of the set ensures that the internal state of the causal model cannot be altered directly.- Returns:
- A new
HashSetcontaining all the background atoms.
-
getExplainableAtoms
Retrieves a copy of the set of explainable atoms currently defined in the causal model. Explainable atoms are those elements that the model explains directly through its structural equations. Returning a copy of the set helps maintain encapsulation and prevents external modifications to the model's state.- Returns:
- A new
HashSetcontaining all the explainable atoms.
-
getStructuralEquations
Retrieves a copy of the set of structural equations currently defined in the causal model. Structural equations are representations of equivalences that define how certain propositions (explainable atoms) depend on other atoms (background or explainable). Each equation must be an instance ofEquivalence. This method filters the model's formulas to return only those that are instances ofEquivalence.- Returns:
- A new
HashSetcontaining all the structural equations.
-
getTwinModel
- Returns:
- A twin model to this instance.
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<PlFormula>- Overrides:
hashCodein classBeliefSet<PlFormula,PlSignature>
-
intervene
This method implements the interventional statement, by replacing all structural equations for the specified explainable atom "v" of this causal model with a formula "v = x".- Parameters:
v- Explainable atom of this causal model, which is to be intervened on.x- Truth value of the intervention.
-
clone
-