8

Hospitals are changing the way they sterilize their equipment. Previously the local surgeons kept all their own equipment and made their own surgery trays. Now they have to confine to a country wide standard. They want to know how many of the new trays they can make from their existing stock, and how much new equipment they need to buy.

The inventory of medical equipment looks like this:

http://pastebin.com/rstWSurU

each hospitals has codes for various medical equipment and then a number for how many they have of the corresponding item

3 surgery trays with their corresponding items are show in this dictionary.

http://pastebin.com/bUAZhanK

There are a total of 144 different operation trays

the hospitals will be told they need 25 of tray x, 30 of tray y, etc...

They would like to maximize the amounts of trays they can finish with their current stock. They would also like to know what equipment they need to purchase in order to finish the remaining trays.

I have thought about two possible solutions one being representing the problem as a linear programming problem. The other solving the problem by doing a round-robin brute force solve of the first 90% of the problem and solving the remaining 10% by doing a randomized algorithm several times and then pick the best solve of those tries.

I would love to hear if anyone knows a smart way of how to tackle this problem!

NicolaiF
  • 1,283
  • 1
  • 20
  • 44
  • Cool task. Where did you find it? Have you done something already? [mcve]? – xenteros Aug 19 '16 at 08:00
  • Please provide a small example for a problem instance. What exactly is to be optimized? Is the goal to minimize the numer of items which have to be bought? – Codor Aug 19 '16 at 08:05
  • What is the question though? What is the input? What is the expected output? – amit Aug 19 '16 at 08:27
  • Sorry if it was not clear enough! The goal is to finalize as many trays as possible so they can use them on the hospitals. If the amount of trays needed exceeds the amount of equipment available, the amount of equipment needed to finish them should be returned, so it can be bought. – NicolaiF Aug 19 '16 at 08:38
  • 1
    I don't see any OR conditions. You just put everything needed, and see what's missing surplus. Why doesn't it work? – amit Aug 19 '16 at 08:40
  • Doing that would indeed minimize the items needed, but it would not maximize the number of trays created – NicolaiF Aug 19 '16 at 09:33
  • If you are maximizing the number of trays before purchasing needed items, from a practical ethical standpoint, you might also want to prioritize surgeries by urgency. – גלעד ברקן Aug 19 '16 at 09:59
  • As of now they do not have any weight or prioritization of any of the surgery trays – NicolaiF Aug 19 '16 at 10:08
  • I have not implemented a solution yet, I am still trying to figure out what the smartest way to tackle the problem is. I have taken the necessary data from the corresponding databases and placed them in Dictionaries, and updated the original question. – NicolaiF Aug 19 '16 at 10:19
  • Let the maximum possible number of trays that could be completed with the existing equipment be T. Are you trying to find, among all solutions that complete T trays, a solution which minimises the cost of the remaining equipment that needs to be bought to have enough trays of each type? (I.e. you have no priorities on trays, but various known costs for the equipment?) – j_random_hacker Aug 19 '16 at 11:18
  • Also can the hospitals trade items? Or does the first JSON file describe 37 independent problems to be solved? – j_random_hacker Aug 19 '16 at 11:22
  • And in line with @amit's comment, I'm inclined to think that whoever gave you the objective to maximise the number of completed trays is a bit confused... Since in the end, regardless of how you assign existing equipment to trays, the *exact same amount of each kind of equipment* needs to be bought to complete *all* the necessary trays. (This answers my own question from my first comment, BTW.) – j_random_hacker Aug 19 '16 at 11:34
  • @j_random_hacker As of now the customer is a bit confused on what they want. But from what I can gather they would prefer to have (as you stated it) "A solution which minimizes the cost of the remaining equipment that needs to be bought to have enough trays of each type" no trays have any priority as of now. The hospitals should each be considered separate entities. – NicolaiF Aug 19 '16 at 12:11
  • Well, in that case it's very simple: Just do as amit suggested, since you'll need to buy exactly the same amount of each kind of equipment regardless! Of course, that's no longer a fun problem to solve ;-) – j_random_hacker Aug 19 '16 at 12:24
  • ah, let me rephrase it! They need a solution which minimizes the cost of the remaining equipment AND maximizes the amount of trays completed. Since the hospitals will be required to have a certain amount of surgery trays available, they would like to finish as many of them as possible. So they can still continue operating while waiting for new equipment to arrive. – NicolaiF Aug 19 '16 at 12:28
  • OK, that makes sense. Thanks. – j_random_hacker Aug 19 '16 at 20:19
  • How important are the upper bounds on trays ("they need 25 of tray x, 30 of tray y, etc.")? Should we assume that if 27 of tray x are produced, this only counts as 25, i.e. the extra 2 trays are "waste"? I ask because handling these upper bounds somewhat complicates and weakens some dominance rules I've come up with. – j_random_hacker Aug 19 '16 at 22:24
  • If they can make more trays than they need, they would not make the trays. Then they would ship the surplus equipment to a hospital who can not make all trays – NicolaiF Aug 19 '16 at 22:34

1 Answers1

2

If I understand this correctly we can optimize for each hospital separately. My guess is that the following would be a good start for an MIP (Mixed Integer Programming) model:

enter image description here

I use the following indices: i is items and t is trays. x(t,i) indicates how many items we assign to each tray type. y(t) counts the number of trays of each type that we can compose using the available items. From the solution we can calculate the shortages that we need to order.

Of course we are just maximizing the number of trays we can make. There is no consideration of balancing (many trays of one type and few or zero of another). I mitigate a little bit by not allowing to create more trays than required (if we have more items they need to go to other types of trays). This requirement is formulated as an upper bound on y(t).

For large problems we can restrict the (t,i) combinations to the ones that are possible. This will make the model smaller. When using precise math notation:

enter image description here

A further optimization would be to substitute out the variables x(t,i).

Adding shipping surplus items to other hospitals would make the model more difficult. In that case we could end up with a model that needs to look at all hospitals simultaneously. May be an interesting case for some decomposition approach.

Erwin Kalvelagen
  • 15,677
  • 2
  • 14
  • 39
  • Had to read up on ILP problems and the MILP variant, this definitely seems like a feasible solution. Do you have any tips for implementation? Right now I am contemplating either R or Python. – NicolaiF Aug 22 '16 at 08:10
  • 1
    I am most productive in high level modeling languages such as GAMS and AMPL. But R and Python are often used to implement optimization models. As the single hospital model is not very complicated, R and Python should work fine. If using Python, you may want to consider using a tool like Pulp or Pyomo (alternatively you can also code the model directly in Python against a solver API). – Erwin Kalvelagen Aug 22 '16 at 09:51