Developing a multiagent framework to explore the implications of fencing waterways using virtual fencing on New Zealand hill country farms.

Hill country farms in New Zealand are faced with having to exclude cattle from waterways to limit their negative impact on water quality. Virtual fencing technology offers the potential to control the access of each animal to its physical environment and, meet the requirement of excluding stock from waterways. Understanding farmer willingness to uptake virtual fencing technology requires exploring farm system changes that would occur when moving from using conventional fences to virtual fencing. This paper describes the investigation of a multiagent framework to explore potential futures that may be created by the application of virtual fencing technology. Compared to conventional fencing, virtual fencing of beef cattle on hill and steep land is a financially viable option to exclude cattle from waterways. Compared to no fencing of waterways, virtual fencing reduced farm annual profitability by 9% and 17% for rolling and steep farms respectively, whereas conventional fencing reduced profitability by 14% and 93% respectively, severely reducing the profit of steep hill country farms. The results from this study used industry sheep and beef production, farm size and stock number averages and therefore are preliminary and indicative only.


Introduction
There is increasing concern about livestock farming causing negative impacts such as nutrient enrichment, sedimentation, and pathogenic contamination of water bodies in New Zealand (Vibart et al. 2015).Dairy enterprises have intensified and undergone rapid expansion on more productive land, which has pushed sheep and beef farming to intensify farm systems in less productive hill country areas, resulting in increased stock numbers, exacerbating the negative impact of livestock on water bodies (Beef + Lamb New Zealand 2019).To address these concerns, the New Zealand Government has developed policies requiring the exclusion of livestock from waterways, which will Developing a multiagent framework to explore the implications of fencing waterways using virtual fencing on New Zealand hill country farms.
potentially be reinforced by regional regulations set by councils.Cattle must be excluded from all waterways on flat country (slopes of 0-4°) by July 2025 and waterways over 1 m wide in rolling hill (slopes of 4-15°) country by 2030 (Ministry for the Environment (MFE) 2017).Rolling hill country comprise 42% of the total land area of New Zealand's more than 5,500 hill country farms (Beef + Lamb New Zealand 2018).
Potential provisions for excluding cattle on steep slopes (>15 o ) require mitigation strategies to minimise environmental impacts on waterways so that water quality is maintained.Sheep generally avoid waterways and are not considered to have a major impact on water quality, so exclusion fencing is not mandatory.
The large number of waterways in New Zealand hill country that require livestock exclusion, and the difficult terrain makes physical fencing extremely costly and presents logistical challenges.Additionally, it increases maintenance costs significantly given that hillside erosion can frequently damage these structures.Farmers will soon be faced with difficult decisions about the future enterprises on their farms to protect waterways.Investigating the potential future enterprise decisions that farmers may make allows for better understanding of potential government policy before changes have been implemented.One way to explore these futures could utilise the case of a potential new disruptive technology (i.e.virtual fencing) and multiagent simulation modelling.
Current fencing methods to control animals in farmed landscapes are costly and time consuming to construct and maintain which can restrict their implementation and potential benefits (Beetham and Garland 2019).Recent advances in animal training techniques, coupled with rapid changes in technology, have resulted in new opportunities in precision animal containment.Virtual fencing is a remotely controlled technology that enables livestock to be confined or moved without the need for a physical fence (Umstatter, 2011).The system relies on neckbands worn by the livestock, in conjunction with wireless and GPS technology to determine livestock location and enforce the virtual boundaries using auditory and physical cues (Umstatter 2011).Virtual fencing may enable better integration of livestock and other farm enterprises, such as forestry and the conservation estate, while contributing to the protection or enhancement of biodiversity and water quality.It is unknown if, or how, individual sheep and beef farmers will adopt this technology within their farm, but government policy regarding exclusion of cattle from waterways provides a disruptive impetus for adoption of this new technology.
Virtual fencing technology has a significant development history and is founded in best practice animal behaviour and training principles with extensive research on individual and small groups of cattle in Australia investigating the animal welfare implications (Campbell et al. 2017;Campbell et al. 2018;Campbell et al. 2019;Lee et al. 2008;Lee et al. 2009;Lee et al. 2018).
The Rural Futures Multi-Agent Simulation model (RF-MAS) was developed to explore the behaviour of farmers and impacts on future land use options in New Zealand (Kaye-Blake et al. 2014).Initially, the RF-MAS was developed based on research by Berger, Schilling, Troost, and Latynskiy (2010) that applied mathematical programming MAS to explore how farmers react with each other and react to changes in their economic and natural environment in Chile.This demonstrates the universal nature of the underlying structure of the model.The first application of the model in New Zealand investigated land use change during dairy farm expansion at a regional scale (Kaye-Blake et al., 2014).RF-MAS has also been used to explore the impacts of water policies (Baillie et al. 2016) and nutrient management policies on the economy and environment (Kaye-Blake et al. 2019).It integrates biophysical, geographical, financial, economic, and social data and projects impacts on future land use for up to 25 years (Kaye-Blake et al. 2014;Bewsell et al. 2017).The model has not been used to understand the impact of transformative technology such as virtual fencing on potential land use change.Understanding farmer willingness to uptake virtual fencing technology requires exploring farm system changes (and subsequent profitability) that would occur when moving from using conventional fences to virtual fencing.
The aim of this paper was to: firstly, determine relative costs of conventional and virtual fencing of waterways on sheep and beef properties; and secondly, understand the suitability of an agent-based model to provide an appropriate framework to explore the impact of adoption of virtual fencing.

