# Using NLopt through GalacticOptim

**URL:** <https://discourse.julialang.org/t/using-nlopt-through-galacticoptim/60244>\
**Category:** General Usage\
**Created:** [April 29, 2021, 1:27pm UTC](https://discourse.julialang.org/t/using-nlopt-through-galacticoptim/60244 "2021-04-29T13:27:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![amrods](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amrods/32/2543_2.png) [@amrods](https://discourse.julialang.org/u/amrods)\
**Post date:** [April 29, 2021, 1:27pm UTC](https://discourse.julialang.org/t/using-nlopt-through-galacticoptim/60244/1 "2021-04-29T13:27:11Z")

</div>

I’m trying to use `NLopt` though `GalacticOptim`, but can’t get it work. What am I doing wrong below?

```julia
using NLopt
using GalacticOptim

# rosenbrock
function f(x; a=1, b=100)
    (a - x[1])^2 + b*(x[2] - x[1]^2)^2
end

# GO wrapper
function go_f(x, p)
    f(x; a=p[1], b=p[2])
end

p = [1, 100]
x0 = [10, 10]
nlopt_go = Opt(:LD_MMA, 2)
nlopt_go.lower_bounds = [-Inf, -Inf]
nlopt_go.xtol_rel = 1e-8
prob = OptimizationProblem(go_f, x0, p)
go_sol = solve(prob, nlopt_go)

```

the last line is supposed to do the optimization but all I get in return is the initial point `x0`.
