![]() |
MFEM v4.9.0
Finite element discretization library
|
MMA (Method of Moving Asymptotes) solves a nonlinear optimization problem involving an objective function, inequality constraints, and variable bounds. More...
#include <mma.hpp>
Public Member Functions | |
| MMA (int nVar, int nCon, real_t *xval, int iterationNumber=0) | |
| Serial constructor. | |
| MMA (const int nVar, int nCon, Vector &xval, int iterationNumber=0) | |
| Serial constructor. | |
| MMA (MPI_Comm comm_, int nVar, int nCon, real_t *xval, int iterationNumber=0) | |
| Parallel constructor. | |
| MMA (MPI_Comm comm_, const int nVar, const int nCon, const Vector &xval, int iterationNumber=0) | |
| Parallel constructor. | |
| ~MMA () | |
| Destructor. | |
| void | Update (const Vector &dfdx, const Vector &gx, const Vector &dgdx, const Vector &xmin, const Vector &xmax, Vector &xval) |
| Update the optimization parameters for a constrained nonlinear program. | |
| void | Update (const Vector &dfdx, const Vector &xmin, const Vector &xmax, Vector &xval) |
| Update the optimization parameters for an unconstrained nonlinear program. | |
| void | SetIteration (int iterationNumber) |
| Change the iteration number. | |
| int | GetIteration () const |
| Return the current iteration number. | |
| void | SetPrintLevel (int print_lvl) |
| change the print level | |
Protected Attributes | |
| ::std::unique_ptr< real_t[]> | a |
| ::std::unique_ptr< real_t[]> | b |
| ::std::unique_ptr< real_t[]> | c |
| ::std::unique_ptr< real_t[]> | d |
| real_t | a0 |
| real_t | machineEpsilon |
| real_t | epsimin |
| real_t | z |
| real_t | zet |
| int | nCon |
| int | nVar |
| int | iter = 0 |
| int | print_level = 1 |
| ::std::unique_ptr< real_t[]> | low |
| ::std::unique_ptr< real_t[]> | upp |
| ::std::unique_ptr< real_t[]> | x |
| ::std::unique_ptr< real_t[]> | y |
| ::std::unique_ptr< real_t[]> | xsi |
| ::std::unique_ptr< real_t[]> | eta |
| ::std::unique_ptr< real_t[]> | lam |
| ::std::unique_ptr< real_t[]> | mu |
| ::std::unique_ptr< real_t[]> | s |
Friends | |
| class | MMASubSvanberg |
MMA (Method of Moving Asymptotes) solves a nonlinear optimization problem involving an objective function, inequality constraints, and variable bounds.
This class finds \({\bf x} \in R^n\) that solves the following nonlinear program:
\[ \begin{array}{ll} \min_{{\bf x} \in R^n} & F({\bf x})\\ \textrm{subject to} & C({\bf x})_i \leq 0,\quad \textrm{for all}\quad i = 1,\ldots m\\ & {\bf x}_{\textrm{lo}} \leq {\bf x} \leq {\bf x}_{\textrm{hi}}. \end{array} \]
Here \(F : R^n \to R\) is the objective function, and \(C : R^n \to R^m\) is a set of \(m\) inequality constraints. The variable bounds are sometimes called box constraints. By convention, the routine seeks \({\bf x}\) that minimizes the objective function, \(F\). Maximization problems should be reformulated as a minimization of \(-F\).
The objective functions are replaced by convex functions chosen based on gradient information, and solved using a dual method. The unique optimal solution of this subproblem is returned as the next iteration point. Optimality is determined by the KKT conditions.
The "Update" function in MMA advances the optimization and must be called in every optimization iteration. Current and previous iteration points construct the "moving asymptotes". The design variables, objective function, constraints are passed to an approximating subproblem. The design variables are updated and returned. Its implementation closely follows the original formulation of 'Svanberg, K. (2007). MMA and GCMMA-two methods for nonlinear optimization. vol, 1, 1-15.'
When used in parallel, all Vectors are assumed to be true dof vectors, and the operators are expected to be defined for tdof vectors.
| mfem::MMA::MMA | ( | int | nVar, |
| int | nCon, | ||
| real_t * | xval, | ||
| int | iterationNumber = 0 ) |
Serial constructor.
Serial MMA.
| nVar | total number of design parameters |
| nCon | number of inequality constraints (i.e., \(C\)) |
| xval | initial values for design parameters (a pointer to nVar doubles). Caller retains ownership of this pointer/data. |
| iterationNumber | the starting iteration number |
| mfem::MMA::MMA | ( | const int | nVar, |
| int | nCon, | ||
| Vector & | xval, | ||
| int | iterationNumber = 0 ) |
Serial constructor.
| nVar | total number of design parameters |
| nCon | number of inequality constraints (i.e., \(C\)) |
| xval | initial values for design parameters (size should be nVar). Caller retains ownership of this Vector. |
| iterationNumber | the starting iteration number |
| mfem::MMA::MMA | ( | MPI_Comm | comm_, |
| int | nVar, | ||
| int | nCon, | ||
| real_t * | xval, | ||
| int | iterationNumber = 0 ) |
Parallel constructor.
| comm_ | the MPI communicator participating in the NLP solve |
| nVar | number of design parameters on this MPI rank |
| nCon | total number of inequality constraints (i.e., \(C\)). Every MPI rank provides the same value here. |
| xval | initial values for design parameters on this MPI rank (a pointer to nVar doubles). Caller retains ownership of this pointer/data. |
| iterationNumber | the starting iteration number. All MPI ranks should pass in the same value here. |
Each MPI rank has a subset of the total design variable vector, and calls for that MPI rank always address its subset of the design variable vector and gradients with respect to its subset of the design variable vector.
If you wanted to determine the global number of design variables, it would be determined as follows:
| mfem::MMA::MMA | ( | MPI_Comm | comm_, |
| const int | nVar, | ||
| const int | nCon, | ||
| const Vector & | xval, | ||
| int | iterationNumber = 0 ) |
Parallel constructor.
| comm_ | the MPI communicator participating in the NLP solve |
| nVar | number of design parameters on this MPI rank |
| nCon | total number of inequality constraints (i.e., \(C\)). Every MPI rank provides the same value here. |
| xval | initial values for design parameters (size should be nVar). Caller retains ownership of this Vector. |
| iterationNumber | the starting iteration number. All MPI ranks should pass in the same value here. |
Each MPI rank has a subset of the total design variable vector, and calls for that MPI rank always address its subset of the design variable vector and gradients with respect to its subset of the design variable vector.
If you wanted to determine the global number of design variables, it would be determined as follows:
|
inline |
|
inline |
|
inline |
| void mfem::MMA::Update | ( | const Vector & | dfdx, |
| const Vector & | gx, | ||
| const Vector & | dgdx, | ||
| const Vector & | xmin, | ||
| const Vector & | xmax, | ||
| Vector & | xval ) |
Update the optimization parameters for a constrained nonlinear program.
| dfdx | vector of size nVar holding the gradients of the objective function with respect to the design variables, \(\frac{\partial F}{\partial {\bf x}_i}\) for each variable on this rank. |
| gx | vector of size nCon holding the values of the inequality constraints. Every MPI rank should pass in the same values here. |
| dgdx | vector of size \(\textrm{nCon}\cdot\textrm{nVar}\) holding the gradients of the constraints in row-major order. For example, {dg0dx0, dg0dx1, ...,} {dg1dx0, dg1dx1, ..., }, ... |
| xmin | vector of size nVar holding the lower bounds on the design values. xmin and xmax are the box constraints. |
| xmax | vector of size nVar holding the upper bounds on the design values. xmin and xmax are the box constraints. |
| xval | vector of size nVar. On entry, this holds the value of the design variables where the objective, constraints, and their gradients were evaluated. On exit, this holds the result of the MMA iteration, the next design variable value to use. |
The caller retains ownership of all Vectors passed into this method.
| void mfem::MMA::Update | ( | const Vector & | dfdx, |
| const Vector & | xmin, | ||
| const Vector & | xmax, | ||
| Vector & | xval ) |
Update the optimization parameters for an unconstrained nonlinear program.
| dfdx | vector of size nVar holding the gradients of the objective function with respect to the design variables, \(\frac{\partial F}{\partial {\bf x}_i}\) for each variable on this rank. |
| xmin | vector of size nVar holding the lower bounds on the design values. xmin and xmax are the box constraints. |
| xmax | vector of size nVar holding the upper bounds on the design values. xmin and xmax are the box constraints. |
| xval | vector of size nVar. On entry, this holds the value of the design variables where the objective, constraints, and their gradients were evaluated. On exit, this holds the result of the MMA iteration, the next design variable value to use. |
The caller retains ownership of all Vectors passed into this method. This should be used when the number of inequality constraints is zero.