Materials and Methods
New Zealand sheep and beef farm survey data (Beef + Lamb New Zealand 2019) were used to define average farm sizes and stocking rates for three land use classes -flat, rolling and steep (data used is presented in Table 3).These data were then used to estimate the cost of fencing options on differing land use classes and then to explore the use of the RF-MAS model to understand how the model could be parameterised to understand farmer decisions around fencing choices.

Estimation of fence cost
The cost of conventional fencing was calculated based on the area of waterways to be fenced.Area of waterways or stream density was based on slope and was calculated using the following assumptions; that the fenced stream area within each hectare of land was a rectangle, and the riparian margin was to be a 2 m, 5 m, or 20 m fenced buffer each side from the centre of the waterway depending on increasing slope (i.e.land use capability (LUC)) based on regional government recommendations.Estimations of stream density data were adapted from Langbein (1947) using slopes of 3 o and 8 o for flat and rolling respectively, and these data were extrapolated using a power function to provide an estimate for steep hill country at 15 o (Table 2).Costs of fencing per meter were obtained from Ministry for the Environment (MfE) and Ministry for Primary Industries (MPI) (2022) .
We have assumed virtual fencing will only be used to manage cattle; hence, the cost of virtual fencing is related to cattle number rather than farm area or stream density, as the 'fence' is completely portable.The cost of virtual fencing was calculated based on the average number of cattle for each of the LUC as described by Beef + Lamb New Zealand (2019).

RF-MAS model
Conceptually, the RF-MAS structure can be described by three layers of data; the farmer/agent layer, land resources and available farming enterprises (Kaye-Blake et al. 2014).The land-use possibilities dictate the feasible farming options, and the enterprise layer The model assumes that the farmer's decision to adopt new technology is based on economic costs and economic benefits, set within a framework of influence provided by relationships to their peers (Kaye-Blake et al. 2014).The economic model of decision-making is based on Burton (2006) and assumes that farmers have a lifecycle that alters their economic goal over time.The farmer layer also defines the age profile of agents, their peer networks, the risk profile of farmers and the presence of a successor (Baillie et al. 2016).
The land layer defines the suitability of the land and soil to sustain farming practices (Appendix 1).This includes farm location / region, size and productive capacity, which is based on their Land Use Capability (LUC) class (Lynn 2009) .In the land layer, a farm is assigned to one of the three LUC categories (A (flat), B (rolling), C (steep)) equivalent to LUC classes 1-2, 3-4, Reduce soil erosion losses from grazing and potentially improve animal welfare through remote movement of animals in adverse events, both may result in production benefits Reduced water reticulation costs 5-7 (Lynn 2009;Vibart et al. 2015).Finally, the actual outputs from each LUC category can be manipulated by the level of inputs such as fertiliser.The model allows for high and low input options, which translate into changes in productivity and stocking rate.
The enterprise layer incorporates the farm stocking policy and productivity and profitability outcomes.Inputs to RF-MAS have been developed using the Farmax farm simulation model (Bryant et al. 2010), and industry benchmarking surveys such as Dairy Base and Beef + Lamb NZ Economic Service data.These sources are readily available and can be used to represent likely scenarios.Here we used data from the New Zealand sheep and beef farm survey (Beef + Lamb New Zealand 2019)

Scenarios
It was first assumed that cattle exclusion from waterways was mandatory to determine if the RF-MAS model can test how the uptake of a new technology, virtual fencing, can affect land use change.Then, the three most likely land uses on hill country farms were identified: sheep only, sheep and beef with conventional fencing of waterways or sheep and beef with virtual fencing of water ways.Based on the likely land uses options, three scenarios were developed to test the model.A summary of actions and possible impacts for each scenario are shown in Table 1.
These scenarios were then used to identify model parameters that would need changing in the assessment.This included economic drivers and changes to the financial inputs to the model as the best starting point to influence decisions around activity and enterprise choice when waterway restrictions were in place.Virtual fencing and conventional fencing were differentiated by capital cost as this allows the model to estimate farmers response to the new technology based on cost minimisation.

