University of FloridaSolutions for Your Life

Download PDF
Publication #AN177

The DairyVIP Program to Evaluate the Consequences of Changes in Herd Management and Prices on Dairy Farms1

Albert De Vries2


Dairy producers, Extension faculty, other advisors, and researchers frequently have a need to evaluate the technical and financial consequences of changes in dairy herd management and prices. Of interest are, for example, the expected consequences of improved reproductive efficiency, increased milk production per cow, reduced involuntary culling, or increased heifer purchase costs.

Changes in herd management or prices affect optimal breeding and replacement decisions and consequently the herd structure such as the frequency of number of cows by days in lactation, the frequency of number cows that are pregnant vs. nonpregnant, etc. Therefore, the consequences of changes in herd structure (and prices) are difficult to determine without the help of a computer program such as DairyVIP.

DairyVIP (Dairy Value Iteration Program) is a computer program that first calculates (optimal) breeding and replacement decisions for individual dairy cows and then calculates many technical and financial herd statistics for a herd of dairy cows that are managed following the calculated breeding and replacement decisions.

The DairyVIP user-interface is developed in Microsoft Excel. Six input sheets allow the user to enter data on milk production, reproduction, body weights, involuntary replacement, prices, and miscellaneous inputs. Default values are given which are plausible values in Florida. After DairyVIP has calculated the consequences of a set of input data, the user-interface shows over 40 statistics such as profit per cow per year, average days to conception, cull rate, etc. It also displays over 70 graphs showing herd statistics over time, by days in lactation, by month of the year, by lactation number, or by level of milk production. Two sets of inputs and their results can be compared simultaneously. The optimal breeding and replacement decisions for each individual cow can also be viewed.

This fact sheet explains some of the methods and describes the input and output sheets of DairyVIP.



The DairyVIP computer program may be downloaded and used for free from the Florida Dairy Extension website at as a single file Unzipped, DairyVIP consists of two files. First, the user enters data and runs the program through a Microsoft Excel (Microsoft Corporation, Issaquah, WA) user-interface spreadsheet called DairyVIP.xlsm. The second file, DairyVIP.exe, is an executable file which calculates (optimal) breeding and replacement decisions for individual cows based on the data entered in the user-interface. DairyVIP.exe then simulates cows over time and calculates herd statistics based on data from the user-interface and the breeding and replacement decisions for each possible cow. The Microsoft Excel spreadsheet and the executable file automatically communicate with each other through macros and ASCII text files (Figure 1, Table 1).

Figure 1. 

Sequence of steps and files in DairyVIP.

[Click thumbnail to enlarge.]

Calculation of Individual Breeding and Culling Decisions

A major feature of DairyVIP is the ability to calculate optimal breeding and voluntary replacement decisions for individual dairy cows with the objective to maximize profitability per slot (stall). Breeding alternatives are to either breed or not breed an eligible nonpregnant cow. Replacement alternatives are to immediately cull a cow or try to keep her at least one more month. If the slot is vacant, the alternatives are to enter a heifer or keep the slot vacant. DairyVIP calculates the discounted future cash flows for each alternative. The value of the decision to keep a cow at least one more month compared to immediately culling her is called the retention payoff (RPO). If the user desires optimal results, DairyVIP will choose the alternative with the greatest discounted future cash flow. The user may restrict the optimization by choosing alternative criteria for making breeding and replacement decisions. Restricted optimization never results in greater profitability.

Cows are categorized in discrete cow states. DairyVIP calculates optimal or non-optimal breeding and voluntary replacement decisions for 343,440 cow states. A cow state is a combination of five main features that characterize a cow. A cow is in a state described by milk production level (1–15), lactation number (1–12), months in lactation (1–24), pregnancy status (0 for nonpregnant or 1–9 for months of gestation), and season of the year (1–12). For example, a cow can be characterized as in the 10th milk production level, 2nd lactation, 6th month in lactation, 2nd month of pregnancy, in February. Some combinations are not physically possible and therefore excluded; for example, 4 months pregnant while 3 months in lactation. Each state is associated with specific revenues and costs that are calculated from the input data provided by the user in the user-interface.

The 15 milk yield levels are a percentage of the average yield (level 8) entered by the user. If the coefficient of variation of milk yield is 12 (default value on the Misc sheet), then milk yield in level 1 is 69.7% of the average and milk yield in level 15 is 130.3% of the average yield. Yields of the other levels are between these lowest and highest yields.

