# How to solve the following linear programming problem using Gurobi (or at least python)?

For an optional ungraded assignment (see it as a complex problem that won't be graded, more to test our skills and knowledge) I was given the following problem. It is not as straightforward as all the other examples we covered and I would really like to know how to solve the problem.

A hotel is estimating that in the next 7 days they will need to have available the following number of sheets:

Day 1 2 3 4 5 6 7
Sheet demand 20 15 30 40 45 45 15

Starting day 1 they have 0 sheets. They need to buy sheets at $20 per set and they can wash to reuse. There are 2 types of laundry services:$6 requiring 2 days (sheets can be used on day 1 and then again on day 3)

$3 requiring 3 days (sheets can be used on day 1 and then again on day 4) The question: How can I formulate the linear programming model to determine the optimal laundry and purchasing policy? And how can I run this using Gurobi (Python)? All I know up to now is that I need to minimize costs of buying, cheap and luxury laundry. Lets say buy = b_i and ranges from 1-7, luxury = x_i and ranges from 1-5 and cheap = y_ij and ranges from (1.4, 1.5, 1.6, 1.7 , 2.5, 2.6, 2.7, 3.6, 3.7 and 4.7), other than that I do not know how to go further. • Welcome to OR.SE! To get an answer, it's best to show your work and ask specific questions about where you're stuck. – EhsanK Commented Nov 16, 2021 at 14:44 • That's just it. I am not much farther than this. I guess I do know that I need to minimize costs of buying, cheap and luxury laundry. Lets say buy = b_i and ranges from 1-7, luxury = x_i and ranges from 1-5 and cheap = y_ij and ranges from (1.4, 1.5, 1.6, 1.7 , 2.5, 2.6, 2.7, 3.6, 3.7 and 4.7). other than that I do not know. – user7537 Commented Nov 16, 2021 at 14:53 • @Simba63, it sounds like a varients of the lot-sizing problem. Do you see/try that? Commented Nov 16, 2021 at 14:58 • @A.Omidi I have not heard of it yet and will gladly take a look. An initial google search brings up a paper by Tempelmeijer & Hilger. Is that what you mean? – user7537 Commented Nov 16, 2021 at 15:01 • @Simna63, I thik you would need to define the variable clearly such that you can develop an initial mathematical model. For example, define the positive variable$x_i$to represent the number of luxury and, etc. What you mean by defining the index$i$and$j\$? Commented Nov 16, 2021 at 15:13

• B) Don't make the "sheets to buy" a genuine optimization variable. Simply buy the number of missing sheets every day. Let's call that a shadow variable sheetsToBuy.
• C) For each day, add a shadow variable availableSheets to calculate the number of sheets available to use that day, before buying extra. So if requiredSheets > availableSheets, then sheetsToBuy = requiredSheets - availableSheets. Calculation for availableSheets = previousday.availableSheets - (previousday.requiredSheets - previousDay.sheetsToBuy) + day.sheetsReturningFromLaundry.
• D) That sheetsReturningFromLaundry is calculated based on the optimization variables from A). Basically the number of expensive laundry decisions 2 days ago plus the number of cheap laundry decisions 3 days ago.