Julia Dashboard
Julia Dashboard
Goals
- Deployment: Showcase the implementation of a surrogate model-based optimization solution.
- Julia: Highlight Julia’s strengths in creating efficient and scalable surrogate model deployments.
High-Level Highlights
We demonstrate how Julia can efficiently deploy a surrogate model solution. By leveraging the flexibility and speed of both the surrogate model framework and the Julia programming language, we created a fast and intuitive user interface for optimizing the operation of a complex water-pumping network. This deployment showcases how a slow, point-by-point physics-based simulation is utilized to create a dynamic, real-time optimization toolset. The image below shows the functionality of one of the dashboards created (we provide details below).
Dashboard
Machine Learning and Artificial Intelligence models are only helpful if they solve problems or create value. Depending on the use case, ML and AI models can be deployed in many ways [1-3].
Here, we demonstrate how surrogate model-based optimization solutions can enhance the operation of complex systems. The optimization problem in Example 1 from Surrogate Model-Based Optimization is solved using the dashboards presented below. Dashboards for both the small-scale and large-scale systems were created.
The image below shows a labeled picture of the user interface. The user can adjust fixed parameters and the upper limit of the pumping power to define the optimization problem. The user executes the optimization algorithm with a click of a button, and the results are displayed in tables. In addition, the user can compare the optimization solution to that of a Monte Carlo approach. The interactive plot compares the optimized operating points at six different power limits with a point cloud generated with 25,000 randomly selected operating conditions. The plot gives the user confidence the optimization algorithm is working and displays the maximum flow rate vs. total pumping power curve for a given set of fixed parameters.
It should be noted the user interface does not require any expert knowledge of system modeling or fluid dynamics. However, the user can still extract value and knowledge from the physics-based model through the dashboard.
Small-Scale Water Pumping Network Dashboard
The image below shows the small-scale water pumping network dashboard in action. The optimization was executed in 0.09 seconds, and the dashboard completed the Monte Carlo comparison study in 2.8 seconds. As noted in Basics of Surrogate Model Creation, on average, the physics-based small-scale water pumping network model takes 5.1 seconds for a single evaluation. Here, we can execute a complex Monte Carlo comparison study in a fraction of that time.
Large-Scale Water Pumping Network Dashboard
The image below shows the small-scale water pumping network dashboard. Due to the large number of sources (40), a drop-down menu was added to the fixed parameters section. The optimization was executed in 6.1 seconds, and the dashboard completed the Monte Carlo comparison study (executed previously) in 61.3 seconds. As noted in Basics of Surrogate Model Creation, the average evaluation time of the physics-based model was 63.4 seconds. Therefore, the optimization and the Monte Carlo comparison study occur in a relatively short amount of time
Computational Timing
We measured how long it takes to complete optimization tasks using different numbers of threads to demonstrate Julia’s parallel processing capabilities. The tables below show how the execution time varies with the number of attempts and threads used.
In Surrogate Model-Based Optimization, we showed how multiple optimization attempts with random initial guesses enhance the reliability of our results. This method significantly reduces the risk of converging to a sub-optimal local minimum. The best result from these independent attempts is chosen, making parallel execution ideal. Multiple optimization attempts are crucial for complex optimization tasks that could fail with certain initial guesses.
The tables present the average time required to complete an optimization task based on 150 experiments for each combination of attempts and threads. These experiments were conducted on a laptop equipped with an Intel i9-11900H processor (2.50 GHz). In both scenarios, Julia’s ability to distribute tasks across multiple threads dramatically reduces the time needed to find a robust optimal solution. This efficiency supports scalable deployments, allowing you to balance timing, robustness, and hardware requirements according to your needs.
Julia
As mentioned earlier, we created the dashboard using the Julia programming language. Using Julia departs from some machine learning paradigms that rely heavily on Python. Since speed and flexibility are the critical attributes of surrogate models, selecting a programming language that enhances these features is only appropriate. Julia provides several advantages over Python for such deployments:
- Speed: Julia is engineered for high-performance computing. It outperforms Python in execution speed, making it ideal for real-time machine-learning applications.
- Parallelism: Julia’s native parallelism is straightforward and powerful, enabling seamless multi-threading and distributed computing. Python requires additional tools, making Julia better for scaling tasks.
- Automatic Differentiation: Julia offers robust, built-in support for automatic differentiation, crucial for gradient-based optimization, without needing external libraries like Python’s Autograd or TensorFlow.
- Efficient Handling of Numerical Computations: Julia excels in numerical computation. It can handle large datasets and complex mathematical operations more efficiently than Python, particularly with its native support for arbitrary-precision arithmetic.
- Mathematical Operations: Unlike Python, which relies heavily on external libraries (like NumPy), Julia has built-in capabilities for advanced mathematical operations, reducing overhead and improving code maintainability.
These features make Julia a great candidate for deploying scalable, efficient, high-performing surrogate model solutions.
To solve large-scale nonlinear problems, we utilized the IPOPT solver [4], which integrates seamlessly with Julia with the ADNLPModels package [5]. The user interface was developed using Dash [6,7] and supporting packages. No machine-learning packages were necessary since a surrogate model’s structure and model weights were imported from an existing fully trained model. Julia is particularly well-suited to evaluate trained surrogate models since they are merely a long sequence of basic mathematical computations.
Summary
The dashboards presented highlight the versatility and power of using surrogate models to create high-performing, tailored solutions. While this implementation focuses on optimization, other workflows, such as robust parameter estimation, optimization under uncertainty, and real-time monitoring, can also be implemented. Furthermore, the dashboard is essentially a user-friendly interface wrapped around a fast surrogate model optimization process, and, therefore, it can be endlessly tailored to fit a wide range of needs.