## MMA.jl

MMA optimization algorithm in Julia
Author KristofferC
Popularity
8 Stars
Updated Last
2 Years Ago
Started In
August 2015

# MMA.jl This module implements the MMA Algorithm in Julia as described by Krister Svanberg in .

The code in this module was made for a course in Structural Optimization and should be seen as educational. For real use it is likely better to use a more mature code base, for example NLopt.jl which contain a more modern MMA algorithm than the one implemented here.

## Usage

Ẁe will solve the nonlinear constrained minimization problem given here

```using MMA

# Define objective function
end
sqrt(x)
end

# Define a constraint function
grad = 3a * (a*x + b)^2
end
(a*x + b)^3 - x
end

# Create the MMAModel with a relative tolerance on x
ndim = 2
m = MMAModel(ndim, f, xtol = 1e-6, store_trace=true)

# Add box constraints to the variables
box!(m, 1, 0.0, 100.0)
box!(m, 2, 0.0, 100.0)

# Solve the problem
x0 = [1.234, 2.345]
results = optimize(m, x0)

# Print the results
print(results)

#Results of Optimization Algorithm
# * Algorithm: MMA._MMA
# * Starting Point: [1.234,2.345]
# * Minimizer: [0.3333332274782007,0.29629691337859027]
# * Minimum: 5.443316e-01
# * Iterations: 7
# * Convergence: true
#   * |x - x'| < 1.0e-06: true
#     |x - x'| = 8.33e-08
#   * |f(x) - f(x')| / |f(x)| < 1.5e-08: false
#     |f(x) - f(x')| / |f(x)| = 7.65e-08
#   * |g(x)| < 1.5e-08: false
#     |g(x)| = 9.19e-01
#   * stopped by an increasing objective: true
#   * Reached Maximum Number of Iterations: false
# * Objective Calls: 8

# Print the trace
#println(results.trace)
#------   --------------   --------------
#     1     3.948114e-01     1.266427e+00
#     2     1.799667e-01     2.778292e+00
#     3     4.353204e-01     1.148579e+00
#     4     5.338213e-01     9.366429e-01
#     5     5.442500e-01     9.186955e-01
#     6     5.443315e-01     9.185578e-01
#     7     5.443316e-01     9.185577e-01```

## References

### Author

Kristoffer Carlsson - kristoffer.carlsson@chalmers.se