Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Challenge: Forecast and Replenish | Inventory Management and Demand Forecasting
Python for Supply Chain
Abschnitt 2. Kapitel 5
single

single

bookChallenge: Forecast and Replenish

Swipe um das Menü anzuzeigen

Before you tackle a full challenge, it's important to recap the key concepts you'll need. Moving average forecasting is a simple but powerful technique where you predict future demand by averaging actual demand over a fixed window of previous days. This helps smooth out fluctuations and provides a reasonable short-term forecast. In inventory simulation, you track how stock levels change over time, considering daily demand and replenishment rules. A common approach is to set a reorder point: when inventory drops below this threshold, you replenish up to a desired level. By combining forecasting and inventory simulation, you can better anticipate stockouts and optimize replenishment decisions.

123456789101112
# Example list of daily demand values (30 days) daily_demand = [ 20, 22, 19, 23, 25, 18, 20, 24, 21, 19, 22, 20, 23, 21, 18, 20, 25, 22, 19, 21, 24, 23, 22, 20, 18, 19, 21, 23, 20, 22 ] # Initial inventory parameters initial_stock = 50 replenishment_quantity = 40 window_size = 3 # For moving average forecast # Reorder point will be calculated in the challenge
copy

For this challenge, you will use the provided daily demand list and inventory parameters to build a complete forecasting and inventory management workflow. Start by implementing a moving average forecast using the specified window size. For each day after the initial window, calculate the average of the preceding days to produce the forecasted demand. Next, simulate inventory levels: begin with the initial stock, subtract daily demand, and whenever the inventory falls below the reorder point, replenish by the fixed quantity. The reorder point should be calculated as the average demand over the moving average window, multiplied by the window size. Throughout the 30-day period, keep track of both actual and forecasted demand, inventory levels, and any days when a stockout (inventory dropping below zero) occurs. Finally, visualize the actual and forecasted demand as well as the inventory levels on a line plot, and print a summary listing all days when stockouts happened.

Aufgabe

Swipe to start coding

Implement the moving average forecast, inventory simulation, visualization, and summary for the provided daily demand data.

  • Calculate the moving average forecast for each day after the initial window, using the average of the previous days within the window.
  • Compute the reorder point as the average demand over the moving average window, multiplied by the window size.
  • Simulate inventory levels: subtract daily demand from the current stock, replenish by the fixed quantity whenever inventory falls below the reorder point, and track any days when inventory drops below zero.
  • Visualize actual demand, forecasted demand, and inventory levels on a single line plot.
  • Print a summary that lists all days when stockouts occurred.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 5
single

single

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

some-alt