You are sent to the market by your father with 800 dollars, and told to buy 100 animals. When you arrive at the market, you find out that pigs cost 8 dollars each, so it would be easy to follow your father's instructions.
However, you see that there are only 99 pigs for sale. The only other animals there are chickens for 1 dollar each, and cows for 80 dollars each.
If there are enough chickens and cows for you to buy as many as you wanted, how can you end up buying 100 animals using exactly 800 dollars?
I think that the problem can be solved with the help of Integer programing. The object is to get 100 animals, right? The way I see it, there are two constraints:
1. 8*P + 1*Ch + 80*Cw = 800
(where P stands for the quantity of pigs bought, Ch marks the quantity of chicken bought, and Cw marks the number of cows bought)
The meaning of it: all of the money must be spent
2. P + Ch + Cw = 100
The meaning: The number of animals bought must be 100,
3. P <= 99
and the function to which the constraints apply, which I think should be:
maxZ = P + Ch + Cw
(or minZ, it's all the same in this case).
If the problem were to be done "on foot" (i.e. manually), then whoever is solving it would have to go through 59 iterations (i.e. steps). I've used a little software which does the needed math (and that only after the user sets the problem in the form of constraints and object function), and the solution (a unique solution, I think) is:
Pigs = 21, Chickens = 72, Cows = 8

Posted by Slobodan
on 20040301 07:55:36 