# Economic optimization of feeding and shipping strategies in pig-fattening using an individual-based model

M. Davoudkhani, Fabrice Mahé, Jean-Yves Dourmad, Alexandre Gohin, E.

Darrigrand, Florence Garcia

► To cite this version:

M. Davoudkhani, Fabrice Mahé, Jean-Yves Dourmad, Alexandre Gohin, E. Darrigrand, et al., Economic optimization of feeding and shipping strategies in pig-fattening using an individual-based model. Agricultural Systems, 2020, 184, pp.102899. 10.1016/j.agsy.2020.102899. hal-02959080

HAL Id: hal-02959080

https://hal.science/hal-02959080

Submitted on 23 Aug 2022

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
1 Economic optimization of feeding and shipping strategies in pig-fattening using an individual-

2 based model

3

4 M. Davoudkhani¹, F. Mahé², J.Y. Dourmad¹, A. Gohin³, E. Darrigrand², F. Garcia-Launay¹

5 ¹PEGASE, INRAE, Institut Agro, 35590 Saint Gilles, France

6 ²Université de Rennes, CNRS, IRMAR - UMR 6625, F-35000 Rennes, France

7 ³SMART LERECO, INRAE, Institut Agro, 35011 Rennes, France

8 Keywords: Optimization procedure, Bioeconomic simulation model, Gross margin, Evolutionary

9 algorithm, Market price.

10

11 ABSTRACT

12 Economic results of pig-fattening systems vary greatly and depend mainly on prices of pork and
13 feeds, and pig growth performance (e.g. feed efficiency, slaughter weight, lean percentage). Previous
14 studies revealed that feeding and shipping strategies are critical factors in the economic outputs of
15 pig production. However, they failed to consider both strategies and the variability in pig growth
16 performance simultaneously. Consequently, we developed a new approach to improve the
17 profitability of pig farms by estimating the best compromise among feeding costs, animal
18 performance, and shipping constraints. We used an individual-based bioeconomic model that
19 simulates the growth of each pig according to its biological traits (e.g. feed intake and protein
20 deposition potential) as a function of different feeding and shipping strategies. The optimization
21 problem is solved using an evolutionary algorithm (CMA-ES, covariance matrix adaptation evolution
22 strategy) that manages the objective function, which is discontinuous, non-convex, nonlinear, and
23 multimodal. Various case studies were constructed to investigate the behavior of the optimization
24 procedure. Effects of pork price on optimal strategies were investigated using three different price
25 scenarios: low (1.173 €/kg), medium (1.314 €/kg), and high (1.662 €/kg) pork prices. Optimizing
26 only feeding strategies improved the gross margin per pig by 5.0% while optimizing shipping
27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

strategies improved the mean gross margin per pig by 4.7%. Optimizing both feeding and shipping strategies improved the gross margin per fattened pig by 10% (2.88 €/pig, with medium pork price (1.314€/kg)) compared to the common practice on farms in France. Pork price had a limited effect on feeding decisions when optimized alone, but a strong impact on shipping decisions. Economic optimization of pig fattening inconsistently affected the environmental impacts. However, increasing pork price improved the optimized mean gross margin per pig but increased all environmental impacts. To our knowledge, this is the first tool able to optimize both feeding and shipping strategies while considering effects of variability in growth potential among a batch of pigs. These features allow consideration of the interaction effect of feeding and shipping strategies on the economic outputs of the batch, and investigation of the trade-off between production cost and technical performance. This tool should interest the pig sector since it can identify the best feeding and shipping strategies depending on the economic context. Further work should consider multiobjective optimization with both economic and environmental objectives.

# 1. Introduction

The world population is expected to reach 9.8 billion by 2050, an increase of 20 percent from today (FAO, 2017). Coupled with an improving standard of living in developing countries, this will increase demand for animal products by 50% (FAO, 2017). The expected growth in animal production raises many concerns about its short and long-term effects. Pork is the most consumed meat in the world. It accounts for 39% of the world's meat intake in 2015 (OECD/FAO, 2016) and its demand is increasing (+37% expected over the period 2010-2050).

Pig production contributes to various environmental impacts, like climate change, acidification, and eutrophication (McAuliffe et al., 2016). Fattening pigs contribute to 70% of total phosphorus (P) and nitrogen (N) excretions on farrow-to-finish farms (Dourmad et al., 1999), and therefore to environmental impacts of pig production. In the past decade, European market prices of pigs and raw ingredients used in pig feeds began to vary greatly. Consequently, the profitability of pig-fattening
53

units has remained unstable. This new volatile context likely affects the optimal feeding strategy and
optimal delivery of pigs to the slaughterhouse.

54

55

The pig-fattening unit, which is the main contributor to environmental impacts of pig production,
represents the majority of pig production costs (Pomar and Remus, 2019) and its profitability depends
largely on market prices of pig carcasses and feed ingredients (Pourmoayed et al., 2016; AHDB,
2018). Farmers receive revenue from delivering pigs to the slaughterhouse when pigs reach a
marketable weight or when the fattening room must be emptied in the “All-in All-out” management
system (Plà-Aragones and Rodríguez-Sánchez, 2015). In most European countries, the revenue from
each pig depends on carcass weight and carcass leanness, which are assessed by a payment grid.

56

57

58

59

60

61

62

Carcass weight resulting in a premium or a discount (per kg of carcass weight) is achieved at a
different fattening duration for each pig in the batch. This is due to variability in feed intake and
potential for body protein deposition among pigs. Feeding costs depend on the price of feeds and the
total consumption of each pig, which also varies among pigs and depends on the ability of the feeding
strategy to meet the pigs' nutritional requirements. In practice, for a given pig, extending the fattening
duration increases both carcass weight and feeding costs but decreases carcass leanness. Depending
on each pig's potential, the feeding strategy, and the market price, extending fattening duration may
decrease or increase the gross margin (Leen et al., 2018). In the meantime, extending the fattening
duration increases environmental impacts. The gross margin per pig, feeding costs and environmental
impacts can thus vary considerably depending on the feeding program. Therefore, interactions
between feeding programs, the delivery of pigs to the slaughterhouse, and the variability in pig growth
performance largely determine the profitability of the pig-fattening unit and the consequences of the
production on the environment; however, they are difficult to predict. The purpose of this study was
to account for these interactions when optimizing the economic output of a batch of pigs.

63

64

65

66

67

68

69

70

71

72

73

74

75

76

The scientific community has focused on the nutritional requirements of growing pigs for energy and
amino acids (van Milgen et al., 2008; Van Barneveld et al., 2018). Nutritional requirements vary
greatly among pigs and change over time during the fattening period. Most pigs on commercial farms

77

78
receive no more than two or three successive feeds in the fattening unit. Brossard et al. (2014) highlighted that regardless of the number of feeding phases, the percentage of pigs that have their digestible lysine requirements (i.e. the most limiting amino acid in the diet) met at the start of each phase is essential for the profitability of the unit. Given the complexity of the pig-fattening unit system, optimizing feeding and shipping strategies requires 1) predicting the variability in performance among pigs depending on the feeding strategy and 2) predicting deliveries to the slaughterhouse depending on a target weight.

Effects of feeding and shipping strategies on animal performance and the economic return of the pig-fattening unit have received substantial attention. They have been tested extensively via experiments (Conte et al., 2011; Pomar et al., 2013; Andretta et al., 2016; López-Vergé et al., 2018) and simulation models (Ali et al., 2018; Cadero et al., 2018a; Peña Fernández et al., 2019). However, experiments provide few insights into optimal strategies and simulation models compare scenarios that are not necessarily optimal.

Previous studies have addressed the issue of economic optimization of pig-fattening units (Morel et al., 2012; Nadal-Roig et al., 2018; Leen et al., 2018) and broilers (Gous and Berhe, 2006). Most studies focused on optimizing pig deliveries to the slaughterhouse (Nadal-Roig et al., 2018; Leen et al., 2018; Kristensen et al., 2012) or optimizing the nutrients in feeds (e.g., energy and digestible lysine, Morel et al., 2012). Some studies also focused on feed formulation in the context of multiphase feeding (Joannopoulos et al., 2015; Joannopoulos, 2018). Morel et al. (2012) used a stochastic growth model that was sensitive to the feeding program to optimize feeding strategies and included the variability in growth performance. To our knowledge, only Niemi (2006) addressed optimization of feeding and shipping strategies. However, the model developed by Niemi (2006) was based upon an average pig performance and without the variability in growth performance. This is a major drawback, because there is an interaction effect of the variability in growth potential among pigs, and feeding and shipping strategies on the technical and economic performance of the pig-fattening unit (Cadero et al. 2018a).
Given this context, the main goals of the present study were to investigate 1) the effect of the interactions between feeding and shipping strategies when optimizing the gross margin of a batch of growing pigs, and 2) the effect of pork price on optimal feeding and shipping strategies. For that purpose, we considered (for the first time) the variability in performances among pigs in an optimization model of a batch of pigs. In this article, we describe the model and the optimization procedure, and explore their behavior with different case studies.

111

## 2. Materials and methods

In this section, we first provide a general overview of the bioeconomic model. Next, we describe the complex features that make the optimization challenging and justify our optimization approach. Then, we explain how we explore the behavior of our model and the applications performed.

### 2.1 General overview of the bioeconomic model

This study couples a bioeconomic model of the pig-fattening unit adapted from Cadero et al. (2018a) with an optimization procedure that considers an objective function (i.e., mean gross margin per pig), to optimize feeding and shipping strategies (Figure 1). The bioeconomic model is a discrete-event mechanistic model that considers farm data and biological traits such as pig feed intake, growth potential, and mortality rate while addressing the stochastic nature of the pig production system. The main entities in the pig-fattening system represented are the batch of pigs, farm management, and farm infrastructure. Pig growth is represented using an individual-based model adapted from the InraPorc model (van Milgen et al., 2008). In this model, each pig is defined by a biologic profile that is used to calculate its growth and nutrient excretion depending on the feeding program. Five parameters are used to describe the pig profile: initial body weight, the two parameters in the equation for feed intake, average protein deposition between 70 days of age and 110 kg body weight (BW), and the shape parameter of the Gompertz function that describes the precocity of protein deposition. In the model, we use a database, which includes 1000 male and 1000 female pig profiles (characterized by individual growth and feed intake potentials). To create a batch of pigs, by default,

105

106

107

108

109

110

112

113

114

115

117

118

119

120

121

122

123

124

125

126

127

128

129

130
the model selects randomly from this database the same number of males and females to generate the appropriate variability within the pig herd. The model can be run either with all pigs characterized by the same average pig profile or with individual pig profiles taken at random within a set of 1000 male and 1000 female pig profiles (Brossard et al., 2014). These values for each pig are set according to the profile of the average pig and a variance-covariance matrix of the parameters to generate the appropriate variability within the pig herd (Vautier et al., 2013). Farm infrastructure consists of fattening rooms, with a number of pens of a given size in each room, and possibly a buffer room to extend the fattening duration of light pigs. This information is provided as input parameters of the bioeconomic model. Farm management includes batch management, allocation of pigs to pens, feeding practices, and shipping practices to send pigs to the slaughterhouse, as well as a calendar of events containing tasks to perform.

