A GENETIC ALGORITHM FOR CROP ROTATION
Angelo Aliano Filho
1
, Helenice de Oliveira Florentino
2
and Margarida Vaz Pato
3
1
Curso de Biometria, Departamento de Bioestat
´
ıstica, IB, UNESP, 18618-970, Botucatu, SP, Brazil
2
Departamento de Bioestat
´
ıstica, IB, UNESP, 18618-970, Botucatu, SP, Brazil
3
CIO- FCUL and ISEG - UTL, 1200-781, Lisboa, Portugal
Keywords:
Optimization, Genetic algorithm, Crop rotation.
Abstract:
In the last few years, crop rotation has gained attention due to its economic, environmental and social impor-
tance which explains why it can be highly beneficial for farmers. This paper presents a mathematical model
for the Crop Rotation Problem (CRP) that was adapted from literature for this highly complex combinatorial
problem. The CRP is devised to find a vegetable planting program that takes into account green fertilization
restrictions, the set-aside period, planting restrictions for neighboring lots and for crop sequencing, demand
constraints, while, at the same time, maximizing the profitability of the planted area. The main aim of this
study is to develop a genetic algorithm and test it in a real context. The genetic algorithm involves a cons-
tructive heuristic to build the initial population and the operators of crossover, mutation, migration and elitism.
The computational experiment was performed for a medium dimension real planting area with 16 lots, con-
sidering 29 crops of 10 different botanical families and a two-year planting rotation. Results showed that
the algorithm determined feasible solutions in a reasonable computational time, thus proving its efficacy for
dealing with this practical application.
1 INTRODUCTION
Brazil has an agricultural tradition, and a variety of
grains and vegetables are planted on a large scale.
Natural conditions, such as climate, fertile soil and
relief, foster the development of this important eco-
nomic sector.
(Altieri, 2002) and (Gliessman, 2000) mention
that conventional agricultural production is mainly
based on monoculture given the fact that its oper-
ational cost is low and can be more easily imple-
mented. But this leads to several harmful factors,
such as the extensive use of capital and toxic pesti-
cides that are extremely damaging to the environment
and facilitates the action and prevalence of pests and
pathogens. Other negative economic aspects arising
from this practice are the impoverishment of small
farmers and the decreasing volumes of certain agri-
cultural products.
To prevent these drawbacks, polyculture should
be expanded, in a sustainable fashion, besides consi-
dering the environmental conservation of planting a-
reas, pest control (and thus the less intensive use of
chemical fertilizers) and economic gain.
In the sequel, crop rotation has been object of
study within the agricultural and ecological fields.
The basic idea consists in annually alternating diffe-
rent plant families within the same agricultural area.
The selected species should have commercial and
soil-recovery purposes. If crop rotation is properly
adopted and conducted for a sufficiently long pe-
riod, its advantages are numerous. A practice such
as this improves the physical, chemical and biologi-
cal characteristics of soil, helps disease and pest con-
trol, replaces organic matter, protects the soil from cli-
mactic agents and, in addition, provides a diversified
production of food and other products.
Crop rotation has also been studied within the ope-
rational research domain, namely by (Lemalade et al.,
2011), (Santos, 2009) and (Santos et al., 2011). In this
paper we propose a new method to tackle the Crop
Rotation Problem (CRP) based on a genetic algorithm
(GA) which embeds a constructive heuristic.
2 MATHEMATICAL MODEL
In the mathematical model proposed for the CRP by
(Santos et al., 2011) the objective is to maximize oc-
cupation of a specific planting area and the follo-
454
Aliano Filho A., de Oliveira Florentino H. and Vaz Pato M..
A GENETIC ALGORITHM FOR CROP ROTATION.
DOI: 10.5220/0003761904540457
In Proceedings of the 1st International Conference on Operations Research and Enterprise Systems (ICORES-2012), pages 454-457
ISBN: 978-989-8425-97-3
Copyright
c
2012 SCITEPRESS (Science and Technology Publications, Lda.)
wing rotation constraints are taken into account for
the planning horizon:
(a) Sowing Season: need to respect the time of plan-
ting and the life cycle of each culture;
(b) Continuity for Same-family Crops: plants belon-
ging to the same family must not be planted in
adjacent parcels of land or lots;
(c) Neighboring for Same Family Crops: plants of the
same family must not be planted consecutively on
the same lot;
(d) Green Fertilization: in the planning horizon each
lot must have a plant of the leguminosae family
and be subject to the above mentioned conditions
(a) and (b), also each of these must be planted only
once;
(e) Set-aside Period: a set-aside period must be
scheduled on each lot.
In this study, the objective of the CRP is to maxi-
mize profitability and a new type of restraint is im-
posed:
(f) demand - each culture has a pre-stablished market
demand must be satisfied.
The planning horizon divided into M periods of
similar duration, a set of N crops belonging to N
f
plant families and the planting area with L lots are
taken into account. Other parameters follow:
C: set of trade crops;
A: set of crops for green fertilization;
F
p
: set of plants of the p family, p = 1..N
f
;
t
i
: crop planting cycle i, including soil preparation
and harvesting;
l
i j
: profitability of crop i in the period j per unit
of area;
I
i
= [C
i
,T
i
]: crop planting interval i, in which C
i
is
the earlier period and T
i
is the later period.
p
i j
: production of crop i in the period j per unit
of area;
D
i
: demand for crop i;
I
D
i
= [C
D
i
,T
D
i
]: demand interval of crop i, in which
C
D
i
is the earlier period and T
D
i
is the later period
of the demand;
S
k
: set of lots adjacent to lot k;
area
k
: area of lot k.
A binary linear programming model is described
below:
maximize z =
iC
jI
i
L
k=1
area
k
l
i j
x
i jk
(1)
subject to
iF
p
t
i
1
r=0
vS
k
x
i( jr)v
L
1
iF
p
t
i
1
r=0
x
i jk
!
,
p = 1..N
f
, j = 1..M,k = 1..L (2)
iF
p
t
i
r=0
x
i( jr)k
1, p = 1..N
f
, j = 1..M,k = 1..L (3)
N+1
i=1
t
i
1
r=0
x
i( jr)k
1, j = 1..M, k = 1..L (4)
iA
M
j=1
x
i jk
1, k = 1..L (5)
M
j=1
x
n jk
1, k = 1..L (6)
j I
D
L
k=1
area
k
p
i
x
i jk
D
i
, i C (7)
x
i jk
{0,1}, i = 1..N + 1, j I
i
, k = 1..L. (8)
where, for convenience of notation, the set-aside pe-
riod is represented by crop (N + 1) and if j r 0
then j r is replaced by j r + M. Here, the decision
variable x
i jk
is equal to 1 if crop i is planted in pe-
riod j (eventually continues in the following periods
according to its cycle) in lot k, and 0 otherwise.
In the proposed model, the deciding variable x
i jk
will be 1 if crop i is in its planting period initiated
in period j and if it is planted in parcel k, and 0 if
otherwise.
The objective function (1) sets out to maximize
the profitability of the rotation performed on the given
area. Constraints (2) prevent the plants of the same
family from being neighbors. Constraints (3) for-
bid the same plant family from being consecutively
planted on the same lot k. Constraints (4) prevents
two plants from occupying the same lot in the same
time interval. This means that, if crop i is planted
on lot k, t
i
periods must elapse before a new plant
occupies the same space. Constraints (5) and (6) en-
sure that each lot has at least one green fertilization
application and a set-aside period, respectively. No-
tice that the neighborhood and consecutive planting
restrictions do not apply to the set-aside period. Fi-
nally, constraints (7) impose satisfaction of demand
for crops during the respective period.
A similar objective function (1) and the same
constraints (2) to (6) and (8) are shared by this model
with the one proposed by (Santos et al., 2011).
A GENETIC ALGORITHM FOR CROP ROTATION
455
3 METHODOLOGY
Due to the high computational resources that are nec-
essary to exactly solve the CRP instances arising from
real applications, non-exact approaches are advisable
for this problem. Genetic algorithms are specially
adapted to deal with this type of combinatorial opti-
mization problem insofar as they can easily deal with
the optimization objective and the many constraints
involved. Hence, a new GA was developed for the
CRP.
The above model (1) to (8) uses binary variables,
but it is more convenient for this algorithm to be based
on integer decision variables taking values in the in-
terval [1,N + 1]. Otherwise, modeling with binary
variables would result in bigger dimension chromo-
somes and enhanced difficulties in dealing with the
constraints. One solution to the problem is associated
with an individual identified by a single chromosome,
which is encoded through an L × M integer matrix.
Its element (k, j) belongs to [1, N + 1] and identifies
which crop is being planted on lot k and in period j,
for all k = 1..L and j = 1..M.
With the purpose of exploring the set of solutions
more efficiently, the initial population for the GA was
determined by a new constructive heuristic. Each ini-
tial solution/individual is built lot by lot thus imposing
the planting sequence constraint on the same lot, that
is, rotation conditions (a) and (b).
The fitness of an individual is initially set equal to
the sum of the profitabilities on all lots. Then an expo-
nential penalization process is used to punish the in-
feasible solutions due to violation of the remaining ro-
tation conditions. Hence, penalizations of the neigh-
borhood, set-aside period, green fertilization and de-
mand violations are added. Considering that their
sum is p, the fitness of the individual is multiplied
by e
p/K
, where K is a positive constant equal to 10.
The GA was applied with 120 generations, 451 in-
dividuals (solutions) in the population of all the gen-
erations and using selection, crossover, mutation, mi-
gration and elitism operators.
The selection method used was a biased roulette
wheel.
As to crossover the option favored a uniform
crossover with a rate of 80%. The chromosome break
points for this genetic operator were horizontally and
randomly selected (to keep feasibility in the line).
Mutation consists of randomly selecting lots of the
individuals and replacing the respective cultures with
crops constructively assigned.
The migration operator was devised to avoid pre-
mature convergence of the algorithm and, at the same
time, it explores the feasible region more efficiently.
In this context, 50% of the population in the genera-
tions 120γ is replaced by randomly generated indi-
viduals (with γ, a control parameter taking the value
0.80).
Migration as well as mutation rates both equal to
5%.
The elitism consists of saving the best solution be-
fore the action of the operators in each generation and
inserting it in the population for the next generation.
4 COMPUTATIONAL RESULTS
The computational experiment was performed with
the algorithms coded using Matlab software, version
7.4.0 R2007a, on Core 2 Quad microcomputers with
2GB memory and 250 GB hard-disk memory.
The computational experiment took into account a
real instance of CRP with a planting area that presents
16 non-parallel lots, as shown is Figure 1, and other
real data for crops coming from a medium size plan-
ting area at S
˜
ao Paulo state, in Brazil.
Figure 1: Plantation area.
A two-year planting program was considered and
each period fixed at one month. Crops 23 to 29 were
selected for green fertilization and crop 30 for the set-
aside period. The plants represented by 1 to 25 corres-
pond to marketing purposes.
The above GA ran 100 times for this real life pro-
blem.
To access the performance of the GA in this con-
text, we measured the average CPU time per GA run
(t in seconds), the number of times the algorithm pro-
vided a feasible best solution out of 100 (α), the ave-
rage profitability of the best solution found per run (z
in R$), the average penalizations for the fitness of the
best solution at the initial population per run (p
inicial
)
and the same for the best solution at the final popu-
lation per run (p
f inal
). Lastly, the value z repre-
sents the average relative deviation between the profi-
tability of the best first and best final solutions found
at each run of the GA. These last three figures are de-
termined with the purpose of accessing the improve-
ment achieved with the algorithm from its beginning
ICORES 2012 - 1st International Conference on Operations Research and Enterprise Systems
456
Figure 2: The best rotation for the real instance with 16 lots.
to the end. These values are displayed in Table 1.
Table 1: Mean of computational results.
t z α p
inicial
p
f inal
z
1,017 1.53 ×10
6
72 44.0 0.43 0.23
From the results in Table 1 one may observe that
the 100 runs of the GA consumed 1017 seconds of
CPU time. However, for 72 of the 100 GA runs
the best solution attained was feasible. The aver-
age penalizations for the fitness of the first genera-
tion best solution are high (p
inicial
= 44.0) at the end
the best solution fitness is penalized on average with
p
f inal
= 0.43. It means that the best solution from
most of the 100 GA runs is non-penalized, that is, it
is feasible, thus satisfying all the CRP constraints.
The figure z = 0.23 represents an average in-
crease of 23% on the total profitability of the best so-
lution in the population from the beginning to the end
of the algorithm.
The best feasible solution determined by the GA
following the 100 runs, a rotation for the planting area
studied, is given in Figure 2.
5 SOME CONCLUSIONS
In this study, a new GA was deve loped, along with
a simple constructive heuristic, for the Crop Rotation
Problem.
The method provided good quality feasible solu-
tions in short computing time, thus proving to be a vi-
able, simple and efficient approach to tackling a real
instance of this problem of a highly complex combi-
natorial nature.
Moreover, the model presented for the CRP pos-
sesses perfect real applicability insofar as it takes into
account both technical as well as economic consider-
ations.
Therefore, the methodology is a promising tool to
help farmers in decision-making processes.
The authors intend to continue this study by tes-
ting the methodology with more real cases besides
working with instances randomly built to simulate the
real contexts addressed.
ACKNOWLEDGEMENTS
We wish to thank CAPES (Coordenac¸
˜
ao
Aperfeic¸oamento Pessoal de N
´
ıvel Superior) finan-
cial support by the first author, FAPESP (Fundac¸
˜
ao
de Amparo
`
a Pesquisa do Estado de S
˜
ao Paulo,
Grant No. 2009/14901-4, Brazil), FUNDUNESP
(Fundac¸
˜
ao para o Desenvolvimento da UNESP,
Brazil), PROPG UNESP for their financial support.
The third author’s research is partially supported
by the Foundation for Science and Technology of
Portugal, under the project POCTI/ISFL/152. The
authors are grateful to Sr. Sebasti
˜
ao Soares de
Oliveira, owner of a farm at Santa Cruz de Rio Pardo
for kindly providing us with all the real data for the
study.
REFERENCES
Altieri, M. A. (2002). Agroecologia: bases cient
´
ıficas para
uma agricultura sustent
´
avel. Gua
´
ıba.
Gliessman, S. R. (2000). Agroecologia: Processos
ecol
´
ogicos em agricultura sustent
´
avel. UFRGS.
Lemalade, J. L., Nagih, A., and Plateau, G. (2011). A mip
flow model for crop-rotation planning in a context of
forest sustainable development. In Annals of Opera-
tions Research 190, pages 149–164.
Santos, L. M. R. (2009). Programac¸
˜
ao de rotac¸
˜
ao de
culturas - modelos e m
´
etodos de soluc¸
˜
ao. Tese de
doutorado, Universidade de S
˜
ao Paulo, ICMC - S
˜
ao
Carlos.
Santos, L. M. R., Michelon, P. R. H., Arenales, M. N., and
Santos, R. H. S. (2011). Crop rotation scheduling
with adjacency constraint. In Annals of Operations
Research 190, pages 165–180.
A GENETIC ALGORITHM FOR CROP ROTATION
457