Skip to content

Original Research

Frontiers in Water ·

Volume 8 - 2026 | https://doi.org/10.3389/frwa.2026.1930007

Machine learning guided optimization of water management options with a physical groundwater model for the Mid-County Basin optimization study

  • Patrick Wickham1*corresponding author
  • Timothy Bayley1
  • Cameron Tana1
  1. Montgomery and Associates Water Resource Consulting, Pasadena, CA, United States
Article metrics0 viewsView details

Abstract

The Santa Cruz Mid-County Basin Groundwater Sustainability Agency conducted a Regional Water Optimization Study to support the selection of water supply projects and management actions within the critically overdrafted Santa Cruz Mid-County Groundwater Basin, for long-term operations and shared regional benefits including sustainable groundwater management and regional water supply needs. To support this objective, the Study utilized an integrated groundwater surface-water flow (GSFLOW) model of the Basin and surrounding areas to simulate water supply projects and management actions into the future (water year 2023 to 2075), covering the sustainability planning horizon under California’s Sustainable Groundwater Management Act. Water supply projects and management actions considered under this study include aquifer storage and recovery, indirect potable reuse, and interagency transfers. Many different implementations are possible for each type of project, such that the number of potential project configurations is practically endless. To facilitate optimization, we developed a novel workflow utilizing machine learning algorithms to conduct optimization by autonomously designing, preprocessing, post-processing, and evaluating physical model scenarios, which we call Machine Learning Guided Optimization (MLGO). MLGO improved project configurations within a complex system by generating a diverse set of management options and identifying effective strategies. These results demonstrate the potential for MLGO to support strategic decision-making and regional water resources planning.

Keywords

1 Introduction

Across the Western United States, various agencies and water providers are planning and implementing water resource sustainability projects to respond to climate change, historic overuse, and evolving supply needs. In California, groundwater basin management agencies must reach and maintain sustainability by 2040 in accordance with the Sustainable Groundwater Management Act. To meet sustainability goals, agencies are developing projects such as water reuse, managed aquifer recharge, interagency water transfers, and aquifer storage and recovery (ASR).

Planning groundwater sustainability projects while considering climate change usually entails using a physical groundwater flow model to simulate impacts of project configurations decades into the future. These models predict the impacts of sustainability projects, informing how water managers plan and prioritize project elements. Groundwater model simulations can take hours or days to run, and adequately optimizing projects requires many iterative simulations to identify better performing project configurations.

Concurrently, machine learning algorithms are increasingly being used to predict groundwater elevations and are sometimes compared favorably to physical models (Malekzadeh et al., 2019; Chen et al., 2020; Tao et al., 2022). However, because pure machine learning methods are not physics-informed and rely on provided training data, they lack the generalization and predictive ability of physical groundwater models, both of which are crucial in a sustainability optimization context (Chen et al., 2020; Asher et al., 2015). Some recent studies, most in surface water hydrology, train an machine learning surrogate or digital twin model on a large compendium of preexisting physical model simulations and use the digital twin for optimization (Dai et al., 2025; Marshall et al., 2025; Fang et al., 2024; Wu et al., 2022). This approach combines the speed of machine learning with the inherent physics of the numerical flow model, but requires large volumes of pre-prepared model simulations for training.

This paper summarizes a new approach, termed machine learning guided optimization (MLGO). This approach uses machine learning algorithms and automated pre- and post-processing scripts to iteratively run a physical groundwater model, build a compendium of physical groundwater model simulations, and progress toward optimization. This approach integrates the speed of machine learning models with the robustness of physical groundwater model predictions, without requiring a preexisting compendium of groundwater model simulations or large observation datasets. By iteratively running the groundwater model, collecting simulation data, and learning from this growing dataset, MLGO can autonomously identify improved project implementations.

MLGO was implemented as part of groundwater modeling services to support the Santa Cruz Mid-County Regional Water Optimization Study (Study). The study’s objective is to support the selection of water supply projects and management actions within the critically overdrafted Santa Cruz Mid-County Groundwater Basin (Basin), for sustainable groundwater management and regional water supply needs.

2 Methods

2.1 Study context and area

The Mid-County Groundwater Basin (Basin) occupies the middle portion of Santa Cruz County, situated in the Central Coast region of California. The Basin has a Mediterranean climate characterized by warm, mostly dry summers and mild, wet winters. Annual rainfall recorded at the Santa Cruz Co-op station within the Basin averages 29.3 inches and most rainfall occurs between November and March. California has substantial climatic variability and rainfall can vary greatly from year to year (MGA, 2019).

The Basin includes all areas where the stacked aquifer system of the Purisima Formation, Aromas Red Sands, and Tertiary-age aquifer units underlying the Purisima Formation constitute a shared groundwater resource. Basin boundaries to the west are primarily geologic, defined by a granitic high. Basin boundaries to the east are primarily jurisdictional.

The Basin is dominated by the Purisima Formation which extends throughout the Basin and overlies granitic basement rock that outcrops in the west of the Basin. In the southeast of the Basin the Purisima Formation is overlain by unconfined Aromas Red Sands. The Purisima Formation is composed of named aquifer and aquitard layers, where the Aromas Red Sands is considered a single aquifer unit. Both the Purisima and Aromas aquifers are hydrologically connected to the Pacific Ocean, creating a seawater intrusion threat to the freshwater aquifers when groundwater pumping from the Basin exceeds natural and artificial groundwater recharge. Figures 1–3, originally from the Basin Groundwater Sustainability Plan, present the surficial hydrostratigraphy and the occurrence and orientation of aquifers and aquitards in the Basin (MGA, 2019).