In this model, feeding strategies combine a series of feeds in a feed sequence plan, a feed rationing plan, and a level of application. Feeds are described by their nutrient contents and formula (i.e. incorporation rates of each ingredient). The feed sequence plan describes which feed or which blend of feeds is distributed in each feeding phase of the sequence, and provides rules to shift from one feeding phase to the next. The feed rationing plan defines the quantity of feed distributed per pig for each day of the fattening period. The feeding strategy, as defined in the model, also includes a level of application of the feed sequence and feed rationing plans (batch, pen, or individual pig).

In the model, shipping strategies are defined by the target weight at slaughter, the maximum fattening duration, and the maximum time that pigs are kept in the buffer room, when applicable. Target weight at slaughter is used to determine whether a pig is ready to be sent to the slaughterhouse. Once a week, the model compares the weight of each pig in the whole batch to the target weight. If any pig from any pen reaches the target weight, it is selected for shipment to the slaughterhouse (individual marketing). The maximum fattening duration depends on batch management and determines the date that fattening rooms must be emptied. In order to clean and disinfect the room before the arrival of a new batch, all pigs must be sent to the slaughterhouse or the buffer room. It means that the latest day
of a possible delivery of the batch to slaughterhouse corresponds to the maximum fattening duration minus the duration of the cleaning period. The maximum time that pigs are kept in the buffer room determines the date that the buffer room must be emptied. On most farms, light pigs are not transferred to the next batch. It is even highly recommended not to do this because of the high sanitary risk of contamination of the next batch. They are either delivered to the slaughterhouse or sometime transferred to a buffer room, but this is not the most usual practice. Indeed, the necessity of a buffer room depends on the adequation between batch management and the number of fattening rooms in a given unit. In our case, we considered a maximum fattening duration of 108 days, which corresponds to the usual practice in France (Cadero et al., 2018a). Therefore, we did not account for a batch with a buffer room but the model has the ability to handle it. The presence or absence of a buffer room is an input parameter of the model.

The minimum number of pigs detected ready to be sent to the slaughterhouse to schedule a shipment was set to 1 because we considered that a truck is not only filled with pigs from a single batch but with pigs from the whole unit. However, we only allowed a maximum of one delivery per week to get a flow of deliveries consistent with what was observed in a previous study (Cadero et al., 2018c).

The bioeconomic model produces technical results for each pig on a daily basis and throughout the fattening period. These outputs are then used to calculate the economic results and environmental impacts per kg of pig live weight gain according to life cycle assessment (LCA) approach (Cadero et al., 2018a). The perimeter of the environmental evaluation includes impacts from the extraction of raw ingredients for crop production used for feeds, up to the farm gate. Potential impacts of the pig-fattening unit on climate change, eutrophication potential, acidification potential, cumulative energy demand, and land occupation were also calculated. Finally, the results for each individual pig were aggregated to calculate technical, economic, and environmental results at the whole-batch level. The model is described in more detail by Cadero et al. (2018a) (Figure 1).
## 2.2. Definition of the optimization problem

The model developed by Cadero et al. (2018a) is a simulation model, which is not able to find optimal feeding and shipping strategies in different economic contexts. Consequently, the present study developed an optimization procedure that overcomes this missing feature, maximizes the economic performance of a batch of pigs, and identifies the best feeding and shipping strategies in a given economic context.

The optimization procedure attempts to maximize the objective function, which is the mean gross margin per fattened pig by optimizing the feeding and shipping strategies:

$$Obj(X, \alpha, TW, Max_d) = \frac{1}{I} \sum_{i=1}^{I} \sum_{g=1}^{3} GM_{ig}(X, \alpha, TW, Max_d). \quad (1)$$

In this optimization problem, we consider a feeding sequence of $p$ phases that uses two feeds, A and B which are mixed in variable proportions at each phase. In this context, feed A has high nutrient density to meet requirements at the start of the fattening period, while feed B has low nutrient density. The shipping strategy focuses on optimizing the decision to send pigs to the slaughterhouse up to the emptying of the fattening room (the use of a buffer room is not considered). The decision variables (Table 1) are as follows:

- Pig weight at the diet change for each phase $p$, $X = (x_1, x_2, x_3 ... x_{p_{m-1}})$, where $x_p$ is the average pig live weight at which phase $p$ is shifted to phase $p+1$

- Percentage of feed A in each phase $p$, $\alpha = (\alpha_1, \alpha_2, \alpha_3 ... \alpha_{p_m})$, where $\alpha_p$ is the percentage of feed A in a blend used during phase $p$

- Target slaughter weight $TW$, which is the minimum live weight of a pig ready for slaughter. Pigs that have reached the target weight are selected for shipment to the slaughterhouse (individual marketing). Pigs that have not yet reached the target weight are kept until the next shipment, unless the maximum fattening duration has been reached.

- Maximum fattening duration ($Max_d$) which is the maximum allowed duration including cleaning and disinfecting time before the arrival of a new batch of pigs. When the maximum fattening duration is reached, all remaining pigs are sent to the slaughterhouse in the next shipment. Light
pigs that have not reached the target weight at the maximum fattening duration result in a lower payment.

## 2.3. Mathematical formulation of the bioeconomic model

To capture the complexity of the system studied, the simulation of each pig is not independent of one another because 1) pigs are allocated to pens by weight at the start of the fattening period, i.e. there are pens of light pigs and pens of heavy pigs. Consequently, pigs from the same pen are fed the same way (pigs stay in the same pen during all the period), but it differs at any given time between pens (when the average live weight of pigs in the pen equals pig weight at the diet change, the model moves to the next feeding phase); 2) the model incorporates a density function, which affects growth when the animal density in the considered pen is above a threshold.

Here, we present only the mathematical elements necessary to understand the optimization procedure.

Tables 2, 3, and 4 provide indices, inputs, and quantities used in the bioeconomic model, respectively.

The gross margin obtained from pig i of sex g is calculated as the selling price of pig i of sex g minus cost of piglet i of sex g minus feeding cost of pig i of sex g (Eq. 2):

$$GM^{ig}(X, \alpha, TW, Max_d) = FSP^{ig}(X, \alpha, TW, Max_d) - PGC^{ig} - FC^{ig}(X, \alpha, TW, Max_d). \quad (2)$$

The feeding cost of pig i of sex g results from the cost associated with the consumption of feeds A and B in each phase of the sequence (Eq. 3):

$$FC^{ig}(X, \alpha, TW, Max_d) = \sum_{p=1}^{p_m} \left[ \sum_{d \in D_p^{ig}(X)} q_d^{ig} (\alpha_p * z_{p,1} + (1 - \alpha_p) * z_{p,2}) \right], \quad (3)$$
where:

$$D_1^{ig} = \{d: LW_d^{ig} < x_1\},$$

$$D_p^{ig} = \{d: x_{p-1} \le LW_d^{ig} < x_p\}, \quad 2 \le p \le p_{m-1},$$

$$D_{p_m}^{ig} = \{d: TW > LW_d^{ig} \ge x_{p_{m-1}}, d \le Max_d\} \cup \{d: d_{TW}^{ig} < d < \min(d_s(d_{TW}^{ig}), Max_d)\}.$$

where $D_p^{ig}$ is the vector of days belonging to the feeding phase $p$ ($p = 1...p_m$) for pig $i$ of sex $g$, $d_{TW}^{ig}$ is the day on which pig $i$ of sex $g$ reaches the target weight (TW), and $d_s(d_{TW}^{ig})$ is the day of the next
shipment following $d_{TW}^{ig}$. Feed intake ($q_d^{ig}$) is modeled as a gamma function of NE requirements for maintenance. This calculation is part of the InraPorc model included in the present model and described in details by van Milgen et al. (2008).

If the pig dies during the fattening period, its selling price equals zero. If not, the pig is slaughtered, and a premium or discount is added to the market price per kg of carcass weight. The premium or discount (ranging from -0.70 to 0.19 €/kg carcass weight) is determined from the carcass weight and lean percentage of pig i of sex g using a payment grid (Table S4 in Supplementary Material). This payment grid, which is described with threshold values to set the premium or discount, is a major source of discontinuity of the objective function. The selling price of pig i of sex g per kg of carcass weight is based on market price and the premium or discount. The carcass price paid to the farmer is based on the selling price $SLP^{ig}$ and cold carcass weight $CCW^{ig}$ (Eq. 4):

$$FSP^{ig}(X, \alpha, TW, Max_d) = SLP^{ig}(X, \alpha, TW, Max_d) * CCW^{ig}(X, \alpha, TW, Max_d). \quad (4)$$

The cost of piglet i of sex g at the entrance of the fattening unit is based on a fixed cost and an additional cost that depend on piglet weight:

$$PGC^{ig} = PP + ADP^{ig}(ILW^{ig}). \quad (5)$$

In our model, transportation cost is not included. Indeed, in France, most of the farms belong to a producer association that manages the transport of pigs to slaughterhouse. In this case, a single truck can get pigs from various farms. Transportation cost is supported by the producer association. There are some articles in the literature dealing with transportation cost in the objective function (Nadal-Roig et al., 2018; Nadal-Roig et al., 2019), but this is relevant for supply chain management problems with an integrator. Therefore, in this case, the objective function is about maximizing the profitability of the integrator itself and not for a single batch. The model is described in more detail in Supplementary Material (Tables S1 and S2).

## 2.4. Optimization approach

The optimization approach was developed to address two issues in the optimization of the bioeconomic model. The first issue was finding an appropriate algorithm to optimize the objective
function, which is discontinuous, non-convex, nonlinear, and multimodal (Leen et al., 2018; Dooyum et al., 2018; Accatino et al., 2019; Peña Fernández et al., 2019). The properties of the optimization function result mainly from the variability in pigs' biological characteristics, the occurrence of discrete events such as deliveries of pigs to the slaughterhouse, the stochasticity related to pig mortality, and the payment grid. An objective function with these features may have a large number of local optima, with the global optimum located near the local optima but in an area smaller than the entire search space (Hansen and Kern, 2010). In this situation, a global optimization algorithm is needed to prevent convergence towards the local optima (Dooyum et al., 2018). The second issue was to decrease the number of functions evaluations during optimization. Since the bioeconomic model simulates the growth of each pig for each day, the pig-fattening unit model requires large amounts of computational time (Cadero et al., 2018b), and running an optimization with it could take a long time. In this case, applying exact methods is not appropriate because they are extremely time-consuming processes (Jourdan et al., 2009; Puchinger and Raidl, 2005).

In order to model problems in pig farming systems, non-exact optimization algorithms have already been used (Morel et al., 2012; Lehmann et al., 2013; Britz and Kallrath, 2012; Accatino et al., 2019; Teillard et al., 2016; Groot et al., 2010; Groot and Rossing, 2011; Alexander et al., 2006). Among different evolutionary algorithms, the covariance matrix adaptation evolution strategy (CMA-ES) was chosen due to its ability to reach an excellent performance on the accuracy, its efficiency, and faster computing speed to deal with non-convex problems compared to other approaches (Hansen, 2006; Hansen and Kern, 2010). CMA-ES belongs to the family of genetic algorithms (Holland, 1973). In CMA-ES, the multivariate normal distribution used to sample potential solutions is used as the mutation operator, and a covariance matrix is used to reach regions with expected lower objective values. Therefore, any result obtained from CMA-ES is a pseudo-optimum or a good-enough approximation to the optimum as CMA-ES is a non-exact optimization method. The model is available open access on the Datainrae data warehouse (https://doi.org/10.15454/OWJJUU).

## 2.5. *Model behavior and application*
Multiple analyses were performed using the bioeconomic model coupled with the optimization procedure aiming at 1) investigating the effect of the variability in pig growth performance, 2) providing practical recommendations on how to use the optimization procedure, 3) illustrating the potential of the optimization procedure to improve the profitability of a batch of pigs in a given economic context, and 4) highlighting effects of pork price on optimal feeding and shipping strategies (Table 5). To this end, optimization of a single batch without mortality rate was considered to reduce the complexity of the problem and the computational time. Market prices for both pork and feed ingredients are exogenous in the model. They are given as an input, with a single value for each, referring to a given economic context. We used mean feed and pork prices over 2 years (2016 and 2017). The years 2016-2017 are medium situation for pork price (1.314 €/kg carcass whereas in 2019 it moved from 1.1 to 1.7 €/kg), and low feed price situation compared to 2014 (Notes de conjoncture Aliment IFIP, 2016; Marché du Porc Breton, 2017). Further description of inputs common to all case studies is available in Table S3 in Supplementary Material.

