Class MonotonicityCounterexamples


  • public class MonotonicityCounterexamples
    extends java.lang.Object
    Representation of a set of counterexamples to monotonicity. Each counterexample is of the form of a pair of elements (x1,x2) where x1 ≤ x2, but f(x1) \not ≤ f(x2), for the non-monotonic function f under consideration.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Ben Lickly
    Pt.AcceptedRating:
    Red (blickly)
    Pt.ProposedRating:
    Red (blickly)
    • Constructor Detail

      • MonotonicityCounterexamples

        public MonotonicityCounterexamples()
        Construct an empty set of counterexamples. We can't really consider this a set of counterexamples until we add some counterexamples.
    • Method Detail

      • fromToken

        public static MonotonicityCounterexamples fromToken​(Token token)
                                                     throws IllegalActionException
        Create a counterexample set from a specific representation as a Ptolemy Token. This Token must be an ArrayToken whose entries are TupleTokens each of length 2, where the lesser concept is on the left hand side and the greater concept is on the right hand side.
        Parameters:
        token - The Ptolemy Token representing a set of counterexamples to monotonicity.
        Returns:
        The counterexample set represented by the given token.
        Throws:
        IllegalActionException - If the given Token does not conform to the required structure;
        See Also:
        toToken()
      • add

        public void add​(Concept x1,
                        Concept x2)
        Add a pair of concepts as a counterexample to this set. This means that x1 ≤ x2, but for the (non-monotonic) function in question, f(x1) \not ≤ f(x2).
        Parameters:
        x1 - The lesser concept.
        x2 - The greater concept.
      • containsCounterexamples

        public boolean containsCounterexamples()
        Determine if this set contains any counterexamples.
        Returns:
        True, if this set contains at least one counterexample. False, otherwise.
      • entrySet

        public java.util.Set<MonotonicityCounterexamples.ConceptPair> entrySet()
        Return a set of all the counterexamples. For each pair in the set returned, (x1, x2), we have x1 ≤ x2, but on the function under consideration f(x1) \not ≤ f(x2)
        Returns:
        A set of pairs of counterexamples.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Return the string representation of the counterexample set.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The string representation of this set.
        See Also:
        Object.toString()
      • toToken

        public ArrayToken toToken()
                           throws IllegalActionException
        Return a representation of the counterexample set as a Ptolemy Token. This Token is an ArrayToken whose entries are TupleTokens each of length 2, where the lesser concept is on the left hand side and the greater concept is on the right hand side.
        Returns:
        The Token representation of this set.
        Throws:
        IllegalActionException - If any of the concepts are null
        See Also:
        fromToken(Token)