DairyVIP uses a dynamic programming algorithm (also known as value iteration) to calculate discounted future cash flows for each alternative and then makes the best decisions for each cow state. The time step is one month. The objective of these breeding and replacement decisions is to maximize the total profit of the slot under steady state (equilibrium) conditions with the current cow and her consecutive replacement heifers. All heifers are assumed to be purchased at the time they enter the herd at first calving and the supply of heifers is assumed to be unlimited.

DairyVIP uses monthly time steps, commonly referred to as stages. Replacement decisions in each state and stage depend only on the performance in the current state and the optimal decisions in the next stage. The dynamic programming algorithm starts with the calculation of optimal breeding and replacement decisions for each state far in the future and then moves backward in time, stage by stage, until the average profit per slot per year is stabilized. At this point the algorithm has converged and all breeding and replacement decisions are independent of the arbitrary starting conditions far in the future.

The maximum profit per slot per year is obtained when the dynamic programming algorithm is allowed to determine all entering, breeding, and voluntary culling decisions (the optimal policy). Non-optimal policies can be simulated when one or more restrictions are placed on entering, breeding or voluntary culling of cows. The dynamic programming algorithm can still be allowed to make some decisions. For example, the option to delay replacement can be enforced or prohibited for each month of the year, while the dynamic programming algorithm still calculates the cull decision for each cow state given the heifer entering restriction. A policy where the user defines the breeding and voluntary culling decisions for all states and the months where heifers are entered can also be simulated but the dynamic programming algorithm then has no optimization function.

Calculation of Herd Statistics

DairyVIP calculates herd statistics that are based upon the user-input data and the calculated breeding and replacement decisions for each cow state. These calculations utilize the Markov chain method. DairyVIP simulates a herd of one cow (or lack thereof) in one slot from stage to stage, multiplying the probability that the cow is in a cow state (dependent on the entering decision calculated earlier) with her performance, revenues, and costs in that state. If the herd has been simulated for a sufficiently long time, the state-to-state transition probabilities become stationary and the herd is in steady-state. At that point the probability that a cow is in a cow state remains constant. The herd structure and herd statistics in each stage can be calculated from the weighted performance and events in each state. Financial steady-state results are displayed as equivalent annual annuity values.

It is also possible to start the simulation with an existing herd structure (.MKV file) and simulate the herd for three years into the future. The starting herd could be the steady-state herd structure that resulted from a different set of inputs, a single heifer purchased today, or the existing herd structure of a real dairy farm. DairyVIP then shows the changes in herd statistics in the next three years. Another option is to simulate an existing herd structure over time but without the ability to enter replacement heifers. This option is useful when the herd structure consists of just one cow and her expected performance over time is of interest.

DairyVIP Input and Output Sheets

The DairyVIP user-interface is a Microsoft Excel spreadsheet. The spreadsheet is protected to prevent unintended editing of the sheets that might prevent the proper calculation and display of the results. Many sheets contain an unprotected grid to allow the user to make notes and calculations. The blue Run sheet controls the calculation of the results. Five green input sheets allow the user to enter data in the yellow cells. Comments provide default values or additional information. Four yellow output sheets display the results. A light green sheet allows for a comparison of two complete input data sets.

Run Sheet

The Run input sheet allows the user to enter the name of the input data set file (.BIO). A previously saved input data set can be read as well. An existing herd structure (.MKV file) may be read in to start the simulation. The results can be displayed under plan A or B. This allows for a side by side comparison of the results of two different input data sets. For example, the results of a first run with DairyVIP can be saved under plan A and the results based on some changes in the inputs can be saved under plan B. DairyVIP starts calculating the results by clicking the GO! button. The results are calculated by the DairyVIP.exe file. This file opens an MS-DOS console window. The status of the execution can be followed in the Status box, or by clicking YES in the Show .EXE box.

Figure 2. 

Run sheet.

[Click thumbnail to enlarge.]

Miscellaneous Sheet

The Miscellaneous (Misc) input sheet requires various input data such as the unit of the data (metric or English), labor cost, veterinary cost, feed prices, calf prices, fixed labor cost, and fixed and variable other costs. The values in cells with a blue border depend on the unit (metric or English). Feed costs are calculated dry matter intake times feed price. Dry matter intakes for lactating cows are based on the NRC (2001) publication Nutrient Requirements of Dairy Cattle. The user also needs to choose the breeding and replacement policy. The optimal policy may be restricted by keeping all cows or all nonpregnant cows. Further restrictions may be implemented by limiting the maximum months nonpregnant, eligible breeding period, minimum daily marginal returns, or minimum daily milk yield.

