Class Variable

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean isPositive
      Whether this variables should be positive.
      private double lowerBound
      Bounds for the variables
      private java.lang.String name
      The name of the variable.
      private double upperBound
      Bounds for the variables
    • Constructor Summary

      Constructors 
      Constructor Description
      Variable​(java.lang.String name)
      Creates a new variable with the given name.
      Variable​(java.lang.String name, boolean isPositive)
      Creates a new variable with the given name.
      Variable​(java.lang.String name, double lowerBound, double upperBound)
      Creates a new variable with the given name and bounds.
    • Field Detail

      • name

        private java.lang.String name
        The name of the variable.
      • isPositive

        private boolean isPositive
        Whether this variables should be positive.
      • upperBound

        private double upperBound
        Bounds for the variables
      • lowerBound

        private double lowerBound
        Bounds for the variables
    • Constructor Detail

      • Variable

        public Variable​(java.lang.String name)
        Creates a new variable with the given name.
        Parameters:
        name - the name of this variable.
      • Variable

        public Variable​(java.lang.String name,
                        boolean isPositive)
        Creates a new variable with the given name.
        Parameters:
        name - the name of this variable.
        isPositive - whether this variables should be positive.
      • Variable

        public Variable​(java.lang.String name,
                        double lowerBound,
                        double upperBound)
        Creates a new variable with the given name and bounds.
        Parameters:
        name - the name of this variable.
        lowerBound - the lower bound of the variable.
        upperBound - the upper bound of the variable.
    • Method Detail

      • isPositive

        public boolean isPositive()
        Checks whether this variables should be positive.
        Returns:
        "true" if this variables should be positive.
      • getUpperBound

        public double getUpperBound()
        Returns the upper bound of this variable.
        Returns:
        the upper bound of this variable.
      • getLowerBound

        public double getLowerBound()
        Returns the lower bound of this variable.
        Returns:
        the lower bound of this variable.
      • value

        public Constant value()
        Description copied from class: Term
        Computes the actual value of this term if it contains no variables.
        Specified by:
        value in class Term
        Returns:
        the value of this term, either a float or an integer.
      • getName

        public java.lang.String getName()
        Returns the name of this variable.
        Returns:
        the name of this variable.
      • getVariables

        public java.util.Set<Variable> getVariables()
        Description copied from class: Term
        Returns all variables in this term.
        Specified by:
        getVariables in class Term
        Returns:
        all variables in this term.
      • getProducts

        public java.util.Set<Product> getProducts()
        Description copied from class: Term
        Returns all products of this term.
        Specified by:
        getProducts in class Term
        Returns:
        all products of this term.
      • getMinimums

        public java.util.Set<Minimum> getMinimums()
        Description copied from class: Term
        Returns all minimums of this term.
        Specified by:
        getMinimums in class Term
        Returns:
        all minimums of this term.
      • getMaximums

        public java.util.Set<Maximum> getMaximums()
        Description copied from class: Term
        Returns all maximums of this term.
        Specified by:
        getMaximums in class Term
        Returns:
        all maximums of this term.
      • getAbsoluteValues

        public java.util.Set<AbsoluteValue> getAbsoluteValues()
        Description copied from class: Term
        Returns all absolute values of this term.
        Specified by:
        getAbsoluteValues in class Term
        Returns:
        all absolute values of this term.
      • replaceTerm

        public Term replaceTerm​(Term toSubstitute,
                                Term substitution)
        Description copied from class: Term
        Replaces each occurrence of "toSubstitute" by "substitution" and return the new term.
        Specified by:
        replaceTerm in class Term
        Parameters:
        toSubstitute - the term to be substituted
        substitution - the new term
        Returns:
        this term where "toSubstitute" is replaced by "substitution"
      • collapseAssociativeOperations

        public void collapseAssociativeOperations()
        Description copied from class: Term
        This method collapses all associative operations appearing in this term, e.g. every min{min{a,b},c} becomes min{a,b,c}.
        Specified by:
        collapseAssociativeOperations in class Term
      • expandAssociativeOperations

        public void expandAssociativeOperations()
        Description copied from class: Term
        This method expands all associative operations appearing in this term, e.g. every min{a,b,c} becomes min{min{a,b},c}.
        Specified by:
        expandAssociativeOperations in class Term
      • isContinuous

        public boolean isContinuous​(Variable v)
        Description copied from class: Term
        Checks whether this term is continuous in v.
        Specified by:
        isContinuous in class Term
        Parameters:
        v - a variable
        Returns:
        "true" iff this term is continuous in v.
      • toLinearForm

        public Sum toLinearForm()
                         throws java.lang.IllegalArgumentException
        Description copied from class: Term
        Converts this term into a linear normal form, i.e. into a sum of products of a constant and a variable.
        Specified by:
        toLinearForm in class Term
        Returns:
        a term in linear normal form.
        Throws:
        java.lang.IllegalArgumentException - if this term cannot be converted into a linear normal form.
      • derive

        public Term derive​(Variable v)
        Description copied from class: Term
        Differentiates the term with respect to the given variable.
        Specified by:
        derive in class Term
        Parameters:
        v - a variable.
        Returns:
        the derivation of this term wrt. the given variable.
      • simplify

        public Term simplify()
        Description copied from class: Term
        Simplifies this term in an equivalent way:
        - Replaces products that contain a zero by the constant zero
        - Removes a term one from products
        - Removes a term zero from sums
        - Aggregates constants in sums, products, and minimums
        - Evaluates functional terms on constants
        - Simplifies fractions where possible.
        Specified by:
        simplify in class Term
        Returns:
        the simplified term.
      • hashCode

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Specified by:
        toString in class Term