Cost of physical and virtual fencing
The cost per hectare of all conventional fences increased with increasing slope due to an increase in cost/metre and stream density (Table 2).Farm size increased with increasing slope (LUC), as did the number of streams that require fencing.Therefore, the relative costs of riparian fencing and relative riparian areas increased significantly with LUC.Compared with a flat farm (0-4°), rolling farms (4-15°) and steep farms (>15°) were respectively around 5 and 40 times more expensive to conventionally fence (Table 3).Fencing cattle out of waterways only requires a 2-wire electric fence, which was the least expensive conventional fencing option at $6.36/m for a flat land, $7.32/m for rolling and steep land.As farm size and slope increases, challenges associated with fence reliability, supplying electricity, and maintaining electric fences means that large steep farms would likely opt for non-electric fences.For all land classes, an 8-wire non-electric fence was around 170% more expensive per metre than a 2-wire electric fence.These costs will only increase in the future.
The cost of virtual fencing per hectare was similar for each LUC (Table 3).The cost of virtual fencing was greater as slope increased due to an increase in farm size and cattle number for hill country farms (Table 3).When compared to conventional fencing, annual virtual fencing costs (over an 8-year period) were much less on rolling and steep farms.When compared to no fencing, virtual fencing reduced farm profitability by 9% and 17% for rolling and steep farms respectively, whereas conventional fencing reduced profitability by 14% and 93% respectively, severely reducing the profit of steep hill country farms (Table 3).Using virtual fencing was 7% more profitable on rolling land and >1000% more profitable on steep farms compared with conventional fencing (Table 3).

RF-MAS
The examination of the RF-MAS identified robustness of the model for further modifications.The current examination of the model demonstrates that the model is robust, and it could be adapted for other applications.
The following sections are presented to reflect the layers within the model.Required changes to test the relative uptake of virtual fencing in hill country farms are identified within each model layer and summarised in Appendix 1, based on the scenarios that were proposed for testing.

Farmer layer
Within the farmer layer the cost of fencing and exclusion of the stock from waterways were determined first.Secondary effects that may change profitability, such as increased pasture utilisation and changing feed quality, have not been considered but could be explored in the future.
Currently the RF-MAS model presents three different economic goals that farmers may target, cost minimisation, profit maximisation and production maximisation.In this study, virtual fencing and conventional fencing are differentiated by capital cost.
In the case of decision-making regarding waterway fencing, mandatory government policies are poised to act as a trigger for action.Exclusion of cattle from all waterways creates a situation in which many farmers will have to change.The question is which change they will make; they might fence waterways with conventional or virtual fences, completely change their enterprises or even some combination of these.Within the RF-MAS model farm decisions to use conventional or virtual fencing can be modelled by reducing nutrient loss caps and adjusting predicted N and P losses from a farm when virtual or conventional fences are used.While using fencing may not explicitly reduce nutrient losses on grazed pasture, the caps built into RF-MAS can be used as a proxy for maintaining compliant stock exclusion.
The current farmer data within the RF-MAS model are focused on land use, or enterprise change, to test the shift from sheep and beef farming for meat production to bovine dairy farming.It is likely the adoption of technology to change an enterprise on farm has the same drivers as land use change (Pannell et al. 2006).Strong influencers in the peer network or perhaps farmer age may have different impacts on technology adoption than on land use change which is not currently included in the model.The proportion of farmers in each age group and the proportion of the type of farmer in the age group in the model needs to be updated by using the most recent census data to provide more probabilistic analysis.
The evaluation of the social data in the model and testing the outcomes of a range of scenarios with groups of farmers and rural professionals, will be needed in the future after RF-MAS scenarios have been run to check the outputs are logical.If the modelled outcomes do not meet expectations, then new social data may have to be collected and added to the RF-MAS model.

