LPSolve Demo CMR
Hello and welcome to this demonstration of LPSolve optimization software. In this video, we’ll walk through the process of formulating a milk replacer using typical milk replacer ingredients.
There are two ways to build a formulation in LPSolve. You can start from scratch using the ingredient library, or you can begin with one of the example files installed with the software. In this demonstration, we’ll use an example file.
Go to the File menu, click Open, and navigate to the LPSolve folder in your Documents directory. From there, open the CMR example file. I’ve already made several changes to this matrix. I’ve updated ingredient prices, added a few ingredients, and adjusted some of the nutrient specifications. You can see those changes reflected in the matrix shown here.
Columns C0 and C1 contain calculated values for lysine and methionine on a dry matter basis. These are calculated by taking lysine and methionine as a percentage of crude protein from the feed library and multiplying them by the crude protein concentration. This allows us to apply amino acid requirements directly using dry matter-based minimums from the literature.
Next, take a look at the ingredient constraints. I’ve limited both wheat gluten and soy protein concentrate to a maximum of 3%. I’ve also adjusted several nutrient constraints.
When mineral ingredients are relatively inexpensive, the optimizer will often try to use as much of them as possible. To control this, I’ve added maximum constraints for some of the minerals. In this example, calcium and sodium are capped at 1%. I’ve also included maximums for potassium and magnesium. These nutrients are not usually limiting, but inexpensive sources can lead to excess inclusion if they’re not constrained.
With all the constraints in place and adjustments to the matrix, we’re ready to run the formulation. I’ll click the Run button, and we see that LPSolve finds a feasible solution.
Here you can see the total cost of the formula in dollars per metric ton. To the right, in the green column that says percent, you can see the ingredient inclusion rates. In this formulation, dried fat, dried whey, WPC34, and vegetable proteins are the primary drivers. Wheat gluten and soy protein concentrate are included at their maximum levels because they’re relatively low-cost protein sources.
To meet amino acid requirements, supplemental lysine and methionine are included. Phosphorus is exactly at its minimum, while calcium, sodium, potassium, and magnesium are all at their respective maximums. This reflects the low cost of these mineral ingredients relative to the other components of the formula.
We are meeting the minimum requirements for crude protein and fat. These values are expressed on a 100% dry matter basis. A 24-18 tag on a dry matter basis corresponds to approximately 25.3% protein and 18.9% fat at a 95% dry matter basis. In this formulation, dry matter is 95.45%, which is very close to the target.
The total cost of the formula is just over 1,800 US dollars per metric ton. Actual costs will vary depending on the ingredient prices, the region, and market conditions.
Below the nutrient specifications, you see the shadow prices. These values show how much the total cost would change with a 1% change in a minimum or maximum constraints. Shadow prices help identify which constraints are the most limiting and which changes could also reduce the formulation cost.
Now look at the final nutrient composition. Ash is just over 11%. Calcium is at its maximum of 1%. Phosphorus is at its minimum of 0.6%. Sodium, potassium, magnesium are all at their maximums, and lysine and methionine are exactly at their required minimums. Overall, the formulation is nutritionally balanced and internally consistent.
On the right side of the matrix, the lower and upper price columns show the price range over which each ingredient will remain in the formula at its current inclusion rate. For example, dried whey is priced at $1,000 per metric ton. If the price drops below approximately $995, the optimizer will use more dried whey. If the price rises above $1,070, it will use less.
To illustrate this, let’s reduce the price of dried whey to $980 per metric ton and rerun the formulation. You can see that dried whey now increases sharply, approaching 42% of the formula. This demonstrates how sensitive ingredient inclusion can be to price changes. In this case, the lower priced whey also shifts the primary protein source from a lower protein WPC to WPC 80. As prices or nutrient constraints change, all lower and upper price ranges are recalculated automatically.
Well, this concludes this demonstration. For additional examples and deeper explanations, be sure to explore other LPSolve knowledge base videos. Well, thanks for watching.