コード例 #1
0
ファイル: Product.java プロジェクト: seikorti/ActualPrototype
 private Double getWeight1(long age) {
   // Weight that will be used when status_cd = ACTIVE
   if (age <= 0) {
     return SystemDao.getDefaultWeight();
   }
   return Math.max(0.2, 1.0 / age);
 }
コード例 #2
0
ファイル: Product.java プロジェクト: seikorti/ActualPrototype
 public double getWeightedWeight1(long age, double defaultWeight) {
   if (age <= 0) {
     return defaultWeight;
   } else {
     return Math.max(getWeight1(age), defaultWeight * (1.0d / age));
   }
 }
コード例 #3
0
ファイル: Product.java プロジェクト: seikorti/ActualPrototype
  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;
  }
コード例 #4
0
ファイル: Product.java プロジェクト: seikorti/ActualPrototype
  private void processInventory() {
    LocalDate crc = SystemDao.getCrc();
    if (isStockedOut) {
      Demand d = getDemand(SystemDao.getCrc());
      if (crc.getDayOfWeek() == DateTimeConstants.SUNDAY) {
        d = getDemand(SystemDao.getReviewCycleStartDate());
      }
      int targetInv = (int) d.getRcAvgDemand() - inventory;

      setInventory(targetInv > 0 ? targetInv : (int) d.getRcAvgDemand());
      isStockedOut = false;
    }

    if (crc.getDayOfWeek() == DateTimeConstants.SUNDAY) {
      rcBopInv = inventory;
    }
    // daily inventory updates
    updateEpEopInv();
    epEopInv = inventory;
    rcInvOut += epInvOut;
    rcInvIn += epInvIn;
    ProductInventory p = getInventory(SystemDao.getReviewCycleStartDate());
    double beginOfPeriodEpAvgInv = 0;
    if (p != null) {
      beginOfPeriodEpAvgInv = p.getEpAvgInv();
    }
    double weight_5 = SystemDao.getWeight_5();
    epAvgInv =
        weight_5 * ((epEopInv >= 0) ? epEopInv : 0) + (((1 - weight_5) * beginOfPeriodEpAvgInv));
    epAvgInv = Math.max(0, epAvgInv);
  }
コード例 #5
0
ファイル: Product.java プロジェクト: seikorti/ActualPrototype
  // 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;
    }
  }
コード例 #6
0
ファイル: Product.java プロジェクト: seikorti/ActualPrototype
 private double getLostSales() {
   // lostSales = max(0, average sales - actual sales)
   return Math.max(0, rcAvgDemand / 7 - epSalesActual);
 }