DSS for Irrigation

Development and comparative evaluation of Fuzzy Logic (Mamdani) and Neuro-Adaptive (ANFIS) decision support systems for agriculture.

Efficient water management in agriculture requires balancing two conflicting goals: minimizing water usage and maximizing crop health. This project developed and validated an Irrigation Decision Support System (IDSS) for vineyards in the Trentino region (Italy), evolving from an expert-based rule system to an adaptive machine learning approach.

Objectives

  1. Design an interpretable Mamdani Fuzzy Inference System based on agronomic expert knowledge.
  2. Develop a data-driven ANFIS (Adaptive Neuro-Fuzzy Inference System) to automate rule learning.
  3. Quantify the trade-offs between the two approaches regarding water savings vs. crop stress mitigation.

My role

  • Designed the fuzzy inference engines and the rule bases.
  • Implemented Bayesian Optimization to tune membership functions against expert surveys.
  • Developed a counterfactual simulation engine to stress-test algorithms on historical data.
  • Conducted statistical bootstrapping to validate performance metrics.


Tech Stack
Language Python 3.11+
Fuzzy Logic Scikit-Fuzzy, PyTorch (S-ANFIS)
Optimization Scikit-Optimize (Bayesian)
Analysis NumPy, Pandas, Matplotlib
DevOps uv (package manager), Jupyter
Repository Structure

The project is modularized to separate logic from evaluation:

  • data Contains all datasets (CSV, XLSX) used for training
  • notebooks For research, demonstration, and evaluation
  • scripts Used for training models and running the main application
  • package Core package containing the logic for different DSSs

The Architecture: Expert Knowledge vs. Machine Learning

The core challenge was translating complex environmental data into actionable irrigation commands (e.g., “Single Turn”, “Double Turn”). The system processes four key inputs:

  1. Current Soil Moisture (Tensiometer)
  2. Predicted Soil Moisture (LSTM Forecast)
  3. Predicted Rainfall
  4. Predicted Temperature

Two architectures were implemented and compared:

  • Mamdani IDSS: Relies on 21 explicit “IF-THEN” rules defined by agronomists. It prioritizes interpretability.
  • Takagi-Sugeno ANFIS: Uses a neural network structure to learn the optimal fuzzy rules and membership functions directly from field data, prioritizing adaptability.
Workflow of the dual architecture: The Mamdani branch (left) uses fixed rules, while the ANFIS branch (right) optimizes parameters via gradient descent.

Methodology: Simulation & Optimization

To ensure the systems were field-ready, a rigorous tuning and testing pipeline was established:

  1. Bayesian Optimization: The membership functions (the curves defining what counts as “High” or “Low” moisture) were fine-tuned to minimize the error between the algorithm’s suggestions and human expert decisions.
  2. Counterfactual Simulation: A “What-If” analysis engine was built to reconstruct the entire growing season. It simulated how the soil moisture would have evolved if the IDSS recommendations had been followed instead of the actual farmer’s actions.
Evolution of Fuzzy Membership functions for input variables before (dashed) and after (solid) ANFIS training.
Comparison of soil moisture trends and irrigation suggestions under different strategies.

Results: The Trade-off

The comparative analysis revealed distinct behavioral profiles for the two systems. Both significantly outperformed the baseline (manual irrigation) by stabilizing soil moisture within the optimal agronomic range.

  • Mamdani (The “Safe” Choice): Excellent at stress mitigation. It reduced the number of “Critical Dry Days” significantly, prioritizing plant health.
  • ANFIS (The “Efficient” Choice): Excellent at water conservation. It achieved >50% water savings compared to traditional practices by adopting a more conservative irrigation schedule.

The study concluded that while ANFIS is superior for resource-scarce environments, Mamdani remains the preferred choice for high-value crops where stress avoidance is paramount.

Bootstrap distribution of total irrigation volume. The ANFIS model (Green) consistently suggests lower water volumes than Mamdani (Red).


Full Documentation

This project resulted in two scientific publications covering the design of the Mamdani system and the subsequent comparative analysis with ANFIS:

Read Comparative Paper (Sensors) Read Mamdani Paper (CoDIT) View Presentation Slides (CoDIT)