Package org.eclipse.app4mc.amalthea.model.util

## Class WeibullUtil

- Object
- - WeibullUtil

    public class WeibullUtil
    extends Object

### Nested Class Summary

Nested Classes
`static class` `WeibullUtil.Parameters`

### Method Summary

All Methods
`static double` `computeAverage​(double shape, double scale, double location, Double upperBound)` See Crénin, François, Truncated Weibull Distribution Functions and Moments (October 30, 2015).
`static double` `computeMedian​(double shape, double scale, double location, Double upperBound)`
`static double` `computeMedianWithPRemainPromille​(double shape, double scale, double location, double pRemainPromille)`
`static double` `computePRemainPromille​(double shape, double scale, double location, double upperBound)`
`static double` `computeUpperBound​(double shape, double scale, double location, double pRemainPromille)`
`static WeibullUtil.Parameters` `findParameters​(double lowerBound, double average, double upperBound, double pRemainPromille)` This is a simple attempt to get a better parameter estimation for big pRemainPromille values.
`static WeibullUtil.Parameters` `findParametersForAverage​(double lowerBound, double average, double upperBound, double pRemainPromille)` The approximation from the given parameters boil down to the following problem (latex formulas):
`static WeibullUtil.Parameters` `findParametersForMedian​(double lowerBound, double median, double upperBound, double pRemainPromille)`

### Methods inherited from class Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### computeAverage

    public static double computeAverage​(double shape,
                                        double scale,
                                        double location,
                                        Double upperBound)

See Crénin, François, Truncated Weibull Distribution Functions and Moments (October 30, 2015). Available at SSRN: https://ssrn.com/abstract=2690255 or http://dx.doi.org/10.2139/ssrn.2690255

Parameters:
  `shape` -
  `scale` -
  `location` -
  `upperBound` -
Returns:

#### computeMedian

    public static double computeMedian​(double shape,
                                       double scale,
                                       double location,
                                       Double upperBound)

#### computeMedianWithPRemainPromille

    public static double computeMedianWithPRemainPromille​(double shape,
                                                          double scale,
                                                          double location,
                                                          double pRemainPromille)

#### computePRemainPromille

    public static double computePRemainPromille​(double shape,
                                                double scale,
                                                double location,
                                                double upperBound)

#### computeUpperBound

    public static double computeUpperBound​(double shape,
                                           double scale,
                                           double location,
                                           double pRemainPromille)

#### findParameters

    public static WeibullUtil.Parameters findParameters​(double lowerBound,
                                                        double average,
                                                        double upperBound,
                                                        double pRemainPromille)

This is a simple attempt to get a better parameter estimation for big pRemainPromille values. As an alternative to the regular estimation another estimation based on the median value is calculated. The better result is selected according to the relative error of both requested values. Better solutions are welcome !

Parameters:
  `lowerBound` -
  `average` -
  `upperBound` -
  `pRemainPromille` -
Returns:

#### findParametersForAverage

    public static WeibullUtil.Parameters findParametersForAverage​(double lowerBound,
                                                                  double average,
                                                                  double upperBound,
                                                                  double pRemainPromille)

The approximation from the given parameters boil down to the following problem (latex formulas):

CDF_{weibull}(upperBound) = 1 - pRemainPromille/1000

Using the Weibull CDF (1) and the Expectation Value (average) (2) we can derive a formula for the scale dependent on shape and known values from (2)

(1) CDF_{weibull}(x) = 1 - e^{- (\frac{x}{scale})^{shape}}

(2) avg = scale \cdot \Gamma(1 + \frac{1}{shape})

(3) scale = \frac{avg}{\Gamma(1 + (1 / shape))}

with (1), (3) and pRemain = pRemainPromille/1000 follows

(4) pRemain = e^{-(\frac{upper limit}{E_{avg}} \cdot \Gamma(1 + \frac{1}{shape}))^{shape}}

from this we form a zero finding problem

(5) 0 = e^{-(\frac{upper limit}{E_{avg}}\cdot \Gamma(1 + \frac{1}{shape}))^{shape}} - pRemain

The work "Robust Scheduling of Real-Time Applications on Efficient Embedded Multicore Systems" (https://mediatum.ub.tum.de/download/1063381/1063381.pdf) proposes an algorithm from (4) which is basically the bisection method.

#### findParametersForMedian

    public static WeibullUtil.Parameters findParametersForMedian​(double lowerBound,
                                                                 double median,
                                                                 double upperBound,
                                                                 double pRemainPromille)