*Definition of different case studies.* All feeding strategies were based on feed A and feed B, which were formulated on a least-cost basis to contain 9.75 MJ NE/kg and to meet 110% and 90% of the average SID lysine requirement of female pigs at 30 and 120 kg BW, respectively. This approach resulted in 1.05 and 0.47 g SID lysine/MJ NE in feed A and B, respectively (diet composition and economic data for feeds A and B are shown in Table S5 in Supplementary material). The supply of essential amino acids other than lysine met or exceeded ratios of the ideal protein profile. Feeds were formulated through a least-cost linear programming prior to the optimization procedure. Therefore, the feeds are inputs of the model.

Two case studies were first simulated to be considered as baselines representative of situations on commercial farms:

- Reference one-phase R-1 in which a single-phase feeding strategy was simulated with feed A supplied throughout the entire fattening period.
299 - Reference two-phase R-2, in which a two-phase feeding strategy was simulated with Growing (G) and Finishing (F) diets based on feeds A and B. Diet G (feed A only) was fed in the first phase from 70 days of age until a mean BW of 65 kg. In the second phase, diet F, supplied from 65 kg BW to the end of the fattening period, provided 0.76 g SID lysine/MJ NE, corresponding to 110% of the mean requirement at 65 kg BW. Diet F was obtained by mixing 54.7% of feed A and 45.3% of feed B (Figure 2). This case study corresponds to a typical two-phase feeding strategy used in practice in France (AGRESTE, 2008).
300
301
302
303
304
305

306 Six case studies were obtained through optimization using different sets of decision variables. The
307 purpose of the different case studies was to investigate interactions between feeding and shipping
308 strategies. For that reason, we first considered feeding and shipping strategies separately using
309 different case studies. Then, we considered both strategies simultaneously (Table 6):
310

310 - Feeding case study F-1 (objective function (decision variables): `Obj(α₁)`), in which a single-phase feeding strategy is optimized by mixing two feeds with low and high nutrient contents, respectively. The decision variable is the percentage of the first feed (α₁).
311
312

313 - Feeding case study F-2 (objective function (decision variables): `Obj(x₁)`), in which pig weight at the diet change (x₁) is optimized in a two-phase feeding strategy that used diets G and F.
314

315 - Feeding case study F-3 (objective function (decision variables): `Obj(x₁, α₁, α₂)`), in which a two-phase feeding strategy is obtained by mixing feeds A and B. The percentage of feed A in the first phase (α₁) and the second phase (α₂) are optimized, as is pig weight at the diet change (x₁) (three decision variables). This case study addresses all the decision variables for the feeding strategy.
316
317
318
319

320 - Shipping case study S-1 (objective function (decision variables): `Obj(TW, Maxₐ₉`)), in which
321 the shipping strategy is optimized in a two-phase feeding strategy that used diets G and F. This
322 case study explores when pigs must be sent to the slaughterhouse since over- and under-weight
323 pigs affect the gross margin.
324
324 - Feeding and shipping case study FS-1 (objective function (decision variables):
$Obj(x_1, \alpha_1, \alpha_2, TW)$) in which a two-phase feeding strategy is obtained by mixing feeds A and
325 B, with four decision variables. Three decision variables are the same as those in F-3, and the
326 fourth is the target weight at slaughter ($TW$). This new decision variable addresses the trade-
327 offs among the increase in feed cost when keeping pigs longer, the risk of decreasing the
328 premium per kg of carcass, and the potential increase in the selling price when shipping heavier
329 pigs.
330

331 - Feeding and shipping case study FS-2 (objective function (decision variables):
$Obj(x_1, \alpha_1, \alpha_2, TW, Max_d)$), in which a two-phase feeding strategy is obtained using feeds A
332 and B, with five decision variables. Four decision variables are the same as those in FS-1, and
333 the fifth is the maximum fattening duration ($Max_d$), which specifies when the fattening room
334 must be emptied (i.e., all remaining pigs must be sent to the slaughterhouse). Increasing $Max_d$
335 extends the fattening of light pigs. This case study will optimize both feeding and shipping
336 strategies and all five decision variables.
337

338 Parameterization of the optimization procedure. All case studies that included the same decision
339 variables used the same initial points for the CMA-ES algorithm: 50 kg for live weight at the diet
340 change ($x_1$), 80% of feed A in the first and second phases ($\alpha_1, \alpha_2$), 120 kg for target weight ($TW$),
341 and 108 days for the maximum fattening duration ($Max_d$). The criterion for stopping the iterations
342 was the function tolerance. Iterations end when the range of the values of the best objective function
343 of the last $10+4n$ ($n$ is the number of decision variables) generations and all function values of the
344 current generation are lower than the function tolerance. The default value of the CMA-ES algorithm
345 ($10^{-12}$) was used for the results presented below. However, due to the limitation of function values to
346 the second digit after the decimal point, the shape of the function, and the averaging performed for
347 different choices of a set of pig profiles (different seeds of the pseudo random draw of the profiles),
348 similar results are obtained with a less precise tolerance ($10^{-6}$, see Table S6 in Supplementary
349
350

Material). The optimization procedure was coded in Python 3.7 and run on an Intel Core i5 CPU (3.40 GHz).

351
352
353
354
355
356

*Analyses performed.* Four sets of analyses were performed (Table 5). The first explored model properties. Since the variability in performance among pigs was assumed to generate discontinuity in the objective function, we simulated case studies F-1 and F-2 with 10 or 400 pigs (which is the mean size of a batch in France), while using either the same average pig profile for all pigs or randomly choosing a different profile for each pig to generate the appropriate variability within the pig herd, as described by Cadero et al. (2018a).

357
358
359
360
361
362
363
364
365
366
367
368
369
370
371

The second set of analyses provided practical recommendations for running an optimization (i.e., defining the number of random seeds (i.e. numbers used to initiate pseudorandom-number generator) and the number of pigs per batch needed to run an optimization). To this end, we investigated the trade-off between the reliability of results and the computational time by varying the number of pigs per batch from 10 to 400 in F-2 and F-3. For each batch size, we used 60 different seeds to select different sets of pig profiles to generate as much variability in the results as possible. Python *random.seed* method was used to generate a pseudo-random number for selecting different sets of pig profiles. Each seed value corresponds to a sequence of generated values for a given random number generator. For this stage, 60 different seed values for each case study (F-2 and F-3) and for each number of pigs (10 up to 400 pigs) were chosen randomly. Effects of the number of pigs on the mean gross margin per pig and the computational time were analyzed using a one-way analysis of variance (ANOVA). The post-hoc Tukey Honestly Significant Difference (HSD) test was used to identify a significant difference between means at a significance level of 5%. We also investigated the effect of the number of seeds and the number of pigs in the simulated batch on the coefficient of variation (CV) of the gross margin.

372
373
374

The third set of analyses illustrated the ability of the optimization procedure to improve the profitability of pig-fattening units. It also provided the environmental impacts of the production associated with each case study. All reference case studies (R-1 and R-2) and optimization case
375
376
377

studies (F-1 to FS-2) were run with the number of seeds and the batch size recommended from the second set of analyses. For each case study, the same sequence of generated values issued from a given seed number was used.

378
379
380
381
382
383
384
385
386
387
388
389
390
391

The fourth set of analyses explored the effect of pork price on the mean gross margin per pig and optimal feeding and shipping strategies. We assumed that farmers have the possibility of buying feeds and selling pigs in advance (with forward or futures contracts) and these prices are fixed for a batch of pigs. However, pork price will change over the year and will be different for the next batch of pigs. Therefore, we considered three different pork prices representing low (1.173 €/kg), medium (1.314 €/kg, the one used in the first three sets of analyses), and high price (1.662 €/kg) situations. These values were mean values of pork price over May to July 2018 (1.173 €/kg), years 2016-17 (1.314 €/kg), and August to October 2019 (1.662 €/kg). For each pork price, R-2 and optimization case studies F-3, S-1, FS-1, and FS-2 were run with the same number of seeds and same batch size as those in the third set of analyses. Effects of all case studies (optimized and simulated) on mean gross margin per pig, decision variables, computational time, and technical outputs were tested with a one-way ANOVA. We again used the post-hoc Tukey HSD test to identify a significant difference between means at a significance level of 5%.

392

## 3. Results

393

### 3.1 Exploration of model properties

394
395
396
397
398
399
400

The effect of the percentage of feed A in the diet on the mean gross margin per pig was explored in F-1 (Figure 3). As we expected, without variability among pigs, the response of the gross margin to the percentage of feed A in the diet was not affected by the number of pigs per batch (10 vs. 400) in the simulation. A jump discontinuity occurred, however, when the percentage of feed A increased from 30.3% (point Q in Figure 3, with mean gross margin of 28.39€/pig) to 30.4% (point P in Figure 3, with mean gross margin of 30.17€/pig). In both case studies, all pigs were kept on the farm until the end of the fattening period, since no pig reached the required live weight at slaughter. The
401

corrected lean percentage for each pig was 61.01% for point Q and 60.99% for point P. Thus, different premiums were obtained according to the payment grid (Table S4). This discontinuity was due to the difference between premiums in the two case studies. By including the biological variability among pigs, the response of mean gross margin per pig to the percentage of feed A was clearly discontinuous for the simulation with 10 pigs. Increasing the number of pigs (400 pigs), however, reduced discontinuity.

402

403

404

405

406

407

The effect of the live weight at the diet change on the mean gross margin per pig was explored in F-2 (Figure 4). Without variability among pigs, the response of gross margin to live weight at diet change was nearly continuous and again not influenced by the number of pigs in the simulation. The optimum live weight at diet change was 47 kg for both sizes of the batch. When simulating 10 pigs and considering biological variability among them, the response of gross margin to live weight at diet change was clearly discontinuous. Discontinuity was dramatically reduced with 400 pigs in the simulation. The gross margin was always lower with variability among pigs than without variability among pigs, and the gross margin had many local optima when simulating 10 pigs (Figures 3 and 4).

408

409

410

411

412

413

414

415

## 3.2 Providing users' recommendations

416

In F-2, the number of pigs per batch did not influence the mean gross margin per pig (Figure 5). However, increasing the number of pigs in the batch reduced the standard deviation, and decreased the difference between the mean and median, of the gross margin. Although increasing the number of pigs provided more consistent results, it also required longer computational time (Figure 6). Moreover, the variability in computational time increased significantly (p<0.05) with the number of pigs in the batch (Figure 6).

