# Nelder Mead tolerance vastly higher when I restart optimization with updated guess for initial parameters

**URL:** <https://discourse.julialang.org/t/nelder-mead-tolerance-vastly-higher-when-i-restart-optimization-with-updated-guess-for-initial-parameters/87939>\
**Category:** General Usage\
**Tags:** statistics, optim, optimization\
**Created:** [September 28, 2022, 3:17pm UTC](https://discourse.julialang.org/t/nelder-mead-tolerance-vastly-higher-when-i-restart-optimization-with-updated-guess-for-initial-parameters/87939 "2022-09-28T15:17:59Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![structural](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@structural](https://discourse.julialang.org/u/structural)\
**Post date:** [October 1, 2022, 10:06am UTC](https://discourse.julialang.org/t/nelder-mead-tolerance-vastly-higher-when-i-restart-optimization-with-updated-guess-for-initial-parameters/87939/15 "2022-10-01T10:06:28Z")

</div>

Ok I managed to retrieve the simplex for each iteration but only after the Optim call completes successfully. But this doesn’t solve my problem because I need to extract the simplex and save to a csv while the optimizer is running.

My issue is that I have an optimizer which runs for 70+ hours but the system I am on terminates the session after 50 hours. So I can’t wait for the routine to complete successfully to export the trace since the first call simply cannot be completed within the constraints of the system.

@stevengj I have seen your suggestion here on printing the function value from within the objective function [Optim.jl, showing trace](https://discourse.julialang.org/t/optim-jl-showing-trace/55258). I imagine this can’t be done in my case because the simplex is determined outside the objective function?

```julia
options = Optim.Options(store_trace = true, extended_trace = true, trace_simplex = true, iterations = 10^10)
res = optimize(b -> f(b, x0), b0, options)

for i = 1:Optim.iterations(res)
    simp = get(Optim.trace(res)[i].metadata, "simplex", "na")
    simp_val = get(Optim.trace(res)[i].metadata, "simplex_values", "na")
end

```

---

_[View the full topic](https://discourse.julialang.org/t/nelder-mead-tolerance-vastly-higher-when-i-restart-optimization-with-updated-guess-for-initial-parameters/87939)._
