8000 Benchmark the authors' Irriblend-DSW optimiser, now MIT-licensed (#40) by rafatahmed · Pull Request #89 · rafatahmed/Flahax · GitHub
[go: up one dir, main page]

Skip to content

Benchmark the authors' Irriblend-DSW optimiser, now MIT-licensed (#40) - #89

Merged
rafatahmed merged 2 commits into
mainfrom
benchmark/irriblend-dsw-code
Oct 22, 2026
Merged

rafatahmed merged 2 commits into
mainfrom
benchmark/irriblend-dsw-code

Conversation

@rafatahmed
Copy link
Copy Markdown
Owner

Follow-up to #40. The Irriblend-DSW authors added the MIT licence on 2026-10-20 (commit a046d5c), so the comparison can now run their code, not only the LP after their method.

What changed

  • tools/competitors/irriblend_adapter.py.
    • Imports their unmodified code/irriblend_dsw_funs.py, after checking its SHA-256.
    • Calls their optimiser ferti_eco_min directly. The notebook mounts Google Drive and writes to a fixed Colab path, so it cannot run elsewhere.
    • Writes the catalogue in their 'ferts' convention: mmol/g, phosphate as H2PO4-, an acid's H+ = minus its anion, dibasic phosphates +1.
    • Leaves out the 15 products the model cannot represent (micronutrients, chelates, urea, citrate), each with its reason recorded.
    • Uses neutral settings: equal prices, a non-binding EC cap, residual HCO3- 0.
    • Keeps a result only if it passes their own filter.
  • Faithfulness check. Through the same calls, their functions reproduce all 97 water blends of their two published case-study outputs exactly (largest difference 0.0000 g/L).
  • Formulation track. New engine irriblend_dsw. The LP after their method stays, labelled as FlahaX's own code. Every engine also gets a macronutrient-only score, because Irriblend-DSW models no micronutrients.
  • Harness files. README (pins, MIT credit, run steps), requirements (pandas, openpyxl, matplotlib, plotly), and constraints (openpyxl and et_xmlfile added, nothing else reordered).
  • Tests. Unit tests for the translation (round trip 1.6e-16, H+ signs, exclusions).
  • New snapshot 2026-10-22-competitors-1ade5b6. Measured at the harness commit and published with the repo tool, with track outputs kept byte for byte. The competitor-comparison page is rewritten from it.

Results (fixed benchmark inputs)

Engine Returned All targets Macronutrients only Acceptable Max incidental Cl
FlahaX recommend, Cl ceiling 52 42 44 42 106.35
Irriblend-DSW method (LP) 52 48 50 34 315.8
Horticalc aligned 52 47 50 4 1070.3
Irriblend-DSW (authors' code) 30 0 2 0 707.6

The page explains that Irriblend-DSW's low scores follow from its design, not a defect:

  • 18 of the 22 rejections are formulas without an ammonium target, where its exact NH4 = 0 constraint excludes calcium nitrate.
  • Every returned recipe meets N, P, K and S. Its Mg and Ca lower bounds overshoot.
  • Chloride salts are cheap sources at equal prices.
  • It measures one optimiser call on fixed inputs, not the tool's water-blend use.

Every accuracy figure also in the 2026-10-21 snapshot is unchanged. Timings are three to four times slower for every tool in this run, PHREEQC included (machine load), which the page states.

Validation

  • FLAHAX_REQUIRE_PHREEQC=1 unittest: 433 tests OK
  • verify_distribution: PASS
  • sphinx -W (fresh build): clean
  • API reference --check: ok
  • git diff --check ok; no CRLF outside the byte-exact snapshot

Email to the authors

A draft results email to Dr Gallego-Elvira is in the owner's working copy (outputs/irriblend-email-draft.md), for review. It is not sent.

Irriblend-DSW (Gallego-Elvira et al. 2021, doi:10.1016/j.agwat.2021.107012)
had no licence, so the formulation track used only an LP after its published
method. The authors added the MIT licence on 2026-10-20 (commit a046d5c).

irriblend_adapter imports their unmodified irriblend_dsw_funs.py (SHA-256
checked) and calls its optimiser ferti_eco_min directly; the Colab notebook
mounts Google Drive and cannot run elsewhere. Through the same calls it
reproduces all 97 water blends of their two published case-study outputs
exactly. The FlahaX catalogue is written in their 'ferts' convention
(mmol/g, phosphate as H2PO4-, acid H+ as minus the anion); products the
model cannot represent (micronutrients, chelates, urea, citrate) are left
out with the reason. Neutral settings: equal prices, a non-binding EC cap,
residual HCO3- 0. The engine runs as irriblend_dsw beside the method LP,
which stays, labelled as FlahaX's own code. Every engine is also scored on
macronutrients only, since Irriblend-DSW models none of the micronutrients.
…lend-DSW (#40)

Measured at 1ade5b6 with the pinned competitor environment (Python 3.13.15,
Windows 11), published with tools/publish_competitor_snapshot.py; track
outputs kept byte for byte.

The comparison page now covers the authors' Irriblend-DSW optimiser beside
the LP after its method, with a macronutrient-only column for every engine
and a section explaining its results on these inputs: 30 of 52 recipes
returned (18 of the 22 rejections are formulas without an ammonium target,
where its exact NH4 constraint excludes calcium nitrate), N, P, K and S met
in every returned recipe, Mg or Ca overshoots as its lower bounds allow, and
up to 708 mg/L chloride at equal prices. Every accuracy figure also in the
2026-10-21 snapshot is unchanged; timings were three to four times slower
for every tool in this run, which the page states.
@read-the-docs-community
Copy link
Copy Markdown

Documentation build overview

📚 Flahax | 🛠️ Build #35327560 | 📁 Comparing 48282c5 against latest (7535cd7)

  🔍 Preview build  

2 files changed
± changelog.html
± evidence/competitor-comparison.html

@rafatahmed
rafatahmed merged commit 5651e16 into main Oct 22, 2026
6 checks passed
@rafatahmed
rafatahmed deleted the benchmark/irriblend-dsw-code branch October 22, 2026 14:32
@rafatahmed rafatahmed self-assigned this Oct 23, 2026
rafatahmed added a commit that referenced this pull request Nov 7, 2026
Benchmark the authors' Irriblend-DSW optimiser, now MIT-licensed (#40)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0