Hydrostratigraphic outcrops in the Basin [Mid-County Basin groundwater sustainability plan].
Figure 1. Hydrostratigraphic outcrops in the Basin [Mid-County Basin groundwater sustainability plan].
Hydrostratigraphic cross section A-A’ in the Basin [Mid-County Basin groundwater sustainability plan].
Figure 2. Hydrostratigraphic cross section A-A’ in the Basin [Mid-County Basin groundwater sustainability plan].
Hydrostratigraphic cross section B-B′ in Basin [Mid-County Basin groundwater sustainability plan].
Figure 3. Hydrostratigraphic cross section B-B′ in Basin [Mid-County Basin groundwater sustainability plan].

The two largest water agencies in the Basin use a range of water supplies: Soquel Creek Water District (District) exclusively use groundwater, while the City of Santa Cruz (City) primarily uses surface water. The City maintains a wellfield in the Basin that constitutes approximately 5% of its water supply in years with normal rainfall, but is relied upon more heavily during drought periods (MGA, 2019).

The Basin is critically overdrafted due to seawater intrusion impacts on productive aquifers stemming from historical overpumping. The Basin’s groundwater sustainability plan defines sustainable management criteria (SMC) that must be achieved by 2040 and maintained through 2070 (MGA, 2019). These SMC are aquifer groundwater levels that must be maintained to prevent seawater intrusion and other negative impacts to the Basin. To achieve these SMC, the City and District are planning ASR and indirect potable reuse supply projects, respectively. The City’s ASR project entails converting select wells into ASR wells, which can inject surplus surface water supply during wet periods and extract water during droughts.

The District’s Pure Water Soquel (PWS) indirect potable reuse project will store highly purified recycled water in the Basin to raise Basin groundwater levels and promote supply. Interagency transfers are also being considered, to redistribute water amongst the City and District depending on respective supply need. Planning these projects involves evaluating numerous different implementation parameters including the number of constructed ASR wells, the number of constructed PWS injection sites, and the timing and source of transfers, which results in a practically endless number of potential project configurations.

To support project planning, the Study utilizes an integrated groundwater surface-water numerical flow (GSFLOW) model of the Basin and surrounding areas to simulate water supply projects five decades into the future (WY 2023 to WY2075). These evaluations will help project partners understand implementation feasibility and advance Basin sustainability and water supply goals.

2.2 Physical groundwater model and water allocation model

Groundwater model simulations conducted to support optimization used a coupled groundwater and surface-water numerical flow (GSFLOW) model of the Basin and surrounding areas which was calibrated to water level data for water year (WY) 1985 to WY 2022 (M&A, 2024). This physical flow model was used to predict groundwater elevations 53 years into the future, including a climate change projection with a significantly drier and warmer climate than historical conditions (MGA, 2019).

Groundwater levels for 3 groundwater sustainability indicators are used to screen water supply project scenarios: seawater intrusion, depletion of interconnected surface water, and chronic lowering of groundwater levels. Evaluation is based on simulated groundwater elevations at specific monitoring wells termed representative monitoring points (RMP). A map of RMP locations for seawater intrusion, interconnected surface water, and chronic lowering of groundwater level is shown on Figure 4 below.

Representative monitoring points by sustainability indicator.
Figure 4. Representative monitoring points by sustainability indicator.

To support the physical model, a Python-based water allocation or ‘transfers’ model was written to logically allocate ASR injection, ASR extraction, PWS injection, District extraction, and operational pumping changes supporting interagency transfers. The water allocation model is capable of accounting for these items based on highly variable project construction conditions and operational parameters. In essence, it allocates flows to utilize available surface water and meet unmet demand, based on each scenario’s unique infrastructure, project implementation, and the monthly climate timeseries. This water allocation model serves as a pre-processor to the groundwater model, providing monthly timeseries injection and pumping inputs to the physical groundwater model.

2.3 Machine learning guided optimization framework

To facilitate optimization of sustainability project implementation using the physical groundwater model, we developed a workflow of that uses machine learning algorithms to supplement optimization by autonomously planning, preprocessing, post processing, and evaluating physical model scenarios to progress toward optimization. We term this workflow Machine Learning Guided Optimization (MLGO).

MLGO consists of a coupled, automated process where the ML algorithm learns from inputs and outputs of a physical groundwater flow model to conduct project optimization by automatically identifying new scenarios to simulate using results of prior model scenarios, based on user-defined optimization goals. For this project, MLGO was tasked with achieving feasibility, sustainability, and projected water supply needs. To do this, it iteratively developed physical groundwater model scenarios, ran the scenarios, and post-processed results by evaluating the model results. All MLGO scenarios and corresponding results were stored for the groundwater modeling team to review, utilize, and make adjustments to MLGO throughout the optimization process, based on their expertise and knowledge.

Figure 5 presents a summary of how MLGO operated by interfacing machine learning algorithms with the model. The following numbered lists refers to positions on Figure 5, which illustrate steps in the MLGO workflow.

  • 1 A set of groundwater model runs (scenarios) is constructed to form the initial ‘compendium’ of scenarios for machine learning.
  • a The compendium contains numerical description of project parameters (physical model inputs) and project goals (physical model outputs reflecting project goals), which describe each scenario.
  • b The initial compendium contained 5 initial scenarios created manually by the groundwater modeling team
  • 2 A machine learning algorithm is trained on the compendium, to predict project parameters that would best meet project goals (inverse modeling).
  • a Many different machine learning algorithms with different architecture were run simultaneously, with the aim of more quickly exploring the optimization parameter space and increasing the likelihood of progress toward optimization.
  • b Given a set of user-defined desired project goals, the machine learning algorithm suggests project parameters that are expected to meet project goals.
  • c An automated post processing script takes the MLGO suggested project parameters, and transforms them into physical model input files.
  • d After assembling the suggested model simulation, MLGO runs the groundwater model scenario.
  • 3 Results from the groundwater model are post processed with respect to project goals.
  • a The project parameters and resulting project goals (groundwater model input and output) are then added to the compendium.
  • b The process then returns to step #2 and trains the machine learning algorithms on a compendium now inclusive of the new scenarios