417

418

419

420

421

422

In F-3, the number of pigs per batch did not influence the mean gross margin per pig (p>0.05). Optimizing three decision variables required 2.5 fold as much computational time as was required to optimize one decision variable in F-2. In F-3, increasing the number of pigs reduced the CV of the optimized gross margin and increased (p<0.05) computational time (Figures 8 and S1 and S2 in supplement material).

423

424

425

426
427

In F-3, regardless of the number of seeds, the CV of gross margin decreased exponentially from 14-16% to a minimum of 2% as the number of pigs increased, and the mean gross margin stabilized when the batch contained at least 200 pigs (Figure 7). Moreover, no significant differences were observed in the means of decision variables obtained with more than 20 seeds and 200 pigs (P>0.05). Consequently, the third set of analyses was performed with 20 seeds and 200 pigs per batch.

428

429

430

431

432

### 3.3 Model potentials

433

Table 7 compares the mean gross margin per pig, decision variables, and technical outputs obtained in the simulation and optimization case studies. With a one-phase feeding strategy, optimizing the percentage of feed A in the blend increased the gross margin by 4.0 €/pig (29.28 €/pig in F-1 vs. 25.26 €/pig in R-1). It also decreased the percentage of feed A (49% in F-1 vs. 100% in R-1) and the mean slaughter weight (115.1 kg/pig in F-1 vs. 116.1 kg/pig in R-1).

434

435

436

437

438

With a two-phase feeding strategy, optimizing pig weight at the diet change (F-2) increased the gross margin by 0.9 €/pig compared to R-2, while it decreased pig weight at the diet change from 65 kg to 38 kg. The number of decision variables increased from one to five when comparing F-2 to FS-2.

439

440

441

Each increase in the number of decision variables increased the gross margin per pig (from 29.3 €/pig in F-2 to 31.3 €/pig in FS-2) and the computational time (from 11.3 min in F-2 to 53.7 min in FS-2).

442

443

When optimizing only the feeding strategy (F-2 and F-3), mean slaughter weight remained nearly stable and did not differ significantly from that in R-2. Optimizing only the shipping strategy (S-1) increased the selling price and feed cost (€/pig). Optimizing both feeding and shipping strategies reduced the dietary digestible lysine content by 10-15% in FS-1 and FS-2 compared to that in R-2. In FS-1, optimizing the target slaughter weight yielded a mean slaughter weight of 117 kg.

444

445

446

447

448

Consequently, revenue from selling pigs and the gross margin improved. In FS-2, optimizing the maximum fattening duration increased mean slaughter weight by an additional 3.7 kg, revenue per pig, and the resulting gross margin. The optimized percentages of feed A in phases 1 (from 69.4% to 72.8%) and 2 (from 40.2% to 46.8%) and pig weight at the diet change were stable in F-3, FS-1, and

449

450

451
452 FS-2. The mean gross margin per pig increased much more when optimizing both feeding and shipping strategies (FS-1 and FS-2) than when optimizing just one strategy.
453

454 Table 8 compares the environmental results obtained in the simulation and optimization case studies.
455 With a one-phase feeding strategy, climate change (-8%), acidification (-13%), eutrophication (-11.5%), and cumulative energy demand (-13.5%) decreased in F-1 compared to those in R-1 (p<0.05).
456
457 However, land occupation increased (3.84 m² year in F-1 vs. 3.72 m² year in R-1). With a two-phase feeding strategy, optimizing either the feeding strategy or both feeding and shipping strategies (F-2 up to FS-2) reduced the environmental impacts except land occupation. Conversely, when optimizing only the shipping strategy (S-1), all impacts increased compared to those in R-2 (p<0.05).
458
459
460

461 3.4 Level changes in pork price

462 Figure 8 shows effects of pork price on the mean gross margin per pig and technical outputs obtained
463 in R-2, F-3, S-1, FS-1, and FS-2 strategies. Relative benefit (calculated as the mean gross margin of
464 each optimization case study minus the mean gross margin of R-2) from optimization increased with
465 increasing pork price except for F-3. Indeed, when increasing pork price, the revenue from selling
466 pigs in R-2 increased more than that in F-3 because slaughter weight in F-3 was lower than that in R-
467 2. Figure 9 shows the effects of pork price on decision variables obtained in the various case studies.
468 Optimizing only the shipping strategy (S-1) increased the target weight and maximum fattening
469 duration, which increased slaughter age and weight. Therefore, S-1 had the highest feed cost (€/pig).
470 The optimization procedure in FS-1 increased the percentage of feed A in both phases. However, pig
471 weight at the diet change decreased as pork price increased. As a result, feed cost (€/pig) and slaughter
472 weight remained rather stable with increasing pork price. The pork price had effects on slaughter
473 weight, premium, and feed cost (€/pig) only when optimizing the maximum fattening duration (S-1
474 and FS-2). Relative benefit increased much more when optimizing both feeding and shipping
475 strategies (FS-1 and FS-2) than when optimizing just one strategy.
476

476 Figure 10 shows the variation of gross margin and environmental impacts according to pork price in
477 FS-2, i.e. the trade-off between economic and environmental outputs. With medium pork price
478

(1.314€/kg), environmental impacts remained stable relatively to the low pork price situation (1.173 €/kg) while gross margin increased by 18%. With high pork price (1.662 €/kg), all environmental impacts increased compared to those in low pork price (1.173 €/kg) situation, by 1.5% to 2.7%: climate change (2.1%), acidification (2.7%), eutrophication (2.6%), cumulative energy demand (1.5%), and land occupation (2.3%).

479

480

481

482

483

484

# 4. Discussion

485

486

487

488

489

490

491

492

493

494

495

496

The objective of this study was to develop a bioeconomic model for the optimization of feeding and shipping strategies for a batch of fattening pigs in order to maximize profitability. We used an individual-based growth model to consider the variability in performance among pigs. To this end, the model developed by Cadero et al. (2018a) was used. However, the bioeconomic model of Cadero et al. (2018a) was a simulation model, which does not allow us to find the optimal feeding and shipping strategies. Therefore, advantages of the present model are to 1) maximize the economic performance of a batch of pigs, and 2) identify the best feeding and shipping strategies in a given economic context. Our approach considers both strategies and the variability in pig growth performance simultaneously, which was not previously made in the literature (Niemi (2006) only used an average pig growth model). However, the optimization process with such a model is challenging because of the complexity of decisions and discontinuous nature of the objective function.

497

498

499

500

501

502

In the next sections, **we discuss ability** of the model to simulate the effect of variability among pigs and its added-value. We provide practical recommendations on the use of the optimization procedure in the bioeconomic model (number of pigs, number of seeds). Then, we evaluate its potential to identify optimal strategies that improve the profitability of a batch of pigs. We also discuss how the level of pork price modifies the optimal feeding and shipping strategies. Last, we analyze the consequences of economic optimization on the environmental impacts of pig production.

503

## 4.1. Ability of the model to simulate the effect of variability among pigs
The first set of analyses using the optimization procedure highlighted the discontinuous nature of the mean gross margin per pig depending on the decision variables, and the relevance of variability among pigs in the model to simulate the economic outputs of the batch. This discontinuity of the objective function results from the various factors and processes modeled: 1) the use of the payment grid to calculate the selling price of each pig, 2) the scheduling of deliveries of pigs to the slaughterhouse, and 3) the variability among pigs. The payment grid defines the premium or discount for a given pig according to fixed thresholds for carcass weight and lean percentage. Therefore, a minor change in a decision variable could change the premium or discount for the pig considered and result in discontinuity. We observed this discontinuity of the objective function in the first set of analyses, even if we simulated the bioeconomic model without variability among the pigs (Figure 3).
These results agree with those of Leen et al. (2018) who showed discontinuous evolution caused by carcass payment grid. In the bioeconomic model, deliveries to the slaughterhouse are scheduled once a week according to the farmer's estimate of each pig's live weight and the number of pigs that reached the target slaughter weight. Hence, a minor change in a decision variable can change a pig's weight status, which can delay its delivery to the slaughterhouse for one week.

Without biological variability among pigs, all pigs had the same growth performance and carcass traits and thus were sent together to the slaughterhouse. In this case, one shipment per batch was performed, which is not consistent with the reality of commercial farms, which usually have at least three shipments per batch (Aubry et al., 2016). Considering between-animal variation in the pig growth model resulted in different feeding and shipping practices for each pig and a decrease in the gross margin. These results, already suggested by Cadero et al. (2018a) and Brossard et al. (2009), clearly support the use of a growth model accounting for variability among pigs. Indeed, Figures 3 and 4 show that 1) not considering variability in animal performance results in overestimating economic results, and 2) when considering variability in pig performance, optimal strategies are different from the one obtained with an average pig growth model. For instance in Figure 3, with 400 pigs, the optimal percentage of feed A without variability was between 42.5% and 44%, whereas the
optimal percentage was 51% when considering variability. In Figure 4, with 400 pigs, the optimal pig weight at the diet change without variability was 47 kg, whereas the optimal pig weight at the diet change with variability was 38 kg. These results also agree with those of Conte et al. (2011), Niemi et al. (2010), and Rodríguez-Sanchez et al. (2018), who indicated that the gross margin decreased when animal variability within herds increased. Considering variability among pigs also contributes to the discontinuous nature of the objective function of the bioeconomic model, because the random pig profiles can differ greatly from each other and result in different economic results depending on the decision variables.

Considering variability in performance among pigs at the batch level means that the optimal time of marketing may be different for each pig. Kristensen et al. (2012) considered the optimization of marketing pigs at the pen level. They assumed that the first possible week of slaughter was week 9 after the beginning of fattening. Once a week, they selected *k* heaviest pigs and sent them to the slaughterhouse. In the present study, the shipping strategy is applied over the whole batch of pigs considering the different pens. When the target slaughter weight is not optimized in our approach, the selection procedure of pigs to be slaughtered is rather similar to the one used by Kristensen et al. (2012), unless it is applied at the batch level. Our approach offers the additional opportunity to optimize simultaneously the slaughter target weight. Using a hierarchical Markov decision process, Pourmoayed et al. (2016) also optimized feeding and shipping strategies at the pen level (15 pigs) with different genetic properties of pigs in each pen. They also showed that optimal feeding strategy (time at diet change in a three-phase feeding program) and optimal time at shipping, differed between pens with different genetic potential. Compared to the model from Pourmoayed et al. (2016), the present model offers the possibility to modulate the proportion of each feed in each pen at each phase and predicts the response of pigs to these changes, on the basis of the individual growth model, whereas in Pourmoayed et al. (2016) time series of pig weights and feeding are obtained from online monitoring. Figures 3 and 4 compare optimal strategies at pen level (10 pigs) with those at batch level (400 pigs, 20 pens with 20 pigs per pen). In Figure 3, the optimal percentage of feed A with one pen
556

(10 pigs) was 55.5%, whereas the optimal percentage of feed A was 51% at the batch level (400 pigs).

557

In Figure 4, the optimal pig weight at the diet change was 43 kg at the pen level (10 pigs), whereas the optimal pig weight at the diet change at the batch level (400 pigs) was 38 kg. Since the optimal strategies at the pen level differed from those observed at the batch level, ignoring variability between pens might change optimal feeding and shipping strategies and consequently reduce the profitability of a batch of pigs.

558

559

560

561

562

## 4.2 Application of the optimization procedure

