The Agricultural Policy Simulator (AgriPoliS) is an agent-based model that can be used observe and analyse the effects of policies and shocks on farm structural change over time. The agents are heterogeneous typical farms of a region. The agents' goal is to maximise their profits if they are a corporate farm, and their household income if they are a family farm. They exercise these decision with regard to their production, investments, factor use, and land rental. The environment are the farms, markets, and space. The agents interact via markets.
At the beginning of each iteration, agents are given the opportunity to rental bids on newly available plots of land. The agents decide how much to bid on each plot based on the additional plot's expected returns. The highest bidder receives the plot.
Each agent then assesses whether they could expect to increase their profits by investing in new machinery or stables. If they expect a new investment to increase their profits, they invest.
Each agent decides what to produce given their land, machinery, stables, and labour in order to maximise their profits or household income.
Finally, at the end of each iteration, the agents either continue on farming for another year or exit agriculture. If an agent can expect to earn more off-farm and through renting out their owned land, the farm closes. If the agent expects to earn more from farming, they continue for another iteration.
For the Overview and Design concepts Sahrbacher et al. 2012 is used. That paper describes AgriPoliS following the ODD protocol (Overview, Design concepts and Details) described in GRIMM et al. (2006) and GRIMM et al. (2010).
Purpose: The main purpose of the model is to understand how farm structures change within a region, particularly in response to different policies. Structural change in agriculture is the result of farms' individual decisions. Each farm decides what to produce and how much, whether it is worth renting additional land or rather releasing some of it, or even to exit agriculture if necessary. Depending on their individual situation and their neighbourhood, farms react differently to the same environmental conditions or policy changes. The heterogeneity in the farm population allows covering these individual responses. Land markets play a crucial role in agricultural structural change. Because the dynamics on land markets are mainly determined by the interactions between individual farms, an agent-based approach offers many advantages for creating an explicit land market.
Entities, state variables and scales: The model comprises different hierarchical levels: farms, farm population, plots, landscape, markets and political environment. The model?s main entities are farms, production activities, investment objects, plots, markets and the political and economic environment. Plots
are individual equally-sized cells in the artificial region. All plots joined together constitute the artificial region, like fields constitute specific landscapes in the reality.
Farms are income or profit maximising entities and characterised by state variables such as an IDnumber, age, managerial ability, location in space and the amount of production factors (land, capital, labour) they own, or rent. A farmer actively manages a farm during 25 years (maximum duration of management) and hands his farm over to a possible successor after this period, i.e. AgriPoliS considers generation change. Age corresponds to the number of years a farmer is already managing his farm. Whereas managerial ability, location and the amount of family labour stays constant over time, the amount of land and capital can change. Capital is further separated into liquid assets, fixed assets (Investment objects) and entitlements for production (milk quota). Farms can choose out of a list of production activities and investment options in order to make an optimally use of their production factors during the production process.
Regarding production activities, it can be further differentiated between plant production activities, livestock production activities and auxiliary activities. All production activities are continuous decision variables and characterised by an ID-number, a revenue, production costs and a price flexibility. Production activities are associated to a production branch like in EU's Farm Accountancy Data Network (e.g. field crop, milk, grazing livestock and pig and poultry). This allows the classification of farms according to their production branch. Furthermore, production activities are associated to a type of investment which is necessary for the production. Labour requirement and the premium associated constitute state variables common to plant and livestock production activities. In addition to this, plant production activities require land of specific soil type and machinery as well as restrictions for crop rotation. Some plant activities can supply fodder for livestock. Livestock production activities require stable places and fodder. Furthermore, they are characterised by a livestock unit. Auxiliary activities are defined to allow an optimal use of capital and labour. Thereby, either overcapacities of production factors can be reduced (e.g. saving money, working off-farm, leasing quota) or scarce capacities can be borrowed, hired or leased in a short term perspective (money, labour, quota, machinery). Only revenues and premium can change over time due to changes in the political and economic environment. Production costs vary among farms according to their managerial ability.
All investment objects are integer variables, i.e., they are not dividable and they are financed with a specific share of long-term borrowed capital. The interest rate of long-term borrowed capital is the same one for all investment objects. Further state variables of investment objects are: an ID-number, type of investment (hog house, cowshed, machinery, hiring a worker for a year or working off-farm for a year), production capacity, investment costs, maximum useful life, age, maintenance costs, labour saving due to size effects and technical progress associated with the investment. Technical progress depends on investment size.
Plots are basic elements of the grid representing an artificial landscape. The state variables of these basic land units are size, location, soil type, ownership, rental price, rental contract duration and age of the contract. Location, size and soil type of a plot are constant during the simulations whereas the ownership status, the rental price and the age of the contract can change over time. The soil type defines land of a specific quality (e.g. high, medium, low, etc.). Depending on the quality, land can only be used for specific production activities and generate a particular yield. Thereby, it is indirectly differentiated between arable land, grassland and non-agricultural land (settlements, roads, rivers, lakes and forests that cannot be used for agriculture). Plots are also characterised by their ownership status; they can be owned, rented or abandoned. Rental prices can change because an endogenous rental market is modelled. Rental contracts have a fixed duration and are terminated when the age of the contract equals the duration. The contract duration is randomly drawn from a uniform distribution whereby a minimum and maximum contract duration is set. Taken altogether, the location of the plots, their size and the soil type form an artificial landscape.
The landscape is represented by five different layers: ownership, soil distribution, block, allocation and usage/field layers. The ownership layer defines the ownership of a specific plot. The second layer represents the distribution of different soil types across the landscape. The block layer replicates the distribution of contiguous areas of given soil types (e.g. arable land and grassland) thus reflecting the geophysical conditions in a region. Such a block is defined as a group of contiguous plots of the same soil type that is separated from other plots of the same type either by another soil type. Two plots are contiguous if they are adjacent to each other. The allocation layer represents how blocks are allocated to farms. Contiguous plots belonging to a farm are called sub-blocks. Plots in a sub-block can either be rented or owned by farms. The fifth layer reflects farms? land use, i.e. a field comprising contiguous plots used by a particular farm for a particular purpose (e.g. wheat production).
Markets are distinguished according to their scale and the applied rules. Regarding the scale, markets are either national and EU-wide, regional or regional and spatially organized at the same time. National and EU-wide markets both follow the same rules which are applied to products like crops, oil seeds, sugar, capital, labour and services. Products traded on regional markets differ from region to region and depend on the specific characteristic of the region modelled. Therefore, even the market rules can differ among products. As the study regions are predominantly small, the effect on prices of nationally and internationally traded products should be marginal. Thus, the national and EU-wide markets are in almost all cases not used. At the regional scale, these are, e.g. a market for manure (Germany, France), a market for calves (Sweden, Västerbotten and Jököping), or a market for milk quota (almost all regions). For regional spatially-organized markets it is assumed that goods are not traded on spot markets. This applies to the land market which is organised as an auction.
The political and economic environment mainly affects prices and payments for production activities over time. Price changes may be caused by changes in the agricultural policy or in the economy. In addition, there might be new obligations to be fulfilled so that farmers receive payments.
In general only a proportion of a region is simulated because of computational time constraints. The plot size is chosen based on regional and computational criteria and varies between 0.5 and 5 ha. For computational reasons the plot sizes should be as large as possible because the number of plots depending on the plot size and the region size is a crucial figure. The more plots there are, the more time is necessary for the allocation of free plots and therefore the longer a simulation will last. A simulation normally runs over 25 time steps (periods) where each time step is equivalent to one year.
Process overview and scheduling: In each period the farms go through the following processes in the presented order: land auction, investment, production, update product markets, farm accounting, set policy, disinvest, exit decision, period results. The schedule is the same for each period. Each process begins when all farms are finished with the previous one. Farms? order stays the same in each single process. For land auction, investment, production and exit decision farms apply a Mixed Integer Programming model (MIP model, cf. Hazell and Norton 1986) order to make their decisions in each step. The MIP model brings together farm?s endowment of production factors, the production activities and the investment options.
In the first period all plots are distributed to farmers, thus land auction is not necessary. In the following periods free land is allocated among farmers via a sequential first-price auction. In each sequence, bids are made for only one plot. I.e., every farm selects the plot which is most valuable to it and then calculates the bid accordingly. The farm with the highest bid gets the plot it wishes. The auction is repeated afterwards until all plots are allocated or until there are no further positive bids. The fact that farms bid for the most valuable plot instead of all farms bidding at the same time for one plot avoids first-mover advantage. To consider complementarities between different soil types, the auction alternates between them. When a plot is rented a contract duration is assigned to it. The contract duration is binding, that is neither the land owner nor the land manager can terminate or renegotiate the rental contract during the entire contractual period. Based on their actual amount of land, farms calculate one after another whether they want to invest or not. After investment decisions are made, the available hours of labour, liquidity as well as stable places and machinery endowments are updated. In the production process each farm chooses the amount and combination of production activities in order to optimally use its production factors. The total amount of products is summed up and transferred to the market, where product prices are updated accordingly. The actual prices are then considered in farms' accountancies. For the farm accounting financial indicators such as income, profit, equity capital change, depreciation of buildings, withdrawals for unpaid family labour etc. are calculated. Unpaid family members withdraw a certain amount of money from the farm's profit for paying taxes and consumption. Remaining money is saved and increases equity capital. If withdrawals are higher than profit, equity capital is reduced. Accountancy data for each individual farm are written in output files and apart from this, data is aggregated for all farms as well. At the end of each period, farms receive information about the political and economic environment for the next year. This affects the farms' expectations for the future. In the disinvest process, the amount of production factors is updated, that is plots with terminated rental contracts are released and investment objects at the end of their useful lifetime are subtracted from the list of farm's production factors. Considering the updated production factors and their expectations regarding future policy and economic environment, farms decide whether to continue farming or not based on the objective to maximise profit or income. Therefore, they calculate their expected income from agriculture for the next year and compare it with the opportunity costs of their production factors. If the age of a farmer is equal to the maximum duration of management a generation change takes place. Therewith, opportunity costs of a possible successor are assumed to be 25% higher because education and training are considered as specific and irreversible investments. If opportunity costs are higher than the expected agricultural income, farms exit the sector. They also do so if they are illiquid. Land released by terminated contracts and exiting farms is available for renting in the next period. The simulation terminates when the number of specified time steps is reached or if all farms stopped farming.
Basic Principles: The following economic concepts are considered in the model: profit or income maximisation, sunk costs, path dependency, economies of size, myopic behaviour, shadow price, transport costs, and opportunity costs.
According to the theory of sunk costs farms do not consider costs of assets (stables and machinery) because these costs arise anyway. This is a realistic assumption because a market for agricultural buildings does not really exist. Sunk costs affect farmers' behaviour and lead to path dependency as shown by Balmann et al. (1996). Path dependency describes a situation where a system is locked in and can only be abandoned at extremely high costs (Arthur 1989). Economies of size are implemented in the model so that investment costs per unit decrease with the size of the investment. Moreover, labour is assumed to be used more effectively with increasing size.
Farm decision making is myopic or boundedly rational (SIMON 1955, 1956, 1996), that is, agents make decisions based on the information available to them, which can possibly even be wrong. The decision problem of the modelled farms is highly simplified compared to that of real farmers in that strategic aspects are not included. Indeed, individual farms in AgriPoliS have information on rents as well as product and input prices but they do not know about other farms' production decisions, factor endowments, size, etc. Farm agents are also boundedly rational with respect to expectations. In reality in a majority of cases, farm agents follow adaptive expectations. Merely policy changes are anticipated one period in advance and included into the decision making process.
To rent land, farms formulate a bid about how much they are willing to pay for renting an additional plot. This bid is based on the farm's shadow price of land. The shadow price is the value by which the farm income would increase if the amount of scarce production factors, here land is increased by one unit (cf. Hazell and Norton 1986).
Compared to regional models like RAUMIS and farm group models like FARMIS, AROPAj and FAMOS (HENRICHSMEYER et al. (1996), JACOBS (1998), JAYET et al. (2007) and HOFREITHER et al. (2005) ) which are mainly used to predict agricultural production, AgriPoliS considers space explicitly. Even if, the landscape in AgriPoliS is rather a model of the real landscape than an exact replication of it (e.g. GIS-based) this allows considering transport costs from the farmstead to the plots and thereby spatial competition on the local land market.
Emergence: Structural change and land price evolution emerge based on the individual decisions of all farms. How a farm develops can only be predicted to a certain extend based on the initialization (e.g. product prices and costs). A farm's development always depends on decisions of neighbouring farms.
Adaption: Farms adapt to changing conditions on markets, their local environment and to policy changes by changing the combination of their production activities or production factors in particular by investing in new objects. Furthermore, they can grow by renting additional plots or shrink. Shrinking is not an active process. Farms release land only when a rental contract for a plot is terminated or if the farm is closed down. Surviving farms can try to lease the plot again or other plots by formulating a bid but it is not sure that this will be the highest bid and that they get the acceptance. A final and irreversible adaption is the exit from agriculture.
Objectives: Farms maximise their household income by using mathematical programming. Therefore, a one-period Mixed Integer Programming model is built including continuous production activities (hire employees on an hourly basis, grow crops on a certain proportion of farmland, borrow credits, etc.), integer investment options (build one stable and not parts of it, hire an employee on a yearly basis and not parts of them), farm's production factors and general production restrictions (cf. Hazell and Norton 1986).
Prediction: Farms expectations about future prices are adaptive.
Sensing: Farms are assumed to know their own state and the state of their investment objects and plots. They also get information about policy changes and price changes caused by policy changes one period in advance. Furthermore, farms sense the state of all plots in the region, and hence can determine which additional plot they wish to rent. However, they do not have any information about their neighbours.
Interaction: In AgriPoliS, farms interact indirectly via the land market as well as via markets for products. On the land market, farms are directly competing with each other. Product markets can be influenced by the individual farmer's production decision as the supply of a product affecting its price. National and EU-wide product markets are coordinated via a simple price function with an exogenously given price elasticity. For regional markets other rules exist.
Observation: AgriPoliS produces results at the sector level as well as for each individual farm at each time step. It delivers results related to economic indicators, production, and investment. Depending on the research question different indicators are analysed. Economic indicators such as profit per farm, economic land rent, rental prices or farm growth are systematically analysed. Results on production and investments are analysed to understand the economic effects.
For the description of the modules Pitson (2021) is used, which largely based on the AgriPoliS input and output objects description found in section 3.4 of Happe (2004).
For the farm agents to make decisions, they must have a set of rules to follow. Generally speaking, the agents must maximise their profits or incomes. Given the complexity of each agent's decisions, a more detailed account of the decision-making is necessary to avoid the model being a "black box" of calculations. This section details the processes and calculations that the agents make to decide how they can maximise their situation, given the constraints they face.
Before delving into the details of the model, it is essential to have an overview of the steps the agents go through in each simulation period, representing one year. Figure 1 is a flow chart that describes these steps in the core version of AgriPoliS. First, the model region is initialised, where the variables such as managerial ability, investments and their ages, farmstead and plot locations, age of farm are randomly assigned. The distribution of the variables can be adjusted to reflect the characteristics of the simulated region or scenario. Then, each agent begins its decision-making process. First, the agent calculates its bids for available land plots based on its expected returns from cultivating that additional plot. The bids go out to the land rental market, the main point of agent interaction and the highest bidder receives the plot. Next, the agent assesses the state of its investments and decides whether investing in this period would maximise its profits or income. After, based on the agents' resources, the agent decides what to produce. Then, it does its annual accounting, which leads it to decide whether it will continue to farm. Agents that are illiquid or whose operator could earn more off-farm exit agriculture. Agents who are at the age of retirement and have a successor that could earn more off-farm exit agriculture. If the successor cannot earn more off-farm, the successor takes over, and the farm continues. In all cases of farm closures, the land returns to the land bank, where the remaining farms can bid on it.