Figure 3. 

Miscellaneous sheet.

[Click thumbnail to enlarge.]

Price and Decisions Sheet

The user enters prices for milk, culled cows, and heifers for 24 months on the Price and Decisions (Price) input sheet. Prices for the first 12 months are used for the first year of the simulation. Prices for the last 12 months are used for all years after the first 12 months. These separate prices are useful if the price forecasts for the first year are different from the long run averages and the objective is to calculate herd statistics for the next three years into the future. Herd steady state results are based on the prices for the first year.

The user also enters decisions about breeding for 24 months. Possible choices are “decide”, “breed”, and “do not breed”. The choice “decide” lets DairyVIP calculate whether breeding or not breeding is the optimal decision. Similarly, for entering heifers the choices are “decide”, “enter”, or “do not enter”. If the choice is “do not enter”, then DairyVIP will not purchase and enter any heifers in that month to replace the involuntary culled cows in the previous month or the voluntary culled cows in the current month. A fraction of the slots will therefore be vacant that month.

Figure 4. 

Price and Decisions sheet.

[Click thumbnail to enlarge.]

Milk Sheet

The Milk yield (Milk) input sheet requires average daily milk yields for the first three lactations by month of lactation and month of the year. The milk yield in the third lactation is also used for later lactations. Average milk yields must be entered for 24 months in lactation. The user may directly enter daily milk yields. Alternatively, the parameters of the Woods incomplete gamma lactation curve for each of the three lactation numbers may be entered. Seasonality can be adjusted separately by entering a percentage adjustment per month of the year. Furthermore, a percentage change or an absolute change may be entered. A third option is to enter peak milk yield, days in milk at peak milk yield, and 305-day total milk yield. Woods incomplete gamma lactation curves will be fitted and daily milk yields are estimated. A fourth option is to choose previously calculated lactation curves based on DHIA data from herds located in Florida and Georgia. The computer program will automatically enter the resulting daily milk yields after the GO! button is clicked. The effects of pregnancy on milk yields are entered separately. The user enters the percentage of nonpregnant daily milk yield caused by pregnancy per month of gestation. The cow is dry when the percentage is 0.

Figure 5. 

Milk yield sheet. The date entry fields for lactations three and greater are not shown.

[Click thumbnail to enlarge.]

Reproduction Sheet

The Reproduction (Repro) input sheet requires data on the probability of service, probability of conception, and additional breeding cost by month of lactation and month of the year. Seasonality can be adjusted separately by entering a percentage adjustment per month of the year. No breeding is possible before the start of the 3rd month (day 61) and after the start of the 16th month (day 456) in lactation. If a cow conceives at the start of the 16th month in lactation, she will calve at the end of the 24th month after calving. The Reproduction sheet also requires the user to enter the risk of abortion per month of pregnancy, the minimum voluntary waiting period for lactations 1, 2 and 3+, the last allowable breeding month, the cost per breeding, and time spent associated with breeding.

Figure 6. 

Reproduction sheet.

[Click thumbnail to enlarge.]

Involuntary Culling Sheet

DairyVIP assumes a risk of involuntary culling in each of the 24 possible months of lactation, even when the optimal decision is to keep the cow. Involuntary culling is caused by death or severe health problems. Essentially, it is the probability that the cow is in such a poor condition that culling is obviously the best decision. The risk of involuntary culling is entered by month of lactation and month of the year on the Involuntary culling (Cull) input sheet. Seasonality can be adjusted separately by entering a percentage adjustment per month of the year. In addition, the relative risk per lactation number is entered.

Figure 7. 

Involuntary culling sheet.

[Click thumbnail to enlarge.]

Body Weight Sheet

Body weights for nonpregnant cows for first and greater parities are entered for 24 months in lactation on the Body weight (BW) input sheet. The additional body weight caused by pregnancy is entered separately. The Korver function allows for predicting body weight data with 6 parameters.

Figure 8. 

Body weight sheet.

[Click thumbnail to enlarge.]

Cow Sheet

The Cow output sheet displays the retention payoff (RPO) and value of pregnancy by month in lactation for a cow state characterized by milk yield level, lactation number, month of conception, and season. The value of a new pregnancy and the cost per additional month nonpregnant are also shown. In addition, the RPO for individual cow states can be found. The .RPO and .DEL files have to be read in before any of these values can be displayed. The user needs to indicate to save the .RPO and .DEL files on the Miscellaneous sheet before DairyVIP calculates the results. Saving these files requires some time and is not needed in order to calculate the herd statistics as displayed on the output sheets Table, Time, and Chart.

