Package org.tweetyproject.comparator
Class NumericalPartialOrder<T extends Formula,R extends BeliefBase>
java.lang.Object
org.tweetyproject.commons.AbstractInterpretation<R,T>
org.tweetyproject.comparator.GeneralComparator<T,R>
org.tweetyproject.comparator.NumericalPartialOrder<T,R>
- Type Parameters:
T
- Some FormularR
- Some Beliefbase
- All Implemented Interfaces:
Comparator<T>
,Map<T,
,Double> Interpretation<R,
T>
public class NumericalPartialOrder<T extends Formula,R extends BeliefBase>
extends GeneralComparator<T,R>
implements Map<T,Double>
This class provides an acceptability interpretation of arguments by assigning
them real values. Often larger values indicate more acceptability, but some
semantics use other ways of ranking the values.
- Author:
- Matthias Thimm, Anna Gessler
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Possible sorting types for the numerical values. -
Field Summary
Modifier and TypeFieldDescriptionstatic double
Precision for comparing values.The method used for ordering the numerical values according to acceptability. -
Constructor Summary
ConstructorDescriptionCreates a new empty numerical argument ranking.NumericalPartialOrder
(Collection<T> args, double initialvalue) Creates a new ranking with the given set of arguments and the given initial ranking value. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
Return true if this ranking contains incomparable arguments, false otherwiseboolean
containsKey
(Object arg0) boolean
containsValue
(Object arg0) entrySet()
Return the sorting type that is used for ranking values (descending, ascending or sorted lexicographically)boolean
isEmpty()
boolean
isIncomparable
(T a, T b) Returns "true" iff a and b are incomparable (i.e.boolean
Returns "true" iff a is strictly less acceptable than b or a is equally acceptable as b or a and b are not comparable, i.e.keySet()
void
boolean
Checks whether this interpretation satisfies the given knowledge base.boolean
Checks whether this interpretation satisfies the given formula.void
setSortingType
(NumericalPartialOrder.SortingType sortingType) Set the sorting type for ranking values.int
size()
toString()
values()
Methods inherited from class org.tweetyproject.comparator.GeneralComparator
compare, getMaximallyAcceptedArguments, getMinimallyAcceptedArguments, isEquallyAcceptableThan, isEquivalent, isStrictlyLessAcceptableThan, isStrictlyMoreAcceptableThan, isStrictlyMoreOrEquallyAcceptableThan
Methods inherited from class org.tweetyproject.commons.AbstractInterpretation
satisfies
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
PRECISION
public static double PRECISIONPrecision for comparing values. -
sortingType
The method used for ordering the numerical values according to acceptability.
-
-
Constructor Details
-
NumericalPartialOrder
public NumericalPartialOrder()Creates a new empty numerical argument ranking. -
NumericalPartialOrder
Creates a new ranking with the given set of arguments and the given initial ranking value.- Parameters:
args
- some set of comparable elementsinitialvalue
- an initial value that will be assigned to all comparable elements
-
-
Method Details
-
isStrictlyLessOrEquallyAcceptableThan
Description copied from class:GeneralComparator
Returns "true" iff a is strictly less acceptable than b or a is equally acceptable as b or a and b are not comparable, i.e. a >= b (or a ~ b)- Specified by:
isStrictlyLessOrEquallyAcceptableThan
in classGeneralComparator<T extends Formula,
R extends BeliefBase> - Parameters:
a
- some comparable elementb
- some comparable element- Returns:
- "true" iff a is strictly less acceptable than b or a is equally acceptable as b
-
toString
-
clear
-
containsKey
- Specified by:
containsKey
in interfaceMap<T extends Formula,
R extends BeliefBase>
-
containsValue
- Specified by:
containsValue
in interfaceMap<T extends Formula,
R extends BeliefBase>
-
entrySet
-
get
-
isEmpty
-
keySet
-
put
-
putAll
-
remove
-
size
-
values
-
getSortingType
Return the sorting type that is used for ranking values (descending, ascending or sorted lexicographically)- Returns:
- the sorting type that is used for ranking values (descending, ascending or sorted lexicographically)
-
setSortingType
Set the sorting type for ranking values. For example, the "ascending" type means that smaller values signify a higher ranking than bigger values.- Parameters:
sortingType
- seesortingType
for a description of the available sorting methods
-
isIncomparable
Description copied from class:GeneralComparator
Returns "true" iff a and b are incomparable (i.e. this ranking is a partial ranking).- Specified by:
isIncomparable
in classGeneralComparator<T extends Formula,
R extends BeliefBase> - Parameters:
a
- comparable elementb
- comparable element- Returns:
- "true" iff a and b are incomparable
-
containsIncomparableArguments
public boolean containsIncomparableArguments()Description copied from class:GeneralComparator
Return true if this ranking contains incomparable arguments, false otherwise- Specified by:
containsIncomparableArguments
in classGeneralComparator<T extends Formula,
R extends BeliefBase> - Returns:
- true if this ranking contains incomparable arguments, false otherwise
-
satisfies
Description copied from interface:Interpretation
Checks whether this interpretation satisfies the given formula.- Specified by:
satisfies
in interfaceInterpretation<T extends Formula,
R extends BeliefBase> - Parameters:
formula
- a formula .- Returns:
- "true" if this interpretation satisfies the given formula.
- Throws:
IllegalArgumentException
- if the formula does not correspond to the expected language.
-
satisfies
Description copied from interface:Interpretation
Checks whether this interpretation satisfies the given knowledge base.- Specified by:
satisfies
in interfaceInterpretation<T extends Formula,
R extends BeliefBase> - Parameters:
beliefBase
- a knowledge base.- Returns:
- "true" if this interpretation satisfies the given knowledge base.
- Throws:
IllegalArgumentException
- IllegalArgumentException if the knowledgebase does not correspond to the expected language.
-