Class LogNormalDistributionParameter

java.lang.Object
it.univr.di.cstnu.util.LogNormalDistributionParameter
All Implemented Interfaces:
Serializable

public class LogNormalDistributionParameter extends Object implements Serializable
Log-normal distribution of the duration of a contingent link, held by the contingent time point.

Immutable: a shifted parameter is a new object. The nodes that hold one share it -- the clone constructors of LabeledNode copy the reference -- so a setter here would reach through every copy of a node, including the one in the network a caller handed to a checking algorithm.

Initially created inside the PSTN class, then extracted to allow the compilation of the package without the PSTN class.

See Also:
  • Constructor Details

    • LogNormalDistributionParameter

      public LogNormalDistributionParameter(double location1, double scale1, int shift1)
      Parameters:
      location1 - Considering the associated normal distribution, this is the mean μ of the normal distribution.
      scale1 - Considering the associated normal distribution, this is the standard deviation σ of the normal distribution.
      shift1 - It is possible that a rigid distance shifts the activation time point. In such a case, the log-normal distribution of the contingent link is the same, but the sample values must be simply added to the shift to have the right value. It would be possible to adjust the location and scale of the log-normal distribution to incorporate such a shift. Still, we verified that such an adjustment introduces some approximation errors. Be careful: if the original PDF was for the contingent link 'X--v--> A===>C' and A was moved to X, the range of the contingent link is increased by v. The shift is 'v', not (-v). Shift can only be positive.
    • LogNormalDistributionParameter

      public LogNormalDistributionParameter(double location1, double scale1)
      Parameters:
      location1 - Considering the associated normal distribution, this is the mean μ of the normal distribution.
      scale1 - Considering the associated normal distribution, this is the standard deviation σ of the normal distribution.
  • Method Details

    • parse

      @Nullable public static LogNormalDistributionParameter parse(String input)
      Parameters:
      input - a toString() representation of a LogNormalDistributionParameter object. Format is "LogNormalDistributionParameter[location=%f, scale=%f, shift=%d]"
      Returns:
      the LogNormalDistributionParameter object represented in the input, null otherwise.
    • cumulativeProbability

      public final double cumulativeProbability(double x)
      Parameters:
      x - value in the domain (it will be compensated by '-shift')
      Returns:
      the cumulative probability at x.
    • getLocation

      public final double getLocation()
      Returns:
      location
    • getLogNormalDistribution

      public org.apache.commons.math3.distribution.LogNormalDistribution getLogNormalDistribution()
      Returns:
      the associated PDF
    • getScale

      public final double getScale()
      Returns:
      the scale
    • getShift

      public final int getShift()
      Returns:
      the shift
    • sample

      public final double sample()
      Returns:
      a random value sampled by the current log-normal distribution adjusted by the shift value.
    • toString

      public final String toString()
      Overrides:
      toString in class Object