J. E. Beasley: Solution
J. E. Beasley: Solution
J. E. Beasley
http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html
Blending problem
Consider the example of a manufacturer of animal feed who is producing feed
mix for dairy cattle. In our simple example the feed mix contains two active
ingredients and a filler to provide bulk. One kg of feed mix must contain a minimum
quantity of each of four nutrients as below:
Nutrient A B C D
gram 90 50 20 2
The ingredients have the following nutrient values and cost
A B C D Cost/kg
Ingredient 1 (gram/kg) 100 80 40 10 40
Ingredient 2 (gram/kg) 200 150 20 - 60
What should be the amounts of active ingredients and filler in one kg of feed mix?
Solution
Variables
In order to solve this problem it is best to think in terms of 1 kg of feed mix. That
kilogram is made up of three parts; ingredient 1, ingredient 2 and filler. So: let
x1 = amount (kg) of ingredient 1 in 1 kg of feed mix
x2 = amount (kg) of ingredient 2 in 1 kg of feed mix
x3 = amount (kg) of filler in 1 kg of feed mix
where x1, x2, x3 >= 0.
Constraints
• balancing constraint (implicit constraint due to the definition of the variables)
x1 + x2 + x3 = 1
• nutrient constraints
100x1 + 200x2 >= 90 (nutrient A)
80x1 + 150x2 >= 50 (nutrient B)
40x1 + 20x2 >= 20 (nutrient C)
10x1 >= 2 (nutrient D)
Beasley — Integer Programming [:4] 2
Solution
To cope with the condition that if x2>=0 we have a fixed cost of 15 incurred
we have the standard trick of introducing a zero-one variable y defined by
y = 1 if x2>=0
= 0 otherwise
and
• add a term +15y to the objective function
and add the additional constraint
Beasley — Integer Programming [:4] 3
In Lindo:
! Beasley "Animal feed"
! http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html
! Beasley "Animal feed"
! http://people.brunel.ac.uk/~mastjjb/jeb/or/moreip.html
! "Integer Programming" X=0.9 0 0.1 0 1 1 1 0, z*=36
min 40x1 + 60x2 + 0x3 + 15y
st
x1 + x2 + x3 = 1
100 x1 +200 x2 - 90 z1 > 0
80 x1 +150 x2 - 50 z2 > 0
40 x1 + 20 x2 - 20 z3 > 0
10 x2 - 2 z4 > 0
x2 - y < 0
z1 + z2 + z3 + z4 > 3
end
int y
int z1
int z2
int z3
int z4