Class StateDensityFunction

java.lang.Object
org.oristool.math.function.StateDensityFunction

public class StateDensityFunction extends Object
Joint probability density function over DBM zones.
  • Constructor Details

    • StateDensityFunction

      public StateDensityFunction()
      Creates an empty PDF.
    • StateDensityFunction

      public StateDensityFunction(StateDensityFunction other)
      Creates the copy of a PDF.
      Parameters:
      other - PDF to copy
  • Method Details

    • equals

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

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

      public PartitionedGEN getContinuosVariablesDensity()
      Returns the PDF of continuous variables (i.e., not deterministic or synchronized).
      Returns:
      PDF of continuous variables
    • addDeterministicVariable

      public void addDeterministicVariable(Variable v, BigDecimal value)
      Adds a deterministic variable to this PDF.
      Parameters:
      v - new variable
      value - deterministic value
    • addSynchronizedVariable

      public void addSynchronizedVariable(Variable v, Variable distributed, BigDecimal delay)
      Adds a variable with deterministic delay with respect to an existing continuous variable.
      Parameters:
      v - new variable
      distributed - continuous variable
      delay - deterministic delay
    • addContinuousVariable

      public void addContinuousVariable(Variable v, PartitionedFunction f)
      Adds a continuous variable with give PDF.
      Parameters:
      v - new variable
      f - PDF (with respect to Variable.X)
    • getVariables

      public Set<Variable> getVariables()
      Returns the set of variables (deterministic, synchronized, continuous).
      Returns:
      variables of this PDF
    • getContinuousVariables

      public Set<Variable> getContinuousVariables()
      Returns the set of continuous variables.
      Returns:
      continuous variables of this PDF
    • getDeterministicVariables

      public Set<Variable> getDeterministicVariables()
      Returns the set of deterministic variables.
      Returns:
      deterministic variables of this PDF
    • getDeterministicValues

      public Set<Map.Entry<Variable,BigDecimal>> getDeterministicValues()
      Returns the set of deterministic variables and their values.
      Returns:
      deterministic variables of this PDF and their values
    • getPartitionedGen

      public PartitionedGEN getPartitionedGen()
      Returns the PDF of continuous variables.
      Returns:
      PDF of continuous variables
    • getLowestDeterministicValue

      public Map.Entry<Variable,BigDecimal> getLowestDeterministicValue()
      Returns the minimum value of deterministic variables.
      Returns:
      minimum deterministic value or null if no deterministic variable is present
    • getLowestDeterministicValue

      public Map.Entry<Variable,BigDecimal> getLowestDeterministicValue(Set<Variable> detVariables)
      Returns the minimum value of deterministic variables among a given set.
      Parameters:
      detVariables - set of deterministic varuables
      Returns:
      minimum deterministic value or null if the set is empty or disjoint from this.getDeterministicVariables()
    • getDeterministicValue

      public BigDecimal getDeterministicValue(Variable v)
      Returns the deterministic value of a given variable.
      Parameters:
      v - variable
      Returns:
      deterministic value
    • getSynchronizedVariables

      public Set<Variable> getSynchronizedVariables()
      Returns the set of synchronized variables.
      Returns:
      synchronized variables of this PDF
    • getSynchronization

      public Synchronization getSynchronization(Variable v)
      Returns synchronization information of a variable.
      Parameters:
      v - input variable
      Returns:
      synchronized information, or null if the variable is not synchronized
    • marginalizeVariable

      public void marginalizeVariable(Variable v)
      Removes a variable from this PDF.
      Parameters:
      v - target variable
    • swap

      public void swap(Variable synch)
      Moves a synchronized variable into the distributed set, and the current distributed one into the synchronized set.
      Parameters:
      synch - a synchronized variable
    • getLowestSynchronizedWrt

      public Variable getLowestSynchronizedWrt(Variable distributedVariable)
      Returns the synchronized variable with minimum delay with respect to a given distributed one.
      Parameters:
      distributedVariable - a distributed variable
      Returns:
      a synchronized variable with minimum delay
    • toString

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

      public Map<Variable,BigDecimal> getSynchDelaysWrt(Variable v)
      Returns all the variables synchronized with a given one (and their delays).

      The input variable can be in the distributed or synchronized set.

      Parameters:
      v - input variable
      Returns:
      synchronized variables
    • getLowestSynchronizedDelayWrt

      public BigDecimal getLowestSynchronizedDelayWrt(Variable distributedVariable)
      Returns the minimum delay of variables synchronized with the input one.
      Parameters:
      distributedVariable - a variable in the distributed set
      Returns:
      the minimum synchronization delay
    • getNullDelayVariables

      public Set<Variable> getNullDelayVariables(Variable v)
      Returns the deterministic, synchronized or distributed variables with zero delay with respect to an input one.
      Parameters:
      v - a deterministic, synchronized or distributed variable
      Returns:
      the set of variables with zero delay
    • shiftAndProject

      public void shiftAndProject(Variable firedVar)
      Subtracts a variable from all others and removes it from this PDF.
      Parameters:
      firedVar - target variable
    • constantShift

      public void constantShift(BigDecimal constant)
      Removes a constant from all variables of this PDF.
      Parameters:
      constant - input constant
    • constantShift

      public void constantShift(BigDecimal constant, Set<Variable> progressing)
      Removes a constant from a set of input variables.
      Parameters:
      constant - input constant
      progressing - set of variables
    • imposeBound

      public void imposeBound(Variable leftVar, Variable rightVar, OmegaBigDecimal bound)
      Imposes the bound leftVar - rightVar <= bound on the support, keeping only subzones with nonzero measure.

      Densities are not normalized.

      Parameters:
      leftVar - first variable of the difference
      rightVar - second variable of the difference
      bound - upper bound on the difference
    • imposeBound

      public void imposeBound(Variable leftVar, Set<Variable> rightVars, OmegaBigDecimal bound)
      Imposes the bound leftVar - rightVar <= bound on the support for all pairs of left/right variables, keeping only subzones with nonzero measure.

      Densities are not normalized.

      Parameters:
      leftVar - first variable of the difference
      rightVars - second variables of the difference
      bound - upper bound on the difference
    • conditionAllToBound

      public BigDecimal conditionAllToBound(Variable leftVar, Set<Variable> rightVars, OmegaBigDecimal bound)
      Imposes the bound leftVar - rightVar <= bound on the support for all pairs of left/right variables, keeping only subzones with nonzero measure.

      Densities are normalized on the new support.

      Parameters:
      leftVar - first variable of the difference
      rightVars - second variables of the difference
      bound - upper bound on the difference
      Returns:
      the probability measure of the restricted support before normalization
    • measure

      public BigDecimal measure()
      Returns the integral of this PDF on the support.

      The result should be 1, unless the support has been reduced without normalization.

      Returns:
      integral over support
    • getMarginalDensity

      public StateDensityFunction getMarginalDensity(Variable v)
      Returns the marginal density of a variable.
      Parameters:
      v - input variable
      Returns:
      PDF of the input variable
    • getMaxBound

      public OmegaBigDecimal getMaxBound(Variable left, Variable right)
      Returns the maximum upper bound on the difference left - right between two variables.
      Parameters:
      left - first variable
      right - second variable
      Returns:
      maximum upper bound on left - right
    • getMaxBound

      public OmegaBigDecimal getMaxBound(Set<Variable> leftVars, Set<Variable> rightVars)
      Returns the maximum upper bound on the difference left - right between variables in two sets.
      Parameters:
      leftVars - first set of variables
      rightVars - second set of variables
      Returns:
      maximum upper bound on left - right
    • getMinBound

      public OmegaBigDecimal getMinBound(Variable left, Variable right)
      Returns the minimum upper bound on the difference left - right between two variables.
      Parameters:
      left - first variable
      right - second variable
      Returns:
      minimum upper bound on left - right
    • getMinBound

      public OmegaBigDecimal getMinBound(Set<Variable> leftVars, Set<Variable> rightVars)
      Returns the minimum upper bound on the difference left - right between variables in two sets.
      Parameters:
      leftVars - first set of variables
      rightVars - second set of variables
      Returns:
      minimum upper bound on left - right
    • conditionToInterval

      public BigDecimal conditionToInterval(Variable v, OmegaBigDecimal min, OmegaBigDecimal max)
      Imposes the bound x <= v <= y on the support, keeping only subzones with nonzero measure.

      Densities are normalized on the new support.

      Parameters:
      v - target variable
      min - lower bound
      max - upper bound
      Returns:
      the probability measure of the restricted support before normalization
    • conditionToZone

      public BigDecimal conditionToZone(DBMZone zone)
      Intersects the support with the input zone, keeping only subzones with nonzero measure.

      Densities are normalized on the new support.

      Parameters:
      zone - input zone
      Returns:
      the probability measure of the restricted support before normalization
    • imposeInterval

      public void imposeInterval(Variable v, OmegaBigDecimal min, OmegaBigDecimal max)
      Intersects the support with the input bound min <= v <= max on the support, keeping only subzones with nonzero measure.

      Densities are not normalized on the new support.

      Parameters:
      v - target variable
      min - lower bound
      max - upper bound
    • imposeZone

      public void imposeZone(DBMZone zone)
      Intersects the support with the input zone, keeping only subzones with nonzero measure.

      Densities are not normalized on the new support.

      Parameters:
      zone - input zone
    • computeMeanValue

      public BigDecimal computeMeanValue(Variable v)
      Computes the mean value of a variable.
      Parameters:
      v - target variable
      Returns:
      mean value according to this PDF