Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Sola Optimization Documentation

Optimization Problem Formulation

Sola provides MATLAB classes for solving constrained optimization problems of the form

minu,z  J(u,z)minz  J^(z)=J(S(z),z),s.t.  c(u,z)=0,\begin{aligned} \min_{\u,\z}\; & J(\u,\z) \qquad\Longleftrightarrow\qquad \min_{\z}\; \Jhat(\z) = J(S(\z),\z), \\ \text{s.t.}\; & \cvec(\u,\z)=\0, \end{aligned}

where

uRnu,zRnz,\u \in \R^{n_u}, \qquad \z \in \R^{n_z},

u\u is the state variable, z\z is the control variable, J(u,z)J(\u,\z) is the objective, c(u,z)\cvec(\u,\z) defines the constraints, and S(z)S(\z) is the state solution operator satisfying

c(S(z),z)=0.\cvec(S(\z),\z)=\0.

Its primary purpose is to prototype optimization constrained by differential equations, where (1) is written in a discretized form, e.g., after spatial discretization of a partial differential equation.

Within sola/src/optimization, the main MATLAB classes are:

The classes Objective and Constraint have interfaces to implement the functions and their first and second derivatives. The class Reduced_Space_Optimization takes inputs of type Objective and Constraint, and automates the implementation of adjoint equations and interfacing with MATLAB’s optimization algorithms.

Sola also provides specialized classes for a broad class of optimization problems in which the state depends on time. The interface for such time-dependent problems involves the classes:

Dynamic_Objective is a specialized objective class for problems of the form

J(u,z)=0Tg(y(t),t)dt+R(z),J(\u,\z) = \int_0^T g(\y(t),t)\,\dd t + R(\z),

where the time-dependent state is denoted by y(t)\y(t).

Dynamic_Constraint is a specialized constraint class for systems governed by ordinary differential equations of the form

ddty(t)=f(y(t),z,t)y(0)=h(z).\begin{align*} & \frac{\dd}{\dd t}\y(t) = \fvec(\y(t),\z,t) \\ & \y(0) = h(\z) . \end{align*}

Implementation Notes

Abstract classes

An abstract class defines methods that must be implemented before the class can be instantiated. In Sola, abstract classes provide a uniform interface for optimization algorithms while allowing users to supply problem-specific physics and derivatives. The code naming convention is that a name such as J_uz_Apply means that the method applies the (u,z)(u,z) second derivative matrix of J(u,z)J(u,z) to a vector. The input and output names such as z_in and u_out indicate the spaces (state or optimization variable) of the input and output vectors in the matrix-vector product.

Vectorized apply methods

Many derivative application methods must accept multiple test directions at once, arranged columnwise in a matrix. This vectorized behavior is required to interface properly with MATLAB optimization routines.

Gauss–Newton option

When the property

Gauss_Newton_Hess = true is enabled in Reduced_Space_Optimization, the optimization uses a Gauss–Newton approximation of the reduced Hessian. This can simplify implementation because certain second-derivative constraint operators are no longer required.

Automatic Differentiation

The code in sola/src/automatic_differentiation provides an interface to automate the implementation of derivatives. Specifically, it requires that ADiGator has been downloaded from https://github.com/matt-weinstein/adigator and installed. The classes and functions in sola/src/automatic_differentiation require user implementation of the objective function and constraint, and utilize ADiGator to implement the derivatives. This is an optional module intended to facilitate rapid prototyping. However, manual implementation of the derivatives will typically give better performance.

Optimization Under Uncertainty

The code in sola/src/optimization_under_uncertainty provides an interface to solve optimization problems of the form

minzJ^(z)=Eθ[J(S(z,θ),z)],\begin{align} \min_{\z} \Jhat(\z) = \mathbb{E}_{\t} \left[ J(S(\z,\t),\z) \right], \end{align}

where θ\t is a vector of uncertain parameters that enter the constraint, e.g., θ\t corresponds to uncertainty parameters in the partial differential equation that SS solves. In Sola, this is defined through the class Parametric_Constraint, which generalizes the Constraint base class by including θ\t dependence. A cell of Parametric_Constraint objects, each corresponding to a different θ\t sample, is passed into the class Reduced_Space_Optimization_Under_Uncertainty, which implements adjoints and interfaces with MATLAB’s optimization algorithms to solve problems of the form (7) via a sample average approximation of the expected value in the objective function.