Package org.tweetyproject.math.algebra
Class ProbabilisticSemiring
java.lang.Object
org.tweetyproject.math.algebra.Semiring<Double>
org.tweetyproject.math.algebra.ProbabilisticSemiring
This class represents a probabilistic (Viterbi) Semiring, where elements range between [0.0, 1.0].The addition operation corresponds to finding the maximum, 0.0 represents the
additive identity, and 1.0 represents the multiplicative identity.
- Author:
- Sandra Hoffmann
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionPerforms a custom division operation on two Double values within the context of a Probabilistic Semiring.Generates a random Double element within the specified maximum value.validateAndReturn
(Double value) Validates and returns the given probabilistic value.Methods inherited from class org.tweetyproject.math.algebra.Semiring
add, betterOrSame, getAddition, getMultiplication, getOneElement, getZeroElement, multiply, toNumericalValue
-
Constructor Details
-
ProbabilisticSemiring
public ProbabilisticSemiring()Constructs a ProbabilisticSemiring instance.
-
-
Method Details
-
validateAndReturn
Validates and returns the given probabilistic value.- Overrides:
validateAndReturn
in classSemiring<Double>
- Parameters:
value
- The value to be validated.- Returns:
- The validated value.
- Throws:
IllegalArgumentException
- If the value is outside the valid range [0.0, 1.0].
-
getRandomElement
Generates a random Double element within the specified maximum value.- Specified by:
getRandomElement
in classSemiring<Double>
- Returns:
- A random Double element.
-
divide
Performs a custom division operation on two Double values within the context of a Probabilistic Semiring. If the divisor is greater than or equal to the dividend, returns the multiplicative identity (oneElement). Otherwise, returns the result of dividing the dividend by the divisor.
-