Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How can I minimize this?

  1. May 12, 2009 #1
    There is a drug that comes in two size. 1 is 300mg and cost 400 and 1 is 500mg and cost 600. Given a total dose needed, how many of each vile type do I need to minimize the cost.

    Ex) I need a 1100mg dose, how many 300mg viles and how many 500 viles do I need to minimize the cost. I know the answer from looking at it is 2-300mg and 1-500mg.

    So if x = # of 300mg viles and y = # of 500mg viles we have :

    Total Cost = 400 * x + 600 * y; I also have the constraint that ( for this paticular example) 300x + 500y >= 1100mg.

    I feel like this should be easy but my mind is not working.

    Thanks

    -Marc
     
  2. jcsd
  3. May 13, 2009 #2

    HallsofIvy

    User Avatar
    Staff Emeritus
    Science Advisor

    Better to write 300x+ 500y= 1100. Then if x and y are not integers, choose the next larger integer.

    Solve 300x+ 500y= 1100 for y, say, as a function of x. Replace y in the cost equation by that. That will result in a quadratic function of x which you can minimize by completeing the square.
     
  4. May 13, 2009 #3
    In some cases (but not in this one), the conversion from discrete to continuous isn't so forgiving. If this were one such case, you might do better to just write a program to check all possibilities and keep the largest. i.e.

    Code (Text):

    for every point (x,y) in the domain
       do see if this yields the best solution so far
          if so, save this.
    the optimum is the best solution so far.
     
    For the record, you should usually use HallsOfIvy's method, except for trick problems designed to mess with your head.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: How can I minimize this?
  1. How can I linearize ? (Replies: 21)

Loading...