563

The purpose of the second set of analyses was to find the adequate number of pigs and seeds to run the optimization procedure, in order to avoid too much discontinuity in the objective function, to reach acceptable stability and accuracy of predictions, while limiting computational time. Increasing the number of pigs per batch reduces the discontinuity of the objective function because a single pig profile that differs greatly from the average profile has less impact on the batch result when included in a batch of 100 pigs than in a batch of 10 pigs. The decrease in the discontinuity and complexity of changes in the gross margin may be due to averaging effects. As a result, the computational time increased, but the number of functions evaluations decreased. The computational time increased mainly due to simulating the growth of each pig individually. Consequently, it was necessary to analyze relationships between the number of pigs per batch, the number of seeds used to run the optimization, and the variability in mean gross margin per pig. Results of F-2 and F-3 indicated that increasing the number of pigs per batch tended to decrease variability in the gross margin per pig but required longer computational time. The CV of the gross margin per pig remained low and stable with a batch size of 200-400 pigs. The number of seeds had little effect on the mean and CV of gross margin per pig. Optimization with only 10 seeds resulted in a slightly higher CV of mean gross margin per pig (only with 10 pigs), while the mean gross margin per pig differed only slightly from those observed with 20-60 seeds. Consequently, the optimization procedure in future studies should include at least 200 pigs per batch and 20 seeds.

564

565

566

567

568

569

570

571

572

573

574

575

576

577

578

579

580

581

## 4.3 Optimization of feeding and shipping strategies
Results of the third set of analyses highlighted that the economic optimum differs from the technical optimum. This is consistent with other studies observing that maximizing profitability differs from maximizing growth performance, and implies not meeting the nutrient requirements of all pigs (Chiba, 2000; Van Heugten, 2010; Niemi et al., 2010; Pomar and Remus, 2019). R-2 supplied 110% of the mean population requirement in digestible lysine at the start of each phase. This level of lysine meets the requirements of most pigs to express their growth potential, regardless of the economic aspects (Brossard et al., 2009). Optimizing the feeding strategy (F-3); however, decreased the digestible lysine supply (from 10.05 g/kg in R-2 to 8.42 g/kg in F-3 for the first phase, and from 7.62 g/kg in R-2 to 6.95 g/kg in F-3 for the second phase) and also decreased pig weight at the diet change. It increased slaughter age and decreased average daily gain, slaughter weight, and lean percentage. Consequently, feed cost (€/pig) in F-3 was lower than that in R-2. Indeed, satisfying the need of all pigs requires supplying more feed A (rich diet), which is more expensive than feed B (poor diet). These results highlight the trade-off between feed cost and technical performance in the optimization procedure.

When optimizing the target weight in addition to the feeding strategy (FS-1), target weight increased and gross margin per fattened pig improved by 6.84% compared to R-2. However, slaughter weight increased only for fast-growing pigs. Slow-growing pigs were delivered to the slaughterhouse at the end of the fattening duration and resulted in a discount. By optimizing target weight and the maximum fattening duration (FS-2 and S-1), the mean gross margin per pig improved, which is consistent with the results of Leen et al. (2018). This result may be explained by increased slaughter weight and premiums of slow-growing pigs. In the economic context used, extending the fattening duration (FS-2) had a better outcome for the total gross margin per batch. However, the maximum fattening duration is a decision variable, which should be considered with care. On most farrow-to-finish farms, the maximum fattening duration is rather a constraint related to the number of rooms and the batch management system. This means that when performing the optimization, if modifying the maximum fattening duration, the gross margin per pig and per day should be examined as well. Optimizing only
the feeding strategy (F-3) decreased feed cost (€/pig) and slaughter weight while optimizing only the shipping strategy (S-1) increased feed cost (€/pig) and slaughter weight. These results highlighted that the trade-off between reducing feeding cost (feeding strategy) and delivering heavier pigs (shipping strategy) must be considered to benefit fully from the potential of the batch of pigs.

Optimizing feeding and shipping strategies simultaneously provided more benefits for the pig-fattening than optimizing only one strategy. Moreover, optimizing the shipping strategy at the same time modified the optimal feeding strategy, which indicates that the bioeconomic model and optimization procedure also consider the interaction between the feeding and shipping strategies. This is the first time that a bioeconomic model of the pig-fattening unit, coupled with an optimization procedure, was able to optimize both feeding and shipping strategies while also considering the influence of the variability in performance among a batch of pigs. This is of high relevance because:
1) interactions between feeding strategies, shipping strategies, and the variability in pig growth performance largely determine the profitability of the batch of pigs; 2) optimal decisions and gross margin are very different from the one obtained with an average pig growth model. This is one contribution to the literature because most previous models optimized either the feeding (Morel et al., 2012) or shipping strategy (Nadal-Roig et al., 2018; Leen et al., 2018), or both strategies, but with a model of the average pig (Niemi, 2006). However, some of the model's decisions are based on information that might be difficult to obtain on farms. For instance, weights of pigs are required to decide the time of diet change or to forecast pig shipping to the slaughterhouse. In practice, farmers may use weighting scales to sort the pigs before shipping, but this is time-consuming, and most often, they perform visual estimation of body weight. In the same way, there is also some uncertainty on the feed composition. For the future, it could thus be interesting to include this uncertainty in the model. However, thanks to the development of precision farming, this uncertainty should drastically reduce with the use of equipment and sensors providing real-time information on characteristics of pigs and their environment (Vranken and Bermans, 2017).

## 4.4 Effects of pork price on optimal feeding and shipping strategies
Results of the fourth set of analyses allowed us to study the effect of changes in pork price on optimal feeding and shipping strategies. The pork price had a minor impact on decision variables associated with feeding strategies when optimizing only the feeding strategy (F-3). However, when optimizing either shipping or both shipping and feeding strategies, pork price had a major impact on shipping decisions. Indeed, shipping decision variables (*TW* and *Max<sub>d</sub>* ) increased as pork price increased. When optimizing both feeding and shipping strategies (FS-1 and FS-2), effects of pork price on the optimal feeding strategy varied. As pork price increased, the optimization procedure in FS-1 supplied richer diets (including more feed A) than those in other case studies. However, since the optimization procedure in FS-2 extended the maximum fattening duration (*Max<sub>d</sub>* ) with increasing pork price, the amount of feed A in diets decreased at the same time to avoid increasing diet costs. This behavior of the optimization procedure highlights interactions between pork price and both types of strategies. Therefore, this indicates that our model is able to handle the effects of the economic context on optimal strategies.

The purpose of the present paper was mainly the development of the optimization model and the identification of an adequate procedure for using it. However, the optimization was performed assuming that the pork price and feed cost are perfectly known. Although this is correct in the context of forward or futures contracts, it is not right for long periods. For future studies, this raises the question of the sensitivity of the optimal feeding and shipping strategies to the uncertainty of pork and feed price and also piglets cost.

4.5 *Environmental impacts*

Since balancing economic outputs and the environmental impacts is a big challenge for pig production, we examined the effect of economic optimization of pig-fattening on the environment burden. When optimizing only the feeding strategy, global warming potential and eutrophication decreased, but land occupation increased. These reductions in environmental impacts may be explained by decreasing the amount of feed A (high nutrient density), which is consistent with the results of Van Heugten (2010) and Monteiro et al. (2017). Conversely, when the shipping strategy is
optimized, especially maximum fattening duration, improving the gross margin resulted in an increase of all environmental impacts. These results showed that optimizing feeding and shipping strategies simultaneously may inconsistently affect the different categories of environmental impacts.

**When exploring the effects of pork price on both gross margin and environmental impacts (Figure 10), we highlighted that with a high pork price, improving the mean gross margin per pig increased all environmental impacts, relatively to a low pork price situation. This result is explained by the fact that pigs stayed longer on farms, and consequently consumed more feed, excreted more nutrients that resulted in higher emissions. Therefore, further work should include multiobjective optimization in order to address the trade-off between economic and environmental objectives.**

## 5. Conclusions

Economic optimization of pig-fattening has received substantial attention since the demand for pork products is expected to increase by **37% over the period 2010-2050**. In this paper, we demonstrated interactions between feeding and shipping strategies while considering the variability in performances among pigs. We combined two tools, a bioeconomic model of pig-fattening and an optimization procedure which is able to maximize the mean gross margin per pig in a given economic context. To our knowledge, this is almost the first tool able to optimize both feeding and shipping strategies while considering effects of variability in growth potential among a batch of pigs. These features allow considering the interaction effect of feeding and shipping strategies on the economic and environmental outputs of the batch, and investigation of the trade-off between production cost and technical performance. Optimizing the shipping strategies modified the optimal feeding strategies and resulted in more economic benefit than optimizing only one type of strategy. Pork price had a limited effect on feeding decisions when optimized alone, but a strong impact on shipping decisions.

This tool should interest the pig sector since it can identify the best feeding and shipping strategies depending on the economic context. The major concern for European pig production for the coming years is coping with both economic and environmental challenges. In the present study, we
686 investigated the effect of economic optimization of pig-fattening on the environment burden. We
687 highlighted that economic optimization may increase environmental impacts. Therefore, in order to
688 balance economic and environmental outputs, further work should consider multiobjective
689 optimization with both economic and environmental objectives. Since feed has a major contribution
690 to impacts, including feed formulation throughout the entire optimization process will give more
691 opportunity to reduce environmental impacts.

692

693

694 Acknowledgements

695 This project received funding from INRAE metaprogram GloFoods and from the Brittany region
696 (grant for phD of M. Mohsen Davoudkhani) of France.

697

698 Software and data repository resources

