Feed Formulation Engine
Methodology
A linear program is only as honest as its constraints and data. This page records the model, the solver and the checks applied before a result is presented.
Mathematical model
Minimize Z = Σ cᵢxᵢ subject to Σxᵢ = 1, Lⱼ ≤ Σ aⱼᵢxᵢ ≤ Uⱼ, and minᵢ ≤ xᵢ ≤ maxᵢ, xᵢ ≥ 0. xᵢ is the as-fed fraction of ingredient i; cᵢ is price per kg; aⱼᵢ is nutrient j per kg of ingredient i.
Fixed inclusions set xᵢ lower = upper. Stock limits cap the upper bound at stock/batch. The objective is cost per kg; batch cost is the objective multiplied by batch mass.
Solver
HiGHS 1.16 is compiled to WebAssembly (MIT licence) and runs client-side in a Web Worker. The adapter uses CPLEX LP text, simplex, presolve and a 10 s time limit. No server or feed data upload is involved.
Solver status is mapped explicitly: optimal, feasible, infeasible, unbounded, time limit, numerical error, invalid model or unavailable. Infeasible is never displayed as a ration.
Independent verification
The final composition is recomputed from ingredient data. Mass balance, every hard nutrient bound, inclusion bounds, cost and finiteness are checked with a documented tolerance of 1e-6. If verification fails, the result is returned as a numerical error and composition is withheld.
Infeasibility and sensitivity
When infeasible, the engine re-solves with one nutrient constraint removed at a time and reports constraints that explain the conflict. This is diagnostic, not a relaxed recommendation. Sensitivity re-solves price scenarios; shadow prices are shown only when the solver returns finite duals and are local values, not safety advice.
Limits
The model is linear. It does not represent nutrient interactions, digestibility kinetics, anti-nutritional factors, feed processing, mycotoxins, animal health, welfare limits or market constraints that are not entered. Reference ingredient and requirement values are secondary transcriptions and require laboratory and professional review.