# Optimize with Fminbox. Can't find the way how to put tolerance and number of iterations

**URL:** <https://discourse.julialang.org/t/optimize-with-fminbox-cant-find-the-way-how-to-put-tolerance-and-number-of-iterations/91720>\
**Category:** General Usage\
**Created:** [December 15, 2022, 11:51pm UTC](https://discourse.julialang.org/t/optimize-with-fminbox-cant-find-the-way-how-to-put-tolerance-and-number-of-iterations/91720 "2022-12-15T23:51:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BMval](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bmval/32/7647_2.png) [@BMval](https://discourse.julialang.org/u/BMval)\
**Post date:** [December 15, 2022, 11:51pm UTC](https://discourse.julialang.org/t/optimize-with-fminbox-cant-find-the-way-how-to-put-tolerance-and-number-of-iterations/91720/1 "2022-12-15T23:51:45Z")

</div>

I am sorry for simmple questions.

```julia

opt = optimize(loss, [0.01],[0.05], [0.02],Fminbox(LBFGS()));

```

How to put tolerance and number of iterations.  
parameters x\_tol, g\_tol don’t work.

thank you in advance.

---

<div class="post-metadata">

**Author:** ![PharmCat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pharmcat/32/6953_2.png) [@PharmCat](https://discourse.julialang.org/u/PharmCat)\
**Post date:** [December 16, 2022, 12:02am UTC](https://discourse.julialang.org/t/optimize-with-fminbox-cant-find-the-way-how-to-put-tolerance-and-number-of-iterations/91720/2 "2022-12-16T00:02:21Z")

</div>

You can use options, this way:

```julia
results = optimize(f, lower, upper, initial_x, Fminbox(GradientDescent()), 
Optim.Options(outer_iterations = 2))

```

See options here: [Optim.jl](https://julianlsolvers.github.io/Optim.jl/stable/#user/config/)

---

<div class="post-metadata">

**Author:** ![BMval](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bmval/32/7647_2.png) [@BMval](https://discourse.julialang.org/u/BMval)\
**Post date:** [December 16, 2022, 4:17am UTC](https://discourse.julialang.org/t/optimize-with-fminbox-cant-find-the-way-how-to-put-tolerance-and-number-of-iterations/91720/3 "2022-12-16T04:17:51Z")

</div>

> [@PharmCat](#):
>
> `GradientDescent()`

thank you. I’ve just tried “iterations” and haven’t found “outer\_iterations”

---

<div class="post-metadata">

**Author:** ![PharmCat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pharmcat/32/6953_2.png) [@PharmCat](https://discourse.julialang.org/u/PharmCat)\
**Post date:** [December 16, 2022, 10:42am UTC](https://discourse.julialang.org/t/optimize-with-fminbox-cant-find-the-way-how-to-put-tolerance-and-number-of-iterations/91720/4 "2022-12-16T10:42:01Z")

</div>

`iterations` can be used too. inside Options structure.  
Better way to use

```julia
Optim.Options()

```

for options, not keywords.
