Skip to main content
Became Hot Network Question
edited tags
Link
RobPratt
  • 34.3k
  • 2
  • 47
  • 90
Source Link
Ralph Asher
  • 783
  • 3
  • 11

Integer Programming Constraints - Min/Max Days Between Deliveries

I'm starting a consulting project for a client who manufacturers perishable food. They want to optimize their delivery schedule to each of their DSD (Direct Store Delivery) customers.

For each store, I have binary decision variables that reflect whether I make a delivery to that store on Sunday, Monday, Tuesday, ... Saturday.

e.g., x1 = binary, 1 if I make a delivery on Sunday, 0 if I don't x2 = binary, 1 if I make a delivery on Monday, 0 if I don't ... x7 = binary, 1 if I make a delivery on Saturday, 0 if I don't

Based upon the store's demand, I may want to deliver 1x weekly, 2x weekly, 3x weekly, or 4x weekly. I can set that delivery frequency up as a constraint on the sum of the binaries, but I am having trouble with ensuring spacing of delivery days to ensure the perishable food doesn't spoil on the store shelf.

For example, if I am delivering 2x per week, having delivery days that are consecutive or only spaced by one day in between - Tuesday and Wednesday, or Saturday and Monday - shouldn't be allowed.

For 2x weekly deliveries, I'd like there to be a 3 day gap and a 4 day gap between delivery days: e.g., Sunday & Wednesday; or Friday & Monday.

For 3x weekly deliveries, I'd like there to be at most a 3 day gap between delivery days (Monday & Thursday = 3 day gap). For 4x delivery days, I'd like there to be at most a 2 day gap between delivery days.

I've figured out an (ugly) way to put this constraint together in a 2x weekly delivery schedule, but no idea how to approach for 3x weekly or 4x weekly. Any help is appreciated.

Also FYI, I haven't actually coded anything at this point, just thinking through how I'd approach the problem with pen & paper.