Project Modelisation LES DOMAINES AGRICOLES
Project Modelisation LES DOMAINES AGRICOLES
May 2024
1 Context
The optimization of red fruit production in greenhouses is crucial for maximizing yield and fruit quality while minimizing
costs and environmental impact. This document presents an in-depth analysis of the various fruit types, planting methods,
production scenarios, and specific constraints associated.
2 Types of Fruits
The red fruits analyzed in this study include:
• Raspberry
• Blackberry
The specific varieties included are:
• Variety 1
• Variety 2
• Variety 3
• Variety 4
The types of plantations and planting periods are essential for optimized production. The plantations are classified
as follows:
• Plantation 1
• Plantation 2
• Plantation 3
• Plantation 4
Months (planting and harvesting periods):
• April
• May
• June
• July
• August
• October
• November
3 Production Scenarios
Fifteen distinct scenarios have been developed to model different production strategies (Fruit, Fruit Variety, Fruit Planting
Type, and Planting Month).
1
4 Constraints and Sector-Specific Requirements
Certain constraints must be considered for effective optimization:
• Scenarios 4 and 5: Can only be executed in sector 6.
• Scenarios 12, 13, 14, 18: Limited to sector 5 and greenhouses of less than 2.87 hectares.
• Bonus: Production must not exceed a predefined threshold, with adjustable parameters for this threshold.
5 Modeling
The modeling uses decision variables represented by a three-dimensional tensor of binary variables. The details of the
modeling are as follows:
subject to:
X(i, j, t) = 1, ∀i ∈ {1, . . . , ngreenhouse }
X(i, 5, t) = 0, X(i, 4, t) = 0, X(i, j, t) = 0, ∀i ∈ {1, . . . , ngreenhouse }, i∈
/ sector greenhouse(6), ∀t ∈ scenario weeks(5)
X(i, j, t) = 0, ∀i ∈ {1, . . . , ngreenhouse }, i∈
/ sector greenhouse(6), ∀t ∈ scenario weeks(4)
∀i ∈ {1, . . . , ngreenhouse }, i∈
/ sector greenhouse(5), ∀j ∈ {12, 13, 14, 18}, ∀t ∈ scenario weeks(j)
∀i ∈ {1, . . . , ngreenhouse }, greenhouse surface(i) > 2.87, ∀j ∈ {12, 13, 14, 18}, ∀t ∈ scenario weeks(j)
2
6.3 Initialization of Scenario and Greenhouse Lists
The code initializes the lists of scenario and greenhouse indices.
• Function prod(j, t): Returns the production for a given scenario and a specific period.
• Function Charges(j): Returns the variable costs for a given scenario.
• Function CV(i, j): Computes the variable costs for a given greenhouse and scenario.
• Function CA(i, j, t1): Computes the revenue for a given greenhouse, scenario, and period.
• Function scenario week(j): Returns the weeks where production is not zero for a given scenario.
• Function scenario week1(j): Returns the weeks (index - 1) where production is not zero for a given scenario.
• Function secteur serre(i): Returns the indices of greenhouses for a given sector.
• All greenhouses are used for the same scenario. This uniformity may indicate consistency in production and
market conditions that favor scenario 12 in week 10.
6.12 Conclusion
This code implements a linear programming approach to optimize greenhouse usage and maximize profit. By respecting
the specified constraints and using the provided data, it determines the best allocation of crops over multiple weeks to
achieve maximum profit.
3
import pandas as pd
import pulp as pl
#Les données sont stockées sous forme d'une liste des tuples et de même ordre que celui étant dans les fichiers.
# Fonction delai(j) :
def delai(j):
if j in scenarios :
for k in production_valeurs:
if k[0]==j: return k[6]
return 0
# Fonction surface(i) :
def surface(i):
for k in simulation_valeurs:
if k[1]==i:
return k[2]
return 0
# Fonction prod(j,t) :
def prod(j,t):
if t==0 : return 0
if t>=38 : return 0
t1=t+7
if j in scenarios:
for k in production_valeurs:
if k[0]==j : return k[t1]
return 0
# Fonction Charges(j) :
def Charges(j):
if j in scenarios:
for k in charges_valeurs:
if j ==k[0] : return k[6]
return 0
# Fonction CV(i,j) :
def CV(i,j):
return surface(i+1)*Charges(j+1)
# Résolution du problème :
def scenario_week(j):
l=[]
if j in scenarios:
for k in production_valeurs:
if j==k[0]:
for t in range (1,38):
if k[t+7] != 0:
l.append(t)
return l
# Fonction qui retourne la liste des indices -1 (t-1, avec t indice de semaine) de semaines étant non nulles pour un scénario j:
def scenario_week1(j):
l=[]
if j in scenarios:
for k in production_valeurs:
if j==k[0]:
for t in range (1,38):
if k[t+7] != 0:
l.append(t-1)
return l
# Initialisation du problème :
P = pl.lpSum(X[i, j, t] * (CA(i, j, t) - CV(i, j)) for i in range(24) for j in range(15) for t in scenario_week1(j+1)
if (i, j, t) in X)
problème.setObjective(P)
for i in range(24):
problème += pl.lpSum(X[i, j, t] for j in range(15) for t in range(37) ) == 1
if i not in secteur_serre(6):
for t in scenario_week1(5):
problème += X[i, 4, t] == 0
for t1 in scenario_week1(4):
problème += X[i, 3, t1] == 0
if i not in secteur_serre(5):
for j in LC3 :
for t in scenario_week1(j+1) :
problème += X[i, j, t] == 0
if surface(i) > 2.87:
for j in LC3 :
for t in scenario_week1(j+1):
problème += X[i, j, t] ==0
problème.solve()