Operations 4 min read

Optimizing Daily Flower Inventory with Poisson Demand: A Python Simulation Approach

This article formulates the daily flower inventory problem as a stochastic decision model with Poisson‑distributed demand, derives the optimal order quantity analytically, and validates it through Python simulations that compute expected profit for varying order levels.

Model Perspective
Model Perspective
Model Perspective
Optimizing Daily Flower Inventory with Poisson Demand: A Python Simulation Approach

Inventory Management Problem

Problem

A vendor purchases fresh flowers at a cost of a yuan per bunch and sells them at b yuan per bunch. Unsold flowers at the end of the day are lost. Daily customer demand follows a Poisson distribution with parameter λ.

The question is: how many bunches should the vendor order each day to maximize expected profit?

Modeling

This is a stochastic decision problem. Let the daily order quantity be u . If the realized demand D is less than or equal to u , profit is (b‑a)·D . If demand exceeds u , profit is (b‑a)·u – a·(D‑u) . The expected daily profit is therefore a function of u and the Poisson distribution of D .

The optimal order quantity u* satisfies the condition that the marginal expected profit of ordering one more bunch becomes non‑positive, which can be expressed using the Poisson cumulative distribution function.

Solution

By consulting a Poisson table or using Python, the optimal order quantity u* can be computed.

Code

<code>from scipy.stats import poisson
a=2; b=3; lamda=10; p=1-a/b
u=poisson.ppf(1-a/b, lamda)  # optimal order quantity
p1=poisson.cdf(u-1, lamda)    # verification values
p2=poisson.cdf(u, lamda)
print(u, p1, p, p2)
</code>

A Monte‑Carlo simulation can further verify the optimal decision. The algorithm iterates over candidate order quantities, generates many Poisson‑distributed demand samples, computes the average profit for each candidate, and selects the order quantity that yields the highest average profit.

<code>import numpy as np
a=2; b=3; lamda=10; M1=0;
u=1; n=10000;
for i in range(1, 2*lamda):
    d = np.random.poisson(lamda, n)  # generate n demand samples
    M2 = np.mean(((b-a)*u*(u<=d) + ((b-a)*d - a*(u-d))*(u> d)))  # average profit
    if M2 > M1:
        M1 = M2
        u = u + 1
    else:
        print('Optimal order quantity:', u-1)
        break
</code>

Reference

司守奎,孙玺菁. Python数学实验与建模 .

simulationPythonoperations researchInventory ManagementPoisson distributionoptimal ordering
Model Perspective
Written by

Model Perspective

Insights, knowledge, and enjoyment from a mathematical modeling researcher and educator. Hosted by Haihua Wang, a modeling instructor and author of "Clever Use of Chat for Mathematical Modeling", "Modeling: The Mathematics of Thinking", "Mathematical Modeling Practice: A Hands‑On Guide to Competitions", and co‑author of "Mathematical Modeling: Teaching Design and Cases".

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.