Beispiel #1
0
  private void initLearningMetrics() {
    if (learningMetricsInitialized) {
      return;
    }
    double defaultWeight = SystemDao.getDefaultWeight();
    double lastWeekLift = getDemandUplift(SystemDao.getReviewCycleStartDate());
    Sales beginOfRunCycleSales = getSales(SystemDao.getReviewCycleStartDate());
    double beginOfRunCycleRcAvgSales = 0;
    if (beginOfRunCycleSales != null) {
      beginOfRunCycleRcAvgSales = beginOfRunCycleSales.getRcAvgSales();
    }

    rcAvgSales =
        getWeightedWeight1(learningWeekCounter, defaultWeight) * epSales / lastWeekLift
            + (1 - getWeightedWeight1(learningWeekCounter, defaultWeight))
                * beginOfRunCycleRcAvgSales;

    // Tim's documentation states:
    // Its important sales metrics are initialized to AVG_WEEKLY_SALES based on the initialization
    // logic.
    // This estimates initial values based on different combinations of the PLs product and location
    // hierarchies dependent on the specific situation for that PL
    rcAvgSalesActual = rcAvgSales;
    rcAvgDemand = rcAvgSales;
    rcOldAvgDemand = rcAvgSales;
    rcAvgDemandActual = rcAvgSales;
    epAvgInv = rcAvgSales;
    rcWass2 = Math.pow(rcAvgSales, 2);
    learningMetricsInitialized = true;
  }
Beispiel #2
0
  // Hook: MSSalesOutlierCheckHook.java
  public void performOutlierProcessing(String locId) {
    // only apply constraint if we are not in a seasonal period
    System.out.println(
        "Starting the Outlier/Unreported Sales Calculation for product/location: " + locId);

    int specialPuchaseOrderWassMult = SystemDao.getSpecialPurchaseOrderWassMultiplier();
    int specialPuchaseOrderSizeMult = SystemDao.getSpecialPurchaseOrderSizeMultipler();
    double rcWass2 = Math.pow(rcAvgSales, 2);
    Double maxValue =
        Math.max(
            rcAvgSales + specialPuchaseOrderSizeMult * Math.sqrt(Math.max(0, rcWass2)),
            specialPuchaseOrderWassMult * innerPackQty);
    if (epSalesActual > maxValue && eventSeasonalIndicator == false) {
      epSales = maxValue;
    } else {
      epSales = epSalesActual;
    }
  }