Class GEN

java.lang.Object
org.oristool.math.function.GEN
All Implemented Interfaces:
Function, PartitionedFunction
Direct Known Subclasses:
Erlang

public class GEN extends Object implements Function
Multidimensional PDF on a DBM zone support (non-piecewise).
  • Constructor Details

    • GEN

      public GEN(DBMZone domain, Expolynomial density)
      Builds a new PDF with the given support and density function.
      Parameters:
      domain - support of the PDF
      density - density function of the PDF
    • GEN

      public GEN(Function f)
      Builds a copy from a given function.
      Parameters:
      f - input function
  • Method Details

    • equals

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

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

      public void normalize()
      Normalizes the PDF, dividing its density by the integral over the support.
    • cartesianProduct

      public GEN cartesianProduct(Function f)
      Computes the product PDF with another set of random variables.
      Parameters:
      f - input PDF
      Returns:
      product PDF
    • integrateOverDomain

      public OmegaBigDecimal integrateOverDomain()
      Integrates the PDF over its support.
      Returns:
      value of the integral
    • project

      public PartitionedGEN project(Variable v)
      Removes a variable from the PDF.
      Parameters:
      v - target variable
      Returns:
      piecewise PDF resulting after removing the input variable
    • shiftAndProject

      public PartitionedGEN shiftAndProject(Variable v)
      Subtracts a variable from all others and removes it from the PDF.
      Parameters:
      v - target variable
      Returns:
      piecewise PDF resulting after removing the input variable
    • computeNonIntersectingZones

      public GEN computeNonIntersectingZones(GEN gen, List<GEN> finalFunctions)
      Computes the PDF on support intersection and those of difference supports.
      Parameters:
      gen - input PDF
      finalFunctions - list where difference PDFs are added
      Returns:
      intersection PDF
    • getSubZonesInducted

      public List<GEN> getSubZonesInducted(GEN gen)
      Computes the subzone PDFs induced by the support of a given PDF.
      Parameters:
      gen - input PDF
      Returns:
      list of intersection PDFs
    • substitute

      public void substitute(Variable oldVar, Variable newVar)
      Replaces a variable name with another.
      Parameters:
      oldVar - old variable name
      newVar - new variable name
    • substitute

      public void substitute(Variable oldVar, Variable newVar, BigDecimal constant)
      Replaces a variable name with another and adds a constant.
      Parameters:
      oldVar - old variable name
      newVar - new variable name
      constant - constant to be added
    • constantShift

      public void constantShift(BigDecimal constant)
      Adds a constant to all variables in the PDF.
      Parameters:
      constant - constant to be added
    • constantShift

      public void constantShift(BigDecimal constant, Collection<Variable> variables)
      Adds a constant to a set of variables in the PDF.
      Parameters:
      constant - constant to be added
      variables - variables to be shifted
    • substituteAndShift

      public void substituteAndShift(Variable oldVar, Variable newVar, BigDecimal constant)
      Replaces the ground with newVar - constant and oldVar with the ground.
      Parameters:
      oldVar - the new ground variable
      newVar - the variable to be removed from all
      constant - constant to be added to all
    • conditionToMin

      public BigDecimal conditionToMin(Variable v, OmegaBigDecimal min)
      Imposes the bound v >= min and normalizes the density.
      Parameters:
      v - target variable
      min - minimum value
      Returns:
      probability that the bound is satisfied (before normalization)
    • conditionToMax

      public BigDecimal conditionToMax(Variable v, OmegaBigDecimal max)
      Imposes the bound v <= max and normalizes the density.
      Parameters:
      v - target variable
      max - maximum value
      Returns:
      probability that the bound is satisfied (before normalization)
    • conditionToBound

      public BigDecimal conditionToBound(Variable v, OmegaBigDecimal min, OmegaBigDecimal max)
      Imposes the bound min <= v <= max and normalizes the density.
      Parameters:
      v - target variable
      min - minimum value
      max - maximum value
      Returns:
      probability that the bound is satisfied (before normalization)
    • toString

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

      public String toMathematicaString()
      Specified by:
      toMathematicaString in interface Function
      Specified by:
      toMathematicaString in interface PartitionedFunction
    • getDomain

      public DBMZone getDomain()
      Specified by:
      getDomain in interface Function
    • getDensity

      public Expolynomial getDensity()
      Specified by:
      getDensity in interface Function
    • newTruncatedExp

      public static GEN newTruncatedExp(Variable v, BigDecimal rate, OmegaBigDecimal eft, OmegaBigDecimal lft)
      Builds the PDF of a truncated EXP.
      Parameters:
      v - variable name
      rate - rate of the EXP
      eft - start of the support
      lft - end of the support
      Returns:
      truncated EXP PDF
    • newDeterministic

      public static GEN newDeterministic(BigDecimal value)
      Builds the PDF of a deterministic variable.

      By convention, this PDF has density equal to 1 and support including only the input value.

      Parameters:
      value - value of the deterministic variable
      Returns:
      deterministic PDF
    • getDETInstance

      public static GEN getDETInstance(Variable v, BigDecimal value)
      Builds the PDF of a deterministic variable.

      By convention, this PDF has density equal to 1 and support including only the input value.

      Parameters:
      v - variable name
      value - value of the deterministic variable
      Returns:
      deterministic PDF
    • newUniform

      public static GEN newUniform(OmegaBigDecimal eft, OmegaBigDecimal lft)
      Builds the PDF of a uniform variable.
      Parameters:
      eft - minimum value
      lft - maximum value
      Returns:
      uniform PDF
    • newExpolynomial

      public static GEN newExpolynomial(String density, OmegaBigDecimal eft, OmegaBigDecimal lft)
      Builds a PDF from an input string.
      Parameters:
      density - string representing the PDF
      eft - minimum value
      lft - maximum value
      Returns:
      expolynomial PDF
    • newHyperExp

      public static GEN newHyperExp(List<BigDecimal> probs, List<BigDecimal> rates)
      Builds the PDF of an hyper-exponential variable.
      Parameters:
      probs - list of mixture probabilities
      rates - list of exponential rates
      Returns:
      hyper-exponential PDF
    • newHypoExp

      public static GEN newHypoExp(BigDecimal rate1, BigDecimal rate2)
      Builds the PDF of an hypo-exponential variable.
      Parameters:
      rate1 - rate of the first exponential
      rate2 - rate of the second exponential
      Returns:
      hypo-exponential PDF
    • newShiftedExp

      public static GEN newShiftedExp(BigDecimal shift, BigDecimal rate)
      Builds the PDF of a shifted exponential.
      Parameters:
      shift - shift amount
      rate - rate of the EXP
      Returns:
      shifted EXP PDF