@@ -0,0 +1,1137 @@
+package com.airbnb.aerosolve.core.util;%0A%0Aimport lombok.experimental.Builder;%0Aimport lombok.extern.slf4j.Slf4j;%0A%0A/*%0A  weibull(x) = exp(a*(x)%5Ek + b)%0A  default max x is Double.MAX_VALUE%0A */%0A@Slf4j @Builder public class Weibull %7B%0A  final private double k, a, b, maxX;%0A%0A  public WeibullBuilder defaultBuilder() %7B%0A    return Weibull.builder().maxX(Double.MAX_VALUE);%0A  %7D%0A%0A  public double getWeibull(double x) %7B%0A    return Math.exp(a * Math.pow(x, k) + b);%0A  %7D%0A%0A  /*%0A     weibull(x) = exp(a*(x)%5Ek + b)%0A     given value of weibull(x), return x%0A   */%0A  public double getXWithOutput(double output) %7B%0A    // Below are the logic to compute the x:%0A    //    val t = (Math.log(p) - b) / a%0A    //    if (t %3E 0) ratio = math.min(math.pow(t, 1.0 / k), 2)%0A    //    else x = 0.0%0A    if (Math.abs(a) %3C 1e-10) %7B%0A      if (b %3E Math.log(output)) %7B%0A        return maxX;%0A      %7D else %7B%0A        return 0.0;%0A      %7D%0A    %7D%0A%0A    // a is not too small.%0A    double t = (Math.log(output) - b) / a;%0A    log.debug(%22k = %7B%7D, a = %7B%7D, b = %7B%7D, t = %7B%7D%22, k, a, b, t);%0A    if (t %3E 0) %7B%0A      return Math.min(Math.pow(t, 1.0/k), maxX);%0A    %7D else %7B%0A      return 0.0;%0A    %7D%0A  %7D%0A%7D%0A

add weibull to util