Dear Data Science community,

I have the following problem to solve and I'd like to learn which algorithm or approach I can use to tackle it. I don't expect a full solution here but I really want to understand what type of optimization problem I am looking at and expecting to get some pointers. FYI, I'm using Python, in case you'd like to suggest a certain library.

Problem domain is parcel lockers.


Calculate the top 5 optimal parcel locker cabinet configurations to accommodate most of the parcel deliveries throughout the year.


  • Assume that I start with the data for daily ecommerce parcel deliveries to parcel lockers for last year. I know how many parcels of which size are delivered to parcel lockers stations for day n (n is 1 to 365) in a certain region. Let's say I don't know the exact parcel locker station locations but I know each customer's rough home coordinates. So data looks like => array of (day of year, parcel size, customer location)
    • All data is per single parcel, no complicated scenarios.
  • Now, I want to create my own optimal parcel locker network to accommodate those deliveries. Let's say I calculated optimal locations for the parcel locker stations. Now my data looks like this: array of (day of year, parcel size, parcel locker station location) => customer location is now translated to closest parcel locker station location.
  • Imagine I'm limited to 3 sizes of lockers and smaller ones can fit in the larger ones.
    • size 1 fits in size 2 and size 3
    • size 2 fits in size 3
  • Given those 3 locker sizes I now know which of my parcels fits to which locker size => now my data is: array of (day of year, min locker size, parcel locker station location) - now aggregating this data per location tells me how many of which locker size (at minimum) I need at each certain parcel locker station.
  • Parcel locker stations are made of locker cabinets which accommodate a certain locker configuration. A fictional locker cabinet configuration would look like: [2 * (size 1), 3 * (size 2), 0 (size 3)] or [1 * (size 1), 2 * (size 2), 1 * (size 3)] etc, etc.

The problem I want to solve starts here

  • Given that:
    • I can place any number of locker cabinets in a parcel locker station;
    • Each locker cabinet can be maximum 2 meters in height and;
    • Each locker cabinet is a single column of lockers (given that all 3 locker sizes have the same width);
    • For cost purposes I'm limited to producing 5 types of locker cabinet configurations.
  • How can I calculate the top best 5 locker cabinet configurations from this data? - Best means:
    • Throughout the year I'll use the minimum amount of locker cabinets;
    • I will also minimize the amount of unhappy customers on peak periods (Christmas, black Friday etc...)
  • To simplify, I'm not allowed to add additional lockers on peak days.

1 Answer 1


That problem could be framed as a bin packing problem, where items of different sizes must be packed into a finite number of bins.

There are many Python libraries to solve bin packing. Two common packages are binpacking (more specific) and pywraplp (more general).

  • $\begingroup$ thanks for your response - I think bin packing applies when you already know the sizes of the bins and/or containers (or in this case cabinets). I'm actually trying to figure out the best cabinet configurations - so, it is a different approach. Do you mean I should try all possible cabinet configurations and run bin packing and see which ones are best? I want to run it over 10M parcels, I can try but I assume it would be computationally extremely expensive. $\endgroup$
    – erichste
    Commented Oct 17, 2022 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.