1. Introduction
The agri-food sector—especially the milk production industry—plays an important role in the global food security chain and economic development. Feed costs are a significant component of milk production expenses, accounting for 50% or more of the total cost [
1], and they depend on the efficiency of feed utilization, the type and quality of feed ingredients used, and the overall management practices employed on a farm. Therefore, optimizing feed costs is critically important in dairy farming to achieve financial stability, competitiveness, and sustainability in the long term [
2]. The sustainability of dairy farming is becoming increasingly important due to its significant environmental impact, particularly regarding feed production and waste management. Optimizing dairy rations not only improves economic efficiency but also plays an important role in reducing the environmental footprint of dairy farming [
3]. On the other hand, each dairy cow has specific requirements for nutrients, which can vary depending on multiple factors, such as age, lactation stage, body weight, and health status. This requires the customization of rations for each cow to ensure their health, well-being, and maximum milk production. Balancing a dairy ration to meet cost, nutritional, and environmental requirements is a demanding task for dairy farmers due to its intrinsic mathematical complexity.
The problem of ration optimization has been the subject of numerous studies for several decades, and different mathematical techniques and computational tools have been used [
4,
5]. Researchers have developed mathematical models for dairy ration optimization based on linear programming [
6,
7,
8,
9], nonlinear programming [
10], goal programming [
11], combinations of linear and weighted goal programming [
2], multi-objective optimization [
12], genetic algorithms [
13,
14], and evolutionary algorithms [
15,
16]. Among the mentioned techniques, linear programming is still the most widely used [
5], even though it is the oldest one and it has several drawbacks and limitations when it comes to reaching a feasible solution with a set of rigid linear constraints or when using nonlinear constraints [
4,
5]. Another limiting factor of linear programming is that it can only operate on solving single-objective problems at a time, such as finding a least-cost ration or maximizing milk yield, under linear constraints. When trying to reach multiple objectives simultaneously, other methods should be used. However, many problems in dairy farming, and in agriculture in general, can be treated as single-objective problems represented with linear objective functions and linear constraints, allowing linear programming to be effectively applied to solve these problems. Multiple applications of linear programming in dairy farming and other fields of agriculture can be found in recent papers [
5,
6,
17,
18,
19].
Dairy farmers face many challenges in optimizing feed costs, including fluctuating feed prices, limited availability and variability of feed ingredients, the complexity of formulating balanced rations that meet nutritional requirements while minimizing costs, ensuring consistent feed quality and proper storage to prevent nutrient degradation, implementing efficient feed management practices, and accessing technology and expertise for effective feed optimization. Addressing these challenges requires a holistic approach that encompasses feed procurement, formulation, storage, and handling, as well as collaboration with agricultural experts to develop strategies for optimizing feed costs and improving the sustainability of dairy farming operations. Solutions and strategies for addressing these challenges often involve a combination of management practices, technological tools, and nutritional strategies tailored to the specific needs and conditions of the farm.
One of the technological solutions that can help dairy farmers in the optimization of feed costs is feed formulation software. Utilizing such software can help dairy farmers formulate balanced rations that meet the nutritional requirements of their cattle while minimizing costs. These software programs allow farmers to input information about available feed ingredients, the nutritional needs of cattle, and cost constraints, and they generate optimized ration formulations. Feed formulation software has been developed from the early days of computers, but it has become more accessible with the proliferation of personal computers [
5,
20]. Today, this kind of software is available in different forms and with different levels of features and complexity depending on the context of use and the device being used.
The most comprehensive software is usually available as commercial desktop applications. Many applications of this type are available on the market, but some of the more recognized ones are CNCPS (version 7), CPM Dairy (version 3.0), DairyComp (version 24.4), DairyLive (version 5), and Spartan Dairy (version 3). CNCPS software is based on the Cornell Net Carbohydrate and Protein System (CNCPS) nutritional model for dairy and beef cattle developed by Cornell University. This nutritional model is also used by many other commercial desktop feed formulation software programs, such as AMTS.Farm.Cattle (version 4), NDS PRO (version 4), CN.Dalex (version 3), and DinaMilk (version 1). The common feature of this type of software is that they offer the most powerful features, but are rather complex and primarily intended for use by nutritionists and advisors.
Another type of commercial feed formulation software is web- and cloud-based software. Some of them are available as standalone applications for feed formulation, such as AFOS and MmmooOgle Ration, while others are part of wider farm management systems, such as Dairy Ration Builder from MilkingCloud and ALIPLAN from ADM. An advantage of this type of software is more flexible access for users in terms of location and device used, as well as simplified maintenance and updates compared to desktop software. Like desktop solutions, this type of feed formulation software is very powerful and comprehensive, but mostly intended for use by nutrition specialists.
Although there is a variety of commercially available feed formulation software on the market, there is little evidence in the literature about the nutritional models and optimization methods they use, which is understandable considering their commercial nature. On the other hand, there are many examples of the development of customized smaller-scale solutions of different types. These solutions are sometimes created to supplement standard feed formulation software, like the set of dairy management tools developed at the University of Wisconsin-Madison [
21], or to be used as simpler and more accessible standalone tools that might help dairy farmers lacking the support of nutritionists and agricultural advisors. In the latter case, the tools are developed as Microsoft Excel spreadsheets using the Solver add-in [
22], Microsoft Excel applications using VBA (Visual Basic for Applications) [
23,
24], as standalone desktop applications using Visual Basic .NET [
25], and as applications for mobile devices [
26,
27,
28]. Most applications of this type use linear programming for optimizing dairy rations.
In any case, using feed formulation software imposes additional challenges for dairy farmers, including the complexity of the software and the technical knowledge required for effective use. Gathering accurate data inputs, particularly regarding feed ingredient composition, prices, and the nutritional requirements of cattle, can be difficult and time-consuming. Dairy farmers must also consider the variability of feed ingredients, which can impact the accuracy of ration formulations. The expense of acquiring and maintaining software, as well as integrating with existing farm management systems, further complicates the adoption of feed formulation software. The adoption of technology in agriculture is often slower than expected due to multiple factors, such as socio-economic, technological, financial, and informational challenges [
29]. This is also true for feed formulation software and other types of agricultural decision-support systems. Although many solutions are developed and available, they might have low practical value for farmers due to the so-called “implementation problem”. This problem is reflected in underutilization because of the technical limitations of systems or farmers’ attitudes towards them [
30]. This is why the evaluation of usage and adoption of new technology is important: to identify potential problems and introduce appropriate measures to address them.
Smallholder farmers may face even more barriers in utilizing feed formulation software, including limited financial resources, technical knowledge, availability in the local language, and access to data. Gathering accurate data inputs and covering software costs can be particularly difficult for smallholder farmers, and they may lack access to training and technical support. Additionally, the scale of their operations may not justify the investment in software. Overcoming these barriers requires targeted interventions to provide financial assistance, training programs, and access to support services, ensuring that smallholder farmers can effectively utilize feed formulation software to optimize feed costs and improve herd nutrition. Some of the efforts in this direction include the development of simple tools that provide smallholder farmers with accessible and user-friendly solutions for optimizing feed costs [
23,
31]. These tools often offer basic functionality for inputting data, generating ration formulations, and monitoring feed usage, making them suitable for farmers with limited technical expertise or access to technology. Some of the limiting factors for the wider use of these tools are their availability in only one language and the requirement of knowing the nutritional needs of cattle and the nutritional composition of feeds.
In some countries, like Bosnia and Herzegovina and many other developing countries, agricultural extension services are not well developed and accessible to all farmers, especially smallholder farmers. These farmers could benefit from using feed formulation software. However, the availability of commercial feed formulation software to smallholder farmers is limited for many reasons, such as the software type, complexity, ease of learning and use, and cost. Many farmers do not have or use personal computers, so desktop applications are not practical. Commercial feed formulation software is usually intended for use by nutritionists and agricultural advisors, making it too complicated and expensive for smallholder farmers. Some free feed formulation solutions are available, but language barriers and the lack of locally relevant data on feeds and their nutritional composition are limiting factors for their usage.
To address the challenges of ration optimization faced by dairy farmers in Bosnia and Herzegovina, a web-based tool called OPTIMILK, with a simple and user-friendly interface in the local language, was developed for a dairy farmers’ association. The association has more than 400 members, mostly small family farms. The tool uses the Simplex method of linear programming to find least-cost rations. The tool enables farmers to efficiently find an optimal ration considering the nutritional needs of dairy cows, feed availability and costs, and the nutritional composition of feed. Apart from optimizing dairy rations for cost efficiency, it supports sustainable dairy farming by manipulating the structure of a ration to reduce its environmental impact. Since collecting data on the nutritional composition of standard feeds was identified as one of the major issues with the adoption of this type of software, a database of locally used feeds with standard nutritional compositions and a feature for the calculation of nutritional requirements of dairy cows were incorporated into the tool. The tool also contains a database of agricultural experts with their contact information and availability status for providing support to farmers.
In this study, the OPTIMILK tool and the application of the Simplex method of linear programming in the formulation of optimal rations for dairy cows are presented. The development of the tool included the creation of a module for calculating nutritional requirements of cows according to locally used nutritional standards, the creation of a new linear programming model for dairy ration optimization that incorporates additional constraints for reaching feasible solution while meeting nutritional and environmental requirements, the design of a user-friendly and accessible interface for data entry and setting up additional constraints, the implementation of model-solving capabilities within the tool, and the implementation of a set of other useful features for manipulating the optimal rations and planning the usage of feeds. After almost four years of operation, the usage of the tool was evaluated by analyzing the data collected within the tool to assess its adoption among local farmers. The results show that after a slow start, there were signs of significant use, which implies the gradual adoption of the tool in dairy farming practices.
Although there are many tools with similar features on the market, most of them, especially commercial ones, are inaccessible to local farmers for many reasons, including type, complexity, cost, and language. Additionally, the literature lacks evidence of the development and usage of free web-based ration optimization solutions customized to the needs of local farmers, especially smallholders. Incorporating features to manipulate the structure of a ration to meet environmental requirements is also an innovative aspect compared to similar non-commercial tools. Therefore, this study contributes to the feed formulation software literature by filling the gap in the development and usage of web-based ration optimization tools customized to local needs. This kind of tool could also be applied in similar contexts to improve their accessibility and adoption, especially for smallholder farmers.
2. Materials and Methods
2.1. Methodological Approach
The development of a software tool for dairy ration optimization involved a systematic approach, starting with an assessment of needs to identify user requirements and challenges, followed by a literature review to gather nutritional data and analyze existing tools. The next step was to select an appropriate optimization method, such as the Simplex method, and develop mathematical models for nutritional requirements and ration formulation. The software design phase included creating an intuitive user interface and robust system architecture, followed by programming and implementation. The testing and validation phase ensured the accuracy of the tool, while user training and video tutorials created conditions for its adoption in farming practice.
2.2. Data Sources and Selection of Nutritional Parameters
Considering the group of target users, the majority of which were small family farms, domestic standards were used in the process of defining the nutritional requirements of dairy cows. The reason for adopting this approach was that most farms in Bosnia and Herzegovina are small farms with cultivation and nutrition technology that does not follow the latest global trends. For the tool to be accepted by such users, it was necessary to adopt domestic standards and terminology. The main source of information for the definition and calculation of the nutritional requirements of dairy cows was the publication in [
32], which contains a detailed description of domestic and international standards for ruminant nutrition and examples of their applications in farming practices. The publication also contains a database of more than 400 feeds with standard nutritional compositions, which was used as a basis for creating a feed database in the OPTIMILK tool.
For the calculation of the daily nutritional needs of dairy cows, a set of parameters of cows was selected, including body weight, milk yield, milk fat, month of pregnancy, lactation stage, and daily gain in weight. Based on these parameters, an appropriate set of nutritional requirements was selected as input for the optimization method. The nutritional requirements included energy requirements expressed in net energy for lactation (NEL), protein requirements expressed in rumen degradable protein (RDP), and calcium (Ca), phosphorus (P), and dry matter (DM) requirements. To calculate the total values of the mentioned nutritional components of a dairy ration, it is necessary to know the nutritional composition of each feed used in a ration. Therefore, each feed added to the OPTIMILK feed database had its nutritional composition defined using the same parameters (NEL, RDP, Ca, P, DM) selected for the definition of the nutritional requirements of dairy cows.
2.3. Linear Programming
Linear programming is used to solve problems that involve finding an optimal solution to linear functions while satisfying a set of linear constraints. The optimal solution can be searched for as a minimum or maximum of a given linear function. The mathematical formulation of linear programming models is usually expressed in matrix form, as shown in Expression (1).
In this example, it is necessary to find the minimum of the linear function while satisfying the given constraints, which are formulated as inequalities. Constraints in a linear programming model can be expressed as inequalities of different types, equalities, and a mix of both. Matrixes C, A, and B in this example are constant vectors/matrixes, while x represents a vector of variables that need to be calculated to reach an optimal solution. The function to be optimized is called an objective function. In linear programming problems, an objective can be to minimize or maximize the objective function, depending on the nature of the problem being solved. In our case, the objective is to minimize the cost of dairy rations while satisfying all of the nutritional requirements of a cow. In some other cases, the objective could be to maximize the profit while using limited resources.
In the case of minimizing the cost of dairy rations, the objective function is a linear function representing the total cost of a ration. Since a ration comprises different feeds, the total cost is the sum of the individual costs of each ration ingredient. The individual cost of each ration ingredient depends on its unit price and the quantity of feed used as an ingredient. If we denote the unit prices of each feed as c1, c2, c3, and the quantities of each feed as x1, x2, x3, then the total cost of a ration can be calculated as y(x) = c1·x1 + c2·x2 + c3·x3. Function y(x) represents the objective function when using three feeds as ration ingredients. To minimize this function, it is necessary to calculate the optimal values of x1, x2, x3 subject to the given constraints. In other words, it is necessary to find the optimal quantities of each feed to achieve the least-cost ration while satisfying a set of given constraints. In this case, these constraints are mostly related to meeting the nutritional requirements of cattle.
2.4. Simplex Method
The Simplex method is an iterative algorithm used to solve linear programming problems. It is widely applicable in fields such as operations research, economics, and different engineering disciplines for optimizing resource allocation, production planning, and decision-making processes. It is also widely used in agriculture for the optimization of various agricultural processes and decisions, including the optimization of crop planting and harvesting, livestock feed optimization, supply chain management, and farm planning and management. The Simplex method has been implemented in many software tools, such as the Solver add-in in Microsoft Excel, MATLAB, Python libraries, and the LPSolve library.
2.5. LPSolve Library
LPSolve [
33] is a mixed-integer linear programming (MILP) solver that is available as a free and open-source library under the LGPL v2 license, and it can be used in multiple programming languages. LPSolve can be used in several ways, such as via API (application programming interface), input files, and an IDE (integrated development environment). In our case, LPSolve was used via input files in native LP (linear programming) format, which enables applications to pass a linear programming model to the solver in the form of an ASCII file. The LP file format is syntactically very similar to the mathematical formulation of the linear programming model.
4. Conclusions
This study presented the OPTIMILK tool, a web-based solution to the problem of finding a least-cost ration for dairy cows by using available feeds while respecting the nutritional needs of each cow and environmental requirements. The tool represents a unique example of non-commercial web-based ration formulation software customized to the needs of local smallholder farmers. Although the mathematical background of finding an optimal solution is not simple, especially for dairy farmers, the process is simplified by creating a tool that performs most of the “hard work” behind the scenes. The availability of local feeds with standard nutritional parameters and prices, and the possibility of changing them and adding additional constraints, contribute to the goal of finding an optimal ration in terms of decreasing feed costs, decreasing feed waste, and improving animal well-being. OPTIMILK not only optimizes dairy rations for cost efficiency, but also supports sustainable farming practices. Introducing additional constraints to obtain the desired structure of a ration might have a positive impact on the environment by reducing the carbon and water footprints of animals.
The OPTIMILK tool was developed for the Dairy Farmers’ Association of the Republic of Srpska and was made available for free to its members, with a user interface in the local language and the possibility of use on mobile devices. The results of its use showed a slow start in the first two years, but after that time, there were signs of significant use, with positive trends being reflected in the increasing number of saved rations and decreasing number of optimizations before reaching an optimal solution. It is important to point out that the users themselves contributed to the expansion of the feed database by adding their own feeds. This shows more degrees of involvement than just using the tool to calculate the optimal ration. The evaluation of use was based only on the data available in OPTIMILK and did not consider feedback from the users regarding their subjective experience, economic and environmental benefits, and effects on milk production and animal well-being after using the optimal rations. Obtaining this information would be very useful for the additional confirmation of the adoption, usability, and effectiveness of the tool, and will be the subject of future work.
Although OPTIMILK was created for local farmers in Bosnia and Herzegovina, with a user interface that is available only in the local language, its internationalization might open it for wider use. The use of other animal nutrition standards, such as the NRC or CNCPS, could enhance the existing functionality and make it usable for farmers in other parts of the world. The tool currently uses locally relevant nutrition standards, but can be easily upgraded to use more than one, giving its users the possibility to select the most appropriate standard. Future developments of OPTIMILK may include the integration of real-time feed price data and advanced predictive analytics to further enhance its features. Finally, future work might include ration optimization for other categories of animals within one species, and/or for other species of farm animals.