Abstract
In the manufacturing of fattening pigs, pig marketing refers to a sequence of culling decisions until the production unit is empty. The profit of a production unit is highly dependent on the price of pork, the cost of feeding and the cost of buying piglets. Price fluctuations in the market consequently influence the profit, and the optimal marketing decisions may change under different price conditions. Most studies have considered pig marketing under constant price conditions. However, because price fluctuations have an influence on profit and optimal marketing decisions it is relevant to consider pig marketing under price fluctuations. In this paper we formulate a hierarchical Markov decision process with two levels which model sequential marketing decisions under price fluctuations in a pig pen. The state of the system is based on information about pork, piglet and feed prices. Moreover, the information is updated using a Bayesian approach and embedded into the hierarchical Markov decision process. The optimal policy is analyzed under different patterns of price fluctuations. We also assess the value of including price information into the model.
Similar content being viewed by others
Notes
Danish pig feed unit (1 FEsv = 7.72 MJ).
Using shared and external processes, i.e. the memory of child processes may be shared and loaded when needed. For further information see the documentation in Nielsen (2009).
References
Andersen, S., Pedersen, B., & Ogannisian, M. (1999). Slagtesvindets sammensætning. meddelelse 429. Technical report, Landsudvalget for Svin og Danske Slagterier. http://vsp.lf.dk/Publikationer/Kilder/lu_medd/medd/429.aspx
Bono, C., Cornou, C., & Kristensen, A. (2012). Dynamic production monitoring in pig herds I: modeling and monitoring litter size at herd and sow level. Livestock Science, 149(3), 289–300. https://doi.org/10.1016/j.livsci.2012.07.023.
Bono, C., Cornou, C., Lundbye-Christensen, S., & Kristensen, A. (2013). Dynamic production monitoring in pig herds II. modeling and monitoring farrowing rate at herd level. Livestock Science, 155(1), 92–102. https://doi.org/10.1016/j.livsci.2013.03.026.
Boys, K., Li, N., Preckel, P., Schinckel, A., & Foster, K. (2007). Economic replacement of a heterogeneous herd. American Journal of Agricultural Economics, 89(1), 24–35. https://doi.org/10.1111/j.1467-8276.2007.00960.x.
Broekmans, J. (1992). Influence of price fluctuations on delivery strategies for slaughter pigs. Technical report, Dina Notat 7, Research Centre Foulum. http://www.prodstyr.ihh.kvl.dk/pub/dina/notat7.pdf
Cai, W., Wu, H., & Dekkers, J. (2011). Longitudinal analysis of body weight and feed intake in selection lines for residual feed intake in pigs. Asian Australasian Journal of Animal Science, 24(1), 17. https://doi.org/10.5713/ajas.2011.10142.
Chavas, J., Kliebenstein, J., & Crenshaw, T. (1985). Modeling dynamic agricultural production response: The case of swine production. American Journal of Agricultural Economics, 67(3), 636–646. https://doi.org/10.2307/1241087.
Cornou, C., Vinther, J., & Kristensen, A. (2008). Automatic detection of oestrus and health disorders using data from electronic sow feeders. Livestock Science, 118(3), 262–271. https://doi.org/10.1016/j.livsci.2008.02.004.
Durbin, J., & Koopman, S. (2012). Time series analysis by state space methods. Oxford: Oxford University Press. https://doi.org/10.1093/acprof:oso/9780199641178.001.0001.
Jørgensen, E. (1992). Price fluctuations described by first order autoregressive process. Technical report, Department of Research in Pigs and Horses, National Institute of Animal Science.
Jørgensen, E. (2003). Foderforbrug pr kg tilvækst hos slagtesvin. fordeling mellem forbrug til vedligehold og til produktion i besætninger under den rullende afprøvning. Technical report, Danish Institute of Agricultural Sciences, Biometry Research Unit.
Khamjan, S., Piewthongngam, K., & Pathumnakul, S. (2013). Pig procurement plan considering pig growth and size distribution. Computers and Industrial Engineering, 64, 886–894. https://doi.org/10.1016/j.cie.2012.12.022.
Kristensen, A., & Jørgensen, E. (2000). Multi-level hierarchic Markov processes as a framework for herd management support. Annals of Operations Research, 94(1–4), 69–89. https://doi.org/10.1023/A:1018921201113.
Kristensen, A., Nielsen, L., & Nielsen, M. (2012). Optimal slaughter pig marketing with emphasis on information from on-line live weight assessment. Livestock Science, 145(1–3), 95–108. https://doi.org/10.1016/j.livsci.2012.01.003.
Kure, H. (1997). Marketing management support in slaughter pig production. PhD thesis, The Royal Veterinary and Agricultural University. http://www.prodstyr.ihh.kvl.dk/pub/phd/kure_thesis.pdf.
Lustig, I., Dietrich, B., Johnson, C., & Dziekan, C. (2010). The analytics journey. Analytics November/December. http://analytics-magazine.org/the-analytics-journey/.
Nielsen, L. (2009). MDP: Markov decision processes in R. R package v1.1. https://github.com/relund/mdp.
Nielsen, L., Jørgensen, E., & Højsgaard, S. (2011). Embedding a state space model into a Markov decision process. Annals of Operations Research, 190(1), 289–309. https://doi.org/10.1007/s10479-010-0688-z.
Nielsen, L., Jørgensen, E., Kristensen, A., & Østergaard, S. (2010). Optimal replacement policies for dairy cows based on daily yield measurements. Journal of Dairy Science, 93(1), 77–92. https://doi.org/10.3168/jds.2009-2209.
Nielsen, L., & Kristensen, A. (2006). Finding the \(K\) best policies in a finite-horizon Markov decision process. European Journal of Operational Research, 175(2), 1164–1179. https://doi.org/10.1016/j.ejor.2005.06.011.
Nielsen, L., & Kristensen, A. (2014). Markov decision processes to model livestock systems. In L.M. Plà-Aragonés (Ed.) Handbook of operations research in agriculture and the agri-food industry. International series in operations research and management Science (Vol. 224, pp. 419–454). Berlin: Springer. https://doi.org/10.1007/978-1-4939-2483-7_19.
Niemi, J. (2006). A dynamic programming model for optimising feeding and slaughter decisions regarding fattening pigs | NIEMI | agricultural and food science. PhD thesis, MTT Agrifood research. http://ojs.tsv.fi/index.php/AFS/article/view/5855.
Ohlmann, J., & Jones, P. (2011). An integer programming model for optimal pork marketing. Annals of Operations Research, 190(1), 271–287. https://doi.org/10.1007/s10479-008-0466-3.
Patterson, H. D., & Thompson, R. (1971). Recovery of inter-block information when block sizes are unequal. Biometrika, 58(3), 545–554.
Pitmand, J. (1993). Probability. Berlin: Springer.
Plà-Aragonés, L. M., Rodriguez-Sanchez, S., & Rebillas-Loredo, V. (2013). A mixed integer linear programming model for optimal delivery of fattened pigs to the abattoir. Journal of Applied Operational Research, 5(4), 164–175.
Pourmoayed, R., & Nielsen, L. (2014). An overview over pig production of fattening pigs with a focus on possible decisions in the production chain. Technical report, PigIT Report No. 4, Aarhus University. http://pigit.ku.dk/publications/PigIT-Report4.pdf.
Pourmoayed, R., & Nielsen, L. (2015). Github repository: Slaughter pig marketing under price fluctuations (v1.1). https://github.com/pourmoayed/hmdpPricePigIT.git.
Pourmoayed, R., Nielsen, L., & Kristensen, A. (2016). A hierarchical Markov decision process modeling feeding and marketing decisions of growing pigs. European Journal of Operational Research. https://doi.org/10.1016/j.ejor.2015.09.038.
R Core Team. (2015) R: A language and environment for statistical Computing. Vienna: R Foundation for Statistical Computing. http://www.R-project.org/.
Rodriguez, S., Jensen, T., Pla, L., & Kristensen, A. (2011). Optimal replacement policies and economic value of clinical observations in sow herds. Livestock Science, 138(1–3), 207–219. https://doi.org/10.1016/j.livsci.2010.12.026.
Roemen, J., & de Klein, S. (1999). An optimal marketing strategy for porkers with differences in growth rates and dependent prices. Research Memorandum 781, Tilburg University, School of Economics and Management. https://pure.uvt.nl/ws/portalfiles/portal/1144463/RJKJ5618037.pdf.
Schaeffer, L. (2004). Application of random regression models in animal breeding. Livestock Production Science, 86(1), 35–45. https://doi.org/10.1016/S0301-6226(03)00151-9.
Tijms, H. (2003). A first course in stochastic models. Berlin: Wiley. https://doi.org/10.1002/047001363X.
Toft, N., Kristensen, A., & Jørgensen, E. (2005). A framework for decision support related to infectious diseases in slaughter pig fattening units. Agricultural Systems, 85(2), 120–137. https://doi.org/10.1016/j.agsy.2004.07.017.
West, M., & Harrison, J. (1997). Bayesian forecasting and dynamic models. Berlin: Springer. https://doi.org/10.1007/b98971.
Acknowledgements
This article has been written with support from The Danish Council for Strategic Research (The PigIT Project, Grant No. 11-116191). We would like to thank the two anonymous referees for improving this paper.
Author information
Authors and Affiliations
Corresponding author
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Appendices
Notation
Because the paper uses techniques from both statistical forecasting and operations research, we have to make some choices with respect to notation. In general, we use capital letters for matrices and let \( A' \) denote the transpose of A. Capital blackboard bold letters are used for sets (e.g., \( \mathbb {P}_{} \) and \( \mathbb {D}_{n^{}} \)). Finally, accent \({\hat{x}}\) (hat) is used to denote an estimate of x. A description of the notation introduced in Sects. 2 and 3 is given in Tables 4 and 5, respectively.
Calculating expected reward
1.1 Modeling weights in the pen
During the growing period in the pen, pigs grow at different rates; that is, given a certain week in the production cycle, there are variation between the weights of the individual animals in the pen. Moreover, as the pigs grow, the variation increases and our uncertainty about the average weight of the pen increases.
Let \((w_{(1)},\ldots ,w_{(k)},\ldots ,w_{(q)})_{t}\) denote the weight distribution of the \( q\) pigs in the pen at week t such that \(w_{(1)}\), \(w_{(k)}\), and \(w_{(q)}\) are ordered random variables (order statistics) related to the weight of the lightest, kth lightest and the heaviest pig in the pen at stage \(n^{}\), respectively. To find the probability distribution of the ordered random variable \(w_{(k)}\), first the weight distribution of a randomly selected pig should be determined in the pen. To specify this distribution, we use a random regression model (RRM), often applied in the animal breeding models (Schaeffer 2004).
Let \(w_{j,t}\) denote the weight of a randomly selected pig j in week t described using an RRM:
where \(X_{t}\) and \(Z_{t}\) are time covariate vectors, \(\beta _{}\) is the vector of fixed parameters, \(\alpha _{j}\) is the vector of random parameters and \(\varepsilon _{j,t}\) is a residual error. In this RRM, \(X_{t}\beta _{}\) is the fixed effect of the model representing the average weight of the pen and \(Z_{t}\alpha _{j}\) is the random effect showing a deviation between the weight of pig j and the average weight of the pen. A quadratic RRM is used suggested by Cai et al. (2011) where \(X_{t}=Z_{t}=\begin{pmatrix}1&\quad t&\quad t^2\end{pmatrix}\), \(\alpha _{j} = \begin{pmatrix} \alpha _{0j}&\quad \alpha _{1j}&\quad \alpha _{2j} \end{pmatrix}'\) and \(\beta = \begin{pmatrix} \beta _{0}&\quad \beta _{1}&\quad \beta _{2} \end{pmatrix}'\):
Random parameter \(\alpha _{j}\) follows a normal distribution with parameters
where \(V\) is independent of pig j and time t. Moreover, the residual errors \(\varepsilon _{j,t} \sim N\left( 0,\;R\right) \) are independent random variables. Because (15) is linear with respect to random parameters \(\alpha _{j}\) and \(\varepsilon _{j,t}\), we can conclude
The parameters \(\beta _{}\), \(V\) and \(R\) can be estimated using the restricted maximum likelihood (REML) method (Patterson and Thompson 1971).
Because the probability distribution of \(w_{j,t}\) is independent of pig j, the weight distribution of all \(q\) pigs in the pen are i.i.d at time t. Hence, the probability density function of the ordered random variable \(w_{(k)}\) becomes
where \(\varPhi (w)\) and \(\phi (w)\) are the cumulative and density functions of the normal distribution defined in (16) (Pitmand 1993, p. 326).
1.2 Carcass weight, leanness, feed intake and growth
Consider the kth lightest pig at stage n with weight \(w\) and daily growth \( g\). The carcass weight \({\tilde{w}}_{}\) can be approximated as
where \(e_{\texttt {\small c}}\sim N(0, \sigma _c^2)\) (Andersen et al. 1999). The relation between growth rate, leanness (lean meat percentage) and feed conversion ratio varies widely between herds. Hence, these formulas must be herd specific. The leanness \(\breve{w}_{}\) can be found as
where \({\bar{g}}\) is the average daily growth in the herd and \({\bar{\breve{w}_{}}}\) is the average herd leanness percentage (Kristensen et al. 2012).
The feed intake (energy intake) is modelled as the sum of feed for maintenance and feed for growth. The basic relation between daily feed intake \( f\) (FEsv), live weight and daily gain is
where \( k_1 \) and \( k_2 \) are constants describing the use of feed per kilogram gain and per kilogram metabolic weight, respectively (Jørgensen 2003). As a result the expected feed intake of a pig over the next \( {\hat{t}} \) days equals
where \( f_t \) denotes the feed intake on day t calculated recursively using (19).
1.3 Settlement pork price
Consider the kth lightest pig at stage n with carcass weight \({\tilde{w}}_{}\) and leanness \( \breve{w}_{}\) at delivery. The settlement pork price, under Danish conditions, is the sum of two linear piecewise functions related to the price of the carcass and a bonus of the leanness:
where \( p_{}^{\texttt {pork}} \) is the current pork price at the market. Functions \(\tilde{p}({\tilde{w}}_{},p_{}^{\texttt {pork}})\) and \(\breve{p}(\breve{w}_{})\) correspond to the unit price of carcass and the bonus of leanness for 1 kg meat, respectively. A plot of each function is given in Fig. 6.
Given the price structure, based on the Danish slaughter pig market,Footnote 3 the unit price of 1 kg carcass is
That is, the market pork price \(p_{}^{\texttt {pork}}\) may be interpreted as the maximum price of 1 kg carcass that can be obtained (when the carcass weight lies between 70 and 95 kg).
The bonus of leanness is calculated as
1.4 Calculation of expected values
The calculations of the expected values (6)–(9) is rather complex due to the ordered random variables and the non-continuous functions \( \tilde{p}({\tilde{w}}_{},p_{}^{\texttt {pork}}) \) and \( \breve{p}(\breve{w}_{}) \). However, the expectations can be calculated using simulation with a simple sorting procedure as described below.
-
Step 0
For each pig \( j=1,\ldots q^{\max }\), draw random vector \( \alpha _{j}\sim N\left( 0,\;V\right) \).
-
Step 1
For each week t and pig j, draw residual \(\varepsilon _{j,t} \sim N\left( 0,\;R\right) \) and find weight
$$\begin{aligned} w_{j,t} = X_{t}\beta _{} + Z_{t}\alpha _{j} + \varepsilon _{j,t}. \end{aligned}$$Moreover, use the weights to find the daily growth \( g\) during a week.
-
Step 2
For each week t and pig j, use (17) and (18) to find the carcass weight and leanness (\( b\) days ahead), respectively. Moreover, use (19) to find the feed intake for the next \( t=7 \) and \( b\) days, i.e., (20) is calculated.
-
Step 3
For each week t, pig j and possible center point of pork price, calculate the settlement pork price (21).
-
Step 4
For each week t, sort the obtained values of feed intake and settlement pork price in non-decreasing order of weight.
We run the simulation 10,000 times to calculate average values of the feed intake and settlement pork price and next use the values to calculate the expected values (6)–(9).
Bayesian updating of SSMs
An SSM includes a set of observable and latent/unobservable continuous variables. The set of latent variables \(\theta _{\{t=0,1,\ldots \}}\) evolves over time using system equation (written using matrix notation)
where \(\omega _t\sim N\left( 0,W_{t}\right) \) is a random term and \(G_{t}\) is a matrix of known values. We assume that the prior \(\theta _{0}\sim N(m_{0},C_{0})\) is given. Moreover, we have a set of observable variables \(y_{\{t=1,2,\ldots \}}\) (time-series data of prices) which are dependent on the latent variable using observation equation
with \(\nu _t\sim N\left( 0,V_{t}\right) \). Here \( F_{t} \) is the design matrix of system equations with known values and \( F' \) denote the transpose of matrix F. The error sequences \(\omega _t\) and \(\nu _t\) are internally and mutually independent. Hence given \(\theta _{t}\) we have that \(y_{t}\) is independent of all other observations and in general the past and the future are independent given the present.
Let \({\mathbb {D}}_{t-1}=(y_{1},\ldots ,y_{t-1},m_{0},C_{0})\) denote the information available up to time \(t-1\). Given the posterior of the latent variable at time \(t-1\), we can use Bayesian updating (the Kalman filter) to update the distributions at time t (West and Harrison 1997, Theorem 4.1).
Theorem 1
Suppose that at time \(t-1\) we have
then
where
Note that the means of the one-step state and forecast distributions, \(a_t\) and \(f_{t}\), only depend on \(m_{t-1}\). Moreover variance \(C_t\) only depends on the number of observations made, i.e., we can calculate it without knowing the observations \(y_{1},\ldots ,y_{t}\). Similarly, we can find k-step conditional distributions.
Theorem 2
Suppose that at time t we have
then
where \( f_t(k) = F_{t+k}'a_t(k) \), \( Q_t(k) = F_{t+k}'R_t(k)F_{t+k} + V_{t+k} \) and \( A_t(k) = R_t(k)F_{t+k}Q_t(k)^{-1} \) which can be recursively calculated using
with starting values \(a_t(0)=m_{t}\) and \(R_t(0)=C_{t}\).
Proof
First, note that the probability distribution of \((y_{t+k} | {\mathbb {D}}_{t})\) and the related proof have been given in West and Harrison (1997, Theorem 4.2). Moreover, because \( f_t(k) \) is a function of \( m_t \), we have that \( \left( y_{t+k}\mid {\mathbb {D}}_{t}\right) = \left( y_{t+k} | m_{t}\right) \).
Next, to find the probability distribution of \((m_{t+k} | {\mathbb {D}}_{t})\), we use the similar procedure given in the proof of Theorem 4.2 in West and Harrison (1997, pp. 107–108). According to the repeated application of system equation in an SSM (West and Harrison 1997, p. 107), the k-step evolution of latent variable \(\theta _t\) can be formulated as
where \(G_{t+k}(r)=G_{t+k}G_{t+k-1},\ldots ,G_{t+k-r+1}\) for \(r<k\), with \(G_{t+k}(0)=I\). Now, using (22)–(24), we can generate an SSM modelling the k-step evolution of \(\theta _t\):
For this SSM we can use the general properties of Theorem 1 with \(t-1\), t, \(G_t\) and \(\omega _t\) replaced with t, \(t+k\), \(G_{t+k}(k)\) and \(\sum _{r=1}^{k}G_{t+k}(k-r)\omega _{t+r}\), respectively. Hence
where
Based on these equations and \((y_{t+k}|m_t)\sim N( f_t(k),Q_t(k))\), we have that
where based on the recursive equation for \(G_{t+k}(r)\) and Theorem 1, we have that
\(\square \)
Rights and permissions
About this article
Cite this article
Pourmoayed, R., Relund Nielsen, L. Optimizing pig marketing decisions under price fluctuations. Ann Oper Res 314, 617–644 (2022). https://doi.org/10.1007/s10479-020-03646-0
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10479-020-03646-0