ropt: A Python module for robust optimization
ropt is developed by the Netherlands Organisation for Applied Scientific
Research (TNO) and released under the GNU General Public License v3.0.
Overview
ropt is a module designed for implementing and executing robust optimization
workflows. In classical optimization problems, a deterministic function is
optimized. However, in robust optimization, the function is expected to exhibit
a stochastic nature and is represented by an ensemble of functions
(realizations) for different values of some (possibly unknown) random
parameters. The optimal solution is then determined by optimizing the value of a
statistic, such as the mean, over the ensemble.
ropt provides several features for efficiently solving complex robust
optimization problems:
- Robust optimization over an ensemble of models, i.e., optimizing the average of a set of objective functions. Alternative objectives can be implemented using plugins, for instance, to implement risk-aware optimization, such as Conditional Value at Risk (CVaR) or standard-deviation-based functions.
- Support for black-box optimization of arbitrary functions.
- Support for running complex optimization workflows, such as multiple runs with different optimization settings or even different optimization methods.
- Support for nested optimization: an evaluation function can run an optimization of its own — for example to optimize a sub-set of the variables as part of a black-box function.
- An interface for running various continuous and discrete optimization methods.
By default, optimizers from the
scipy.optimizepackage are included, but additional optimizers can be added via a plugin mechanism. The most common options of these optimizers can be configured in a uniform manner, although algorithm- or package-specific options can still be passed. - Efficient estimation of gradients using a Stochastic Simplex Approximate Gradient (StoSAG) approach. Additional samplers for generating perturbed values for gradient estimation can be added via a plugin mechanism.
- Support for linear and non-linear constraints, if supported by the chosen optimizer.
- Flexible configuration of the optimization process using
pydantic. - Support for tracking and processing optimization results generated during the optimization process.
- Optional support for exporting results as
pandasorpolarsdata frames.
ropt can be employed to construct optimization workflows directly in Python
scripts or as a building block in optimization applications. At a minimum, the
user needs to provide additional code to calculate the values for each function
realization in the ensemble. This can range from simply calling a Python
function that returns the objective values to initiating a long-running
simulation on an HPC cluster and reading the results. Furthermore, ropt
exposes all intermediate results of the optimization, such as objective and
gradient values, but functionality to report or store any of these values must
be added by the user. Optional functionality to assist with this is included
with ropt.
ropt separates two concerns. The optimizer setup describes what to
solve — the variables, objectives, constraints, and the components that drive
the optimization — and is the same no matter how you run it; it is covered in
the Optimizer Setup section. There are two options
covering how to run a configured optimization:
- Running Optimizations is the recommended starting point: a single function call covers most optimization tasks, including parallel evaluation across threads, processes, or an HPC cluster, custom result handling, and running multiple optimization steps sequentially or in parallel, possibly nested within each other.
- Optimization Workflows expose the individual building blocks — compute steps, event handlers, executors — directly, for full flexibility.
Getting started
- Read the Background for the ideas behind
ropt, then work through Installation and the Quickstart. - Running Optimizations is the recommended starting point for running an optimization and covers most cases.
- The Key Concepts page introduces the terms used throughout the documentation.
- The Examples show
roptin action through worked examples. - The Configuration page describes the configuration format in detail.
Related packages
Plugins
Additional backend optimizers can be installed separately and used via the plugin system:
- The
ropt-dakotaplugin provides access to algorithms from the Dakota package. - The
ropt-nomadplugin implements the MADS algorithm based on the NOMAD package. - The
ropt-pymoomakes the algorithms from thepymoopackage available toropt.
Applications
The ropt package is used by the
Everest decision-making tool as its
core optimization engine.