mma module¶
GCMMA-MMA-Python. This file is part of GCMMA-MMA-Python.
GCMMA-MMA-Python is licensed under the terms of GNU General Public License as published by the Free Software Foundation. For more information and the LICENSE file, see ` https://github.com/ arjendeetman/GCMMA-MMA-Python <https://github.com/arjendeetman/GCMMA-MMA-Python>`_ . The original work is written by Krister Svanberg in MATLAB. This is the python version of the code written Arjen Deetman. version 09-11-2019.
MMA optimizer.
Original work written by Krister Svanberg in Matlab. This is the python version of the code written by Arjen Deetman.
- gemseo_mma.opt.core.mma.compute_kkt_residual_on_local_approximation(m, n, x, y, z, lam, xsi, eta, mu, zet, s, xmin, xmax, df0dx, fval, dfdx, a0, a, c, d)[source]
KKT residual computation.
The left hand sides of the KKT conditions for the following nonlinear programming problem are calculated.
Minimize f_0(x) + a_0*z + sum(c_i*y_i + 0.5*d_i*(y_i)^2) subject to f_i(x) - a_i*z - y_i <= 0, i = 1,…,m
xmax_j <= x_j <= xmin_j, j = 1,…,n z >= 0, y_i >= 0, i = 1,…,m
- Parameters:
m (int) – The number of general constraints.
n (int) – The number of variables x_j.
x (ndarray) – The current values of the n variables x_j.
y (ndarray) – The current values of the m variables y_i.
z (ndarray) – The current value of the single variable z.
lam (ndarray) – The Lagrange multipliers for the m general constraints.
xsi (ndarray) – The Lagrange multipliers for the n constraints xmin_j - x_j <= 0.
eta (ndarray) – The Lagrange multipliers for the n constraints x_j - xmax_j <= 0.
mu (ndarray) – The Lagrange multipliers for the m constraints -y_i <= 0.
zet (ndarray) – The Lagrange multiplier for the single constraint -z <= 0.
s (ndarray) – The Slack variables for the m general constraints.
xmin (ndarray) – The Lower bounds for the variables x_j.
xmax (ndarray) – The Upper bounds for the variables x_j.
df0dx (ndarray) – The vector with the derivatives of the objective function f_0 with respect to the variables x_j, calculated at x.
fval (ndarray) – The vector with the values of the constraint functions f_i, calculated
x. (at)
dfdx (ndarray) – The (m x n)-matrix with the derivatives of the constraint functions f_i with respect to the variables x_j, calculated at x. dfdx(i,j) = the derivative of f_i with respect to x_j.
a0 (float) – The constants a_0 in the term a_0*z.
a (ndarray) – The vector with the constants a_i in the terms a_i*z.
c (ndarray) – The vector with the constants c_i in the terms c_i*y_i.
d (ndarray) – The vector with the constants d_i in the terms 0.5*d_i*(y_i)^2.
- Returns:
The vector residual, its norm and its maximum.
- Return type:
- gemseo_mma.opt.core.mma.solve_mma_local_approximation_problem(m, n, n_iterations, xval, xmin, xmax, xold1, xold2, f0val, df0dx, fval, dfdx, low, upp, a0, a, c, d, move, external_move_limit=10.0, internal_limit=0.01, asyinit=0.5, asyincr=1.2, asydecr=0.7)[source]
MMA sub function.
This function mmasub performs one MMA-iteration, aimed at solving the nonlinear programming problem:
Minimize f_0(x) + a_0*z + sum( c_i*y_i + 0.5*d_i*(y_i)^2 ) subject to f_i(x) - a_i*z - y_i <= 0, i = 1,…,m
xmin_j <= x_j <= xmax_j, j = 1,…,n z >= 0, y_i >= 0, i = 1,…,m
- Parameters:
m (int) – The number of general constraints.
n (int) – The number of variables x_j.
n_iterations (int) – The current iteration number (=1 the first time mmasub is called).
xval (ndarray) – The column vector with the current values of the variables x_j.
xmin (ndarray) – The column vector with the lower bounds for the variables x_j.
xmax (ndarray) – The column vector with the upper bounds for the variables x_j.
xold1 (ndarray) – The value of xval, one iteration ago (provided that n_iterations>1).
xold2 (ndarray) – The value of xval, two iterations ago (provided that n_iterations>2).
f0val (ndarray) – The value of the objective function f_0 at xval.
df0dx (ndarray) – The column vector with the derivatives of the objective function f_0 with respect to the variables x_j, calculated at xval.
fval (ndarray) – The column vector with the values of the constraint functions f_i, calculated at xval.
dfdx (ndarray) – The (m x n)-matrix with the derivatives of the constraint functions f_i with respect to the variables x_j, calculated at xval.
low (ndarray) – The column vector with the lower asymptotes from the previous iteration (provided that n_iterations>1).
upp (ndarray) – The column vector with the upper asymptotes from the previous iteration (provided that n_iterations>1).
a0 (float) – The constants a_0 in the term a_0*z.
a (ndarray) – The column vector with the constants a_i in the terms a_i*z.
c (ndarray) – The column vector with the constants c_i in the terms c_i*y_i.
d (ndarray) – The column vector with the constants d_i in the terms 0.5*d_i*(y_i)^2.
move (float) – The maximum optimization step.
external_move_limit (float) –
The maximum distance of the asymptotes from the current design variable value.
By default it is set to 10.0.
internal_limit (float) –
The minimum distance of the asymptotes from the current design variable value.
By default it is set to 0.01.
asyinit (float) –
The initial asymptotes distance from the current design variable value.
By default it is set to 0.5.
asyincr (float) –
The incremental factor for successful iterations.
By default it is set to 1.2.
asydecr (float) –
The decremental factor for unsuccessful iterations.
By default it is set to 0.7.
- Returns:
- xmma = The Column vector with the optimal values of the variables x_j
in the current MMA subproblem.
- ymma = The Column vector with the optimal values of the variables y_i
in the current MMA subproblem.
- zmma = The Scalar with the optimal value of the variable z
in the current MMA subproblem.
lam = The Lagrange multipliers for the m general MMA constraints. xsi = The Lagrange multipliers for the n constraints alfa_j - x_j <= 0. eta = The Lagrange multipliers for the n constraints x_j - beta_j <= 0. mu = The Lagrange multipliers for the m constraints -y_i <= 0. zet = The Lagrange multiplier for the single constraint -z <= 0. s = The Slack variables for the m general MMA constraints. low = The Column vector with the lower asymptotes, calculated and used
in the current MMA subproblem.
- upp = The Column vector with the upper asymptotes, calculated and used
in the current MMA subproblem.
- Return type:
tuple[ndarray, ndarray, ndarray, ndarray, ndarray, ndarray, ndarray, ndarray, ndarray, ndarray, ndarray]