The APSIM Initiative Reference Panel has provided two examples for connecting APSIM to optimisation techniques.
Two optimisation techniques - R (www.r-project.org) and PEST (www.pesthomepage.org/Home.php) - serve to demonstrate contrasting approaches in connecting APSIM to optimisation software.
The first bespoke example shows the use of the R XML library to manipulate apsim input files, simple data importation, and calculation of error statistics. The trivial example modifies a single soil parameter (CN2 of bare soil). There are other optimisation libraries in R that can exploit available hardware (parallel evaluation) and software (multi-objective optimisation) features of the problem under examination.
The second example follows the simple worked example in the PEST documentation. The problem description follows a template driven approach, where string patterns are searched for and replaced with the specific parameter value(s) under examination. It likewise examines a single apsim soil parameter. PEST also has facilities for parallel evaluation, though requires small effort to write predicted data into a form that can be read by the optimising harness. APSIMs flexible manager and reporting components make this process quite easy.
Optimiser Demo 2018.zip