Hi Jude, 

I don't know anything about how fminbnd works, but I have ported a few 
optimization problems over from Matlab to Julia. You should figure out 
which solution method fminbnd uses and compare them to those found here 
http://ab-initio.mit.edu/wiki/index.php/NLopt_Algorithms to make sure 
you're picking the best one. In general this format will get you through 
almost any port. Where you just replace LN_SBPLX with the algorithm you'd 
like and you add gradient information if you can. 

using NLopt

## Set Initial Parameters from the outside

z=189

## Make "Container" Function because I can only optimize over x, even 
though z is still a parameter

function test_max(x,z)
x[1]^2 + z 
end


# keep track of # function evaluations

count = 0 

function func(x::Vector, grad::Vector)

    global count +=1
    println("f_$count($x)")

 test_max(x[1],z)

end

opt = Opt(:LN_SBPLX,1)

min_objective!(opt, func)

(minf,minx,ret)=optimize(opt,[1])

println("got $minf at $minx after $count iterations (returned $ret)")

-Alex

On Wednesday, September 3, 2014 5:12:34 AM UTC-7, Jude wrote:
>
> Hi,
>
> I am in the process of converting my Matlab code to Julia. I see that 
> there is a package called NLopt available but rather than spending time 
> trying to decipher the syntax, I was wondering if anyone knows the syntax 
> for doing something similar to Matlab's fminbnd, eg, I have something like 
> the following in Matlab and I would like to know how to do it in Julia:  
>
> [x, value] = fminbnd(@(x) objectivefunc(x, params), lbA1, ubA1, 
> optimset('TolX',tol))
>
> Any help would be really appreciated.
>
> Thanks,
> Jude  
>

Reply via email to