699 The code to run all the case studies described in this paper is accessible on the Datainrae data
700 warehouse (https://doi.org/10.15454/OWJJUU).

701

702 REFERENCES

703

704 Accatino, F., Tonda, A., Dross, C., Léger, F., Tichit, M., 2019. Trade-offs and synergies between
705 livestock production and other ecosystem services. Agric. Syst. 168, 58-72.
706 https://doi.org/10.1016/j.agsy.2018.08.002.

707 AGRESTE, 2008. Enquête sur les bâtiments d’élevage porcin de novembre 2008. Retrieved on 27
708 November 2019 at http://www.agreste.agriculture.gouv.fr/IMG/pdf_porcin2010T5.pdf.

709 AHDB, 2018. 2018 pig cost of production in selected countries. Retrieved on 3 June 2020 at
710 https://ahdb.org.uk/knowledge-library/2018-pig-cost-of-production-in-selected-countries.

711 Alexander, D.L.J., Morel, P.C.H., Wood, G.R., 2006. Feeding strategies for maximising gross margin
712 in pig production. In: Pinter, J.D. (Ed.), Nonconvex Optimisation and its Application. Global
713 Optimisation Scientific and Engineering Case Studies, vol. 85., Springer, US, pp. 33–43.

714 Ali, B.M., Berentsen, P.B.M., Bastiaansen, J.W.M., Oude Lansink, A., 2018. A stochastic bio-
715 economic pig farm model to assess the impact of innovations on farm performance. Animal 12,
716 819-830. https://doi.org/10.1017/s1751731117002531.

717 Andretta, I., Pomar, C., Kipper, M., Hauschild, L., Rivest, J., 2016. Feeding behavior of growing-
718 finishing pigs reared under precision feeding strategies. J. Anim. Sci. 94, 3042-3050.
719 https://doi.org/10.2527/jas.2016-0392.
720 Aubry, A., Lescot, M., Cadero, A., Garcia-launay, F., Correge, I., Quiniou, N., 2016. La gestion des fins de bande en élevage porcin : analyse des stratégies décisionnelles des éleveurs et des enjeux économiques associés 225-230.

721
722
723 Britz, W., & Kallrath, J., 2012. Economic simulation models in agricultural economics: the current and possible future role of algebraic modeling languages. In Algebraic Modeling Systems (pp. 199-212). Springer, Berlin, Heidelberg.

726 Brossard, L., Dourmad, J.-Y., Rivest, J., Van Milgen, J., 2009. Modelling the variation in performance of a population of growing pig as affected by lysine supply and feeding strategy. Animal 3, 1114-1123. https://doi.org/10.1017/S1751731109004546.

729 Brossard, L., Vautier, B., Van Milgen, J., Salaun, Y., & Quiniou, N., 2014. Comparison of in vivo and in silico growth performance and variability in pigs when applying a feeding strategy designed by simulation to control the variability of slaughter weight. Animal Production Science, 54(12), 1939-1945.

733 Cadero, A., Aubry, A., Brossard, L., Dourmad, J. Y., Salaün, Y., & Garcia-Launay, F., 2018a. Modelling interactions between farmer practices and fattening pig performances with an individual-based model. Animal, 12(6), 1277-1286. https://doi.org/10.1017/S1751731117002920.

737 Cadero, A., Aubry, A., Brun, F., Dourmad, J. Y., Salaün, Y., & Garcia-Launay, F., 2018b. Global sensitivity analysis of a pig fattening unit model simulating technico-economic performance and environmental impacts. Agricultural Systems, 165, 221-229. https://doi.org/10.1016/j.agsy.2018.06.016.

741 Cadero, A., Aubry, A., Dourmad, J. Y., Salaün, Y., & Garcia-Launay, F., 2018c. Towards a decision support tool with an individual-based model of a pig fattening unit. Computers and Electronics in Agriculture, 147, 44-50. https://doi.org/10.1016/j.compag.2018.02.012.

744 Chiba, L. I., 2000. Feeding systems for pigs. Feeding systems and feed evaluation models. CABI Publishing, Wallingford, UK, 189-209.

746 Conte, S., Boyle, L.A., O'Connell, N.E., Lynch, P.B., Lawlor, P.G., 2011. Effect of target slaughter weight on production efficiency, carcass traits and behaviour of restrictively-fed gilts and intact male finisher pigs. Livest. Sci. 136, 169-174. https://doi.org/10.1016/j.livsci.2010.08.018.

749 Dooyum, U.D., Mallipeddi, R., Pamulapati, T., Park, T., Kim, J., Woo, S., Ha, Y., 2018. Interactive livestock feed ration optimization using evolutionary algorithms. Comput. Electron. Agric. 155, 1-11. https://doi.org/10.1016/j.compag.2018.08.031.

752 Dourmad, J. Y., Sève, B., Latimier, P., Boisen, S., Fernandez, J., Van der Peet-Schwering, C., & Jongbloed, A. W., 1999. Nitrogen consumption, utilisation and losses in pig production in France, The Netherlands and Denmark. Livestock Production Science, 58(3), 261-264.

755 FAO, 2017. World Livestock (2017) – Livestock in food security. FAO.

756 Gous, R.M., Berhe, E.T., 2006. Modelling populations for purposes of optimization. In: Gous, R.M., Morris, T., Fisher, C. (Eds.), Mechanistic Modelling in Pig and Poultry Production. CAB International, pp. 76-96.

759 Groot, J.C.J., Jellema, A., Rossing, W.A.H., 2010. Designing a hedgerow network in a multifunctional agricultural landscape: Balancing trade-offs among ecological quality, landscape character and implementation costs. Eur. J. Agron. 32, 112-119. https://doi.org/10.1016/j.eja.2009.07.002.

763 Groot, J.C.J., Rossing, W.A.H., 2011. Model-aided learning for adaptive management of natural resources: an evolutionary design perspective. Methods Ecol. Evol. 2, 643-650. https://doi.org/10.1111/j.2041-210X.2011.00114.x.

766 Hansen, N., 2006. The CMA Evolution Strategy: A Comparing Review, in: Lozano, J.A., Larrañaga, P., Inza, I., Bengoetxea, E. (Eds.), Towards a New Evolutionary Computation: Advances in the Estimation of Distribution Algorithms. Springer Berlin Heidelberg, Berlin, Heidelberg, pp. 75-102. https://doi.org/10.1007/3-540-32494-1_4.

770 Hansen, N., Kern, S., 2010. Evaluating the CMA Evolution Strategy on Multimodal Test Functions 282-291. https://doi.org/10.1007/978-3-540-30217-9_29.
772 Holland, J. H., 1973. Genetic algorithms and the optimal allocation of trials. SIAM Journal on Computing, 2(2), 88-105.

774 Joannopoulos, E. 2018. Contributions à la résolution globale de problèmes bilinéaires appliqués à l'industrie porcine. Optimisation et contrôle [math.OC]. Thèse de doctorat INSA de Rennes, Français. NNT:2018ISAR0006 tel-01885186

777 Joannopoulos, E., Dubeau, F., Dussault, J.-P., Pomar, C., 2015. Diet Problems. In: Plà-Aragonés, L.M. (Ed.), Handbook of Operations Research in Agriculture and the Agri-Food Industry. Springer New York, New York, NY, pp. 397-417.

780 Jourdan, L., Basseur, M., Talbi, E.G., 2009. Hybridizing exact methods and metaheuristics: A taxonomy. Eur. J. Oper. Res. 199, 620-629. https://doi.org/10.1016/j.ejor.2007.07.035.

782 Kristensen, A.R., Nielsen, L., Nielsen, M.S., 2012. Optimal slaughter pig marketing with emphasis on information from on-line live weight assessment. Livest. Sci. 145, 95-108. https://doi.org/10.1016/j.LIVSCI.2012.01.003.

785 Leen, F., Van den Broeke, A., Aluwé, M., Lauwers, L., Millet, S., Van Meensel, J., 2018. Stakeholder-driven modelling the impact of animal profile and market conditions on optimal delivery weight in growing-finishing pig production. Agric. Syst. 162, 34-45. https://doi.org/10.1016/j.agsy.2018.01.013.

789 Lehmann, N., Finger, R., Klein, T., Calanca, P., & Walter, A., 2013. Adapting crop management practices to climate change: Modeling optimal solutions at the field scale. Agricultural Systems, 117, 55-65.

792 López-Vergé, S., Gasa, J., Temple, D., Bonet, J., Coma, J., Solà-Oriol, D., 2018. Strategies to improve the growth and homogeneity of growing-finishing pigs: Feeder space and feeding management. Porc. Heal. Manag. 4, 1-9. https://doi.org/10.1186/s40813-018-0090-9.

795 Marché du Porc Breton, 2017. Retrieved on 20 March 2020 at https://www.marche-porc-breton.com.

796 McAuliffe, G.A., Chapman, D.V., Sage, C.L., 2016. A thematic review of life cycle assessment (LCA) applied to pig production. Environmental Impact Assessment Review 56, 12-22.

798 Monteiro, A.N.T.R., Bertol, T.M., de Oliveira, P.A.V., Dourmad, J.-Y., Coldebella, A., Kessler, A.M., 2017. The impact of feeding growing-finishing pigs with reduced dietary protein levels on performance, carcass traits, meat quality and environmental impacts. Livest. Sci. 198, 162-169. https://doi.org/10.1016/j.LIVSCI.2017.02.014.

802 Morel, P. C. H., Sirisatien, D., & Wood, G. R., 2012. Effect of pig type, costs and prices, and dietary restraints on dietary nutrient specification for maximum profitability in grower-finisher pig herds: A theoretical approach. Livestock Science, 148(3), 255-267.

805 Nadal-Roig, E., Pagès-Bernaus, A., Plà-Aragonès, L.M., 2018. Bi-objective optimization model based on profit and CO 2 emissions for pig deliveries to the abattoir. Sustain. 10, 1-13. https://doi.org/10.3390/su10061782.

808 Nadal-Roig, E., Plà-Aragonès, L.M., Alonso-Ayuso, A., 2019. Production planning of supply chains in the pig industry. Comput. Electron. Agric. 161, 72-78. https://doi.org/10.1016/j.COMPAG.2018.08.042.

811 Niemi, J. K., Sevón-Aimonen, M. L., Pietola, K., & Stalder, K. J., 2010. The value of precision feeding technologies for grow-finish swine. Livestock science, 129(1-3), 13-23.

813 Niemi, J.K., 2006. A dynamic programming model for optimising feeding and slaughter decisions regarding fattening pigs. Agric. Food Sci. 15, 1-121.

815 Notes de conjoncture Aliment IFIP, 2016. Retrieved on 25 March 2020 at https://www.ifip.asso.fr/fr/content/la-note-de-conjoncture-aliment-de-1%E2%80%99ifip-mensuel-dinformation-sur-les-mati%C3%A8res-premi%C3%A8res.

818 OECD/FAO, 2016. OECD-FAO Agricultural Outlook (Edition 2016). OECD Agriculture Statistics (database). https://doi.org/10.1787/60b7ee42-en.

820 Peña Fernández, A., Norton, T., Youssef, A., Exadaktylos, V., Bahr, C., Bruininx, E., Vranken, E., Berckmans, D., 2019. Real-time modelling of individual weight response to feed supply for fattening pigs. Comput. Electron. Agric. 162, 895-906. https://doi.org/10.1016/j.compag.2019.05.046.
824 Plà-Aragones, L.M., Rodríguez-Sánchez, S.V., 2015. Optimal Delivery of Pigs to the Abattoir. In: 825 Plà-Aragones, L.M. (Ed.), Handbook of Operations Research in Agriculture and the Agri-Food 826 Industry. Springer New York, New York, NY, pp. 381-395.

827 Pomar, C., Pomar, J., Dubeau, F., Joannopoulos, E., & Dussault, J. P., 2013. The impact of daily 828 multiphase feeding on animal performance, body composition, nitrogen and phosphorus 829 excretions, and feed costs in growing-finishing pigs. Animal, 8(5), 704-713.

830 Pomar, C., Remus, A., 2019. Precision pig feeding: A breakthrough toward sustainability. Anim. 831 Front. 9, 52-59. https://doi.org/10.1093/af/vfz006.

832 Pourmoayed, R., Nielsen, L.R., Kristensen, A.R., 2016. A hierarchical Markov decision process 833 modeling feeding and marketing decisions of growing pigs. Eur. J. Oper. Res. 250, 925-938. 834 https://doi.org/10.1016/j.ejor.2015.09.038.

835 Puchinger, J., Raidl, G.R., 2005. Combining Metaheuristics and Exact Algorithms in Combinatorial 836 Optimization: A Survey and Classification, in: Mira, J., Álvarez, J.R. (Eds.), Artificial 837 Intelligence and Knowledge Engineering Applications: A Bioinspired Approach. Springer Berlin 838 Heidelberg, Berlin, Heidelberg, pp. 41-53.

839 Rodríguez-Sanchez S. V., Pla-Aragones L. M., De Castro R., 2018. Insights to optimise marketing 840 decisions on pig-grower farms. Animal Production Science 59, 1126-1135.

841 Teillard, F., Doyen, L., Dross, C., Jiguet, F., Tichit, M., 2017. Optimal allocations of agricultural 842 intensity reveal win-no loss solutions for food production and biodiversity. Reg. Environ. Chang. 843 17, 1397-1408. https://doi.org/10.1007/s10113-016-0947-x.

844 Van Barneveld, R. J., Hewitt, R. J. E., & D'Souza, D. N., 2018. Advances in understanding pig 845 nutritional requirements and metabolism. In Achieving sustainable production of pig meat 846 Volume 2 (pp. 121-148). Burleigh Dodds Science Publishing.

847 Van Heugten, E., 2010. Growing-finishing swine nutrient recommendations and feeding 848 management. National Swine Nutrition Guide (ed. DJ, Meisinger), 80-95.

849 van Milgen, J., Valancogne, A., Dubois, S., Dourmad, J. Y., Sève, B., & Noblet, J., 2008. InraPorc: 850 a model and decision support tool for the nutrition of growing pigs. Animal Feed Science and 851 Technology, 143(1-4), 387-405.

852 Vautier, B., Quiniou, N., Van Milgen, J., & Brossard, L., 2013. Accounting for variability among 853 individual pigs in deterministic growth models. Animal, 7(8), 1265-1273.

854 Vranken, E., Berckmans, D., 2017. Precision livestock farming for pigs. Anim. Front. 7, 32-37. 855 https://doi.org/10.2527/af.2017.0106.
856 **Figure captions**
857

Figure 1. Diagram of the bioeconomic model and the optimization procedure. Decision variables addressed are the percentage of feed A in each phase ($\alpha$), live weight at the diet changes ($x$), target weight (TW), and the maximum fattening duration ($Max_d$). In each iteration of the optimization procedure different values for the decision variables based on CMA-ES algorithm are tested (1).
Feeding and shipping strategies are defined by setting values for the decision variables, (2). The individual-pig growth model produces technical results for each pig on a daily basis and throughout the fattening period based on the feeding and shipping strategies defined in the last stage (3). These outputs are then used to calculate the economic results and environmental impacts (4). The results for each individual pig are aggregated to calculate the mean gross margin per pig (the objective function) (5). This procedure continues (6) until CMA-ES algorithm obtains a good-enough approximation to optimum (7).
858
859
860
861
862
863
864
865
866
867
868
869

Figure 2. Digestible lysine requirement per kg of feed for growing pigs as a function of live weight and overview of 2-phase feeding strategy. In each case study, 2-phase feeding strategy is defined using feeds A and B. Feeds A and B had 110% and 90% of the average SID lysine requirement of female pigs at 30 and 120 kg body weight (BW), respectively. Decision variables can be pig weight at the diet change ($x_1$) and the percentages of feed A in the first ($\alpha_1$) and second phases ($\alpha_2$).
870
871
872
873
874
875

Figure 3. Gross margin as a function of percentage of feed A ($\alpha_1$) in a blend used in a one-phase feeding strategy (case study F-1: one phase with two feeds). Results are displayed with 10 or 400 pigs simulated per batch and with or without variability in pig growth performance, using a step size set to 0.1 for $\alpha_1$.
876
877
878
879
880
Figure 4. Gross margin as a function of live weight at diet change ($x_1$) in a two-phase feeding strategy with a growing and a finishing diet (case study F-2). Results are displayed with 10 or 400 pigs simulated per batch and with or without variability in pig growth performance, using a step size set to 0.1 for $x_1$.

Figure 5. Boxplots of gross margin as a function of the number of pigs per batch in F-2 (two phases with growing and finishing diets and pig weight at the diet change as a decision variable) with 60 random seeds for each number of pigs. The rectangular portion of each box covers from the first up to the third quartile. In order to illustrate the median, a straight line dividing the box into two equal parts is drawn. Crosses indicate the mean gross margins based on 60 random seeds for each number of pigs. Means that do not share a letter differ significantly according to the Tukey Honestly Significant Difference test, with $\alpha = 0.05$.

Figure 6. Boxplots of the computational time as a function of the number of pigs per batch in F-2 based on 60 random seeds. Means that do not share a letter differ significantly according to the Tukey Honestly Significant Difference test, with $\alpha = 0.05$.

Figure 7. Influence of the number of pigs per batch and the number of random seeds on the mean (M) gross margin and the coefficient of variation (CV) of gross margin in F-3 (two-phase feeding strategy optimizing both pig weight at diet change and the percentage of feed A in each phase).

Figure 8. Effects of pork price (low (1.173 €/kg), medium (1.314 €/kg), and high (1.662 €/kg) situations), in case studies with two-phase feeding strategy, on (A) mean gross margin per pig and relative benefit per pig (mean gross margin for each given case study minus mean gross margin in reference R-2 (---)) and (B) technical outputs. Results are displayed for case studies optimizing feeding (←), shipping (→), and both strategies (---). F-3 optimizes pig weight at diet change and
907 percentage of feed A in both phases. S-1 optimizes shipping strategy (target weight and maximum fattening duration). FS-1 optimizes feeding (pig weight at diet change and percentage of feed A in both phases) and shipping (target weight) strategies. FS-2 optimizes feeding (pig weight at diet change and percentage of feed A in both phases) and shipping (target weight and maximum fattening duration) strategies.
908
909
910
911

912
913 Figure 9. Effects of pork price (low (1.173 €/kg), medium (1.314 €/kg), and high (1.662 €/kg) situations), in case studies with two-phase feeding strategy, on decision variables. Results are displayed for case studies optimizing feeding (←), shipping (→), and both strategies (---). R-2 (---) simulates a reference two-phase feeding strategy. F-3 optimizes pig weight at diet change and percentage of feed A in both phases. S-1 optimizes shipping strategy (target weight and maximum fattening duration). FS-1 optimizes feeding (pig weight at diet change and percentage of feed A in both phases) and shipping (target weight) strategies. FS-2 optimizes feeding (pig weight at diet change and percentage of feed A in both phases) and shipping (target weight and maximum fattening duration) strategies.
914
915
916
917
918
919
920
921

922
923 Figure 10. Variations of economic (**left y-axis**) and environmental (**right y-axis**) outputs in case study FS-2. FS-2 optimizes feeding (pig weight at diet change and percentage of feed A in both phases) and shipping (target weight and maximum fattening duration) strategies. Black dashed line (---) represents the economic results. Grey lines (——) represent the environmental impacts. GM: mean gross margin per pig (objective function); CC: Climate change; AC: Acidification; EU: Eutrophication; NE: Cumulative energy demand; LO: Land occupation. **All environmental impacts are expressed as a percentage of the environmental impacts obtained in the low pork price situation (1.17 €/pig) (right y-axis).**
924
925
926
927
928
929
930
<table><caption>Table 1. Description of the decision variables of the optimization procedure.</caption><thead><tr><td>Decision variables</td><td>Description</td><td>Unit</td></tr></thead><tbody><tr><td>X = (x<sub>1</sub>, x<sub>2</sub>, x<sub>3</sub> ... x<sub>p<sub>m-1</sub></sub>)</td><td>Where x<sub>p</sub> is the live weight at which phase p is shifted to p+1</td><td>kg</td></tr><tr><td>α = (α<sub>1</sub>, α<sub>2</sub>, α<sub>3</sub> ... α<sub>p<sub>m</sub></sub>)</td><td>Where α<sub>p</sub> is the percentage of the first feed in phase p</td><td>%</td></tr><tr><td>TW</td><td>Target weight</td><td>kg</td></tr><tr><td>Max<sub>d</sub></td><td>Maximum duration in the fattening unit</td><td>days</td></tr></tbody></table>
<table><caption>Table 2. Subscripts and superscripts used in the bioeconomic model equations.</caption><thead><tr><th>Description</th><th>Range of values</th></tr></thead><tbody><tr><td><i>i</i> Pig</td><td><i>i</i> = {1, ..., <i>I</i>}</td></tr><tr><td><i>d</i> Day</td><td><i>d</i> = {1, ..., <i>D<sub>p</sub></i>}</td></tr><tr><td><i>p</i> Phase</td><td><i>p</i> = {1, ..., <i>P<sub>m</sub></i>}</td></tr><tr><td><i>g</i> Sex</td><td><i>g</i> = {1: female, 2: male, 3: castrated male}</td></tr><tr><td><i>k</i> <i>k</i><sup>th</sup> bound of lean percentage in the payment grid</td><td><i>k</i> = {1, ..., <i>k<sub>m</sub></i>}</td></tr><tr><td><i>n</i> <i>n</i><sup>th</sup> bound of carcass weight in the payment grid</td><td><i>n</i> = {1, ..., <i>n<sub>m</sub></i>}</td></tr></tbody></table>
<table><caption>Table 3. Abbreviations and description of the bioeconomic model inputs.</caption><thead><tr><td>Abbreviation</td><td>Description</td><td>Unit</td></tr></thead><tbody><tr><td>z<sub>p,1</sub></td><td>Price of the first feed in phase p</td><td>€/t</td></tr><tr><td>z<sub>p,2</sub></td><td>Price of the second feed in phase p</td><td>€/t</td></tr><tr><td>PP</td><td>Piglet price (weight: 25 kg)</td><td>€/piglet</td></tr><tr><td>ILW<sup>ig</sup></td><td>Initial live weight of pig i of sex g</td><td>kg</td></tr></tbody></table>
<table><caption>Table 4. Quantities used in the bioeconomic model.</caption><thead><tr><th>Notation</th><th>Description</th><th>Unit</th></tr></thead><tbody><tr><td>LW<sup>ig</sup><sub>d</sub></td><td>Live weight of pig <i>i</i> of sex <i>g</i> on day <i>d</i></td><td>kg</td></tr><tr><td>q<sup>ig</sup><sub>d</sub></td><td>Feed intake of pig <i>i</i> of sex <i>g</i> on day <i>d</i></td><td>kg</td></tr><tr><td>FC<sup>ig</sup>(X, α, TW, Max<sub>d</sub>)</td><td>Feeding cost of pig <i>i</i> of sex <i>g</i></td><td>€</td></tr><tr><td>SLP<sup>ig</sup>(X, α, TW, Max<sub>d</sub>)</td><td>Selling price of pig <i>i</i> of sex <i>g</i></td><td>€/kg carcass weight</td></tr><tr><td>D<sup>ig</sup><sub>p</sub>(X)</td><td>Vector of days belonging to phase <i>p</i> of pig <i>i</i> of sex <i>g</i></td><td>day</td></tr><tr><td>FSP<sup>ig</sup>(X, α, TW, Max<sub>d</sub>)</td><td>Final selling price of pig <i>i</i> of sex <i>g</i></td><td>€</td></tr><tr><td>GM<sup>ig</sup>(X, α, TW, Max<sub>d</sub>)</td><td>Gross margin of pig <i>i</i> of sex <i>g</i></td><td>€</td></tr><tr><td>ADP<sup>ig</sup>(ILW<sup>i</sup>)</td><td>Additional price of piglet <i>i</i> of sex <i>g</i></td><td>€</td></tr><tr><td>PGC<sup>ig</sup></td><td>Cost of piglet <i>i</i> of sex <i>g</i></td><td>€</td></tr></tbody></table>
<table><caption>Table 5. Description of the four sets of analyses including objective, number of pigs per batch and seeds, and types of case studies used.</caption><thead><tr><th>Set of analyses</th><th>Objective</th><th>Types of case studies</th><th>Number of simulated pigs per batch and number of seeds</th></tr></thead><tbody><tr><td>1</td><td>Explore the behavior of the optimization procedure</td><td>R<sup>1</sup></td><td>10 and 400 pigs</td></tr><tr><td>2</td><td>Define recommendation of use of the optimization procedure</td><td>F</td><td>From 10 to 400 pigs with 60 random seeds</td></tr><tr><td>3</td><td>Explore some practical questions</td><td>R, F, S, and FS</td><td>200 pigs with 20 seeds</td></tr><tr><td>4</td><td>Explore effects of pork price</td><td>F, S and FS</td><td>200 pigs with 20 seeds</td></tr></tbody></table>

¹ Case studies simulated with one decision variable varying from lower to upper bound.

R: reference strategy simulated, F: Feeding strategy optimized, S: Shipping strategy optimized, FS: Feeding and shipping strategies simultaneously optimized
<table><caption>Table 6. Description of the simulated and optimized case studies, indicating the decision variables (D) and their bounds during optimization. Asterisks indicate when they are considered as input parameters.</caption><thead><tr><th rowspan="3"></th><th colspan="8">Case studies</th><th colspan="2">Bounds</th></tr><tr><th colspan="4">Simulated</th><th colspan="4">Optimized</th><th rowspan="2">Min</th><th rowspan="2">Max</th></tr><tr><th>R-1</th><th>R-2</th><th>F-1</th><th>F-2</th><th>F-3</th><th>S-1</th><th>FS-1</th><th>FS-2</th></tr></thead><tbody><tr><td>Percentage of feed A in each phase (α<sub>1</sub>, α<sub>2</sub>)</td><td>α<sub>1</sub> = 100*</td><td>(100*, 55*)</td><td>D</td><td>(100*, 55*)</td><td>D</td><td>(100*, 55*)</td><td>D</td><td>D</td><td>0</td><td>100</td></tr><tr><td>Live weight at the diet change (x<sub>1</sub>, kg)</td><td>-</td><td>65*</td><td>-</td><td>D</td><td>D</td><td>65*</td><td>D</td><td>D</td><td>30</td><td>120</td></tr><tr><td>Target weight (TW, kg)</td><td>116.4*</td><td>116.4*</td><td>116.4*</td><td>116.4*</td><td>116.4*</td><td>D</td><td>D</td><td>D</td><td>110</td><td>130</td></tr><tr><td>Maximum fattening duration (Max<sub>d</sub>, day)</td><td>108*</td><td>108*</td><td>108*</td><td>108*</td><td>108*</td><td>D</td><td>108*</td><td>D</td><td>100</td><td>125</td></tr></tbody></table>

946 R: reference strategy simulated, F: Feeding strategy optimized, S: Shipping strategy optimized, FS: Feeding and shipping strategies simultaneously optimized
<table><caption>Table 7. Mean (± 1 standard deviation) of gross margin, decision variables, and technical outputs obtained in the simulation and optimization case studies, run with 20 random seeds and 200 pigs per batch in the third set of analyses. Bold text indicates decision variables in each case study.</caption><thead><tr><th>Case studies</th><th>Gross margin (€/pig)</th><th>LW at the diet change (kg) (x<sub>1</sub>)</th><th>% of feed A in phase 1 (α<sub>1</sub>)</th><th>% of feed A in phase 2 (α<sub>2</sub>)</th><th>Target weight (kg) (TW)</th><th>Maximum fattening duration (days) (Max<sub>d</sub>)</th><th>Computational time (min)</th><th>Slaughter weight (kg)</th><th>Feed cost (€/pig)</th></tr></thead><tbody><tr><td>R-1</td><td>25.26<sup>e*</sup> ± 0.86</td><td>-</td><td>100</td><td>-</td><td>116.4</td><td>108</td><td>-</td><td>116.13<sup>c</sup> ± 0.51</td><td>47.91<sup>b</sup> ± 0.18</td></tr><tr><td>F-1</td><td>29.28<sup>c</sup> ± 0.80</td><td>-</td><td><strong>49.11 ± 4.04</strong></td><td>-</td><td>116.4</td><td>108</td><td>14.99<sup>c</sup> ± 3.73</td><td>115.30<sup>d</sup> ± 0.60</td><td>42.49<sup>g</sup> ± 0.17</td></tr><tr><td>R-2</td><td>28.37<sup>d</sup> ± 0.81</td><td>65</td><td>100</td><td>54.65</td><td>116.4</td><td>108</td><td>-</td><td>115.79<sup>c,d</sup> ± 0.46</td><td>44.44<sup>d</sup> ± 0.15</td></tr><tr><td>F-2</td><td>29.30<sup>c</sup> ± 0.82</td><td><strong>38.26<sup>c</sup> ± 4.04</strong></td><td>100</td><td>54.65</td><td>116.4</td><td>108</td><td>11.37<sup>c</sup> ± 3.24</td><td>115.69<sup>c,d</sup> ± 0.56</td><td>43.22<sup>f</sup> ± 0.19</td></tr><tr><td>F-3</td><td>29.78<sup>b,c</sup> ± 0.73</td><td><strong>54.17<sup>a,b</sup> ± 2.84</strong></td><td><strong>69.51 ± 4.48</strong></td><td><strong>42.08 ± 3.41</strong></td><td>116.4</td><td>108</td><td>24.27<sup>b</sup> ± 5.73</td><td>115.43<sup>d</sup> ± 0.36</td><td>42.45<sup>g</sup> ± 0.17</td></tr><tr><td>S-1</td><td>29.69<sup>b,c</sup> ± 0.89</td><td>65</td><td>100</td><td>54.65</td><td><strong>124.27<sup>c</sup> ± 0.52</strong></td><td><strong>114.73<sup>a</sup> ± 2.06</strong></td><td>13.33<sup>c</sup> ± 3.37</td><td>121.13<sup>a</sup> ± 0.57</td><td>48.16<sup>a</sup> ± 0.17</td></tr><tr><td>FS-1</td><td>30.31<sup>b</sup> ± 0.84</td><td><strong>52.97<sup>b</sup> ± 2.44</strong></td><td><strong>72.81 ± 3.34</strong></td><td><strong>46.83 ± 2.20</strong></td><td><strong>124.92<sup>b</sup> ± 0.87</strong></td><td>108</td><td>26.25<sup>b</sup> ± 5.89</td><td>117.00<sup>b</sup> ± 0.68</td><td>43.47<sup>c</sup> ± 0.21</td></tr><tr><td>FS-2</td><td>31.26<sup>a</sup> ± 0.84</td><td><strong>55.70<sup>a</sup> ± 2.73</strong></td><td><strong>71.41 ± 4.67</strong></td><td><strong>40.22 ± 2.68</strong></td><td><strong>125.48<sup>a</sup> ± 0.42</strong></td><td><strong>113.65<sup>a</sup> ± 1.32</strong></td><td>51.79<sup>a</sup> ± 6.38</td><td>120.73<sup>a</sup> ± 0.71</td><td>46.02<sup>c</sup> ± 0.17</td></tr></tbody></table>

<footnote>*Means that do not share a letter differ significantly according to the Tukey Honestly Significant Difference test, with α = 0.05</footnote>

<footnote>LW = live weight</footnote>
<table><caption>Table 8. Mean (± 1 standard deviation) of environmental impacts per kg live weight gain obtained in the simulation and optimization case studies, run with 20 random seeds and 200 pigs per batch in the third set of analyses.</caption><thead><tr><th>Case studies</th><th>Climate change (kg CO<sub>2</sub>-eq.)</th><th>Acidification (g SO<sub>2</sub>-eq.)</th><th>Eutrophication (g PO<sub>4</sub>-eq.)</th><th>Cumulative energy demand (MJ)</th><th>Land occupation (m<sup>2</sup> year)</th></tr></thead><tbody><tr><td>R-1</td><td>2.19<sup>a*</sup> ± 0.02</td><td>56.51<sup>a</sup> ± 0.67</td><td>19.11<sup>a</sup> ± 0.21</td><td>13.88<sup>a</sup> ± 0.10</td><td>3.72<sup>f</sup> ± 0.03</td></tr><tr><td>F-1</td><td>2.02<sup>d,e</sup> ± 0.01</td><td>49.13<sup>e</sup> ± 0.47</td><td>16.93<sup>f</sup> ± 0.03</td><td>12.02<sup>f,g</sup> ± 0.08</td><td>3.84<sup>b,c</sup> ± 0.03</td></tr><tr><td>R-2</td><td>2.07<sup>c</sup> ± 0.02</td><td>51.55<sup>c</sup> ± 0.53</td><td>17.63<sup>c</sup> ± 0.17</td><td>12.70<sup>c</sup> ± 0.08</td><td>3.76<sup>e</sup> ± 0.03</td></tr><tr><td>F-2</td><td>2.03<sup>d</sup> ± 0.02</td><td>49.83<sup>d</sup> ± 0.56</td><td>17.12<sup>e</sup> ± 0.18</td><td>12.26<sup>d</sup> ± 0.09</td><td>3.79<sup>d,e</sup> ± 0.03</td></tr><tr><td>F-3</td><td>2.01<sup>e</sup> ± 0.01</td><td>48.93<sup>e</sup> ± 0.42</td><td>16.87<sup>f</sup> ± 0.13</td><td>11.98<sup>g</sup> ± 0.08</td><td>3.84<sup>b,c</sup> ± 0.03</td></tr><tr><td>S-1</td><td>2.11<sup>b</sup> ± 0.02</td><td>52.97<sup>b</sup> ± 0.61</td><td>18.09<sup>b</sup> ± 0.19</td><td>12.90<sup>b</sup> ± 0.09</td><td>3.85<sup>b</sup> ± 0.03</td></tr><tr><td>FS-1</td><td>2.02<sup>d,e</sup> ± 0.01</td><td>49.23<sup>e</sup> ± 0.48</td><td>16.95<sup>f</sup> ± 0.15</td><td>12.09<sup>f</sup> ± 0.08</td><td>3.82<sup>c,d</sup> ± 0.03</td></tr><tr><td>FS-2</td><td>2.06<sup>c</sup> ± 0.01</td><td>50.32<sup>d</sup> ± 0.46</td><td>17.32<sup>d</sup> ± 0.15</td><td>12.17<sup>e</sup> ± 0.06</td><td>3.94<sup>a</sup> ± 0.04</td></tr></tbody></table>

<footnote>*Means that do not share a letter differ significantly according to the Tukey Honestly Significant Difference test, with α = 0.05</footnote>
<figure><img src="image_2.png" /><figcaption>Figure 1</figcaption></figure>
<figure><img src="image_3.png" /><figcaption>Figure 2</figcaption></figure>
<figure><img src="image_4.png" /><figcaption>Figure 3</figcaption></figure>
<figure><img src="image_5.png" /><figcaption>Figure 4</figcaption></figure>
<figure><img src="image_6.png" /><figcaption>Figure 5</figcaption></figure>
<figure><img src="image_7.png" /><figcaption>Figure 6</figcaption></figure>
<figure><img src="image_8.png" /><figcaption>Figure 7</figcaption></figure>
<figure><img src="image_9.png" /><figcaption>Figure 8</figcaption></figure>
<figure><img src="image_10.png" /><figcaption>Figure 9</figcaption></figure>
<figure><img src="image_11.png" /><figcaption>Figure 10</figcaption></figure>