---
title: "Supporting Sustainable Agroecological Initiatives for Small Farmers through Constraint Programming"
authors:
  - "Margot Challand"
  - "Philippe Vismara"
  - "Dimitri Justeau-Allaire"
  - "Stéphane de Tourdonnet"
doi: "10.24963/ijcai.2023/657"
url: "https://ijcai.org/proceedings/2023/657"
pdf: "https://ijcai.org/proceedings/2023/0657.pdf"
venue: "Proceedings of the Thirty-Second International Joint Conference on Artificial Intelligence"
year: 2023
pages: "5924-5931"
track: "AI for Good"
keywords:
  - "AI for Good: Constraint Satisfaction and Optimization"
  - "AI for Good: Multidisciplinary Topics and Applications"
  - "AI for Good: Planning and Scheduling"
---

# Supporting Sustainable Agroecological Initiatives for Small Farmers through Constraint Programming

Margot Challand, Philippe Vismara, Dimitri Justeau-Allaire, Stéphane de Tourdonnet

*Proceedings of the Thirty-Second International Joint Conference on Artificial Intelligence*, pages 5924-5931. DOI: [10.24963/ijcai.2023/657](https://doi.org/10.24963/ijcai.2023/657)

## Abstract

Meeting the UN's objective of developing sustainable agriculture requires, in particular, accompanying small farms in their agroecological transition. This transition often requires making the agrosystem more complex and increasing the number of crops to increase biodiversity and ecosystem services. This paper introduces a flexible model based on Constraint Programming (CP) to address the crop allocation problem. This problem takes a cropping calendar as input and aims at allocating crops to respect several constraints.  We have shown that it is possible to model both agroecological and operational constraints at the level of a small farm. Experiments on an organic micro-farm have shown that it is possible to combine these constraints to design very different cropping scenarios and that our approach can apply to real situations. Our promising results in this case study also demonstrate the potential of AI-based tools to address small farmers' challenges in the context of the sustainable agriculture transition.

## Full text

## 1 Introduction

Agriculture is now at a crossroads. It requires many innovations to meet the challenges of food security and nutrition (FSN) while evolving towards sustainable food systems. Agroecology, one of the main drivers of this transformation, aims at building locally relevant food systems that strengthen the economic viability of rural areas based on short marketing chains, and fair and safe food production [HLPE, 2019]. However, there is a gap of knowledge between agroecological principles and practical applications that requires the development of new tools to help design agroecological farms [Duru et al., 2015]. In this paper, we focus on the problem of crop allocation taking into account both agroecological and operational constraints.

Among crop management problems, the crop rotation problem has been the most studied. It consists in choosing a set of crops and assigning them recurrently to different periods on a set of plots. The choice is usually driven to optimize land use to maximize net income. For decades, many decision tools have been developed to address the combinatorial nature of the crop rotation problem. Most of them are implemented with Mixed Integer Linear Programming (MILP) and according to [Dury et al., 2011], they are often based on a single monetary criterion optimization procedure. Sustainable agriculture concepts can be integrated, first of all, the principle of crop rotation which requires alternating crops from different botanical families, as opposed to monoculture systems. The use of fallow land and green manures or the separation of fields containing the same crops can also be considered [Alfandari et al., 2011; Fendji , 2021 ].

However, these decision support tools do not seem to be able to fully meet UN Sustainable Development Goal 2: double the agricultural productivity and incomes of small-scale food producers and ensure sustainable food production systems and implement resilient agricultural practices. Indeed, crop rotation and crop management tools cannot be used by farmers worldwide because they neglected farms with only a few hundred square meters of farming ground [Sch¨oning et al., 2023]. However, farms smaller than 2 hectares produce roughly 35% of the world's food [Lowder et al., 2021]. One of the conditions for the sustainability of these small farms is their ability to combine a large number of vegetable and fruit crops. In these farms, such as agroforestry systems, crops are managed at the scale of vegetable beds that allow the production of several plants (fruits, vegetables, etc.) on the same plot (see Figure 1).

To our knowledge, crop management tools have not yet been investigated in highly diversified cropping systems in an operational sustainable agriculture approach. For large farms, an intermediate approach has been proposed in [Juventia et al., 2022] which investigates rotations of alternating strips of two or more crops within the same plot. For small farms, it is necessary to develop decision support tools that can integrate the specificities of the farm. This means being able to select the most relevant agroecological constraints for each farm and combine them with the operational constraints identified by the farmer in order to help him explore and choose among a multitude of spatial and temporal crop arrangement solutions. Artificial intelligence can contribute to the development of these tools by providing formalisms with a high level of expressiveness, such as Constraint Pro-

© 2021 Potagers &amp; Compagnie

Figure 1: The diversified micro-farm constituting the case study.

![Image](https://ijcai.org/proceedings/2023/fulltext/657/image_000000_5e092f86c9c28123fdd8093d5bd485a671815251f08ff68ac9c6efafea8fbdd1.png)

gramming [Rossi et al., 2006].

In this paper, we propose to use Constraint Programming to model and solve the crop allocation problem at the level of the vegetable beds of small diversified farms. This work is only the first step in the development of an operational tool, the next step being a participatory validation phase with farmers and agroecological farms designers. The remainder of the paper is organised as follows: we first introduce mixed fruit tree-vegetable cropping systems which are widespread on small farms (Section 2) then we formalize the associated crop allocation problem (Section 3) and we propose a flexible Constraint Programming model (Section 4) which is applied to a real case study in an organic micro-farm (Section 5). Finally, we briefly discuss the results and perspectives.

## 2 Mixed Fruit Tree-Vegetable Cropping

## Systems

Mixed fruit tree-vegetable cropping systems are agroforestry systems that associate fruit trees and diversified vegetables (often more than 40 species and varieties of vegetables) on the same plot. These agricultural systems are common in tropical countries in the form of home gardens. In temperate regions, they have lately regained importance. They are most often found on small-scale organic farms, which sell their products through short supply chains [L´eger et al., 2018]. Due to their highly agroecological nature, these emerging forms of agroforestry systems are able to address many of the current issues of agriculture. Indeed, they allow a reduction of the land required for food production thanks to their efficiency [Paut et al., 2020]. Their diversified production is particularly suited to the needs of urban populations while facilitating the creation of social bonds, as it allows the shortening of food supply chains. Finally, due to their strong agroecological properties, these systems can limit negative externalities in agricultural systems while maintaining high levels of agricultural production per unit area.

Mixed fruit tree-vegetable cropping systems are divided into production units, which generally correspond to a vegetable bed. A vegetable bed is a long thin strip of about 1m width on which a succession in time of different vegetable crops will be grown. The arrangement of the beds is usually linear. They are arranged next to each other and generally grouped in bundles of 10 to form a new unit called a 'garden'. The gardens can be separated from each other by one or more rows of fruit trees. Each bed has a set of characteristics (e.g. pedoclimatic characteristics, proximity to a spot on the farm, etc.). Figure 1 is an example of a diversified micro-farm with vegetable beds. The growth of the fruit trees will gradually modify the characteristics of the adjacent beds. Market gardeners define their cropping calendar each year, i.e. the list of vegetable crops they have to grow at each period of the year to achieve their production objectives, and in adequacy with the available workforce. The market gardeners will then create their cropping plan for the year by allocating the selected crops to vegetable beds for a fixed time period in the field.

The creation of the cropping plan is crucial because it will be decisive for the productivity of the coming year. To arrange the crops, the market gardeners take into account various constraints of three different types : operational, pedoclimatic and agroecological. Indeed, since micro-farms are often characterised by a high workload for the vegetable growers [Morel et al., 2018], the layout of the crops must allow them to limit the number of trips around the farm in order to limit their workload. At the same time, they must take into account the soil and climate characteristics of each vegetable bed. In order to prevent soil impoverishment, but also to break the cycle of pests and diseases and thus limit their attacks and phytosanitary treatments, vegetable growers establish crop rotations, i.e. they do not plant the same crops on the same bed one after the other. Finally, it is possible to reduce the use of synthetic inputs by arranging vegetables in such a way as to place crops in close proximity that have beneficial interactions with each other, for example repelling insect pests or attracting insect crop helpers [Ratnadass et al., 2012]. Since every farming system is different, the creation of the cropping plan must integrate the specifics of the ecological, agronomic and human contexts in order to propose an adapted solution.

Creating the cropping plan is a multi-criteria and highly combinatorial problem, and market gardeners struggle to take all the constraints into account. To reduce the complexity of the process, they use predefined crop groups based on their chosen criteria, which is mainly botanical family. Each group of crops is allocated to a garden and shifted every year to the next garden [Morel and L´eger, 2015]. However, this strategy fails to integrate agroecological constraints that favour natural regulation processes. The model presented in this article makes it possible to explore alternative solutions for arranging vegetable crops taking into account operational and agronomic constraints and the soil and climate characteristics of the land, as well as integrating agroecological constraints. Note that the cropping calendar is decided by farmers and is an input of this model.

## 3 The Crop Allocation Problem 3.1 Input Data

## The Mixed Fruit-Vegetable Micro-Farm

A micro-farm F is composed of N vegetable beds {b0, ..., bN-1}, distributed among various gardens (see Figure 2). An important consideration in our crop allocation problem is the spatial adjacency of beds, which we define as follows:

Definition 1 (Adjacency of vegetable beds). Two vegetable beds bi and bj are adjacent if they are located in the same garden and share a common side. We define the adjacency function as follows:

<!-- formula-not-decoded -->

Each garden and each vegetable bed can be associated with a set of characteristics, such as their level of sun exposure, their soil characteristics, their distance from the barn, etc.

## The Cropping Calendar

In this problem, the cropping calendar is a fixed input. It consists of a list of various vegetable crops that market gardeners have planned to grow throughout the year, in specific time intervals. Note that the time unit in this context is the week. Thus, given a micro-farm F, the cropping calendar C is defined as a set of L vegetable crops {c0, ..., cL-1}. Each vegetable crop ci is defined by a set of attributes, which we define in the following.

Crop attribute 1 (Crop type). Let ci be a crop, we define the crop type of ci by its botanical species spi . Any species spi is also associated with its botanical family fami . Note that distinct species can be from the same family, but a species is from a single unique family.

Crop attribute 2 (Time interval). Let ci be a crop, the time interval ti = [si, ei] ∈ N2 is the time during which market gardeners want to allocate the crop ci to a vegetable bed. si and ei are respectively the starting and ending cultivation weeks of the crop.

Note that, according to market gardeners' production objectives, it is frequent to have distinct crops that are from the same species and are cultivated during the same time interval. Such crops are said identical.

## Crop Type Characteristics and Interactions

Most of the constraints that market gardeners need to take into account are linked to the crops' botanical characteristics (e.g. light requirements), and their interactions. Thus, we introduce a set of crop characteristics that will be useful to define the operational and agroecological constraints of the problem.

Crop type characteristic 1 (Return delay). Let famk be a botanical family, the return delay rk ∈ N of famk is the necessary delay (in weeks) before it is possible to plant another crop from the same family on the same vegetable bed.

Crop type characteristic 2 (Light requirements). It is necessary to allocate crops in beds that satisfy their light requirement. Species are classified into three categories regarding their light requirement: full sunlight, shadow, unrestricted.

Crop type characteristic 3 (Care requirements). Crops that require frequent care (e.g. daily harvest) must be allocated to easily accessible beds. Species are classified into two categories: high and moderate care requirements.

Figure 2: Schematic example of a mixed fruit-vegetable micro-farm, with its gardens, beds, and rows of fruit trees.

![Image](https://ijcai.org/proceedings/2023/fulltext/657/image_000001_621f6005da338fb3a6c7b1bac44de0c0a409e7de50e7aafbf8ce4d62b3c024ce.png)

Crop type characteristic 4 (Monitoring requirements). Crops that require regular monitoring must be allocated to the beds located at the edge of the central path. Species are classified into two categories regarding their monitoring requirements: high and moderate monitoring requirements.

Crop type characteristic 5 (Species interaction). Given two species spi and spj , we denote by interij ∈ {-1, 0, 1} the degree of interaction between the species i and the species j. If spi and spj have negative interactions, interij = -1, if they have neutral interactions, interij = 0, and if they have beneficial interactions, interij = 1.

## 3.2 Formal Description of the Problem

First, we introduce the notion of intersecting crops, which simply designates any two crops whose time intervals intersection is not empty.

Definition 2 (Intersecting crops). Two crops ci and cj are said intersecting if their time intervals ti = [si, ei] and tj = [sj , ej ] have a non-empty intersection. Formally: ti ∩ tj ̸= ∅.

Given a micro-fam F and a cropping calendar C, our base problem consists in allocating each crop of C to a vegetable bed of F such that no two intersecting crops ci and cj are allocated in the same bed. We shall call such an allocation a feasible crop allocation, which defines as follows.

Definition 3 (Feasible crop allocation). Let F be a microfarm composed of N vegetable beds. Let C be a cropping calendar composed of L vegetable crops. A feasible crop allocation is a tuple {a0, ..., aL-1} of bed indices such that ai is the unique index of the bed on which the crop i is allocated, and such that no two intersecting crops are allocated in the same bed, that is:

<!-- formula-not-decoded -->

It is easy to show that this base problem can be solved in polynomial time, by reducing it to a colouring problem on an interval graph, a subclass of chordal graphs, for which the graph colouring problem can be solved in polynomial time

![Image](https://ijcai.org/proceedings/2023/fulltext/657/image_000002_5e615aa21566c72cbd83caf799f226b89c90ead36bf02635392df25afc4b437c.png)

(a) Cropping calendar as intervals

Figure 3: Representation of a cropping calendar as intervals, and its corresponding interval graph representation.

![Image](https://ijcai.org/proceedings/2023/fulltext/657/image_000003_e92ca57cd81845383e720a84834d10607277c5170e49d03c7b554f616dc8288f.png)

[Golumbic, 1980; Kolen et al., 2007]. This interval graph, G = (V, E), is defined such that:

<!-- formula-not-decoded -->

This crop interval graph and its colouring will be the main component of our CP model. An example of such a graph and its corresponding cropping calendar is depicted in Figure 3. Although this base problem can be solved in polynomial time, several additional constraints (agroecological, pedoclimatic , and operational) must be integrated into the crop allocation problem from a catalogue, according to market gardeners' needs and preferences. These constraints break the simplicity of the problem. We introduce this constraint catalogue in the following, assuming that ai is the index of the vegetable bed on which the crop ci is allocated.

Constraint C1 (Ensure return delays - agroecological). Agroecological principles recommend avoiding cultivating the same family one after another without respecting a given delay. In our model, this constraint holds if for any distinct pair (ci, cj) of crops from the same botanical family allocated on the same bed, the delay between the beginning of ci and cj is at least equal to the return delay associated with this botanical family. Formally:

<!-- formula-not-decoded -->

Constraint C2 (No negative interactions - agroecological). The proximity between cultures can be detrimental, for instance when one species shadows the other. Such situations can be avoided with a constraint that holds if every distinct pair of intersecting crops (ci, cj ) having negative interactions are non-adjacent. Formally:

<!-- formula-not-decoded -->

Constraint C3 (Dilute crops - agroecological). In some situations, crops from the same species must be spatially diluted to avoid the spread of diseases. This constraint holds if every distinct pair of intersecting crops (ci, cj) that are from the same species are non-adjacent. Formally:

<!-- formula-not-decoded -->

Constraint C4 (Compatible beds). For each crop, a list of beds compatible with its pedoclimatic and operational needs is defined. We have identified three criteria for crop compatibility with the beds.

- Ensuring light requirements (pedoclimatic)
- High care requirements (operational)
- High monitoring requirements (operational)

This constraint holds if every crop ci is allocated to a bed which satisfies the requirements. Let Bi be the set of beds which satisfy these requirements, then:

<!-- formula-not-decoded -->

Constraint C5 (Group identical crops - operational). This constraint holds if, a given set of crops {ci, ..., ck} (e.g. identical crops) are allocated to a connected set of beds (e.g. to limit the moves when market gardeners are working on the same crops). Without loss of generality, we consider that the numbering is consecutive from i to k. Formally:

<!-- formula-not-decoded -->

Given the definition of a feasible crop allocation and this catalogue of constraints, we can now introduce a formal definition of the crop allocation decision problem.

Definition 4 (Crop allocation decision problem). Let F be a micro-farm, C a cropping calendar, and R a catalogue of constraints. A crop allocation decision problem is a triplet (F, C,X ⊆ R). A solution to this problem is a feasible crop allocation {a0, ..., aL-1} such that every constraint in X is satisfied.

It can easily be proven that given the constraint catalogue introduced previously, R = {C1, C2, C3, C4, C5}, a crop allocation decision problem (F, C,X ⊆ R), where X is the set of constraints chosen by the market gardeners, is NP-complete depending on X. Indeed, constraint C1 breaks the chordality of the graph (see an example in Figure 4), turning the problem into a general colouring graph problem [Karp, 1972], while constraints C4 make the problem close to the list colouring problem, more general than the colouring problem, and NP-complete even for interval graphs [Arkin and Silverberg, 1987; Bir´o et al., 1992; Kolen et al., 2007]. To show completeness when C4 ∈ X, we transform any instance (G,L) of the list colouring problem on an interval graph G into an instance of crop allocation decision problem. Each interval is associated with a crop and the set of colours is the set of beds. Then, constraints C4 can be used to restrict the colours/beds allowed for each vertex/crop v to the given list L(v).

Since the set R is still under development and validation, it would be premature to try to design efficient algorithms for values of R where the problem becomes polynomial. The fact that the problem can be NP-complete validates the approach based on constraint programming whose great expressive power facilitates the collaborative design of the set R.

Figure 4: Cropping calendar and crop interval graph with an additional return delay constraint (in red). The additional edges in the graph break its chordality (a cycle of length 4 without chords is depicted with bold lines).

![Image](https://ijcai.org/proceedings/2023/fulltext/657/image_000004_7acfa3f73f725018039c8a845ad19cb946aa1ba1094fde163af50c81eed8dd42.png)

Finally, although in many situations the constraint satisfaction version of the problem is sufficient to satisfy market gardeners' needs, some may need to include an optimization objective. Just like the constraint catalogue, the aim is to provide them with several possibilities. Here, we introduce an optimization objective example which consists in maximizing the number of beneficial interactions between adjacent crops. This objective is defined by the number of adjacent and intersecting crops that are allocated to adjacent beds.

Objective O1 (Beneficial interactions). Given a crop allocation decision problem (F, C, X ⊆ R), the objective O1 is the number of adjacent and intersecting crops that have beneficial interactions. Formally, if {a0, ..., aL-1} is a solution, O1 is given by:

<!-- formula-not-decoded -->

Definition 5 (Crop allocation optimization problem). Let (F, C,X ⊆ R) be a crop allocation decision problem, o an objective variable, and p ∈ {minimize, maximize} a policy. The crop allocation optimization problem (F, C,X ⊆ R, o, p) is such that any solution {a0, ..., aL-1} is optimal according to o and p.

Since the crop allocation decision problem is potentially NP-complete depending on the constraints chosen in the set X, we can easily deduce that the optimisation problem becomes NP-hard depending on X.

## 4 A Flexible Constraint ProgrammingModel

Constraint Programming (CP) is a declarative paradigm for modelling and solving constraint satisfaction and constrained optimization problems (CSPs and COPs). One of the main advantages of CP are its expressiveness and flexibility, which makes it well-suited to design generic and adaptable decisionsupport tools. Indeed, the paradigm includes several types of variables (e.g. integer, set) and constraints (e.g. arithmetic, semantic) [Rossi et al., 2006]. Although to the best of our knowledge, CP was never considered to design crop management decision support tools (to the exception of [Akplogan et al., 2013], who used a weighted CSP approach to solve the crop rotation problem), it is well suited to encode the crop allocation problem described in Section 3. In particular, the flexibility of CP is welcome in the context of small farms, which have to cope with many contextual constraints.

## 4.1 The Base CPModel

Our base CP model relies on the notion of feasible crop allocation introduced in Definition 3. First, to each crop ci ∈ C we associate a decision variable (integer) ai ∈ [0,N - 1]. An instantiation of a variable ai corresponds to the index of the vegetable bed it is allocated to. To ensure that any tuple {a0, ..., aL-1} is a feasible crop allocation problem, that is no two intersecting crops are allocated to the same bed, we apply an ALLDIFFERENT constraint to each set of variables corresponding to the maximal cliques of the interval graph G = (V,E) defined in Section 3. Because G is chordal, identifying these maximal cliques can be done in linear time using the Minseps-Maxcliques algorithm with a Maximal Cardinality Search [Tarjan and Yannakakis, 1984; Berry and Pogorelcnik, 2011]. Note that this preprocessing step also gives a lower bound on the chromatic number of G, which can help detect an insufficient number of vegetable beds in advance.

## 4.2 CP Encoding of the Constraint Catalogue

Encoding the constraints described in Section 3 is straightforward in CP. For Constraint C1, we first identify all pairs of distinct crops (ci, cj) such that fami = famj ∧ |si - sj | ≤ ri and apply the constraint ai ̸= aj. For Constraints C2 and C3, for each pair of distinct crops (ci, cj) that must be nonadjacent, we identify all potential pairs of adjacent beds allocations from their domain and apply a TABLE constraint with forbidden tuples. We employ a similar procedure for Constraint C5, but with allowed tuples. Finally, Constraint C4 is encoded by reducing the domains of decision variables corresponding to affected crops. The symmetry related to identical cultures is eliminated thanks to INCREASING constraints between the corresponding variables.

## 4.3 CP Encoding of Optimization Objectives

In CP, the optimization objective is an integer variable. Thus, encoding an objective consists in adding a variable which is constrained to correspond to the metric that market gardeners want to optimize. To encode our example objective, O1, we introduce auxiliary adjacency Boolean variables adjij for each pair of distinct and intersecting crops (ci, cj) having beneficial interactions, using a reified TABLE constraint. Then, the objective variable o is constrained to be equal to the sum of auxiliary Boolean variables, with a SUM constraint.

## 4.4 Implementation and Distribution

We implemented the crop allocation CP model introduced here with Choco-solver, an open-source Java CP solver [Prud'homme and Fages, 2022]. The source code of our implementation is open-source and freely available in GitHub (https://github.com/philippevismara/agroecoplan) and Zenodo (https://doi.org/10.5281/zenodo.7970929).

## 5 Experiments

## 5.1 Case Study

The farm constituting this case study is an organic microfarm located in the Var department, in the south of France.

Figure 5: Annotated aerial photo of the case study's farm.

![Image](https://ijcai.org/proceedings/2023/fulltext/657/image_000005_98767597f235452ad0bb339eff9ce9e510a4246a1e542f37dafb2e741703073d.png)

This farm of 1 ha is managed by two market gardeners and is constituted of three production workshops: market gardening, fruit growing and laying hens. The farm includes 80 vegetable beds of 30m long by 0.75m wide which are grouped by 10 into 8 gardens numbered A to H. Gardens A, B, C, D and E are located along the central path, which is the most used path. Gardens C, D, E, F, G and H are separated from each other by double rows of fruit trees that shade the northern adjacent beds. From a practical point of view, the market gardeners go back and forth between the gardens and the equipment shed which is located at the beginning of the central path, in a wooded area. Thus, the workshop is the central point of the farm. (See Figure 5)

The list of crops used for this study is the list market gardeners have created for the year 2022. That year, the market gardeners decided to reduce their activity and eliminate the H garden. The list of crops contains 42 vegetable crops to be grown for different periods. Some crops have to be grown on several vegetable beds at the same time. Counting these repetitions, 77 crops must be assigned to the 70 vegetable beds.

In order to study the possibility of exploring cropping plans that take into account various constraints of different types (agroecological, operational and pedoclimatic), three scenarios with contrasting sets of constraints have been established. The first two scenarios test the possibility of exploring cropping plans by integrating agroecological constraints. The third scenario verifies the possibility of exploring cropping plans by integrating operational constraints.

The three scenarios have in common the pedoclimatic constraints linked to each vegetable bed. In this case study, because the soil characteristics are homogeneous on all the beds, the only pedoclimatic constraint is the light resource available. To allocate the crops to the vegetable beds we took into account the beds that are in the shade in summer and winter.

## Scenario 1: Interactions Between Crops

The constraint taken into account in scenario 1 is the constraint of interactions between crops. The proximity between crops can induce ecological processes that are favourable to both crops (e.g. attracting other crop pests' enemies). On the contrary, it can be unfavourable for both crops (e.g. transmitting diseases to each other). In this scenario, the allocation of crops that have negative interactions with each other on adjacent beds is forbidden ( C2). We also seek to maximise positive interaction between crops (O1).

Table 1: Summary of the results, including the number of cores used in each scenario, the solving time, and the completeness of the search.

|            |   Nb. threads | Solving time   | Complete search   |
|------------|---------------|----------------|-------------------|
| Scenario 1 |             8 | 1h             | No                |
| Scenario 2 |             1 | 0.16s          | Yes               |
| Scenario 3 |             1 | 0.16s          | Yes               |

## Scenario 2: Crop Rotations and Dilution Effect

The second scenario includes the constraint of rotation according to botanical families (C1) and the constraint of diluting the crops in space (C3), i.e. crops of the same species whose field periods overlap must be separated at least by one bed in order to limit disease transmission.

## Scenario 3: Facilitating Crop Management

The third scenario takes into account three operational constraints that aim to simplify crop management. The first is the grouping constraint (C5), i.e. identical crops must be allocated to adjacent vegetable beds in order to limit the moves when working on the same crops. The second is the constraint of facilitating frequent care (C4), i.e. the crops that require frequent care (crops that are harvested or weeded regularly) should not be allocated to the beds of gardens F and G because they are the furthest from the equipment shed. The third is the constraint to facilitate monitoring (C4), i.e. crops that need regular monitoring should be placed on the beds at the edge of the central path.

## 5.2 Results

All scenarios were run for one-year schedules on an Ubuntu laptop, powered with an Intel i7-12700Hx20 CPU and 32GB of RAM. In Scenario 1, a parallel portfolio strategy was used with 8 threads [Prud'homme and Fages, 2022] and a time limit of 1 hour was set. The solver could not provide optimality proof within this time. In Scenarios 2 and 3, the constraint satisfaction was quickly done by the solver on a single thread (see Table 1).

In Figure 6 which shows the model outputs at week 24 for the three scenarios, it clearly appears that the solutions generated by the model are different. They also differ from the cropping plan created by the market gardeners (see D in Figure 6). The market gardeners grouped most crops by botanical family and assigned these groups to different gardens. They then organized the rotations by moving each year families to the next garden. This strategy allows them to group crops together and thus limit displacements during an intervention on crops of the same species, and to integrate crop rotations according to the criteria of botanical families. However, it excludes the possibility of integrating agroecological constraints such as those considered in scenarios 1 and 2. For instance, in scenario 1 (see A in Figure 6), no crop pairs with negative interactions were allocated to adjacent beds, while the vegetable growers have negative interactions in their cropping plan (e.g. tomatoes and aubergines in D in Figure 6).

Figure 6: Schematic representation of week 24 for the model outputs for the three scenarios and comparing to the cropping plan actually created by the farmers. For scenario 1 and the market gardeners' cropping plan the interactions between crops are represented by coloured lines (red: negative interaction; yellow: neutral interaction; green: beneficial interaction). For scenario 3, red-framed beds indicate crops that require regular care and beds marked with a red arrow indicate the crops that require monitoring.

![Image](https://ijcai.org/proceedings/2023/fulltext/657/image_000006_9913ef103c3d358e47964b829c7ace85fd9d132e0b664b21945210c3f8053ae1.png)

The market gardener's strategy also excludes the possibility of integrating new operational constraints such as those considered in scenario 3 (e.g. market gardeners allocated onions to a garden located far away from the equipment shed). Finally, we have taken into account in the three scenarios the constraint of ensuring light requirements, while market gardeners have allocated some crops that require access to sunlight to shaded beds.

## 6 Discussion and Conclusion

In this paper, we have introduced a flexible model based on Constraint Programming (CP) to address the crop allocation problem, with a strong emphasis on empowering small farmers with decision support tools that were so far unsuited to their needs. In contrast to the well-studied crop rotation problem, this problem takes the cropping periods as input and involves a much greater diversity of crops and constraints. We have shown that this problem is a complex combinatorial problem, which requires both an expressive and flexible approach to address the wide variety of issues that small farmers need to face. Based on a real case study from an agroecological farm in the South of France, our approach have shown promise to efficiently provide small farmers with diverse and alternative cropping plans.

Such cropping plans could be of great help to foster sustainable and agroecological food production systems, and support small-scale food producers, in accordance with the UN Sustainable Development Goal (SDG) 2. However, further requirements for the appropriation of our approach by market gardeners are (i) its ability to satisfy as many situations as possible, and (ii) its availability. Indeed, although we have presented a flexible and extensible model and applied it in a real use case, we expect to discover many additional constraints and optimization objectives by confronting our approach with as many small farmers as possible, in as many places as possible. In addition, and as raised by [Sch¨oning et al., 2023], the provisioning of small farmers with advanced crop management tools is a major challenge for addressing SDG 2. As demonstrated in this work, CP is a good candidate to build such tools. Indeed, unlike ad-hoc approaches, AI-based approaches such as CP can provide high levels of flexibility, expressiveness, and extensibility.

More generally, our approach is part of a trend allowed by AI which tends to question many of our practices. Indeed, tasks such as the crop allocation problem are almost impossible to fully address without the help of computers. Not only do AI-based tools facilitate small farmers' tasks, but they also offer them the possibility to take a disruptive point of view about their practice. For example, it is frequent to witness practices that are contradictory with sustainability and agroecology but are employed because of operational constraints, a lack of knowledge about potential alternatives, and mainly, the combinatorial difficulty of including many constraints to build the allocation of the culture. As an example, many hypotheses about beneficial interactions between species could never be tested, because it is too complex for a small farmer to change a functional cropping plan without the guarantee that the new one will satisfy its operational needs. We hope that our approach will strengthen small farmers' capacity by offering them the opportunity to experiment with alternative cropping plans, in line with sustainability principles, without ever losing the guarantee that their operational requirements will be satisfied.

## Acknowledgments

We extend our gratitude to the Saint-Georges farmers, Julien Vert, Loric Ferreri and Merlin Leppens who made this work possible. This work was supported by the French National Research Agency under the Investments for the Future Program, referred as ANR-16-CONV-0004 (#DigitAg).

## References

1. [Akplogan et al., 2013] Mahuna Akplogan, Simon de Givry, Jean-Philippe Métivier, Gauthier Quesnel, Alexandre Joannon, and Frédérick Garcia. Solving the crop alloca- tion problem using hard and soft constraints. RAIRO -Op- erations Research, 47(2):151-172, 2013.
2. [Alfandari et al., 2011] L. Alfandari, J.L. Lemalade, A. Nagih, and G. Plateau. A mip flow model for crop-rotation planning in a context of forest sustainable development. Ann Oper Res, 190:149-164, 2011.
3. [Arkin and Silverberg, 1987] Esther M Arkin and Ellen B Silverberg. Scheduling jobs with fixed start and end times. Discrete Applied Mathematics, 18(1):1-8, 1987.
4. [Berry and Pogorelcnik, 2011] Anne Berry and Romain Pogorelcnik. A simple algorithm to generate the minimal separators and the maximal cliques of a chordal graph. In- formation Processing Letters, 111(11):508-511, 2011.
5. [Biró et al., 1992] Miklós Biró, Mihály Hujter, and Zs Tuza. Precoloring extension. i. interval graphs. Discrete Mathe- matics, 100(1-3):267-279, 1992.
6. [Duru et al., 2015] Michel Duru, Olivier Therond, Guil- laume Martin, Roger Martin-Clouaire, Marie-Angélina Magne, Eric Justes, Etienne-Pascal Journet, Jean-Noël Aubertot, Serge Savary, Jacques-Eric Bergez, and Jean- Pierre Sarthou. How to implement biodiversity-based agri- culture to enhance ecosystem services: a review. Agron- omy for Sustainable Development, 35, 10 2015.
7. [Dury et al., 2011] Jérôme Dury, Noémie Schaller, Frédérick Garcia, Arnaud Reynaud, and Jacques Eric Bergez. Mod- els to support cropping plan and crop rotation deci- sions. a review. Agronomy for Sustainable Development, 32:567-580, 2011.
8. [Fendji et al., 2021] Jean Louis Ebongue Kedieng Fendji, Clovis Tchuinte Kenmogne, David Jaurès Fotsa-Mbogne, and Anna Förster. Improving farmers' revenue in crop rotation systems with plot adjacency constraints in or- ganic farms with nutrient amendments. Applied Sciences, 11(15), 2021.
9. [Golumbic, 1980] Martin Charles Golumbic. Algorithmic graph theory and perfect graphs, courant institute of math- ematical science, new york university. Academic Press, 1:980, 1980.
10. [HLPE, 2019] HLPE. A report by the high level panel of experts on food security and nutrition. agroecological and other innovative approaches for sustainable agricul- ture and food systems that enhance food security and nu- trition. Technical report, Committee on World Food Secu- rity, FAO, Rome, 2019.
11. [Juventia et al., 2022] Stella D. Juventia, Isabella L.M. Selin Norén, Dirk F. van Apeldoorn, Lenora Ditzler, and Wal- ter A.H. Rossing. Spatio-temporal design of strip cropping systems. Agricultural Systems, 201:103455, 2022.
12. [Karp, 1972] Richard M. Karp. Reducibility among Combi- natorial Problems, pages 85-103. Springer US, Boston, MA, 1972.
13. [Kolen et al., 2007] Antoon W.J. Kolen, Jan Karel Lenstra, Christos H. Papadimitriou, and Frits C.R. Spieksma. Inter- val scheduling: A survey. Naval Research Logistics (NRL), 54(5):530-543, 2007.
14. [Léger et al., 2018] Franc ¸ois Léger, Kevin Morel, Agnès Bellec-Gauche, and Franc ¸ois Warlop. Agroforestry mar- ket gardening: a strategic choice to improve sustainabil- ity in agroecological transition? International Journal of Agricultural Extension, 6(3):43-52, 2018.
15. [Lowder et al., 2021] Sarah K. Lowder, Marco V. Sánchez, and Raffaele Bertini. Which farms feed the world and has farmland become more concentrated? World Devel- opment, 142:105455, 2021.
16. [Morel and Léger, 2015] Kevin Morel and Franc ¸ois Léger. Strategies to manage crop planning complexity in very di- versified direct selling farming systems: the example of organic market gardeners. In 5th International Symposium for Farming Systems Design (FSD), 2015.
17. [Morel et al., 2018] Kevin Morel, Magali San Cristobal, and Franc ¸ois Gilbert Léger. Simulating incomes of radical or- ganic farms with merlin: A grounded modeling approach for french microfarms. Agricultural Systems, 161:89-101, 2018.
18. [Paut et al., 2020] Raphaël Paut, Rodolphe Sabatier, and Marc Tchamitchian. Modelling crop diversification and association effects in agricultural systems. Agriculture, Ecosystems & Environment, 288:106711, 2020.
19. [Prud'homme and Fages, 2022] Charles Prud'homme and Jean-Guillaume Fages. Choco-solver: A java library for constraint programming. Journal of Open Source Soft- ware, 7(78):4708, 2022.
20. [Ratnadass et al., 2012] A Ratnadass, P Fernandes, and J Avelino. Plant species diversity for sustainable manage- ment of crop pests and diseases in agroecosystems: a re- view. Agronomy Sust. Developm., 32:273-303, 2012.
21. [Rossi et al., 2006] Francesca Rossi, Peter Van Beek, and Toby Walsh. Handbook of constraint programming. El- sevier, 2006.
22. [Schöning et al., 2023] Julius Schöning, Paul Wachter, and Dieter Trautz. Crop rotation and management tools for ev- ery farmer?: The current status on crop rotation and man- agement tools for enabling sustainable agriculture world- wide. Smart Agricultural Technology, 3:100086, 2023.
23. [Tarjan and Yannakakis, 1984] Robert E Tarjan and Mihalis Yannakakis. Simple linear-time algorithms to test chordal- ity of graphs, test acyclicity of hypergraphs, and selec- tively reduce acyclic hypergraphs. SIAM Journal on com- puting, 13(3):566-579, 1984.
