Short answer: Least-cost formulation chooses the cheapest combination of several ingredients that still meets every nutrient target and every limit you set. It is the method most commercial mills use, and it should be run again whenever a price or a lot analysis changes. In our worked layer example, with illustrative prices, the caps you set on fishmeal and palm kernel cake do more to shape the mix than the prices do.
Key takeaways
- Least-cost formulation solves for several ingredients at once, against many nutrient targets and limits.
- The limits you enter decide the answer as much as the prices, so write each cap and minimum down with its reason.
- Binding constraints show where the mix is pinned, and they point to the limit worth questioning first.
- Shadow prices show what each extra unit of a limit would cost or save, which helps with buying decisions.
- Build a small margin above each minimum, because real ingredient lots vary and the solver lands exactly on the line.
- Re-run the calculation when a lot analysis changes, not only when a price does.
The cheapest mix on paper often fails a limit nobody wrote down
A common farm mix looks cheap per kilo and still fails. It uses plenty of wheat bran and palm kernel cake because they cost least, a little soya for protein, and maize for the rest. Protein comes out near the target. Energy, methionine and calcium come out short, and nobody notices until the eggs get smaller and the feed bill goes up anyway.
The problem is that the farmer checked one figure at a time, and each cheap ingredient was cheapest only in isolation. Least-cost formulation fixes that. It holds every nutrient target at once and then makes the total cost as small as it can, which is a different job from picking the cheapest ingredient.
If you have only ever balanced two ingredients, start with the Pearson Square, which is the same idea in its simplest form. This article works through a complete example for a layer ration, with nine ingredients, real-looking nutrient values and the answer the solver returns. The prices are illustrative, so the cedi figures are there to show the method rather than to quote a market.
What the limits are, and why you need both kinds
A least-cost run needs two kinds of rule. The first is a set of minimums and maximums for the nutrients the birds need: energy, protein, lysine, methionine, calcium and available phosphorus at the bottom, and fibre usually at the top. The second is a set of caps on each ingredient, because the solver will happily put 40 per cent fishmeal into a mash if you let it.
| Nutrient or limit | Type | Target used in this example |
|---|---|---|
| Metabolisable energy | Minimum | 2,650 kcal/kg |
| Crude protein | Minimum | 16.0% |
| Lysine | Minimum | 0.75% |
| Methionine | Minimum | 0.36% |
| Calcium | Between 3.5% and 4.0% | Layers at point of lay |
| Available phosphorus | Minimum | 0.35% |
| Crude fibre | Maximum | 7.0% |
The targets here are a working set for a layer ration in the tropics, and the basics behind each one are in our feed formulation basics guide. Your breeder guide or nutritionist should give the figures for your strain and stage, and those figures override ours.
Setting up the problem with nine ingredients
The solver needs the nutrient content of every ingredient, the price per kilo and a cap for each one. Here are the nutrient values we used. They are rounded values from common feed tables, and they are the kind of numbers you would enter for a first run before replacing them with your own lot analyses.
| Ingredient | Energy (kcal/kg) | Protein (%) | Lysine (%) | Methionine (%) | Calcium (%) | Available P (%) |
|---|---|---|---|---|---|---|
| Maize | 3,350 | 8.5 | 0.25 | 0.18 | 0.02 | 0.10 |
| Soya 44% | 2,230 | 44 | 2.70 | 0.60 | 0.30 | 0.20 |
| Wheat bran | 1,500 | 15 | 0.55 | 0.20 | 0.10 | 0.30 |
| Fishmeal 60% | 2,900 | 60 | 4.60 | 1.70 | 4.00 | 2.50 |
| Palm kernel cake | 1,700 | 16 | 0.45 | 0.35 | 0.25 | 0.10 |
| Limestone | 0 | 0 | 0 | 0 | 38 | 0 |
| Dicalcium phosphate | 0 | 0 | 0 | 0 | 22.5 | 18.0 |
| DL-methionine 99% | 0 | 0 | 0 | 99 | 0 | 0 |
| L-lysine HCl 78% | 0 | 0 | 78 | 0 | 0 | 0 |
Prices and caps come next. The illustrative prices are GH₵5.50 for maize, 9.50 for soya, 3.00 for bran, 14.00 for fishmeal, 3.50 for palm kernel cake, 0.50 for limestone, 12.00 for dicalcium phosphate, 55.00 for DL-methionine and 40.00 for L-lysine, all per kilo. Caps are kilos per 100 kg of finished feed: maize 70, soya 30, bran 10, fishmeal 5, palm kernel cake 10, limestone 12, phosphate 3, and both synthetic amino acids 0.5. The premix is left out of the sum to keep the example readable.
What the solver returned
With those inputs, the solver finds the lowest-cost mix that meets every minimum and stays within every cap. The answer is below. Read the cost column as the part of the GH₵581.79 per 100 kg that each ingredient accounts for.
| Ingredient | kg per 100 kg | Cost (GH₵) |
|---|---|---|
| Maize | 59.23 | 325.75 |
| Soya 44% | 13.17 | 125.07 |
| Wheat bran | 3.82 | 11.46 |
| Fishmeal 60% | 5.00 | 70.00 |
| Palm kernel cake | 10.00 | 35.00 |
| Limestone | 8.09 | 4.04 |
| Dicalcium phosphate | 0.66 | 7.87 |
| DL-methionine 99% | 0.05 | 2.60 |
| Total | 100.00 | 581.79 |
That is GH₵5.82 per kilo of finished feed on these prices. The mix hits the energy, protein, methionine, phosphorus and calcium minimums on the line, which is where a least-cost answer usually sits. Lysine comes out at 0.80 per cent, above its 0.75 minimum, and fibre at 4.4 per cent, under its 7.0 maximum.
Why the answer sits on the edge of several limits
A constraint that the answer sits exactly on is called binding. Here, energy, protein, methionine, available phosphorus, the calcium minimum and two ingredient caps are binding. Lysine and fibre are not, so they can be ignored when you decide what to change next. If methionine is the one pinning the mix, our note on methionine and lysine in Ghana poultry feed explains how to check it.
The solver also reports a shadow price for each limit, which is what one extra unit of that limit would cost. Those figures answer the question every farmer asks, which is whether a particular limit is worth worrying about.
| Limit | Change | Effect on cost per 100 kg |
|---|---|---|
| Fishmeal cap | Raise from 5 kg to 6 kg | Saves about GH₵2.15 |
| Palm kernel cake cap | Raise from 10 kg to 12 kg | Saves less than GH₵0.10 |
| Methionine | Add 0.01 percentage points | Costs about GH₵0.59 |
| Available phosphorus | Add 0.01 percentage points | Costs about GH₵0.72 |
| Energy | Add 10 kcal/kg | Costs about GH₵2.03 |