Figure 1 Agent decision-making flow chart
Table 1, describes the variables used in the calculations throughout the simulations.

Agents make plans to maximise their annual household income or profits based on their expected prices and costs, given their resources and constraints.
For agents to find their optimal use of their resources, a mixed-integer program (MIP) is used. A MIP is used because investments and fixed labour are non-divisible, thus integer activities. A MIP solves for the optimal actions given the restrictions. In AgriPoliS terms, the MIP maximises the agents' household income/profits by telling the agents what to produce given their:
Using the abbreviations in Table 1 the MIP optimisation problem is expressed as:
$$\text{max }\quad Y^e(\boldsymbol{x}, \boldsymbol{p^e}, \boldsymbol{c}, \boldsymbol{A}, \boldsymbol{I}, \boldsymbol{r}, MP, D, RE, L, BC, IC ...)$$ $$ Y^e= \boldsymbol{x^\prime} (\boldsymbol{p^e}-\boldsymbol{c})+IR+S+W-RE-MC-D-OV-TC-IC-HW $$ $$ \text{ subject to }\quad \boldsymbol{b} \ge \boldsymbol{x^\prime r} \quad \text{with} \quad \boldsymbol{r}=(r_1,...,r_l;..., r_H,...,r_J ) \quad \text{ and} \quad \boldsymbol{x}\ge \boldsymbol{0} $$The land market plays a central role in AgriPoliS as it is the primary interaction between agents. Each plot in the model is the same size, and plots are not divisible. Model plot sizes represent the average plot size of the region. Farm agents can own land if it is common in the real region. The amount and types of owned land are assigned to agents at initialisation. Agents may not sell their land but can choose to rent it out to maximise their profits or household income. Equally, agents cannot purchase land. Instead, they compete in the land rental market.
Agents bid annually on available plots in an iterative auction. In making their bids, agents take into account transport costs, potential economies of size for their machinery, taxes, and administrative costs. The bid BIDy,z for plot Py,z of either land type is a function of both transport costs TCy,z between the farmstead and the plot, and the number of adjacent plots T defined as:
$$ BID_{y,z} = (q_{land} - TC_{y,z})\cdot \beta + T \quad \text{when}\quad 2\lt T\le 8 $$ $$ BID_{y,z}=(q_{land}-TC_{y,z}\cdot\beta \quad\text{when}\quad 0\le T \le 2 $$ $$ \text{with}\quad 0\lt \beta \lt 1 $$$q_{land}$ is the agent's shadow price, or estimate benefit, of an additional plot. The shadow price is determined by the MIP, which produces the vector q, shadow prices of scarce resources. The parameter ? reduces the bid to reflect the costs associated with leasing land, e.g. taxes, administrative costs, labour costs and fees, and the additional rent derived from renting that specific plot. The agent with the highest bid receives the plot.
The length of the rental contract is randomly assigned based on typical rental contracts in the region. In AgriPoliS, there are no penalties for farms that terminate their rental contract early. Land enters the rental market by contracts ending or farms closing and their owned land being put up for rent. An agent terminates their contract for a rented plot early if the shadow price does not cover the plot's costs, consisting of the rent and transportation costs.
The agents plan their production based on their expectations, as the actual prices and costs are revealed at the end of the model year. These expectations are short-term, including the next period or model year. The agent assumes that in the periods following, the prices and costs will remain constant.
Agents determine their price expectations for production activity i in period $t +1$ by:
$$ p^e_{i,t+1} = ({p_{i,t}}^\alpha\cdot {p^e_{i,t}}^{(1-\alpha)})\cdot \gamma_i^{-1} \quad \text{ with}\quad 0 \le \alpha\le 1\quad\text{and }\quad p \gt 0 \quad\text{for}\quad i = 1,K,I$$Coefficient $\gamma$ accounts for the price trend, the percent change in price from the previous period, in production activity $i$ , where prices increase if $\gamma\lt 1$ and decrease if $\gamma\gt 1$ . The actual and expected prices in period $t$ are equally weighted, $\alpha=0.5$ .
Agents form cost expectations for agricultural activities similar to that of prices, minus the price trend. They are calculated as:
$$ c^e_{i,t+1}= {c_{i,t}}^\alpha\cdot {c^e_{i,t}}^{(1-\alpha)} \quad\text{ with}\quad 0 \le\alpha\le 1 \quad\text{for}\quad i = 1,K, I $$The investment options in AgriPoliS comprise of typical machinery and stables that would be used in the region. Each agent has its investments based on the type of farm it is. At initialisation, each agent's investments are randomly assigned an age. Each investment has a cost, production capacity (animals or hectares), lifespan (model years), labour requirements (hours), and maintenance costs. An agent invests if it expects that the investment(s) would return higher profits or household income than its current situation. Based on their price and cost expectations, agents calculate what they expect their income or profits to be if they were to invest.
In AgriPoliS, economies of scale are assumed and realised through investments. Larger investments have a lower cost per unit produced compared to smaller investments. The larger the investment, the smaller the labour demands per unit, resulting in lower costs per unit produced. Investments are sunk costs, which cannot be sold once purchased.
When considering a new investment, agents account for the cost-savings of using more advanced technology. For livestock, they formulate their cost expectations $c^e_{i,t+1}$ of production activity i produced with investment object I as:
$$ c^e_{i,t +1} = c_{i,t} - f_{o,i}\cdot c_{i,t } \quad\text{with}\quad 0 \le l \lt 1 \quad\text{for}\quad i = 1,K, I $$Where factor $f$ represents the size of the investment, with the factor increasing with larger investments.
For plant production, larger machinery's cost savings can only be realised if the agent has sufficient land. An agent with 100 ha will not save on machinery costs per unit if they invest in a large tractor suitable for farms 500 ha and larger. An agent with 500 ha is better off to buy a larger machine than several smaller machines. Expected costs of plant production activities $c^e_{i,t+1}$ are a function of costs at the outset of the simulation in period t=0, adjusted by a factor l, a function of the average number of adjacent plots and the size of the farm calculated as:
$$c^e_{i,t+1 }= c_{i,0} - l \cdot c_{i,0} \quad\text{with}\quad 0 \le l \lt 1\quad\text{for}\quad i = 1,K, I $$Factor $l$ captures the effect of land size and is calculated as:
$$ l_t=\left[ 1-\frac{0.15}{(1+100/Z)}\right] \cdot \left[ 1-\frac{0.45}{1+100/(10\cdot AP_t+1)}\right] $$Investment-related expenditures are distributed throughout the investment's lifespan. The average annual costs, $AC_h$ , of investment, $I_{h,i}$ , considered in the farm-planning objective function are calculated by:
Agents use long-term loans to finance their investments. The loan runs for the investment's lifespan, and each agent receives the same rate of interest on a long-term loan. An agent will only invest if its share of self-financed capital does not exceed its minimum capital reserve (MR), calculated using the defined variables in Table 2 by:
$$\sum^L_{l=1} (v\cdot A_l) \le L + 0.7\cdot LA + 0.3 \cdot \sum^L_{l=1}A_{ec,l} \quad \text{with}\quad L=EC_{t-1}-LA-\sum^L_{l=1}A_{ec,l} $$This means that 70% of land assets (LA) and 30% of the financed fixed assets must be covered by the agent's capital $EC_{t-1}$ at all times. The parameters 0.3 and 0.7 were set because they produced the most realistic results during calibration tests (Happe, 2004).
After an agent has made all of its decisions, the model year ends with the annual accounting. At this point, each agent decides whether or not to continue. In the core version of AgriPoliS, a farm closes for three reasons. A farm closes if it is illiquid, meaning it could not get a line credit. The second reason a farm closes is if the agent's opportunity costs are too high or if the agent could earn more off-farm. The third reason that a farm closes is if it is time for retirement and the agent's successor's opportunity costs are too high. It is assumed that as agents age, they will earn less off-farm than the successor. Table 2 describes selected variables calculated in the year-end financial statements.

These remarks on preparing input files for AgriPoliS focus mainly on the syntactic aspects of the input files. Only some limited information are provided regarding the meaning and preparation (calculation) of the data in the input files, as this is addressed in greater detail in 6.1.
The following general remarks apply to all input files
#is a comment line. They are treated just as empty lines and therefore have no influence to the program.
!contains the column names of the table. The column names for columns which are necessary for the program must be kept unchanged. The necessary columns for such files are given in corresponding sections below. Additional columns can be added to the table without influence to the program, but they must have column names in the
!line. Consequently, if a file has a line starting with
!, then the order of the columns is insignificant.
!-line.
.txtextension) the program will give out a warning.
investin the capacity link has one more value than in objective function links or matrix links.
liquidity/financing_ruleif the other parts of the links are the same.
!-line.
-symbol, otherwise they must be numbers.
!-line.
Policy will be initialized with the policy of iteration 0.
Where Scenario:, Description:, Policy_file:, [options] and [globals] are part of the format. The globals listed under [globals] and the options under [options] override the corresponding values in globals.txt and options.txt respectively. The scenario name will be in the output files.
farm_investment.dat: provides information about type and number of investments each farm has made during the simulation;
farm_production.dat: provides information about which kind of agricultural products and how much each farm has produced during the simulation;
farm_standard_indicators.dat: provides economic and financial for each farm during the simulation
sec_prices.dat: provides information about development of prices introduced in the model for each product during the simulation
sector.dat: provides economic, financial and agricultural information at the sectoral level
The purpose of this guideline is to assist AgriPoliS users in the collection and preparation of data for the implementation of their region into AgriPoliS. This guideline is the documentation of the data collection process IAMO took in the implementation of the German NUTS 2 region, Weser-Ems, into AgriPoliS. It is broken into the following steps:
Structural data is the basic statistical information, from which the structural composition of the region can be interpreted. With this data, the modelers have an idea of the typical farm structures in the region which serve to both assist the automated process of selecting typical farms and to verify the reality of the model in the automated upscaling process.
Examples of the indicators accompanied by Weser-Ems data can be seen below in Table 3 .
A few tips to keep in mind during the structural data collection:Be aware of how full and part time farms are classified in your structural data. Does it depend on the amount of labour needed? Or European Size Units (ESU)? The FADN uses ESU based on the country in which the farm is located.
The purpose of this data is to represent the region ? do not simply fill in your regional statistics based on Weser-Ems structural data. The information should reflect the region. E.g. is there significant protein crop production? Add it under arable land.
The size groupings listed below are relevant to depict Weser-Ems' structure. Please use size groups which best represent your region.


