Class DBMZone

java.lang.Object
org.oristool.math.domain.DBMZone

public final class DBMZone extends Object
A DBM zone encoding pairwise constraints between variables.
  • Constructor Details

    • DBMZone

      public DBMZone()
    • DBMZone

      public DBMZone(Variable... vars)
    • DBMZone

      public DBMZone(Collection<Variable> vars)
      Creates a zone for the given variables, without constraints.
      Parameters:
      vars - zone variables
    • DBMZone

      public DBMZone(DBMZone dbm)
      Creates a copy of a DBM zone.
      Parameters:
      dbm - input zone
  • Method Details

    • getCoefficient

      public OmegaBigDecimal getCoefficient(Variable left, Variable right)
      Returns the constant c for the constraint left-right <= c.

      Use getBound if the DBM is not normalized.

      Parameters:
      left - first variable
      right - second variable
      Returns:
      upper bound
    • getBound

      public OmegaBigDecimal getBound(Variable left, Variable right)
      Returns the upper bound for the difference left-right between two variables, which is the constant c of a constraint left-right <= c.
      Parameters:
      left - first variable
      right - second variable
      Returns:
      upper bound
    • getMinLFT

      public OmegaBigDecimal getMinLFT(Set<Variable> vars)
      Returns the minimum value that any of the input variables can take inside this zone.
      Parameters:
      vars - input variables
      Returns:
      minimum allowed value for the input variables
    • setCoefficient

      public void setCoefficient(Variable left, Variable right, OmegaBigDecimal coefficient)
      Sets the constant c for the constraints left-right.
      Parameters:
      left - first variable
      right - second variable
      coefficient - upper bound for left-right
      Throws:
      IllegalArgumentException - if left==right or coefficient is negative infinity
    • addVariables

      public void addVariables(Variable... vars)
    • addVariables

      public void addVariables(Collection<Variable> vars)
      Introduces new variables in this zone.
      Parameters:
      vars - input variables
    • getVariables

      public Set<Variable> getVariables()
    • normalize

      public void normalize()
      Normalizes this zone, so that upper bounds satisfy the triangular inequality.
    • cartesianProduct

      public DBMZone cartesianProduct(DBMZone other)
      Computes the Cartesian product with another zone (with distinct set of variables).
      Parameters:
      other - another zone
      Returns:
      the Cartesian product with this zone
    • isFullDimensional

      public boolean isFullDimensional()
      Checks if this zone is fully-dimensional in its variable space.
      Returns:
      true if the zone is fully dimensional, false otherwise
    • isEmpty

      public boolean isEmpty()
      Checks if this zone has unsatisfiable constraints.
      Returns:
      true if the zone is empty, false otherwise
    • imposeBound

      public void imposeBound(Variable left, Variable right, OmegaBigDecimal coefficient)
      Imposes an upper bound for the difference left-right. If a stricter constraint already exists, no change is applied.
      Parameters:
      left - first variable
      right - second variable
      coefficient - upper bound
    • imposeVarLower

      public void imposeVarLower(Variable var, Collection<Variable> others)
      Imposes the bound var-x <= 0 for each x in others.
      Parameters:
      var - a variable
      others - a set of variables
    • imposeVarLowerAndNormalize

      public void imposeVarLowerAndNormalize(Variable var, Collection<Variable> others)
      Imposes the bound var-x <= 0 for each x in others. This method may result in a faster computation time if normalization is required.
      Parameters:
      var - a variable
      others - a set of variables
    • canVariableBeLowestOrEqual

      public boolean canVariableBeLowestOrEqual(Variable var)
      Checks if a variable can be the minimum in the zone.
      Parameters:
      var - a variable
      Returns:
      true if the variable can be the minimum
    • canVariableBeLowerOrEqual

      public boolean canVariableBeLowerOrEqual(Variable var, Collection<Variable> others)
      Checks if a variable can be the minimum among a set of variables.
      Parameters:
      var - a variable
      others - a set of variables
      Returns:
      true if the variable can be the minimum
    • setNewGround

      public void setNewGround(Variable v)
      Discards the constraints of the input variable and uses it as the new ground.
      Parameters:
      v - a variable
    • projectVariable

      public void projectVariable(Variable v)
      Discards the constraints of the input variable.
      Parameters:
      v - a variable
    • projectVariables

      public void projectVariables(Variable... vars)
    • projectVariables

      public void projectVariables(Collection<Variable> vars)
      Discards the constraints of a set of variables.
      Parameters:
      vars - a set of variables
    • substitute

      public void substitute(Variable oldVar, Variable newVar)
      Replaces the name of a variable in all of its constraints.
      Parameters:
      oldVar - the old name
      newVar - the new name
    • substitute

      public void substitute(Variable oldVar, Variable newVar, BigDecimal coefficient)
      Replaces the name of a variable and applies a constant shift.
      Parameters:
      oldVar - the old name
      newVar - the new name
      coefficient - shift value
    • constantShift

      public void constantShift(BigDecimal constant)
      Applies a constant shift to all variables.
      Parameters:
      constant - shift value
    • constantShift

      public void constantShift(BigDecimal constant, Collection<Variable> variables)
      Applies a constant shift to a set of variables.
      Parameters:
      constant - shift amount
      variables - target variables
    • isSyncronized

      public boolean isSyncronized(Variable x, Variable y)
    • getNullDelayVariables

      public Set<Variable> getNullDelayVariables(Variable v)
      Finds the variables synchronized with the input one.
      Parameters:
      v - input variable
      Returns:
      set of synchronized variables
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • intersect

      public void intersect(DBMZone other)
      Intersects this zone with the input one.
      Parameters:
      other - a zone
    • contains

      public boolean contains(DBMZone other)
      Checks whether this zone fully contains an input one.
      Parameters:
      other - a zone
      Returns:
      true if the input zone is fully contained
    • contains

      public boolean contains(Map<Variable,OmegaBigDecimal> point)
      Checks if this zone contains the input point.
      Parameters:
      point - a point
      Returns:
      true if this zone contains the point
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toAndString

      public String toAndString()
      Produces a representation of the zone constraints as "and" && operators.
      Returns:
      string representation of the zone as and operators
    • toRegionPlotString

      public String toRegionPlotString()
      Produces a representation of the zone constraints Mathematica RegionPlot.
      Returns:
      string representation of the zone as region plots
    • toUnitStepsString

      public String toUnitStepsString()