Two readings matter on the farm. The fishmeal cap is the one worth negotiating if a cleaner, well-tested lot of fishmeal is available at 6 kg per 100 kg. The palm kernel cake cap barely matters at these prices, so there is no point spending time on it. Once you can see those figures, you know where to put your effort.
Doing the same job in a spreadsheet
You do not need specialist software. A spreadsheet with a solver add-in will do this, and LibreOffice Calc has a Solver that works in the same way. Set up one row of kilos, one cell per ingredient. Use a SUMPRODUCT formula for each nutrient, which multiplies the kilos by the nutrient values and adds them up. Divide the result by 100 so that the units match the targets.
- Set the objective to the total cost, with a SUMPRODUCT of kilos and prices, and choose minimise.
- Add a constraint for the total of all kilos, set equal to 100.
- Add one constraint for each nutrient minimum or maximum, using the divided SUMPRODUCT.
- Add a constraint for each ingredient cap, and set every variable to be non-negative.
- Pick the simplex LP method, which suits a linear problem like this one, and run it.
The units trap is the one to watch. A first run often comes back as infeasible because the nutrient sums have not been divided by 100 before they are compared with the targets. The solver is right to refuse. A result that says the problem cannot be solved is very often a units error, so check the scaling before you change any targets.
When prices move, the recipe may not
Ingredient prices change with the season, the harvest and the exchange rate, so a least-cost run has to be repeated. The useful thing to learn is how much the recipe changes when a price moves. In our example it changes very little, because the caps and the nutrient targets do most of the work.
Raise soya from 9.50 to 12.00 and the cost per kilo rises to about GH₵6.15, but the recipe stays the same. Raise maize from 5.50 to 9.00 and the cost rises to about GH₵7.89, with the same recipe again. Cut fishmeal from 14.00 to 10.00 and the cost falls to about GH₵5.62, with no change to the mix, because the fishmeal cap is already binding.
So a price move on its own is a cost question. A change in the lot analysis is a recipe question. When a new batch of soya or groundnut cake arrives with a different protein or lysine figure, enter those figures and run the calculation again, even if the price has not changed.
The safety margin the solver does not know about
The solver lands exactly on each minimum. Protein sits at 16.0, methionine at 0.36 and phosphorus at 0.35. That is correct on paper, but a real lot of soya can test a little lower than its label, and a real batch can be mixed a little unevenly. A ration that lands exactly on the line has no room for either.
The cost of a margin is easy to see. Raising the methionine minimum to 0.38 adds about GH₵1.17 per 100 kg. Raising crude protein to 16.5 adds about GH₵8.35. Raising energy from 2,650 to 2,700 kcal/kg adds about GH₵10.13. Put margins on methionine (0.38), protein (16.5), available phosphorus (0.38), energy (2,680 kcal/kg) and calcium (3.6) together, and the cost rises to about GH₵600 per 100 kg, or GH₵6.00 per kilo. That is roughly 3 per cent more than the bare minimum.
In our view, three per cent is a fair premium for knowing the birds will get what the formula says, provided the margins are set on purpose and not inflated for comfort. A margin is a decision, and it should be written down with the reason.
Need chicks for your next batch?
Send breed, number and town. We reply with price, hatch date and delivery cost in writing.
Common errors that make least-cost fail
Most failed runs come from the inputs, and the same few errors come up again and again on farms and in small mills.
- Mixing units: percentages entered as fractions, or sums not divided by 100 before comparing with targets.
- Using total phosphorus where the target asks for available phosphorus, which overstates what the birds can use.
- Leaving out premix, salt and other fixed items, so the mix does not add up to the batch you will actually make.
- Running with no caps, so the answer depends on an ingredient you cannot source or do not trust.
- Using a table value for a lot you have never tested, which is the biggest single source of error.
- Forgetting bulk and fibre limits, so the cheapest answer is a mash the birds cannot pack into their crop.
If a result looks strange, go back to the inputs before you trust it. The solver is honest about what you give it, and that is both its strength and its weakness.
Cheapest per kilo is not cheapest per egg
Least-cost formulation minimises the cost of a kilo of feed. Your real cost is the cost per egg or per kilo of live weight, which depends on how much each bird eats and what it produces. A feed that is a little dearer per kilo can cost less per egg if the hens eat less of it and lay more.
That is why the cost in the example should be read as one input among several. Track feed given, egg output and egg size for each batch, and compare the cost per egg rather than the cost per kilo. Our guide to feed cost per egg and per bird in Ghana sets out the sum, and the broiler feed conversion ratio guide covers the same logic for meat birds.
Where least-cost formulation really pays off
We hatch and import chicks, and we do not sell feed. What we see is the other end of the sum. A flock that is set up well from the first day, with the right breed and a feed plan that matches it, is much easier to run to a cost target than one that is fixed after the birds have slipped.
Ask your breeder or nutritionist for the targets before you run any least-cost calculation. The breed guide sets the numbers for energy, protein and minerals, and the solver will only ever be as good as the targets you give it. Start from our layer day-old chicks or broiler day-old chicks pages, which list the lines we supply.
If you want to talk through a ration before you order, message us on WhatsApp at +233 24 915 1503. We cannot formulate your feed for you, but we can point you to the right breed information and the right questions to ask your feed maker. Our breeds section is the place to start, and our frequently asked questions cover the practical side of ordering.
A checklist before you trust a least-cost mix
- Write down every target, with the source, whether it is a minimum, a maximum or a range.
- Enter a nutrient value for each ingredient from a recent analysis, not from a general table.
- Include premix, salt and any amino acid in the sum, so the batch adds up.
- Set a cap on every ingredient you would not want above a certain share, and write the reason beside it.
- Check the units and the divide by 100, then confirm the solver returns a feasible answer.
- Read the binding limits and the shadow prices before you buy.
- Add a margin above each critical minimum, and record its cost.
- Re-run when a lot changes, and compare cost per egg or per kilo of weight, not per kilo of feed.
Questions farmers ask
What is least-cost feed formulation?
It is a method that finds the cheapest combination of several ingredients that still meets every nutrient target and every limit you set. It uses a linear programme or a solver, and it handles many ingredients and nutrients at once, which hand methods cannot do well.
Do I need special software for least-cost formulation?
No. A spreadsheet with a solver add-in can do it, provided the sums are set up correctly and the units match. Many feed mills use dedicated formulation software, but the principle is the same, and the spreadsheet gives you a clear view of each constraint.
Why does the solver put so much of one ingredient in the mix?
Usually because that ingredient is cheap relative to the nutrients it supplies, and its cap has not been reached. If one ingredient dominates, check its cap and its nutrient values first. An ingredient that dominates because a cap is missing is a sign the limits need reviewing.
What does a shadow price tell me?
It tells you how much the total cost would change for one extra unit of a limit. For example, it can show that raising a fishmeal cap by one kilo saves a few cedis per 100 kg. It is a guide for negotiation and buying, not a promise, because the answer can shift if you change more than one limit.
Should the answer sit exactly on the minimums?
Mathematically it will, because that is the cheapest point that meets the target. In practice, a small margin above each critical minimum is wise, since real lots vary. Record the cost of the margin, and decide on it on purpose rather than by accident.
How often should I re-run the calculation?
Re-run it whenever a lot analysis changes, a new ingredient is introduced, or a price moves far enough to matter. Many farms re-run it at the start of each season. A change in the lot is more important than a change in the price, because it can change the recipe as well as the cost.
Can least-cost formulation make a feed that is safe from aflatoxin?
Not by itself. The calculation only sees the limits you enter. Our <a href="/blog/feed-storage-aflatoxin-ghana/">guide to feed storage and aflatoxin</a> covers the testing and storage steps that come first. If a lot of groundnut cake or maize carries aflatoxin, the solver will not know unless you test it and exclude that lot. Testing and storage come first, then the least-cost run uses only the lots you have cleared.
