# GCMMA using NLopt

**URL:** <https://discourse.julialang.org/t/gcmma-using-nlopt/101642>\
**Category:** Optimization (Mathematical)\
**Tags:** question\
**Created:** [July 15, 2023, 12:38am UTC](https://discourse.julialang.org/t/gcmma-using-nlopt/101642 "2023-07-15T00:38:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mary](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mary/32/53139_2.png) [@mary](https://discourse.julialang.org/u/mary)\
**Post date:** [July 15, 2023, 12:38am UTC](https://discourse.julialang.org/t/gcmma-using-nlopt/101642/1 "2023-07-15T00:38:56Z")

</div>

Hi All. I have a question can i use NLopt for GCMMA algorithm?  
also one other question can zygote has errors in calculating gradients?  
thank you

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 15, 2023, 12:50am UTC](https://discourse.julialang.org/t/gcmma-using-nlopt/101642/2 "2023-07-15T00:50:17Z")

</div>

> [@mary](#):
>
> I have a question can i use NLopt for GCMMA algorithm?

Yes, the `NLopt.LD_MMA` algorithm in NLopt is the “globally convergent” variant of MMA by [Svanberg (2002)](https://epubs.siam.org/doi/10.1137/S1052623499362822). (These days, I would tend to use the `NLopt.LD_CCSAQ` algorithm instead, which is another variant of the Svanberg algorithm.)

Nonconvex.jl [also implements](https://julianonconvex.github.io/Nonconvex.jl/stable/algorithms/mma/#NonconvexMMA.MMA02) this method.

---

<div class="post-metadata">

**Author:** ![mary](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mary/32/53139_2.png) [@mary](https://discourse.julialang.org/u/mary)\
**Post date:** [July 15, 2023, 12:54am UTC](https://discourse.julialang.org/t/gcmma-using-nlopt/101642/3 "2023-07-15T00:54:56Z")

</div>

however, It is mentioned in NLopt documents that it is not using ptof. Svanberg algorithm. aslo as it is LD i though that it is local not global. right?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 15, 2023, 1:11am UTC](https://discourse.julialang.org/t/gcmma-using-nlopt/101642/4 "2023-07-15T01:11:50Z")

</div>

> [@mary](#):
>
> however, It is mentioned in NLopt documents that it is not using ptof. Svanberg algorithm.

I don’t know what you are referring to. The NLopt manual [specifically says it is using the Svanberg (2002) algorithm](https://nlopt.readthedocs.io/en/latest/NLopt_Algorithms/#mma-method-of-moving-asymptotes-and-ccsa).

> [@mary](#):
>
> aslo as it is LD i though that it is local not global. right?

It is “LD” because the Svanberg algorithm _is_ a local-optimization algorithm. I think you’re misunderstanding the meaning of the term “globally convergent”. “Globally convergent” does **not** mean that the algorithm necessarily converges to a global optimum. What it means is that the algorithm is **guaranteed to converges to a _local optimum_ from any feasible starting point** (i.e. from any starting point satisfying the constraints).

(If you’re doing high-dimensional optimization of arbitrary non-convex functions, as is usually the case in PDE-constrained topology optimization, there _is_ no practical optimization algorithm with any useful guarantees of attaining a global optimum. There are algorithms that converge to a global optimum _eventually_, of course — even random search does that — but they may take an arbitrarily long time and give no useful indication of when the global optimum is found.)

---

<div class="post-metadata">

**Author:** ![mary](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mary/32/53139_2.png) [@mary](https://discourse.julialang.org/u/mary)\
**Post date:** [July 15, 2023, 1:19am UTC](https://discourse.julialang.org/t/gcmma-using-nlopt/101642/5 "2023-07-15T01:19:17Z")

</div>

ok thank you! i think i just get misunderstood from this sentence "[The MMA implementation in NLopt, however, is completely independent of Svanberg’s, whose code we have not examined; any bugs are my own, of course.)"](https://nlopt.readthedocs.io/en/latest/NLopt_Algorithms/)

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 15, 2023, 1:23am UTC](https://discourse.julialang.org/t/gcmma-using-nlopt/101642/6 "2023-07-15T01:23:20Z")

</div>

NLopt uses Svanberg’s published mathematical _algorithm_, it just doesn’t use his _code_ (for copyright reasons).
