Class MonotonicityConcept

  • All Implemented Interfaces:
    java.lang.Cloneable, InequalityTerm, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class MonotonicityConcept
    extends MapTypeInfiniteConcept<Concept>
    A concept that represents the monotoncity of an expression. Note that for an arbitrary expression, it will not have a monotonicity concept of simply Monotonic, Constant, etc. Rather, the expression will have a monotonicity that depends on it's free variables. For example, an expression of the form (x <= Concept1) ? Bottom : (y <= Concept2) ? Top : Concept1 may have a monotonicity that is monotonic with respect to the variable x, but antimonotonic with respect to y (and constant with respect to all other variables). This class represents exactly such concepts, representing them as {x = Monotonic, y = Animonotonic}, in a manner and syntax similar to records of the Ptolemy II type system. In records, however, accessing an undefined tag is an error, whereas in expressions, they are simply constant with respect to any variables that are not free.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Ben Lickly
    Pt.AcceptedRating:
    Red (blickly)
    Pt.ProposedRating:
    Red (blickly)
    • Constructor Detail

      • MonotonicityConcept

        protected MonotonicityConcept​(Ontology ontology)
                               throws IllegalActionException,
                                      NameDuplicationException
        Create a new Monotonicity concept, belonging to the given ontology.
        Parameters:
        ontology - The finite ontology to which this belongs. This should be the 4 element monotonicity lattice if we are really going to be doing inference on monotonicity of expressions.
        Throws:
        NameDuplicationException - Should never be thrown.
        IllegalActionException - If the base class throws it.
    • Method Detail

      • createMonotonicityConcept

        public static MonotonicityConcept createMonotonicityConcept​(Ontology ontology)
        Create a new monotonicity concept, belonging to the given ontology, with an automatically generated name.
        Parameters:
        ontology - The finite ontology to which this belongs. This should be the 4 element monotonicity lattice if we are really going to be doing inference on monotonicity of expressions.
        Returns:
        The newly created MonotonicityConcept.
      • compare

        public int compare​(Concept concept)
                    throws IllegalActionException
        Compare this concept with the given concept. Returns an int value that corresponds to the ordering between the elements as given in the CPO interface.
        Specified by:
        compare in class InfiniteConcept
        Parameters:
        concept - The concept with which we are comparing.
        Returns:
        CPO.HIGHER if this concept is above the given concept, CPO.LOWER if this concept is below the given concept, CPO.SAME if both concepts are the same, and CPO.INCOMPARABLE if concepts are incomparable.
        Throws:
        IllegalActionException - If the specified concept does not have the same ontology as this one.
        See Also:
        Concept.isAboveOrEqualTo(ptolemy.data.ontologies.Concept)
      • getColor

        public ColorAttribute getColor()
                                throws IllegalActionException
        Return the correct color for this monotonicity concept by looking at the color of the finite monotonicity representative.
        Overrides:
        getColor in class Concept
        Returns:
        A ColorAttribute corresponding to the highlight color of this monotonicity concept.
        Throws:
        IllegalActionException - Thrown if there is an error getting the color for the finite monotonicity concept.
      • getMonotonicity

        public Concept getMonotonicity​(java.lang.String variableName)
        Get the monotonicity of this concept with respect to a specific variable. While the overall monotonicity of an expression cannot be represented so simply, the monotonicity with respect to a single variable can be represented as one of:
        • Constant
        • Monotonic
        • Antimonotonic
        • General
        • NonMonotonic_{Counterexamples}
        • NonAntimonotonic_{Counterexamples}
        This method returns one these concepts.
        Parameters:
        variableName - The variable whose monotonicity we are querying.
        Returns:
        The monotonicity of this concept with respect to the given variable; one of Constant, Monotonic, Antimonotonic, or General.
      • greatestLowerBound

        public Concept greatestLowerBound​(Concept concept)
        Compute the greatest lower bound (GLB) of this and another concept.
        Specified by:
        greatestLowerBound in class InfiniteConcept
        Parameters:
        concept - The other concept.
        Returns:
        The concept that is the GLB of this and the given concept.
      • leastUpperBound

        public Concept leastUpperBound​(Concept concept)
        Compute the least upper bound (LUB) of this and another concept.
        Specified by:
        leastUpperBound in class InfiniteConcept
        Parameters:
        concept - The other concept.
        Returns:
        The concept that is the LUB of this and the given concept.
      • putMonotonicity

        public void putMonotonicity​(java.lang.String variable,
                                    Concept monotonicity)
        Set the monotonicity of this concept with respect to a specific variable.
        Parameters:
        variable - The variable whose monotonicity we are querying.
        monotonicity - The monotonicity of this concept with respect to the given variable.
        See Also:
        getMonotonicity(String)