The structural data is typically gathered and published by a government agency. For the Weser-Ems region, the data is prepared and distributed by the Landesamt fuer Statistik Niedersachsen; the state statistical agency.
The three input files which are especially important for the creation of new model regions are the market, investments, and globals; explained in the following sections. These files provide the model with the financial information, production and investment options, and labour activities for the region. This data should be as recent as possible correspond to the year of your structural data. It should represent the typical or average of the region. For example, the price and costs of crop production can vary drastically across Germany based on the soil quality and typical machinery of the region. For this reason, it was important that we spoke with experts to confirm our numbers so that we were not representing the prices and costs of a region which produces under different circumstances.
We suggest that users first collect data from stastical sources and then confirm this with local experts. For Weser-Ems, data was collected from various German statistics on agricultural business planning such as the KTBL and the Niedersachsen and Brandenburg Agricultural Ministries data collections. We realized that often such data sources provide ?best-practice? or data from the top-performing farms, what is neither representative nor helpful to model a region. After we gathered and calculated our inputs, we confirmed our inputs with regional experts. Confirming your data with regional experts will both ensure accuracy and enable you to learn more about the region, e.g. what the restrictions for production are; information that is necessary to produce the final inputs and calibrate the model to the new model region.
The market input file defines key production activities in the CS region. The file requires data on the costs and benefits associated with crop and animal production in your region. Here we are looking for what is typical or average in the CS region. This is particularly relevant for the prices, costs, and labour requirements, as they can vary across country and even within countries.
If we take winter wheat production in Weser-Ems as an example, we need to know:
The investment input file should reflect the typical investment options, which are stables and machinery, of the region. This also includes past and future investments. Past investments are the types of stables and machines that farms have and use now but would no longer be invested in today. Future investments are the stables and machinery that will likely be invested in in the future. Like in the markets, we are looking for the typical or average costs that farmers have in the region.
Using sow stables as an example, we will need to know:
The globals file contains general information which are used in the model.
For AgriPoliS, globals vary from average annual milk yield per cow to average plot size. In the Excel document, GLOBALS, annotated explanations are provided of each variable that is foreseeably required for new region implementation. However, if you think that there is information that is relevant for your region but not being asked for, please document it in the requirements and restrictions, detailed in the following section.
In addition to the input files data, modelers need general information on requirements and restrictions of the region in order to capture the details of the regions in the matrix (see 4.3.2).
This is for example necessary to capture the feeding requirements per animal:
Regarding restrictions, modelers need to capture both general environmental production restrictions but also the unique socio-political-economic situations of the model region. For example, we have recently been introduced to a region where the local ministry will not give any building permits to farmers for livestock stables. This unique circumstance of the region drastically affects the investment possibilities, a core function of the model. Therefore the modelers must alter the input files in such a way that AgriPoliS understands the restrictions and models a version of the region which closely reflects reality.
Some questions to think about in detailing the restrictions:
As premiums play a strong role in EU agriculture, it is important to understand the premium distributions of each region. Some relevant questions might be:
To adapt AgriPoliS to a new region a set of typical farms has to be selected. This is done through an upscaling process, where the model farm structure is created through model farms which represent the typical farms in the region so that the model regions reflects the real-world region. The process was automated by Sahrbacher and Happe (2008) and modernised for current technology as part of the AgriPoliS2020 project.
Using anonymised FADN farms and the regional farm structural data, the upscaling program selects the fewest number of characteristic farms from the FADN sample to appear in the model region a certain number of times. These selected "typical farms" cumulatively result in a region closely resembling the farm structural data statistics.
The quadratic integer optimisation problem can be represented mathematically as:
$$\text{min}\quad \sum_i w_i (S_i-F_i)^2 $$ WhereTo run AgriPoliS, you need
inputfilescontains
farmscontaining as many text files as typical farms (region specific)
mipcontaining following text files: capacityLinks, matrix_new, matrixlinks and objFuncLinks
glpk_4_45.dllwhich the program needs for solving farms? optimization problems
A Batch file to start AgriPoliS should look like this:
start cmd /k D:\Users\YourName\YourFolder\AgriPoliS\src\agpCC\release\agpCC.exe D:\Users\YourName\YourFolder\YourRegion\inputfiles
You can use Editor, Notepad++ or any equivalent software open and edit an existing batch file or to create your own. Please adjust the paths leading to the executable file agpCC.exe as well as to the folder inputfiles and save the file as ChooseAName.bat before you close it.
All you have to do now is to double click on the batch file and there you go: The program will open a completely unspectacular black window where you can see that the program is initializing, in which iteration the simulation is and how many farms are still active.
Output files will automatically be saved with the .dat extension in separated, automatically created outputfiles folder in the same folder where your inputfiles are saved (D:\Users\YourName\YourFolder\YourRegion ). The output folder contains 5 files:
farm_investment.dat: provides information about type and number of investments each farm has made during the simulation; farm_production.dat: provides information about which kind of agricultural products and how much each farm has produced during the simulation; farm_standard_indicators.dat: provides economic and financial for each farm during the simulation sec_prices.dat: provides information about development of prices introduced in the model for each product during the simulation sector.dat: provides economic, financial and agricultural information at the sectoral levelIt is recommended to run simulations with different initializations to assure the robustness of the results. To run simulations with repetitions, you need a batch-file and it has to look like this:
echo off
set i=1
set max=101
set workdir=D:\Users\YourName\YourFolder\YourRegion
set inputdir=%workdir%\inputfiles
set scenario=scenario
set ext=.txt
set file=%inputdir%\%scenario%
rem set ranfile=randomNumbers.txt
rem set ran
:start
echo ============== Repeat %i% ==============
if "%i%"=="%max%" goto end
rem set ran=%RANDOM%
rem echo %ran% >>%inputdir%\%ranfile%
PowerShell "(GC %file%%ext% -Raw ) -Replace '_SEED_', %i% |SC %file%-%i%%ext%"
%workdir%\agpCC-hoc.50.exe %inputdir% %scenario%-%i%%ext% %i%
del %file%-%i%%ext%
set /A i=%i%+1
goto start
:end
With set i and set max you set the number of repetitions. This example will run 100 repetitions. It is necessary to specify the input variables that you want to vary with the different initializations in the scenario.txt file. They have to be indicated as follows:
seed_demogFF _SEED_
seed_demogCF _SEED_
seed_demogNewAge _SEED_
seed_mgmtCoeff _SEED_
seed_farmAge _SEED_
seed_closeFarm _SEED_
seed_investAge _SEED_
seed_contractLengthInit _SEED_
seed_contractLength _SEED_
seed_freePlot_initLand _SEED_
seed_freePlot_rentPlot _SEED_
Additionally, and in contrast to runs without repetitions , you need to create a folder for your output files under the same directory as your input folder, before you start the batch file. The folder needs to contain "outputfiles" and the name of the scenario that is indicated in the scenario.txt input file, both separated by an underscore: D:\Users\YourName\YourFolder\YourRegion\outputfiles_Yourscenario. This is not done automatically!