# Optim.jl NelderMead, how to avoid stucking situation?

**URL:** <https://discourse.julialang.org/t/optim-jl-neldermead-how-to-avoid-stucking-situation/101590>\
**Category:** Optimization (Mathematical)\
**Created:** [July 13, 2023, 9:20pm UTC](https://discourse.julialang.org/t/optim-jl-neldermead-how-to-avoid-stucking-situation/101590 "2023-07-13T21:20:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zerosum](https://avatars.discourse-cdn.com/v4/letter/z/b2d939/32.png) [@Zerosum](https://discourse.julialang.org/u/Zerosum)\
**Post date:** [July 13, 2023, 9:20pm UTC](https://discourse.julialang.org/t/optim-jl-neldermead-how-to-avoid-stucking-situation/101590/1 "2023-07-13T21:20:34Z")

</div>

I think this is a question more related to optimization than Julia’s.

I figured out that Optim.jl NelderMead algorithm doesn’t support fminbox. The out-of-boundary search is not a real problem because I can impose some penalties. However, sometimes it causes errors in my model estimation (e.g., I have to impose a log on an object, but when a constraint is not satisfied, the object turns out to be negative).

I naively thought that I could return large values for those cases whenever the estimation was not properly implemented. However, then the algorithm gets stuck on the domain there.

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [July 13, 2023, 9:34pm UTC](https://discourse.julialang.org/t/optim-jl-neldermead-how-to-avoid-stucking-situation/101590/2 "2023-07-13T21:34:00Z")

</div>

I’m general, neadlermead is a pretty bad algorithm. it isn’t even guaranteed to converge to local minima