Land layer
The land layer, based on LUC classes, provides an appropriate base on which to apply the scenarios developed.The landscape of many hill country farms in New Zealand covers a combination of more than one slope or LUC and the farmers may choose different enterprises, solutions, or adoption strategies for LUC parcels within a farm.
Critical to applying RF-MAS for the application to virtual fencing is the ability to represent the number and complexity of waterways in the model, which are not currently represented.The cost of fencing becomes dependent on slope/LUC, and the area of the farm lost to potential production also increases with slope under current guidelines for riparian protection i.e. increasing buffer width with increasing slope.
Costs of fencing can be incorporated in the RF-MAS model in its current form.The conventional fencing cost per hectare can be applied to the 'other farm expenses' or 'other capital assets' depending on depreciation strategy, and virtual fencing costs assigned to 'stock cost per beef stock unit'.The cost of a conventional fence may need to be applied as the total cost of the fence and accrued interest, spread over a 30-year replacement period to represent the capital investment in the fence and costs of maintenance (Table 3).The cost of virtual fencing is different, being directly related to the number of cattle, and is applied at the per head scale, unrelated to slope.It is also less expensive than conventional fencing as the slope increases (Table 3).The model of ownership of the virtual fencing collars is still unclear, it may be as a yearly rental, or calculated as a capital expenditure.Manufacturers have indicated an indicative 8-year replacement period, with $1.50 per unit annual data handling charges (Table 3).
The assumption that the relationship between stream density and slope in New Zealand is the same as the United States of America where the original research was undertaken (Langbein 1947) needs to be confirmed.This approach would need validation against a geographic information system dataset to understand the width, distribution, and frequency of waterways on New Zealand farms by slope.This would also provide information to test the appropriateness of the current legislation as it only includes waterways >1m wide.

Enterprise layer
The model needs to be modified to represent likely scenarios only applicable for hill country farming.It was assumed that possible changes of enterprises on hill country could be sheep and beef or sheep only, so some categories (such as dairy, arable and horticulture) may need to be removed as options.Forestry is also an option for some hill country areas but has not been considered here.The examination of this layer identified that the model does not contain a sheep only farming system as an enterprise that is required to represent the scenarios described in this paper.
To parameterise the RF-MAS model for a sheep-only enterprises on flat, rolling and steep land, new economic and productivity parameters for each LUC are required.These figures can be obtained by altering the Farmax sheep and beef model; adjustments to the Farmax model would be primarily made by balancing sheep stocking rates with pasture production (Thompson and Ward 2016).Farmers moving from a sheep and beef to a sheep only system would require increased sheep numbers of 20-46% across LUC (Table 3) to maintain the same stocking rate.This would likely require an increase in inputs and labour for animal handling events (e.g.shearing) and animal health treatments.Cattle play an important role in the maintenance of pasture quality by non-selectively consuming bulk mixed pastures.Sheep only farms may risk losing productivity and profitability over time without cattle in the system, especially in hill country, if pasture quality cannot be maintained by sheep, which are more selective grazers.This loss of pasture quality will need to be accounted for when modelling the impact of virtual fencing on future land use.
An example of input costs, from New Zealand sheep and beef farm survey data (Beef + Lamb New Zealand 2019) averaged over five years (years 2012/2013 -2017/2018) for each LUC is presented in Table 3.The combination of the fence cost by LUC and the sheep and beef farm data was used to estimate head of cattle, head of sheep to replace cattle, the costs on a per farm, per hectare and stock unit basis of conventional and virtual fencing, number of years for return on conventional or virtual fencing and the area of grazing lost to riparian fencing for industry average farms across the three LUC (Table 3).The relative number of sheep required to replace cattle can be used to create new Farmax models for sheep only scenarios.
To model the uptake of virtual fencing, it will be necessary to determine the ratio of cattle to sheep for different intensities of farming (Table 3) and assign a virtual fencing cost based on the proportion of cattle.Productivity and profitability of sheep vs cattle enterprises can be modelled using Farmax and the outputs incorporated in RF-MAS to determine how the uptake of virtual fencing will affect land use change.
Some factors are not represented in RF-MAS, such as the cost of fence maintenance or the potential loss of pasture quality in a sheep only system.Other factors such as riparian planting and water reticulation costs were not included as they were assumed to be the same for conventional fencing and virtual fencing.

Conclusions
Virtual fencing offers an opportunity for hill country farmers to restrict animal access from waterways at a lower cost per hectare than conventional fencing.With modifications to the enterprise layer RF-MAS can be used as a multiagent framework to explore potential future land uses that may be created by the application of virtual fencing technology.

Figure 1
Figure 1 Structure of the layers in the Rural Futures Multi-Agent Simulation model and what influences them (arrows) Source: Based on figure sourced from Baillie et al.(2016)

Table 1
Description of modelled scenarios in the Rural Futures Multi Agent Simulation (RF-MAS) model and possible impacts on the farming operation

Table 3
Sheep and beef farm size, stock units (SU), stock species, and profitability for three classes ofBeef and Lamb NZ South  Island Model Farms (2019), based on a 5-year average, with costs of conventional (CF) and virtual (VF) riparian fencing for three different land use classes (LUC) based on slope (i.e.flat <4°, rolling 4°-15 ° and steep >15 °) assuming all waterways require fencing.
1 Annualised cost calculated as the total of maintenance, depreciation and interest costs on the capital investment