Package org.tweetyproject.math.algebra
Class NonNumericSemiring
java.lang.Object
org.tweetyproject.math.algebra.Semiring<NonNumericSemiring.SemiringElement>
org.tweetyproject.math.algebra.NonNumericSemiring
This class represents an example for a non numeric semiring. This implementation uses an example semiring from the following paper: Bistarelli, Stefano, and Francesco Santini. "Weighted Argumentation." FLAP 8.6 (2021): 1589-1622.
- Author:
 - Sandra Hoffmann
 
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnum representing the elements in the non-numeric semiring: BAD, FAIR, and GOOD. - 
Constructor Summary
ConstructorsConstructorDescriptionConstructs a NonNumericSemiring with the specified total ordering, multiplication, and identity elements. - 
Method Summary
Modifier and TypeMethodDescriptiondivide(NonNumericSemiring.SemiringElement dividend, NonNumericSemiring.SemiringElement divisor) Performs a custom division operation on two SemiringElements.Generates a random element from the semiring.doubleConverts a non-numeric weight to its numerical representation.Methods inherited from class org.tweetyproject.math.algebra.Semiring
add, betterOrSame, getAddition, getMultiplication, getOneElement, getZeroElement, multiply, validateAndReturn 
- 
Constructor Details
- 
NonNumericSemiring
public NonNumericSemiring()Constructs a NonNumericSemiring with the specified total ordering, multiplication, and identity elements. 
 - 
 - 
Method Details
- 
getRandomElement
Generates a random element from the semiring.- Specified by:
 getRandomElementin classSemiring<NonNumericSemiring.SemiringElement>- Returns:
 - A randomly chosen SemiringElement.
 
 - 
toNumericalValue
Converts a non-numeric weight to its numerical representation.- Overrides:
 toNumericalValuein classSemiring<NonNumericSemiring.SemiringElement>- Parameters:
 weight- The SemiringElement to be converted.- Returns:
 - The numerical value associated with the SemiringElement.
 
 - 
divide
public NonNumericSemiring.SemiringElement divide(NonNumericSemiring.SemiringElement dividend, NonNumericSemiring.SemiringElement divisor) Performs a custom division operation on two SemiringElements. If the divisor has a greater or equal numerical value, returns the dividend. Otherwise, returns the divisor.- Specified by:
 dividein classSemiring<NonNumericSemiring.SemiringElement>- Parameters:
 dividend- The SemiringElement dividend.divisor- The SemiringElement divisor.- Returns:
 - The result of the custom division operation.
 
 
 -