Figure 9. 

The Cow sheet shows the retention payoff (RPO) and value of pregnancy by months in lactation and pregnancy status for an individual cow.

[Click thumbnail to enlarge.]

Table Sheet

Technical and financial results per cow (slot) per year or per 100 kg (or lbs) milk produced are displayed on the Table output sheet. Separate results for years 1, 2, and 3 can be selected. The financial results include all types of revenues and costs, as well as profit. Technical results include several measures about reproductive performance, replacement, and feed costs.

Figure 10. 

The Table sheet shows technical and financial results per cow (slot) per year or per 100 kg (lbs) for two different sets of inputs (plan A and plan B).

[Click thumbnail to enlarge.]

Time Sheet

The Time output sheet displays technical and financial results per month of the year for years one to three in 38 different graphs. Effects of seasonality are easily observed. Results include, for example, profit per month, fraction culled, fraction delayed breedings, pregnancy rate, and average daily milk yield. Note that plans A and B should have the same starting season; otherwise the graphs are not displayed properly.

Figure 11. 

The Time sheet shows technical and financial results per month of the year. The first 3 of a total of 38 graphs are shown.

[Click thumbnail to enlarge.]

Chart Sheet

The Chart output sheet displays average technical and financial results for the first three years in 38 different graphs. The breakdown is either by milk yield, days after calving, or lactation number. Measures include for example days to first breeding, days nonpregnant, value of pregnancy, herd demographics, and the economic loss due to involuntary replacement.

Figure 12. 

The Chart sheet shows technical and financial results per level of milk production days after calving, or lactation number. The first 6 of a total of 38 figures are shown.

[Click thumbnail to enlarge.]


De Vries, A. 2004. "Economics of delayed replacement when cow performance is seasonal." Journal of Dairy Science 87:2947-2958.

De Vries, A. 2006. "Economic value of pregnancy." Journal of Dairy Science 89:3876-3885


Table 1. 

Parameters within the .RPO, .DEL, .POL, and .MKV files created by DairyVIP.




.POL 3

.MKV 5


Milk yield level

Season ***

Season ***

Milk yield level


Lactation number

Milk yield level

Milk yield level

Lactation number


Month in lactation

Lactation number

Lactation number

Month in lactation


Months pregnant

Month in lactation

Months pregnant

Months pregnant



Month in future

Policy 4

Cow state probability 6


Retention payoff *

Gain/loss pregnant * 1


First service probability


Retention payoff **

Gain/loss pregnant **


VWP probability



Gain/loss nonpregnant * 2




Gain/loss nonpregnant **



Value of pregnancy *



Value of pregnancy **



Cull value



Milk yield



Milk yield (level 8)








* year 1 (12 months)

** year 2 and later (12 months)

*** years 1 and 2 and later (24 months)

1 Gain/loss if cow gets pregnant x months in future (Cow output sheet).

2 Gain/loss if nonpregnant cow remains at least x months longer open (Cow output sheet).

3 First row, for every season: 1 = enter heifer, 0 = do not enter heifer in vacant slot.

4 Policy, for every month in lactation: 0 = cull, 1 = keep (do not breed), 2 = keep (breed), 8 = unfeasible.

5 First row: dummy values. The MKV file contains the herd structure at the end of the last month of the simulation.

6 Probability that a cow is in the specific cow state.



This document is AN177, one of a series of the Animal Sciences Department, UF/IFAS Extension. Original publication date September 2006. Revised January 2016. Visit the EDIS website at Financial support was received from the Southeast Milk, Inc. Dairy Check-off program and IFAFS grant no. 2001-52101-11318 from USDA-CSREES.


Albert De Vries, assistant professor, Department of Animal Sciences; UF/IFAS Extension, Gainesville, FL 32611.

The Institute of Food and Agricultural Sciences (IFAS) is an Equal Opportunity Institution authorized to provide research, educational information and other services only to individuals and institutions that function with non-discrimination with respect to race, creed, color, religion, age, disability, sex, sexual orientation, marital status, national origin, political opinions or affiliations. For more information on obtaining other UF/IFAS Extension publications, contact your county's UF/IFAS Extension office.

U.S. Department of Agriculture, UF/IFAS Extension Service, University of Florida, IFAS, Florida A & M University Cooperative Extension Program, and Boards of County Commissioners Cooperating. Nick T. Place, dean for UF/IFAS Extension.