Machine learning guided optimization overview.
Figure 5. Machine learning guided optimization overview.

As the compendium grows, the machine learning algorithms improve their understanding of the effect of projects on sustainability outcomes and can predict a different and improved set of projects to be run in the model. This process (steps #1 through #3) is completely automated, and can be conducted by many different agents simultaneously. Through this process, MLGO attempts to find a better set of project parameters over successive iterations.

The images on Figure 6 present an example of MLGO undergoing progressive optimization. For this example, a simple physical model analogue was constructed using a number guessing game. In this analogue, MLGO was tasked with guessing a series of 10 random numbers. The guess for each of these numbers serves as project parameters. Following each guess, a ‘scenario’ is conducted where MLGO receives the numeric distance away from each number as feedback (i.e., prediction error). This serves as an analogue for project goals output from a physical model, with the ultimate goal of having 0 distance between each number. MLGO was provided with 2 poor guesses as training data, then set to optimize for 0 prediction error. While the initial guesses are poor during an exploratory phase (iterations 1 through 10), MLGO eventually improves its guesses as it builds a repository of prior attempts during a refinement phase (iterations 10 through 40). Eventually, it explores the parameter space and optimization framework enough to guess the correct answer. This simple example illustrates the MLGO progressive learning process; over successive iterations more data is constructed by creating scenarios and running the physical model, which improves the quality of future scenarios.

Simple example of MLGO in real time.
Figure 6. Simple example of MLGO in real time.

2.4 Project goals

Optimization aims to achieve a situation where multiple thresholds, or project goals, are met. For this Study, project goals reflect physical model outputs that simulate feasibility and sustainability, and water allocation model outputs that account for water supply goals. An illustrative diagram summarizing the MLGO project goals is shown on Figure 7. Project goals cluster into 3 groups: sustainability, feasibility, and supply.

Summary of project goals is presented visually below (Figure 8) and tabulated in Table 2.
Figure 7. Summary of project goals is presented visually below (Figure 8) and tabulated in Table 2.

2.4.1 Sustainability

Sustainability for this project is defined based on adherence to sustainable management criteria as defined in the Basin groundwater sustainability plan. In summary, sustainability is defined as maintaining simulated groundwater elevations above minimum thresholds (MT) at representative monitoring points. These points are spread across the Basin and across multiple aquifers as shown on Figure 4. Depending on the sustainability indicators each point is associated with, elevations may be evaluated on a monthly basis or on the basis of a 5-year moving average.

2.4.2 Feasibility

Feasibility for this project is defined based on maintaining daily simulated elevations below infeasible levels at injection wells. A secondary aspect of feasibility is maintaining realistic pumping, quantified using seepage face losses at the ASR and production wells calculated by the MODFLOW Multi-Node Well package used by the GSFLOW model. Seepage flow losses result in reduced pumping due to low groundwater levels.

2.4.3 Supply

Supply project goals are the simplest project goals to quantify because they are already evaluated numerically based on volume of unmet supply. For this project, both cumulative unmet demand over the course of the 50-year simulation and maximum monthly unmet demand were used to quantify supply goals.

In total, there are 58 individual project goals that MLGO was tasked with achieving. An overview of project goals is presented in Figure 7 and tabulated in Table 1.

Table 1. Summary of project goals.

GroupProject goalsOperationalization and description
SustainabilitySeawater intrusionCumulative 5-year running average elevations below minimum thresholds
Depletion of interconnected surface waterCumulative monthly head below minimum thresholds
Chronic lowering of groundwater levelCumulative monthly head below minimum thresholds
FeasibilityAsr injection elevationsCumulative head above infeasible elevations (0 or 10 feet above ground surface depending on location)
Asr seepage face lossesCumulative number of days when simulated seepage face losses occur
Pure water soquel injection elevationsCumulative head above infeasible elevations (0 feet above ground surface)
SupplyCumulative supply gapCumulative supply gap that occurs across the projected scenario
Maximum monthly supply gapMaximum monthly supply gap that occurs across the projected scenario

2.5 Project parameters

In an operational optimization framework, different operational settings or model input parameters are manipulated to achieve a desired outcome. In MLGO these are referred to as ‘project parameters’ and, like project goals, must be operationalized into numbers. For this Study, project parameters reflect the myriad physical model inputs designating how projects are implemented. Project parameters cluster into 3 groups, based on the associated project or management action: ASR implementation, Pure Water Soquel Implementation, and transfers implementation.

2.5.1 Aquifer storage and recovery

The ASR project parameters implemented for this study allow for up to 4 additional City ASR wells to be installed at 5 sites. The sites reflect model grid cells overlying actual available site locations. A numeric designation for layering was also implemented for model layers 7 to 9 or a combination of layers 7 and 8 or 8 and 9. At both new and existing ASR well sites, project parameters also reflected each well’s maximum pumping and injection volumes and a preferred distribution percentage amongst the wells.

2.5.2 Pure water soquel purified water recharge

The PWS project parameters implemented for this study allow for up to 3 additional PWS purified water injection wells to be installed at 23 sites. The sites reflect model grid cells overlying actual available site locations. A numeric designation for layering was also implemented for model layers 7 to 9, or combination of layers. At both new and existing well sites, project parameters also reflect a percentage of system-wide injection volume applied at that well and any increase in system-wide injection.

Similarly, this study allows for up to 3 additional District extraction wells to be installed at 23 sites. These wells extract additional water that provides in-lieu recharge uniformly across the rest of the District wellfield.

2.5.3 Transfers

This study allowed for bi-directional transfers between the 2 agencies: from City to District during wet periods and from District to City in dry periods. These transfers are applied using changes in pumping in the District’s production wells. Table 2 presents the project parameters reflecting transfers.

Table 2. Summary of project parameters.

GroupParameterDescriptionMinimumMaximum
ASRSite location for new ASR wellsASR sites are numbered 1–51 (Site 1)5 (Site 5)
Layering for new ASR wellsLayering reflects model layers 7–9, and combinations of layers 7/8 and layers 9/10.7 (Layer 7, Purisima A)11 (Layer 8 and Layer 9 Purisima AA and Tu)
Injection and extraction weights for existing and new ASR wellsWeights are used to develop a desired relative injection or extraction percentage, for the water allocation model0 (no injection/ extraction)50 (maximum weight for injection/ extraction)
Injection and extraction maximum runtimesDetermines the maximum injection or extraction capacity1 (predicted sustainable and feasible capacity informed by previous work)5 (aspirational capacity identified by City staff)
O’Neill as ASRBinary check for whether the district O’Neill production well should be operated as an ASR well or exclusively as a District production well0 (District production well)1 (ASR well)
Pure water soquel (injection wells)Site location for new PWS injection wellsPWS sites are numbered 1–231 (Site 1)23 (Site 23)
Layering for new PWS injectionLayering reflects model layers 7–9, and combinations of layers 7/8 and layers 8/97 (Layer 7, Purisima A)11 (Layer 8 and Layer 9 Purisima AA and Tu)
Injection weights for new and existing PWS injection wellsWeights are used to develop a desired relative injection percentage, for the water allocation model0 (no injection/ extraction)50 (maximum weight for injection/ extraction)
Pure water soquel (new district extraction wells)Added PWS injection volumeAdditional volumes of injection, in addition to planned 1,500 AFY0 (no added injection)7 (additional injection of 1,500 AFY)
Site location for new district extraction wellsSites are numbered 1–231 (Site 1)23 (Site 23)
Layering for new district extractionLayering reflects model layers 7–9, and combinations of layers 7/8 and layers 8/9.7 (Layer 7, Purisima A)11 (Layer 8 and Layer 9 Purisima AA and Tu)
Extraction weights for new pws extraction wellsWeights are used to develop a desired relative extraction percentage, for the water allocation model0 (no extraction)50 (maximum weight for extraction)
Added pws extraction volumeAdditional volumes of extraction applied at new pws extraction wells0 (no added extraction)7 (additional extraction of 1,500 AFY)
TransfersTransfers priorities for district to city transfersThe order in which pumping is increased to support district to city transfers across the district’s production wells1 (1st in order)19 (last in order) or 20 (no increases allowed)
Max runtimes for transfersMaximum runtimes allowed for wells supporting transfers from district to city1 (12 h per day)5 (21.6 h per day)
Reduction priorities for city to district transfersThe order in which pumping is decreased to support city to district transfers across the district’s production wells1 (1st in order)19 (last in order) or 20 (no decreases allowed)
Limit transfersBinary check for whether transfers are limited to existing intertie capacity or unlimited0 (transfers limited)1 (transfers not limited)

In total, there were 118 individual project parameters used for this implementation of MLGO. An overview of project parameters is presented on Figure 8 and in Table 2.

Summary of project parameters.
Figure 8. Summary of project parameters.

2.6 Machine learning algorithms

A variety of machine learning algorithms were constructed for this application of MLGO. These algorithms were deployed concurrently, with the goal of more fully exploring the optimization parameter space and ensuring generation of useful results. The algorithms used here can be grouped into 3 major categories:

Neural network algorithms, using PyTorch (Ansel et al., 2024). Neural networks are a class of machine learning models that use layers of interconnected nodes to process data, recognize patterns, and make predictions.

Random forest algorithms, using Scikit-learn (Pedregosa et al., 2011). Random forests are ensemble learning methods that construct multiple decision trees during training and output a combined prediction.

Combined neural network/random forest workflow algorithms, where a neural network algorithm was used for feature extraction, and a random forest algorithm was trained on the extracted features and used for prediction.

Within each category, several machine learning algorithm architectures were developed and used over the course of the project. This proved fruitful as some algorithms performed better than others, introducing variety into the compendium via different optimization pathways and potentially avoiding local minima. Examination of different algorithm success also allowed the human modelers to prioritize these better performing algorithms when allocating agents.

2.7 Loss function

The loss function for this implementation of MLGO is presented in Equation 1. In short, loss is calculated as the weighed mean squared error (MSE) in the machine learning model’s prediction of physical model inputs, plus an out-of-bounds penalty for predictions outside of possible ranges. The MSE terms exists to drive the machine learning model toward accurate predictions of project input parameters, while the penalty term guides the model away from impossible predictions. The magnitude of the penalty term increases with the square of the predictions distance from the upper and lower bounds, which results in stronger penalties for predictions further outside of the possible range. A penalty coefficient of 0.1 was used to implement a preference for predictions compliant with bounds, while maintaining emphasis on the model’s accuracy at predicting project parameters.

L = ∑ i = 1 P W i 1 N ∑ n = 1 N ( Y n , i − Y t n , i ) 2 + B NP ∑ i = 1 P ∑ n = 1 N [ max ( 0 , L i − Y n , i ) 2 + max ( 0 , Y n , i − U i ) 2 ]

Where:

L = Total Loss.

N = Number of Scenarios in Compendium.

P = Number of Project Parameters Predicted by Machine Learning Model.

Yn, i = Normalized Machine Learning Predicted Value for Scenario n, Project Parameter i.

Yt n, i = Normalized True Value for Scenario n, Project Parameter i.

Wi = Weight for Project Parameter i.

Li, Ui = Normalized Lower (L) and Upper (U) Bounds for Project Parameter i.

B=Out of Bounds Penalty Coefficient (0.1 for this case study).

3 Results

The MLGO workflow produced informative scenarios that balanced sustainability, feasibility, and regional supply objectives. These scenarios included project approaches and configurations not previously envisaged by the modeling team. The process generated better solutions over time, and the large compendium of generated scenarios increased project understanding.

3.1 MLGO learning over time

The MLGO algorithms ran successfully and generated 3,407 scenarios. In Figure 9 below, each scenario is assessed for performance against a metric combining all of the project goals described in section 2.3 above. This metric is the sum of the normalized sustainability project goals, feasibility project goals, and supply project goals groups. Project goals groups are normalized by dividing by the maximum over all scenarios, exclusive of values below 5th percentile and above the 95th percentile. Figure 9 displays all runs conducted by MLGO over the analysis period, the Y axis is the combined metric representing total scenario efficacy or adherence to project goals. Lower numbers, closer to 0, represent a scenario that better meets desired goals. Runs conducted by the algorithm type that achieved the most success on average are presented in red and display an ability to improve or “learn” over time, evidenced by the reduction in the combined evaluation metric (analogous to an objective function). Though this algorithm performed best on average, it also learned from the runs conducted by all other algorithms, and agents were not allocated evenly to each algorithm type, obfuscating any comparison of algorithm type efficacy.

MLGO scenario performance over time.
Figure 9. MLGO scenario performance over time.

The Study organized optimization into ‘Tracks’ that specified restrictions on which projects could be expanded. Accordingly, MLGO was run in ‘Tracks’, where MLGO was only allowed to manipulate certain model input information in accordance with the relevant track. In general, these tracks incorporated successive complexity by starting with the lowest amount of infrastructure expansion (and therefore smallest parameter space) and ending with the largest allowable infrastructure expansion (and therefore the largest parameter space). Incorporating successive complexity allowed MLGO to utilize its understanding of the existing parameter space, as the parameter space expanded. Examining the 50-run moving average over these tracks highlights the MLGO learning processes. At the start of each track there is typically an exploration phase where results become worse as new avenues are explored. This occurs because MLGO is testing previously unavailable options and generating data. Following this exploration phase, results begin to converge toward better solutions. This pattern is displayed on the 50-run moving average shown on Figure 9.

Results from both the exploration phase and convergence phase were informative for the modeling team to identify solutions that did and did not work. While MLGO supported analysis in all tracks, the benefit of MLGO is best exemplified by scenarios that allowed for the most expanded infrastructure (Track 5). While many scenarios were conducted using several concurrent algorithms running continuously, the most optimized or informative scenarios were not necessarily always produced at the end of a given track (50-run moving average approaches 0 on Figure 9). Rather, the compendium was examined continuously by staff modelers; high-performing runs were reviewed for strategic insights throughout the optimization process.

Figure 10 is an embedded video displaying the top-scoring 1,000 scenarios, visualized in a 3D space with axes of feasibility, sustainability, and supply. Gaps in the 3D optimization space illustrate the non-linearity of the solution framework: for example, injecting more purified water may improve sustainability, but make achieving feasibility more difficult. Conversely pumping more for transfers may improve supply, but decrease sustainability. Scenarios cluster along the sustainability axis; sustainability goals are highly complex and typically the most difficult to meet for both MLGO and manual optimization.

Video: 3D visualization of Top 1,000 scenarios [digital animation].
Figure 10. Video: 3D visualization of Top 1,000 scenarios [digital animation].

From these many scenarios, 4 project configurations were chosen that represent highly optimized, progressively expensive, options for improving regional water supply. Two of the 4 configurations incorporate a strategy of symbiotically using ASR and PWS by recharging PWS upland of ASR facilities, which decreases the need for regional transfers. This overall strategy was derived directly from MLGO scenarios and was a new concept to the project team.

3.2 Analysis of machine learning algorithms

As described above, while many agents with varying architecture and hyperparameters were utilized, the machine learning algorithm types cluster into 3 groups (random forest, neural network, and combined random forest neural network). As this study was publicly funded and therefore limited in time and scope, resources (computer core space dedicated to each algorithm type) were not allocated evenly amongst these 3 groups. Rather, priority was given to algorithm types that (1) displayed good and continuously improving adherence to project goals, and (2) displayed a perceived ability to explore the optimization parameter space by conducting novel scenarios (i.e., not repeatedly conduct ing the same scenario). It is fully acknowledged that the manual hyperparameter tweaking process and unequal resource allocation could heavily influence the perceived performance of each algorithm type.

From a practical standpoint it should be noted that results from all algorithm types were printed to the same compendium, and therefore all algorithm types learned from a compendium (training dataset) that consisted of runs conducted by all algorithm types. Accordingly, it cannot be stated that a “poorly performing” algorithm type did not assist with the performance of the “high performing” algorithm type by providing useful scenarios for training.

3.3 Operational complexity, challenges, and limitations

MLGO optimization was conducted over a period of months, during which numerical elements of the water allocation model and physical groundwater model changed substantially at several junctures. For example, during Track 2–4 optimization, MLGO began producing highly optimized scenarios that incorporated large volumes of pumping. While initially intriguing, manual review uncovered that these scenarios were exploiting features of GSFLOW that limit prescribed pumping when a well is overpumped (seepage face losses). In these circumstances the scenario results for supply and sustainability would appear highly optimized, but this was a result of the groundwater model not reflecting the prescribed inputs. It was observed that MLGO scenarios began prioritizing the incorporation of these seepage face losses, which are essentially an error in this circumstance. Therefore, the MLGO code and framework had to be modified to record seepage face losses and to target 0 seepage face losses as a project goal. Accordingly, seepage face losses were artificially added to previously conducted runs in the compendium in accordance with new domain knowledge. Following this edit, MLGO avoided seepage face losses quite well.

Later during the optimization process, a water rights change related to dry period surface water volumes available for ASR injection was incorporated into the larger optimization framework. This substantially altered the output of the water allocation model by reducing ASR injection volumes, and therefore changed the numerical parameter space for MLGO. No modifications to the compendium or MLGO were made in this case, and MLGO continued to perform well. However, it is almost certain that having scenarios in the compendium which operated using a different water allocation model impacted MLGOs ability to predict optimized scenarios in some respect, as they constitute a form of error in the training data. Despite this, an advantage of MLGO is that the compendium’s training data can be edited, sorted, and otherwise adapted to flexibly overcome emergent challenges.

This application of MLGO relies on a sole numerical groundwater flow model upon which to conduct optimization using machine learning algorithms. Accordingly, results will inherit any uncertainty or errors inherent in the numerical flow model. Similarly, this workflow relied primarily on a single climate realization, and a single realization of groundwater model aquifer parameters. Future efforts could use MLGO with multiple aquifer parameter realizations, multiple climate realizations, and/or multiple groundwater flow models.

3.4 Principal component analysis

Analysis of high-dimensionality datasets like those generated by MLGO can be simplified through principal component analysis (PCA). PCA presents us with new simplified principal components (PCs) that efficiently organize the data to maximize variance and reveal dominant patterns in combinations of project goals and management parameter. Each project goals and management parameter contributes a percentage to each individual PC; patterns in percent contribution can elucidate trends in the compendium. Each PC can be thought of as a statistically significant trend or dominant pattern in the dataset, typically reflecting a key trade-off or relationship.

Principal component analysis (PCA) was conducted as part of results evaluation using the PCA function from sklearn.decomposition in python. Figure 11 presents 20 PCs extracted from all scenarios conducted for this study. PCs are organized from 1 through 20 in order of cumulative increasing contribution to variance in the dataset. For example, PC1 can be used to explain just over 40% of the variability in the dataset, while PC2 contributes an additional 10%. While the dimensionality of the dataset prior to PCA is exceedingly large (58 project goals and 118 project parameters), over 60% of all variability in the compendium can be explained by the first 5 principal components. Table 3 summarizes the top 5 principal components and their relevance to the project understanding. Conclusions derived from PCA support recommendations for project configuration as shown in Table 1.

Contribution of principal components to explained variance.
Figure 11. Contribution of principal components to explained variance.

Table 3. Summary of top 5 principal components.

Principal componentDescriptionRelevance to recommendations for project configuration
1High volumes of district to city transfers originating from pumping near existing PWS injection wells are correlated with a lower supply gapPrioritize utilizing District wells near existing PWS injection wells to provide water to the City during dry periods
2Lower levels of injection at existing PWS injection wells are correlated with sustainability problems.Injection volumes at existing PWS injection wells should not be reduced without significantly expanding infrastructure.
3New PWS injection wells and ASR wells which are screened solely in one aquifer are correlated with feasibility issuesScreen all new ASR and/or PWS wells across 2 aquifers.
4Installation of a new ASR well, PWS injection well, or PWS extraction well in a given aquifer screening is correlated with additional infrastructure expansion in that same aquifer screeningWhen expanding infrastructure, prioritize adding pairs of ASR and PWS injection wells screened in the same aquifers.
5Increased ASR and PWS injection and increased ASR extraction is corelated with lower transfer volumes, sustainability, increased feasibility issues at new sites, and decreased feasibility issues at existing sitesThere exists a tradeoff between infrastructure expansion, and the volume of district to city district transfers, which should be considering in project planning

4 Discussion

Overall, MLGO was an effective method for optimizing this complex system. Not only did MLGO progress toward optimization over time and produce scenarios with increasingly improved optimization metrics, it also generated a large compendium of scenarios that proved useful for selecting project designs and increasing project understanding. Additional principal component analysis helped identify generalized principals which could be used to guide practical implementation of projects. Ultimately, the machine learning algorithms used here, and therefore the MLGO process, are heuristic in nature. The machine learning agents attempt to solve the entire optimization problem presented to them at once, and therefore attempt to progress by the shortest path possible to the desired result. In theory, this allows for rapid efficient optimization in a practical applied setting, as time is not spent methodically perturbing project parameters or intentionally randomly sampling the project parameter space. However, this also raises the possibility that an alternative solution may be missed during the MLGO process, that might have been captured by software that more systematically perturbs parameters to conduct scenarios. This risk was reduced by introducing manual scenarios into the initial training data that explored various strategies and by having multiple ML algorithms that explored the parameter space in different ways.

Metalearning or meta learning refers to an AI algorithm ‘learning to learn’ (Brazdil et al., 2022). Rather than the non-meta learning that takes place when an algorithm trains itself on a static dataset, metalearning encompasses changes to algorithm structure or hyperparameters that allow it to adapt to a changing dataset or optimization framework. Some sort of manual or automated architecture or hyperparameter adjustment is critical for MLGO, as it is continuously expanding its dataset of model scenarios as it progresses toward optimization. While a given algorithm architecture may produce small final loss in its objective function with a relatively small dataset, over time as the dataset expands, the loss function may become larger indicating a decreased ability of the algorithm to produce meaningful scenarios using the existing architecture or hyperparameters. Therefore, the algorithm architecture and hyperparameters must be periodically examined and tweaked by the automated workflow itself (self-imposed metalearning or true metalearning), or by the supervising modeler (user-imposed modification). For this study, this modification was largely user-imposed as described in the methods. While MLGO progressed autonomously, metrics for total objective function loss during the learning process were recorded and analyzed by the overseeing modeler. If loss was judged to be stagnating or getting larger over time as the dataset expands, the modeler would make tweaks to hyperparameters or model architecture until it produced low levels of loss. Future work with MLGO could lessen its reliance on manual manipulation of architecture or hyperparameters by incorporating automated ML algorithm hyperparameter optimization. True self-imposed metalearning could be implemented by building functionalities that test a range of hyperparameters and architectures, and then selecting a ‘Best Algorithm’ from these (Brazdil et al., 2022). As highlighted in the results, the overall success of a given algorithm in producing high-quality scenarios is highly dependent on the architecture and hyperparameters of that algorithm, and the skill of the manual machine learning engineer in manually adjusting these elements. By utilizing true metalearning, high-quality scenarios could be generated more consistently with less manual intervention, theoretically reducing the number of scenarios required to reach sufficient optimization.

During development and presentation of MLGO, comparisons were often made to Model-Independent Parameter Estimation and Uncertainty Analysis (PEST), an industry-standard software frequently used for calibration of numerical models, particularly groundwater flow models. PEST undertakes highly parameterized inversion of environmental models. In doing so, it runs a model many times, either sequentially or in parallel (White et al., 2019). MLGO differs from PEST mainly in that it does not conduct inversion or explicitly conduct runs perturbing the parameter space to create a Jacobian matrix. Rather, it learns from an ever-growing compendium of scenario data and relies on the internal mechanisms of the machine learning algorithms to generate a fit to the data. This process can be stopped and restarted at any time without loss of data, and the compendium can be manipulated without interruption of the process. Rather than iteratively perturbing parameters, MLGO immediately attempts to solve the problem heuristically at any given point. In theory, given a set of well-trained machine learning algorithms, this could result in a faster time to optimization relative to PEST; conversely, it is also possible that PEST could be less likely to become trapped in a local minimum, and more reproducible. While no such comparison is attempted here, future work could compare the time to optimization, optimization outcomes, and reproducibility for both MLGO and PEST, though each process will be highly dependent on its implementation and therefore direct comparison may be difficult. In future applications, it could also be possible to leverage both PEST and MLGO; MLGO could operate in conjunction with PEST by gathering additional compendium scenarios from those conducted by a concurrent PEST run. In this way, MLGO would learn from PEST, which methodically perturbs parameters, while simultaneously continuing its heuristic optimization.

As described above, early in optimization MLGO observed seepage face losses (in this circumstance essentially a physical model software bug) and heuristically prioritized these scenarios before a manual intervention to edit the optimization framework. An advantage of MLGO is that the compendium of previous runs can be manually edited to reflect changes in the optimization framework, which was done here to flag scenarios with this bug. As each MLGO agent conducts deep learning on the compendium ‘from scratch’ to conduct each scenario, it was relatively straightforward to incorporate a change in the optimization framework and preserve compendium data where possible. This flexibility may be an advantage when compared to other optimization software.

Optimization for this project was conducted using a single deterministic projected scenario. Future applications of MLGO could use an objective function that optimizes project implementation over many projected scenarios, as in ensemble analysis. Workflows similar to MLGO may also be used for calibration and parameter estimation. Finally, optimization of projects with fixed infrastructure could use MLGO with reinforcement learning algorithms to make implementation decisions and evaluate project efficacy at each numerical model timestep.

Results from this study directly informed regional water supply planning by improving understanding constraints, benefits, and optimal implementation interagency transfers, wellfield pumping volumes, ASR well siting, and recycled water injection siting. Most notably it identified a unique new strategy of injecting surface water or recycled water in the Basin’s highlands, along the border between the City of Santa Cruz and Soquel Creek Water District. This allows for more pumping by the City of Santa Cruz, and less need for transfers from Soquel Creek Water District, mutually benefitting both agencies and reducing the need for large hydraulic intertie upgrades.

In conclusion, MLGO was an effective and practical approach for optimizing water supply project implementation within a complex, highly constrained groundwater system. The principal methodological contribution of MLGO is that functions as a self-building surrogate model optimization tool, which does not require a preexisting library of groundwater model simulations or a large observational dataset. By building its own training compendium iteratively, MLGO combines the speed of machine learning with the physical rigor of a calibrated numerical flow model. Over the course of the Study, MLGO autonomously designed, executed, and evaluated 3,407 groundwater model scenarios, progressively improving its adherence to sustainability, feasibility, and supply goals within each optimization track. In doing so, MLGO identified project strategies that had not been envisioned by the modeling team including recharging purified recycled water in the Basin highlands near ASR facilities. This strategy allowed additional City pumping while reducing the need for interagency transfers and associated intertie upgrades. More broadly, the approach demonstrated here is not specific to this Basin and should transfer to any planning problem in which a slow physical model must be interrogated across a large configuration space.

Generative AI statement

The author(s) declared that Generative AI was not used in the creation of this manuscript.

Any alternative text (alt text) provided alongside figures in this article has been generated by Frontiers with the support of artificial intelligence and reasonable efforts have been made to ensure accuracy, including review by the authors wherever possible. If you identify any issues, please contact us.

Publisher’s note

All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors and the reviewers. Any product that may be evaluated in this article, or claim that may be made by its manufacturer, is not guaranteed or endorsed by the publisher.

Footnotes

Edited by: Jacob Zwart, United States Department of the Interior, United States

Reviewed by: Sushindra Kumar Gupta, National Institute of Hydrology, India

Ahteshamul Haq, Integral University, India

Statements

Conflict of interest

The author(s) declared that this work was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.

Funding

The author(s) declared that financial support was received for this work and/or its publication. This work was supported by funding and staff from Soquel Creek Water District and the City of Santa Cruz Water Department. This research was funded by the Mid-County Groundwater Agency through a California Department of Water Resources Prop 1 grant.

Data availability

The datasets presented in this article are not readily available because data analyzed in this study are purely simulations of the Mid-County Basin groundwater flow model. Data sharing is not applicable to this article. Requests to access the datasets should be directed to pwickham@elmontgomery.com.

Author contributions

PW: Methodology, Visualization, Conceptualization, Validation, Formal analysis, Writing – original draft, Software, Investigation, Data curation, Writing – review & editing, Resources. TB: Formal analysis, Validation, Writing – review & editing. CT: Funding acquisition, Formal analysis, Supervision, Conceptualization, Project administration, Validation, Writing – review & editing, Data curation.

Acknowledgements

Special thanks to Shelley Flock, Heidi Luckenbach, and Melanie Mow Shumacher.

References

  1. Ansel J., Yang E., He H., Gimelshein N., Jain A., Voznesensky M.. (2024). “ PyTorch 2: faster machine learning through dynamic Python bytecode transformation and graph compilation,” in Proceedings of the 29th ACM International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS '24) San Diego, CA, USA, 27 April–1 May 2024, vol. 2. doi: doi:10.1145/3620665.3640366
  2. Asher M. J., Croke B. F., Jakeman A. J., Peeters L. J. (2015). A review of surrogate models and their application to groundwater modeling. Water Resour. Res. 51, 5957 – 5973. doi: doi:10.1002/2015wr016967
  3. Brazdil P., Giraud-Carrier C., Soares C., Vilalta R. (2022). Metalearning: Applications to Automated Machine Learning and Data Mining. Cham, Switzerland: Springer Nature.
  4. Chen C., He W., Zhou H., Xue Y., Zhu M. (2020). A comparative study among machine learning and numerical models for simulating groundwater dynamics in the Heihe River basin, northwestern China. Sci. Rep. 10, 1 – 13. doi:, doi:10.1038/s41598-020-60698-9
  5. Dai T., Maher K., Perzan Z. (2025). Machine learning surrogates for efficient hydrologic modeling: insights from stochastic simulations of managed aquifer recharge. J. Hydrol. 652: 132606. doi: doi:10.1016/j.jhydrol.2024.132606
  6. Fang Z., Ke H., Ma Y., Zhao S., Zhou R., Ma Z.. (2024). Design optimization of groundwater circulation well based on numerical simulation and machine learning. Sci. Rep. 14: 11506. doi:, doi:10.1038/s41598-024-62545-7
  7. M&A (2024). Santa Cruz Mid-County Basin Optimization Study, Summary of Groundwater Modeling Supporting Alternative Selection (Technical Memorandum 3). Tucson, AZ: Montgomery & Associates.
  8. Malekzadeh M., Kardar S., Shabanlou S. (2019). Simulation of groundwater level using MODFLOW, extreme learning machine and wavelet-extreme learning machine models. Groundwater Sustain. Dev. 9: 100279. doi: doi:10.1016/j.gsd.2019.100279
  9. Marshall S. R., Tran T. N. D., Tapas M. R., Nguyen B. Q. (2025). Integrating artificial intelligence and machine learning in hydrological modeling for sustainable resource management. Int. J. River Basin Manag., 1 – 17. doi: doi:10.1080/15715124.2025.2478280
  10. MGA (2019). Santa Cruz Mid-County Groundwater Management Agency (MGA). Santa Cruz Mid-County Groundwater Basin Groundwater Sustainability Plan. Available online at:
  11. Pedregosa F., Varoquaux G., Gramfort A., Michel V., Thirion B., Grisel O.. (2011). Scikit-learn: machine learning in Python. J. Mach. Learn. Res. 12, 2825 – 2830. Available online at:
  12. Tao H., Hameed M. M., Marhoon H. A., Zounemat-Kermani M., Salim H., Kim S.. (2022). Groundwater level prediction using machine learning models: a comprehensive review. Neurocomputing 489, 271 – 308. doi: doi:10.1016/j.neucom.2022.03.014
  13. White J., Welter D., Doherty J. (2019). PEST++ Version 4.2.1 Documentation. Denver, CO, USA: U.S. Department of the Interior, Bureau of Reclamation.
  14. Wu F., Yang X., Ma Y., Zhang Q., Zhang Z., Yuan X.. (2022). Machine-learning guided optimization of laser pulses for direct-drive implosions. High Power Laser Sci. Eng. 10: e12. doi: doi:10.1017/hpl.2022.4

Citation

Wickham, P., et al. (2026). Machine learning guided optimization of water management options with a physical groundwater model for the Mid-County Basin optimization study. Frontiers in Water, Volume 8. https://doi.org/
Received
Accepted
Published
Volume
8 - 2026

Copyright

Copyright © 2026 Wickham, Bayley and Tana.

License: https://creativecommons.org/licenses/by/4.0/

*Correspondence: Patrick Wickham

Article metrics

Views
0
Downloads
0
Citations
0
Shares
0