GithubHelp home page GithubHelp logo

juliaopt / nlopt.jl Goto Github PK

View Code? Open in Web Editor NEW
253.0 18.0 45.0 174 KB

Package to call the NLopt nonlinear-optimization library from the Julia language

License: Other

Julia 100.00%
julia math optimization numerical-optimization nonlinear-optimization nonlinear-programming

nlopt.jl's Introduction

The NLopt module for Julia

CI

This module provides a Julia-language interface to the free/open-source NLopt library for nonlinear optimization. NLopt provides a common interface for many different optimization algorithms, including:

  • Both global and local optimization
  • Algorithms using function values only (derivative-free) and also algorithms exploiting user-supplied gradients.
  • Algorithms for unconstrained optimization, bound-constrained optimization, and general nonlinear inequality/equality constraints.

See the NLopt introduction for a further overview of the types of problems it addresses.

NLopt can be used either by accessing it's specialized API or by using the generic MathOptInterface or MathProgBase interfaces for nonlinear optimization. Both methods are documented below.

Installation

Within Julia, you can install the NLopt.jl package with the package manager: Pkg.add("NLopt")

On Windows and OS X platforms, NLopt binaries will be automatically installed. On other platforms, Julia will attempt to build NLopt from source; be sure to have a compiler installed.

Using with MathOptInterface

NLopt implements the MathOptInterface interface for nonlinear optimization, which means that it can be used interchangeably with other optimization packages from modeling packages like JuMP or when providing hand-written derivatives. Note that NLopt does not exploit sparsity of Jacobians.

The NLopt solver is named NLopt.Optimizer and takes parameters:

  • algorithm
  • stopval
  • ftol_rel
  • ftol_abs
  • xtol_rel
  • xtol_abs
  • constrtol_abs
  • maxeval
  • maxtime
  • initial_step
  • population
  • seed
  • vector_storage

The algorithm parameter is required, and all others are optional. The meaning and acceptable values of all parameters, except constrtol_abs, match the descriptions below from the specialized NLopt API. The constrtol_abs parameter is an absolute feasibility tolerance applied to all constraints.

Tutorial

The following example code solves the nonlinearly constrained minimization problem from the NLopt Tutorial:

using NLopt

function myfunc(x::Vector, grad::Vector)
    if length(grad) > 0
        grad[1] = 0
        grad[2] = 0.5/sqrt(x[2])
    end
    return sqrt(x[2])
end

function myconstraint(x::Vector, grad::Vector, a, b)
    if length(grad) > 0
        grad[1] = 3a * (a*x[1] + b)^2
        grad[2] = -1
    end
    (a*x[1] + b)^3 - x[2]
end

opt = Opt(:LD_MMA, 2)
opt.lower_bounds = [-Inf, 0.]
opt.xtol_rel = 1e-4

opt.min_objective = myfunc
inequality_constraint!(opt, (x,g) -> myconstraint(x,g,2,0), 1e-8)
inequality_constraint!(opt, (x,g) -> myconstraint(x,g,-1,1), 1e-8)

(minf,minx,ret) = optimize(opt, [1.234, 5.678])
numevals = opt.numevals # the number of function evaluations
println("got $minf at $minx after $numevals iterations (returned $ret)")

The output should be:

got 0.5443310476200902 at [0.3333333346933468,0.29629628940318486] after 11 iterations (returned XTOL_REACHED)

Much like the NLopt interfaces in other languages, you create an Opt object (analogous to nlopt_opt in C) which encapsulates the dimensionality of your problem (here, 2) and the algorithm to be used (here, LD_MMA) and use various functions to specify the constraints and stopping criteria (along with any other aspects of the problem).

The same problem can be solved by using the JuMP interface to NLopt:

using JuMP
using NLopt

model = Model(NLopt.Optimizer)
set_optimizer_attribute(model, "algorithm", :LD_MMA)

a1 = 2
b1 = 0
a2 = -1
b2 = 1

@variable(model, x1)
@variable(model, x2 >= 0)

@NLobjective(model, Min, sqrt(x2))
@NLconstraint(model, x2 >= (a1*x1+b1)^3)
@NLconstraint(model, x2 >= (a2*x1+b2)^3)

set_start_value(x1, 1.234)
set_start_value(x2, 5.678)

JuMP.optimize!(model)

println("got ", objective_value(model), " at ", [value(x1), value(x2)])

The output should be:

got 0.5443310477213124 at [0.3333333342139688,0.29629628951338166]

Note that the MathOptInterface interface sets slightly different convergence tolerances by default (these default values are given by the NLopt.DEFAULT_OPTIONS dictionary), so the outputs from the two problems are not identical.

Some algorithms need a local optimizer. These are set with local_optimizer, e.g.,

model = Model(NLopt.Optimizer)
set_optimizer_attribute(model, "algorithm", :AUGLAG)
set_optimizer_attribute(model, "local_optimizer", :LD_LBFGS)

To parametrize the local optimizer, pass use the NLopt.Opt interface, e.g.,

model = Model(NLopt.Optimizer)
set_optimizer_attribute(model, "algorithm", :AUGLAG)
local_optimizer = NLopt.Opt(:LD_LBFGS, num_variables)
local_optimizer.xtol_rel = 1e-4
set_optimizer_attribute(model, "local_optimizer", local_optimizer)

where num_variables is the number of variables of the optimization problem.

Reference

The main purpose of this section is to document the syntax and unique features of the Julia interface; for more detail on the underlying features, please refer to the C documentation in the NLopt Reference.

Using the Julia API

To use NLopt in Julia, your Julia program should include the line:

using NLopt

which imports the NLopt module and its symbols. (Alternatively, you can use import NLopt if you want to keep all the NLopt symbols in their own namespace. You would then prefix all functions below with NLopt., e.g. NLopt.Opt and so on.)

The Opt type

The NLopt API revolves around an object of type Opt. Via functions acting on this object, all of the parameters of the optimization are specified (dimensions, algorithm, stopping criteria, constraints, objective function, etcetera), and then one finally calls the optimize function in order to perform the optimization. The object should normally be created via the constructor:

opt = Opt(algorithm, n)

given an algorithm (see NLopt Algorithms for possible values) and the dimensionality of the problem (n, the number of optimization parameters). Whereas in C the algorithms are specified by nlopt_algorithm constants of the form NLOPT_LD_MMA, NLOPT_LN_COBYLA, etcetera, the Julia algorithm values are symbols of the form :LD_MMA, :LN_COBYLA, etcetera (with the NLOPT_ prefix replaced by : to create a Julia symbol).

There is also a copy(opt::Opt) function to make a copy of a given object (equivalent to nlopt_copy in the C API).

If there is an error in these functions, an exception is thrown.

The algorithm and dimension parameters of the object are immutable (cannot be changed without constructing a new object), but you can query them for a given object by:

ndims(opt)
opt.algorithm

You can get a string description of the algorithm via:

algorithm_name(opt::Opt)

Objective function

The objective function is specified by setting one of the properties:

opt.min_objective = f
opt.max_objective = f

depending on whether one wishes to minimize or maximize the objective function f, respectively. The function f should be of the form:

function f(x::Vector, grad::Vector)
    if length(grad) > 0
        ...set grad to gradient, in-place...
    end
    return ...value of f(x)...
end

The return value should be the value of the function at the point x, where x is a (Float64) array of length n of the optimization parameters (the same as the dimension passed to the Opt constructor).

In addition, if the argument grad is not empty [i.e. length(grad)>0], then grad is a (Float64) array of length n which should (upon return) be set to the gradient of the function with respect to the optimization parameters at x. That is, grad[i] should upon return contain the partial derivative ∂f/∂xi, for 1≤in, if grad is non-empty. Not all of the optimization algorithms (below) use the gradient information: for algorithms listed as "derivative-free," the grad argument will always be empty and need never be computed. (For algorithms that do use gradient information, however, grad may still be empty for some calls.)

Note that grad must be modified in-place by your function f. Generally, this means using indexing operations grad[...] = ... to overwrite the contents of grad. For example grad = 2x will not work, because it points grad to a new array 2x rather than overwriting the old contents; instead, use an explicit loop or use grad[:] = 2x.

Bound constraints

The bound constraints can be specified by setting one of the properties:

opt.lower_bounds = lb::Union{AbstractVector,Real}
opt.upper_bounds = ub::Union{AbstractVector,Real}

where lb and ub are real arrays of length n (the same as the dimension passed to the Opt constructor). For convenience, you can instead use a single scalar for lb or ub in order to set the lower/upper bounds for all optimization parameters to a single constant.

To retrieve the values of the lower/upper bounds, you can use the properties

opt.lower_bounds
opt.upper_bounds

both of which return Vector{Float64} arrays.

To specify an unbounded dimension, you can use ±Inf.

Nonlinear constraints

Just as for nonlinear constraints in C, you can specify nonlinear inequality and equality constraints by the functions:

inequality_constraint!(opt::Opt, fc, tol=0)
equality_constraint!(opt::Opt, h, tol=0)

where the arguments fc and h have the same form as the objective function above. The optional tol arguments specify a tolerance (which defaults to zero) in judging feasibility for the purposes of stopping the optimization, as in C. For the default tol=0, you can also use opt.inequality_constraint = fc or opt.equality_constraint = hc.

Each call to these function adds a new constraint to the set of constraints, rather than replacing the constraints. To remove all of the inequality and equality constraints from a given problem, you can call the following functions:

remove_constraints!(opt::Opt)

Vector-valued constraints

Just as for nonlinear constraints in C, you can specify vector-valued nonlinear inequality and equality constraints by the functions

inequality_constraint!(opt::Opt, c, tol::AbstractVector)
equality_constraint!(opt::Opt, c, tol::AbstractVector)

Here, tol is an array of the tolerances in each constraint dimension; the dimensionality m of the constraint is determined by length(tol). The constraint function c must be of the form:

function c(result::Vector, x::Vector, grad::Matrix)
    if length(grad) > 0
        ...set grad to gradient, in-place...
    end
    result[1] = ...value of c1(x)...
    result[2] = ...value of c2(x)...
    ...

result is a (Float64) array whose length equals the dimensionality m of the constraint (same as the length of tol above), which upon return should be set in-place (see also above) to the constraint results at the point x (a Float64 array whose length n is the same as the dimension passed to the Opt constructor). Any return value of the function is ignored.

In addition, if the argument grad is not empty [i.e. length(grad)>0], then grad is a 2d array of size n×m which should (upon return) be set in-place (see above) to the gradient of the function with respect to the optimization parameters at x. That is, grad[j,i] should upon return contain the partial derivative ∂ci/∂xj if grad is non-empty. Not all of the optimization algorithms (below) use the gradient information: for algorithms listed as "derivative-free," the grad argument will always be empty and need never be computed. (For algorithms that do use gradient information, however, grad may still be empty for some calls.)

An inequality constraint corresponds to ci≤0 for 1≤im, and an equality constraint corresponds to ci=0, in both cases with tolerance tol[i] for purposes of termination criteria.

(You can add multiple vector-valued constraints and/or scalar constraints in the same problem.)

Stopping criteria

As explained in the C API Reference and the Introduction), you have multiple options for different stopping criteria that you can specify. (Unspecified stopping criteria are disabled; i.e., they have innocuous defaults.)

For each stopping criteria, there is a property of the opt::Opt object that you can use to get/set the value of the stopping criterion. The meanings of each criterion are exactly the same as in the C API:

opt.stopval

Stop when an objective value of at least stopval is found. (Defaults to -Inf.)

opt.ftol_rel
opt.ftol_abs

Relative or absolute tolerance on function value. (Defaults to 0.)

opt.xtol_rel
opt.xtol_abs

Absolute or relative tolerances on the optimization parameters. (Both default to 0.) In the case of xtol_abs, you can either set it to a scalar (to use the same tolerance for all inputs) or a vector of length n (the dimension specified in the Opt constructor) to use a different tolerance for each parameter.

opt.maxeval

Stop when the number of function evaluations exceeds mev. (0 or negative for no limit, which is the default.)

opt.maxtime

Stop when the optimization time (in seconds) exceeds t. (0 or negative for no limit, which is the default.)

Forced termination

In certain cases, the caller may wish to force the optimization to halt, for some reason unknown to NLopt. For example, if the user presses Ctrl-C, or there is an error of some sort in the objective function. You can do this by throwing any exception inside your objective/constraint functions: the optimization will be halted gracefully, and the same exception will be thrown to the caller. See below regarding exceptions. The Julia equivalent of nlopt_forced_stop from the C API is to throw a ForcedStop exception.

Performing the optimization

Once all of the desired optimization parameters have been specified in a given object opt::Opt, you can perform the optimization by calling:

(optf,optx,ret) = optimize(opt::Opt, x::AbstractVector)

On input, x is an array of length n (the dimension of the problem from the Opt constructor) giving an initial guess for the optimization parameters. The return value optx is a array containing the optimized values of the optimization parameters. optf contains the optimized value of the objective function, and ret contains a symbol indicating the NLopt return code (below).

Alternatively,

(optf,optx,ret) = optimize!(opt::Opt, x::Vector{Float64})

is the same but modifies x in-place (as well as returning optx=x).

On failure (negative return codes), optimize() throws an exception (see Exceptions, below).

Return values

The possible return values are the same as the return values in the C API, except that the NLOPT_ prefix is replaced with :. That is, the return values are :SUCCESS, :XTOL_REACHED, etcetera (instead of NLOPT_SUCCESS etcetera).

Exceptions

The error codes in the C API are replaced in the Julia API by thrown exceptions. The following exceptions are thrown by the various routines:

If your objective/constraint functions throw any exception during the execution of optimize, it will be caught by NLopt and the optimization will be halted gracefully, and opt.optimize will re-throw the same exception to its caller.

Local/subsidiary optimization algorithm

Some of the algorithms, especially MLSL and AUGLAG, use a different optimization algorithm as a subroutine, typically for local optimization. You can change the local search algorithm and its tolerances by setting:

opt.local_optimizer = local_opt::Opt

Here, local_opt is another Opt object whose parameters are used to determine the local search algorithm, its stopping criteria, and other algorithm parameters. (However, the objective function, bounds, and nonlinear-constraint parameters of local_opt are ignored.) The dimension n of local_opt must match that of opt.

This makes a copy of the local_opt object, so you can freely change your original local_opt afterwards without affecting opt.

Initial step size

Just as in the C API, you can set the initial step sizes for derivative-free optimization algorithms via the opt.initial_step property:

opt.initial_step = dx

Here, dx is an array of the (nonzero) initial steps for each dimension, or a single number if you wish to use the same initial steps for all dimensions. initial_step(opt::Opt, x::AbstractVector) returns the initial step that will be used for a starting guess of x in optimize(opt,x).

Stochastic population

Just as in the C API, you can get and set the initial population for stochastic optimization algorithms by the property

opt.population

(A population of zero, the default, implies that the heuristic default will be used as decided upon by individual algorithms.)

Pseudorandom numbers

For stochastic optimization algorithms, NLopt uses pseudorandom numbers generated by the Mersenne Twister algorithm, based on code from Makoto Matsumoto. By default, the seed for the random numbers is generated from the system time, so that you will get a different sequence of pseudorandom numbers each time you run your program. If you want to use a "deterministic" sequence of pseudorandom numbers, i.e. the same sequence from run to run, you can set the seed by calling:

NLopt.srand(seed::Integer)

To reset the seed based on the system time, you can call NLopt.srand_time().

(Normally, you don't need to call this as it is called automatically. However, it might be useful if you want to "re-randomize" the pseudorandom numbers after calling nlopt.srand to set a deterministic seed.)

Vector storage for limited-memory quasi-Newton algorithms

Just as in the C API, you can get and set the number M of stored vectors for limited-memory quasi-Newton algorithms, via integer-valued property

opt.vector_storage

(The default is 0, in which case NLopt uses a heuristic nonzero value as determined by individual algorithms.)

Version number

The version number of NLopt is given by the global variable:

NLOPT_VERSION::VersionNumber

where VersionNumber is a built-in Julia type from the Julia standard library.

Author

This module was initially written by Steven G. Johnson, with subsequent contributions by several other authors (see the git history).

nlopt.jl's People

Contributors

abelsiqueira avatar anriseth avatar aquohn avatar ararslan avatar benhemingway avatar blegat avatar femtocleaner[bot] avatar ggggggggg avatar gustafsson avatar iainnz avatar jeffbezanson avatar juliatagbot avatar lcontento avatar magerton avatar malmaud avatar mlubin avatar mzaffalon avatar odow avatar palday avatar pierre-haessig avatar ranjanan avatar staticfloat avatar stefankarpinski avatar stevengj avatar svillemot avatar tkelman avatar yurivict avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nlopt.jl's Issues

unable to load NLopt

as mentioned in https://groups.google.com/forum/#!topic/julia-dev/qQTTHg8U22M I am unable to load the NLopt package in versions 0.3.0-rc4+20 and 0.4.0-dev+151 of julia. I think the problem may be caused by changes in BinDeps. If in NLopt/src/NLopt.jl I add

@show libnlopt

immediately after the line

@BinDeps.load_dependencies

I get

julia> using NLopt
libnlopt => {((System Paths,Dict{Any,Any}()),"/usr/lib/x86_64-linux-gnu/libnlopt.so")}
ERROR: type: ccall: expected Symbol, got Array{Any,1}
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in reload_path at loading.jl:152
 in _require at loading.jl:67
 in require at loading.jl:51
while loading /home/bates/.julia/v0.3/NLopt/src/NLopt.jl, in expression starting on line 375

unexpected roundoff_limited status

The following instance:

using JuMP, NLopt
m = Model(solver=NLopt.NLoptSolver(algorithm=:LD_SLSQP))
@defVar(m, x)
@addNLConstraint(m, -1 <= x <= 1)
@setNLObjective(m, Min, x)
status = solve(m)

results in a ROUNDOFF_LIMITED return status from NLopt (which we translate to :Suboptimal). Note that we're using the default tolerances set here. Any idea why we're getting this status on such a simple problem? Is there a setting for the tolerances which would give a nicer status?
I'm not discarding the possibility of an issue in the MathProgBase wrapper, but it seems to be finding the correct solution at least:

julia> getValue(x)
-1.0

@NLconstraint, JuMP

I posted the following MFE on JuliaOpt and it was pointed out by Miles Lubin that it was not "a compilation issue or anything related to JuMP. NLopt or the NLopt/MathProgBase interface is rejecting the problem. You should open an issue at the NLopt repo."
mfe.zip

In the attached .zip file the problem equality constraint is commented with "PROBLEM constraint."

Thanks.

Order of calls to target function and constraints

I suppose my problem is one of nlopt itself rather than the julia interface but I'm not sure, so I post it here. I use COBYLA on a function f with two nonlinear constraints g,h. f is expensive to evaluate but the constraints are cheap. If the constraint is violated there is no point of evaluating f. My constraints prevent unphysical values leading to

ERROR: DomainError:

in f.

Is there any way to have the constraints evaluate first? I traced the calls and right now the order is f,g,h but I'd prefer g,h,f. The error message without a line specifying the source of the error was not very helpful.

Error: `convert` has no method matching

I'm getting the following error:

in callback catch
exception on 1: ERROR: `convert` has no method matching convert(::Type{Float64}, ::Void)
Closest candidates are:
  convert(::Type{T}, ::T)
  convert(::Type{Nullable{T}}, ::T)

 in nlopt_callback_wrapper at /home/benjamin/.julia/v0.4/NLopt/src/NLopt.jl:410

My setup looks like:

  opt = Opt(:LD_SLSQP, length(theta))
  lower_bounds!(opt, zeros(length(theta)))
  upper_bounds!(opt, ones(length(theta)))

  min_objective!(opt, NLOPTobjective!)
  equality_constraint!(opt,(x,g) ->  constraints!(x,g) )

  (minf, minx, ret) = optimize(opt, theta)
  println(minx)

COBYLA does not give me the right answer

Here is my code:
using NLopt
function ob(x::Vector,grad)
(x[1]-4)^2+(x[2]-4)^2
end
function ieq1(x::Vector,grad)
-(2x[1]+3x[2]-6)
end
function ieq2(x::Vector,grad)
3x[1]+2x[2]-12
end
function ieq3(x::Vector,grad)
-(x[1]-10.0)
end
function ieq4(x::Vector,grad)
-(x[2]-10.0)
end
opt = Opt(:LN_COBYLA, 2)
min_objective!(opt, ob)
xtol_rel!(opt,1e-6)
inequality_constraint!(opt,ieq1,1e-6)
inequality_constraint!(opt,ieq2,1e-6)
inequality_constraint!(opt,ieq3,1e-6)
inequality_constraint!(opt,ieq4,1e-6)
(optf,optx,ret) = optimize(opt, [20.0,20.0])

Solution is 0.22222222222222182[3.6666666666666665,3.6666666666666674]XTOL_REACHED
Obviously,this does not satisfy ieq3 and ieq4 .why this happen or where I write wrong? thank you

ERROR: nlopt failure

I often encounter "ERROR: nlopt failure" when I run NLopt with ftol_abs set to let less than 1e-6. Is that behavior to be expected? I'd like to set ftol_abs to about 1e-8. The derivatives I pass to NLopt are all analytic, and I've verified them in test cases by comparing them to results from numeric differentiation. Are these errors likely due to numerical instability, i.e. slight incompatibilities between the objective function's values the derivatives? Or are there other common causes of nlopt failures? Are there any standard ways to work around this type of error?
Thanks.

[PkgEval] NLopt may have a testing issue on Julia 0.3 (2014-08-06)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.2) and the nightly build of the unstable version (0.3). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.3

  • On 2014-08-04 the testing status was Tests pass.
  • On 2014-08-06 the testing status changed to No tests, but package loads.

Tests pass. means that PackageEvaluator found the tests for your package, executed them, and they all passed.

No tests, but package loads. means that PackageEvaluator did not find tests for your package. However, trying to load your package with using worked.

This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

>>> 'Pkg.add("NLopt")' log
INFO: Installing BinDeps v0.2.14
INFO: Installing MathProgBase v0.2.4
INFO: Installing NLopt v0.1.0
INFO: Installing URIParser v0.0.2
INFO: Building NLopt
INFO: Package database updated

>>> 'using NLopt' log

>>> test log
no tests to run
>>> end of log

The number of required iterations have changed since April 2015

Update: ignore the question, my bad..

I had run the test with tol = 1e-4, with 1e-12 floating point accuracy messed things up. Sorry


I tested NLopt.jl in April and wrote down the required number of iterations. To my amazement, when I rerun the script now the results were worse by orders of magnitude and the algorithm that was best (and should be!) performed worst. Here is the code:

using NLopt

count = 0 # keep track of # function evaluations

function myfunc(x::Vector, grad::Vector, datain)

    global count
    count::Int += 1
    return (datain[1] - x[1])^2 + (datain[2] - x[2])^4

end

opt = Opt(:LN_COBYLA, 2) # 64
#opt = Opt(:LN_NELDERMEAD, 2) # 86
#opt = Opt(:LN_SBPLX, 2) # 152

xtol_rel!(opt,1e-12)
data = [5.0, 6.0] 
min_objective!(opt, (x, grad) -> myfunc(x, grad, data))

@time (minf,minx,ret) = optimize(opt, [1.234, 5.678])
println("got $minf at $minx after $count iterations (returned $ret)")

Here are the results:

Algorithm Iterations before Iterations now
:LN_COBYLA 64 4263263
:LN_NELDERMEAD 86 231
:LN_SBPLX 152 545

I have tested with both Julia v0.3 and v0.4 on Ubuntu 15.10, NLopt version is libnlopt0:amd64 2.4.2+dfsg-2

What's happening?

invalid NLopt arguments

Recently, NLopt keeps giving me "invalid NLopt arguments" error all the time,it does not optimize anything.. This happens even with the tutorial example.
When run with Julia version 0.3.3-pre+39 and NLopt 0.1.3, the error is as follows:

julia> include("/home/kybic/.julia/v0.3/NLopt/test/tutorial.jl")
ERROR: ArgumentError("invalid NLopt arguments")
in chk at /home/kybic/.julia/v0.3/NLopt/src/NLopt.jl:225
in inequality_constraint! at /home/kybic/.julia/v0.3/NLopt/src/NLopt.jl:428
in include at ./boot.jl:245
in include_from_node1 at ./loading.jl:128
while loading /home/kybic/.julia/v0.3/NLopt/test/tutorial.jl, in expression starting on line 32

Argument error when using LN_BOBYQA

using NLopt

function f{T<:Float64}(x::Vector{T}, grad::Vector{T})
    if length(grad) > 0
        for i in 1:length(x); grad[i] = 2.x[i]; end
    end
    dot(x,x)
end

opt = Opt(:LN_NELDERMEAD,2)
min_objective!(opt,f)
xtol_rel!(opt,1e-6)
xtol_abs!(opt,1e-20)
ftol_abs!(opt,1e-20)
lower_bounds!(opt,[0.,-Inf])
println(optimize(opt,[1.,-1.]))

opt = Opt(:LN_BOBYQA,2)
min_objective!(opt,f)
xtol_rel!(opt,1e-6)
xtol_abs!(opt,1e-20)
ftol_abs!(opt,1e-20)
lower_bounds!(opt,[0.,-Inf])
println(optimize(opt,[1.,-1.]))

When using LM_NELDERMEAD the call to optimize converges. When using LM_BOBYQA it reports "invalid NLopt arguments" but I can't decide which arguments are invalid. Insight would be appreciated.

implement MathProgBase nonlinear interface

We're proceeding with the implementation of the solver-independent NLP interface in MathProgBase; it's been implemented by Ipopt and Mosek, and JuMP has been updated to use it to provide derivatives. I'm opening this to keep track of implementing this interface for NLopt, which will allow it to be usable from JuMP (and any other modeling interfaces).

Build Failure on Ubuntu 12.04.5 x64

Hi Everyone!

I am trying to use NLopt on a droplet via digital ocean. This droplet is running Ubuntu 12.04.5 x64. My julia build is a fresh new build (version info is provided below). When I try Pkg.add("NLopt"), there is a build error and I cannot figure out how to get it to work. I've included the full output from both Pkg.add("NLopt"), Pkg.build("NLopt"), and using NLopt below. Also I can successfully add the package Optim.

Does anyone have suggestions?

Thanks

Version Info:
Julia Version 0.3.0
Commit 7681878 (2014-08-20 20:43 UTC)
Platform Info:
System: Linux (x86_64-linux-gnu)
CPU: Intel(R) Xeon(R) CPU E5-2630L v2 @ 2.40GHz
WORD_SIZE: 64
BLAS: libopenblas (NO_LAPACK NO_LAPACKE DYNAMIC_ARCH NO_AFFINITY Sandybridge)
LAPACK: liblapack.so.3
LIBM: libopenlibm
LLVM: libLLVM-3.3

julia> Pkg.add("NLopt")
INFO: Initializing package repository /root/.julia/v0.3
INFO: Cloning METADATA from git://github.com/JuliaLang/METADATA.jl
INFO: Cloning cache of BinDeps from git://github.com/JuliaLang/BinDeps.jl.git
INFO: Cloning cache of MathProgBase from git://github.com/JuliaOpt/MathProgBase.jl.git
INFO: Cloning cache of NLopt from git://github.com/JuliaOpt/NLopt.jl.git
INFO: Cloning cache of SHA from git://github.com/staticfloat/SHA.jl.git
INFO: Cloning cache of URIParser from git://github.com/JuliaWeb/URIParser.jl.git
INFO: Installing BinDeps v0.3.5
INFO: Installing MathProgBase v0.3.0
INFO: Installing NLopt v0.1.3
INFO: Installing SHA v0.0.3
INFO: Installing URIParser v0.0.2
INFO: Building NLopt
INFO: Attempting to Create directory /root/.julia/v0.3/NLopt/deps/downloads
INFO: Downloading file http://ab-initio.mit.edu/nlopt/nlopt-2.4.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2305k 100 2305k 0 0 649k 0 0:00:03 0:00:03 --:--:-- 680k
INFO: Done downloading file http://ab-initio.mit.edu/nlopt/nlopt-2.4.tar.gz
INFO: Attempting to Create directory /root/.julia/v0.3/NLopt/deps/src
INFO: Attempting to Create directory /root/.julia/v0.3/NLopt/deps
INFO: Directory /root/.julia/v0.3/NLopt/deps already created
INFO: Attempting to Create directory /root/.julia/v0.3/NLopt/deps/src/nlopt-2.4
INFO: Attempting to Create directory /root/.julia/v0.3/NLopt/deps/builds/libnlopt
INFO: Changing Directory to /root/.julia/v0.3/NLopt/deps/builds/libnlopt
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... no
checking whether make supports nested variables... no
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in /root/.julia/v0.3/NLopt/deps/builds/libnlopt': configure: error: no acceptable C compiler found in $PATH Seeconfig.log' for more details
=====================================================================================================================================================[ ERROR: NLopt ]======================================================================================================================================================

failed process: Process(setenv(/root/.julia/v0.3/NLopt/deps/src/nlopt-2.4/configure --enable-shared --without-guile --without-python --without-octave --without-matlab --with-cxx --prefix=/root/.julia/v0.3/NLopt/deps/usr,Union(ASCIIString,UTF8String)["PATH=/root/.julia/v0.3/NLopt/deps/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games","PWD=/root","LESSOPEN=| /usr/bin/lesspipe %s","SHELL=/bin/bash","SSH_CONNECTION=68.98.38.66 54999 198.199.112.122 22","CPPFLAGS= -I/root/.julia/v0.3/NLopt/deps/usr/include","MAIL=/var/mail/root","LANG=en_US.UTF-8","LDFLAGS= -L/root/.julia/v0.3/NLopt/deps/usr/lib -Wl,-rpath -Wl,/root/.julia/v0.3/NLopt/deps/usr/lib","SHLVL=1","LOGNAME=root","PKG_CONFIG_PATH=/root/.julia/v0.3/NLopt/deps/usr/lib/pkgconfig","SSH_CLIENT=68.98.38.66 54999 22","=/usr/bin/julia","USER=root","SSH_TTY=/dev/pts/0","LESSCLOSE=/usr/bin/lesspipe %s %s","TERM=xterm-256color","HOME=/root","LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arj=01;31:.taz=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.zip=01;31:.z=01;31:.Z=01;31:.dz=01;31:.gz=01;31:.lz=01;31:.xz=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.jpg=01;35:.jpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.axv=01;35:.anx=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.axa=00;36:.oga=00;36:.spx=00;36:_.xspf=00;36:"]), ProcessExited(1)) [1]
while loading /root/.julia/v0.3/NLopt/deps/build.jl, in expression starting on line 54

=====================================================================================================================================================[ BUILD ERRORS ]======================================================================================================================================================

WARNING: NLopt had build errors.

  • packages with build errors remain installed in /root/.julia/v0.3
  • build a package and all its dependencies with Pkg.build(pkg)
  • build a single package by running its deps/build.jl script

INFO: Package database updated

julia> Pkg.update()
INFO: Updating METADATA...
INFO: Computing changes...
INFO: No packages to install, update or remove

julia> Pkg.add("NLopt")
INFO: Nothing to be done

julia> using NLopt
ERROR: NLopt not properly installed. Please run Pkg.build("NLopt")
in error at error.jl:21
in include at ./boot.jl:245
in include_from_node1 at ./loading.jl:128
in reload_path at loading.jl:152
in _require at loading.jl:67
in require at loading.jl:51
while loading /root/.julia/v0.3/NLopt/src/NLopt.jl, in expression starting on line 16

julia> Pkg.build("NLopt")
INFO: Building NLopt
INFO: Attempting to Create directory /root/.julia/v0.3/NLopt/deps/downloads
INFO: Directory /root/.julia/v0.3/NLopt/deps/downloads already created
INFO: Downloading file http://ab-initio.mit.edu/nlopt/nlopt-2.4.tar.gz
INFO: Done downloading file http://ab-initio.mit.edu/nlopt/nlopt-2.4.tar.gz
INFO: Attempting to Create directory /root/.julia/v0.3/NLopt/deps/src
INFO: Directory /root/.julia/v0.3/NLopt/deps/src already created
INFO: Attempting to Create directory /root/.julia/v0.3/NLopt/deps
INFO: Directory /root/.julia/v0.3/NLopt/deps already created
INFO: Attempting to Create directory /root/.julia/v0.3/NLopt/deps/src/nlopt-2.4
INFO: Directory /root/.julia/v0.3/NLopt/deps/src/nlopt-2.4 already created
INFO: Attempting to Create directory /root/.julia/v0.3/NLopt/deps/builds/libnlopt
INFO: Directory /root/.julia/v0.3/NLopt/deps/builds/libnlopt already created
INFO: Changing Directory to /root/.julia/v0.3/NLopt/deps/builds/libnlopt
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... no
checking whether make supports nested variables... no
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in /root/.julia/v0.3/NLopt/deps/builds/libnlopt': configure: error: no acceptable C compiler found in $PATH Seeconfig.log' for more details
=====================================================================================================================================================[ ERROR: NLopt ]======================================================================================================================================================

failed process: Process(setenv(/root/.julia/v0.3/NLopt/deps/src/nlopt-2.4/configure --enable-shared --without-guile --without-python --without-octave --without-matlab --with-cxx --prefix=/root/.julia/v0.3/NLopt/deps/usr,Union(ASCIIString,UTF8String)["PATH=/root/.julia/v0.3/NLopt/deps/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games","PWD=/root","LESSOPEN=| /usr/bin/lesspipe %s","SHELL=/bin/bash","SSH_CONNECTION=68.98.38.66 54999 198.199.112.122 22","CPPFLAGS= -I/root/.julia/v0.3/NLopt/deps/usr/include","MAIL=/var/mail/root","LANG=en_US.UTF-8","LDFLAGS= -L/root/.julia/v0.3/NLopt/deps/usr/lib -Wl,-rpath -Wl,/root/.julia/v0.3/NLopt/deps/usr/lib","SHLVL=1","LOGNAME=root","PKG_CONFIG_PATH=/root/.julia/v0.3/NLopt/deps/usr/lib/pkgconfig","SSH_CLIENT=68.98.38.66 54999 22","=/usr/bin/julia","USER=root","SSH_TTY=/dev/pts/0","LESSCLOSE=/usr/bin/lesspipe %s %s","TERM=xterm-256color","HOME=/root","LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arj=01;31:.taz=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.zip=01;31:.z=01;31:.Z=01;31:.dz=01;31:.gz=01;31:.lz=01;31:.xz=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.jpg=01;35:.jpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.axv=01;35:.anx=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.axa=00;36:.oga=00;36:.spx=00;36:_.xspf=00;36:"]), ProcessExited(1)) [1]
while loading /root/.julia/v0.3/NLopt/deps/build.jl, in expression starting on line 54

=====================================================================================================================================================[ BUILD ERRORS ]======================================================================================================================================================

WARNING: NLopt had build errors.

  • packages with build errors remain installed in /root/.julia/v0.3
  • build a package and all its dependencies with Pkg.build(pkg)
  • build a single package by running its deps/build.jl script

julia> Pkg.add("Optim")
INFO: Cloning cache of Calculus from git://github.com/johnmyleswhite/Calculus.jl.git
INFO: Cloning cache of DualNumbers from git://github.com/JuliaDiff/DualNumbers.jl.git
INFO: Cloning cache of Optim from git://github.com/JuliaOpt/Optim.jl.git
INFO: Installing Calculus v0.1.5
INFO: Installing DualNumbers v0.1.0
INFO: Installing Optim v0.4.0
INFO: Package database updated

[PkgEval] NLopt may have a testing issue on Julia 0.2 (2014-08-06)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.2) and the nightly build of the unstable version (0.3). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.2

  • On 2014-08-04 the testing status was Tests pass.
  • On 2014-08-06 the testing status changed to No tests, but package loads.

Tests pass. means that PackageEvaluator found the tests for your package, executed them, and they all passed.

No tests, but package loads. means that PackageEvaluator did not find tests for your package. However, trying to load your package with using worked.

This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

>>> 'Pkg.add("NLopt")' log

>>> 'using NLopt' log

>>> test log
no tests to run
>>> end of log

how can i install NLopt.jl on a system with pre-installed NLOpt?

Hi,

I'm working on a scienfitic unix cluster where the NLopt.jl provided build.jl fails. I paste the error output in the end. I installed NLopt manually into ~/local. How can I build NLopt.jl such that it takes my ~/local/lib/libnlopt.a? I have done

push!(Sys.DL_LOAD_PATH, "${HOME}/local/lib")

but doesn't work. here's the error I get for Pkg.add("NLopt") (sorry for the long line):

====================================================[ ERROR: NLopt ]====================================================

could not spawn setenv(`/home/eisuc151/.julia/v0.3/NLopt/deps/src/nlopt-2.4/configure --enable-shared --without-guile --without-python --without-octave --without-matlab --with-cxx --prefix=/home/eisuc151/.julia/v0.3/NLopt/deps/usr`,Union(UTF8String,ASCIIString)["PATH=/home/eisuc151/.julia/v0.3/NLopt/deps/usr/bin:/home/eisuc151/local/bin:/home/eisuc151/.autojump/bin:/home/eisuc151/local/bin:/local/software/rh53/hdf5/1.8.4/gcc/bin:/local/software/rh53/python/2.6.5/gcc/bin:/local/software/rh53/protobuf/2.4.1/gcc/bin:/local/software/rh53/samtools/0.1.16/bin:/local/software/rh53/gcc/4.8.1/bin:/usr/lib64/qt-3.3/bin:/local/software/rh53/acroread/8.1.6/Adobe/Reader8/bin:/local/software/maui/3.3.1/bin:/usr/lpp/mmfs//bin:/local/software/torque/default/sbin:/local/software/torque/default/bin:/usr/local/bin:/bin:/usr/bin","HDF5_INC_DIR=/local/software/rh53/hdf5/1.8.4/gcc/include","QTDIR=/usr/lib64/qt-3.3","LD_LIBRARY_PATH=/local/software/rh53/hdf5/1.8.4/gcc/lib:/local/software/rh53/mpc/0.9/gcc/lib:/local/software/rh53/gmp/5.0.2/gcc/lib:/local/software/rh53/mpfr/2.4.2/gcc/lib:/local/software/rh53/gcc/4.8.1/lib:/local/software/rh53/gcc/4.8.1/lib64:/local/software/torque/default/lib","MANPATH=/local/software/rh53/python/2.6.5/gcc/share/man:/local/software/rh53/protobuf/2.4.1/gcc/share/man:/local/software/rh53/samtools/0.1.16/man:/local/software/rh53/gcc/4.8.1/share/man:/local/software/torque/default/man:/usr/local/share/man:/usr/share/man/en:/usr/share/man:/local/Modules/3.2.6/man","MODULEPATH=/local/Modules/versions:/local/Modules/\$MODULE_VERSION/modulefiles:/local/Modules/modulefiles:","LIBPATH=/local/software/rh53/gcc/4.8.1/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1","USER=eisuc151","KDEDIR=/usr","PBS_SERVER=blue30,blue31","SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass","LESSOPEN=|/usr/bin/lesspipe.sh %s","MAUIHOMEDIR=/local/maui/3.3.1","SHELL=/bin/bash","QTLIB=/usr/lib64/qt-3.3/lib","SSH_CLIENT=152.78.130.89 44959 22","SSH_TTY=/dev/pts/7","HOME=/home/eisuc151","TERM=xterm-256color","HOSTNAME=blue34","QTINC=/usr/lib64/qt-3.3/include","HISTSIZE=1000","LC_ALL=C","LC_CTYPE=en_GB.UTF-8","LANG=en_US.UTF-8","SHLVL=1","LOADEDMODULES=torque/current:gpfs:moab/6.1.9:acroread/8.1.6:gcc/4.8.1:samtools/0.1.16:protobuf/2.4.1:python/2.6.5/gcc:hdf5/1.8.4","LOGNAME=eisuc151","OLDPWD=/home/eisuc151/local","_LMFILES_=/local/Modules/modulefiles/torque/current:/local/Modules/modulefiles/gpfs:/local/Modules/modulefiles/moab/6.1.9:/local/Modules/3.2.6/modulefiles/acroread/8.1.6:/local/Modules/3.2.6/modulefiles/gcc/4.8.1:/local/Modules/3.2.6/modulefiles/samtools/0.1.16:/local/Modules/3.2.6/modulefiles/protobuf/2.4.1:/local/Modules/3.2.6/modulefiles/python/2.6.5/gcc:/local/Modules/3.2.6/modulefiles/hdf5/1.8.4","HDF5_LIB_DIR=/local/software/rh53/hdf5/1.8.4/gcc/lib","SHARKCLONEROOT=/usr/lpp/mmfs//src","_=/home/eisuc151/local/bin/julia","CVS_RSH=ssh","G_BROKEN_FILENAMES=1","MODULE_VERSION_STACK=3.2.6","GIT_SSL_NO_VERIFY=true","PWD=/home/eisuc151/local/lib","MODULESHOME=/local/Modules/3.2.6","PYTHONPATH=/home/eisuc151/local/lib/python2.6/site-packages/","BASH_FUNC_module()=() {  eval `/local/Modules/\$MODULE_VERSION/bin/modulecmd bash \$*`\n}","SSH_CONNECTION=152.78.130.89 44959 152.78.31.149 22","AUTOJUMP_ERROR_PATH=/home/eisuc151/.local/share/autojump/errors.log","OPENBLAS_NUM_THREADS=8","CPPFLAGS= -I/home/eisuc151/.julia/v0.3/NLopt/deps/usr/include","MAIL=/var/spool/mail/eisuc151","LDFLAGS= -L/home/eisuc151/.julia/v0.3/NLopt/deps/usr/lib -Wl,-rpath -Wl,/home/eisuc151/.julia/v0.3/NLopt/deps/usr/lib","MODULE_VERSION=3.2.6","PKG_CONFIG_PATH=/home/eisuc151/.julia/v0.3/NLopt/deps/usr/lib/pkgconfig","INPUTRC=/etc/inputrc","KDE_NO_IPV6=1","LS_COLORS=di=1;34:fi=0:ln=31:pi=5:so=5:bd=5:cd=5:or=31:mi=0:ex=35:*.sh=31:*.r=32:*.R=32:*.out=35"]): no such file or directory (ENOENT)
while loading /home/eisuc151/.julia/v0.3/NLopt/deps/build.jl, in expression starting on line 54

========================================================================================================================

====================================================[ BUILD ERRORS ]====================================================

Pkg.add("NLopt") results in "unknown package" on v0.5.0-rc3 and OS X 10.11.6

@dmbates
There also seems to be a problem with the home-brew NLopt formula.

(1) Pkg.add

et-imac-retina:~ sjbespa$ julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.5.0-rc3+0 (2016-08-22 23:43 UTC)
 _/ |\__'_|_|_|\__'_|  |  
|__/                   |  x86_64-apple-darwin15.6.0

julia> Pkg.add("NLopt")

(2) while updating a package (MixedModels) that uses NLopt:

julia> Pkg.build("MixedModels")
INFO: Building Rmath
INFO: Recompiling stale cache file /Users/sjbespa/.julia/lib/v0.5/BinDeps.ji for module BinDeps.
INFO: Recompiling stale cache file /Users/sjbespa/.julia/lib/v0.5/URIParser.ji for module URIParser.
INFO: Recompiling stale cache file /Users/sjbespa/.julia/lib/v0.5/SHA.ji for module SHA.
INFO: Building Homebrew
INFO: Recompiling stale cache file /Users/sjbespa/.julia/lib/v0.5/Homebrew.ji for module Homebrew.
Updated Homebrew from 5c7c9de to 72846fa.
Updated 1 tap (homebrew/core).
==> New Formulae
direvent          feedgnuplot       fsevents-tools    hg-fast-export    hopenpgp-tools    pybind11          vaulted         
==> Updated Formulae
...                          
==> Renamed Formulae
geode -> apache-geode
==> Deleted Formulae
curaengine                geany                     idcomments                rfcdiff                   txt2man                 
INFO: Building NLopt
WARNING: Base.WORD_SIZE is deprecated.
...
Error: No available formula with the name "nlopt" 
Error: No available formula with the name "nlopt" 

Unrecognized function abs`

I am trying to use NLOpt from JuMP. Whenever I have tried to use an objective function with abs I get

m_nl = Model(solver=NLoptSolver(algorithm=:LN_COBYLA))
@defVar(m_nl, 0 <= x <= 1)
@setNLObjective(m_nl, :Min, abs(x))
ERROR: Unrecognized function abs
 in error at ./error.jl:21

Surely, at least some of the algorithms should be able to handle expressions with abs

gradnorm_tol

Hi,

It seems the native NLopt library and NLopt.jl both do not provide a means to terminate running the optimization based on the gradient norm (for gradient-based optimizers).

However, from my practical experience with other optimization codes, the norm of the gradient (projected on the constraint set) is a very useful termination criteria.

Is the choice not to include such criteria based on the limited interface the solvers provide?

Thanks,
Sebastian

in callback catch

Using :LN_COBYLA, I'm getting a bunch of "in callback catch" errors (about 1300 times).

What I basically do is

opt = Opt(:LN_COBYLA, n)
lower_bounds!(opt, lb)
upper_bounds!(opt, ub)
xtol_rel!(opt,1e-4)

min_objective!(opt, myfunc)

(min,datamin,result) = optimize(opt, data)

Strangely, myfunc never gets called.

(lb, ub, data are all Array{Float64,1} of length n and n is 200)

Zero length gradient passed to target (local_optimizer!)

Hi,

I'm trying to implement an optimization using the Multi-Level Single-Linkage (MLSL) global optimization algorithm of NLopt. The algorithm splits the parameter space into smaller sub-spaces and runs a possibly gradient based algorithm on each sub-space. According to the NLopt manual, I should specify the algorithm used in the local optimization via the nlopt_opt_set_local_optimizer function in the C API. I figured this would be the same as calling local_optimizer!(opt::Opt, local_opt::Opt) in the Julia API. Here's some rudimentary example code for maximizing the Shubert function:

using NLopt

function shubert(x::Vector, grad::Vector)
    println("Gradient vector length: $(length(grad))")
    println("Parameter vector length: $(length(x))")
    ## Compute gradient elements
    grad[1] = (cos(1 + 2*x[2]) + 2*cos(2 + 3*x[2]) + 3*cos(3 + 4*x[2]) + 4*cos(4 + 5*x[2]) + 5*cos(5 + 6*x[2]))*
     (-2*sin(1 + 2*x[1]) - 6*sin(2 + 3*x[1]) - 12*sin(3 + 4*x[1]) - 20*sin(4 + 5*x[1]) - 30*sin(5 + 6*x[1]))

    grad[2] = (cos(1 + 2*x[1]) + 2*cos(2 + 3*x[1]) + 3*cos(3 + 4*x[1]) + 4*cos(4 + 5*x[1]) + 5*cos(5 + 6*x[1]))*
    (-2*sin(1 + 2*x[2]) - 6*sin(2 + 3*x[2]) - 12*sin(3 + 4*x[2]) - 20*sin(4 + 5*x[2]) - 30*sin(5 + 6*x[2]))

    ## Compute target
    target = (cos(1 + 2*x[1]) + 2*cos(2 + 3*x[1]) + 3*cos(3 + 4*x[1]) + 4*cos(4 + 5*x[1]) + 5*cos(5 + 6*x[1]))*
       (cos(1 + 2*x[2]) + 2*cos(2 + 3*x[2]) + 3*cos(3 + 4*x[2]) + 4*cos(4 + 5*x[2]) + 5*cos(5 + 6*x[2]))

    ## Print info
    println("Target: $target")
    println("Gradient: $grad")

    ## Return target
    return target
end

## Configure global optimization
opt = Opt(:G_MLSL_LDS, 2)
lower_bounds!(opt, [-3, -3])
upper_bounds!(opt, [3, 3])

## Configure local optimization
opt_local = Opt(:LD_TNEWTON_PRECOND_RESTART, 2)
local_optimizer!(opt, opt_local)
vector_storage!(opt, 10)

max_objective!(opt, shubert)
optimize(opt, [3., 3.])

The corresponding output is this:

julia> include("shubert.jl")
Gradient vector length: 0
Parameter vector length: 2
in callback catch
ERROR: BoundsError()
 in shubert at /Users/Felix/Desktop/shubert.jl:7
 in nlopt_callback_wrapper at /Users/Felix/.julia/v0.3/NLopt/src/NLopt.jl:410
 in optimize! at /Users/Felix/.julia/v0.3/NLopt/src/NLopt.jl:509
 in optimize at /Users/Felix/.julia/v0.3/NLopt/src/NLopt.jl:515
 in include at /Applications/Julia-0.3.5.app/Contents/Resources/julia/lib/julia/sys.dylib
 in include_from_node1 at /Applications/Julia-0.3.5.app/Contents/Resources/julia/lib/julia/sys.dylib
while loading /Users/Felix/Desktop/shubert.jl, in expression starting on line 36

julia>

As you can see, NLopt seems to pass a zero-length gradient vector to my target function. As a result Julia throws the BoundsError(). Do you have any idea why this is happening? Am I doing something wrong?

Apart from this. I'd be happy to stick with the MathProgBase API. Unfortunately, I don't know whether I can then use MLSL with some specific local optimization algorithm.

Thanks in advance,

Felix

segfault on OS X when testing VennEuler.jl package

Hi. I'm updating VennEuler.jl, after a long hiatus, and my tests seem to be failing with a segfault in the optimization. To reproduce, you could try pulling the master version of VennEuler.jl, then running test/test.jl. It's failing at the end, line 102.

Here's the traceback I'm seeing:

... (tens of thousands of rows of this)
in callback catch
in callback catch
in callback catch

signal (11): Segmentation fault: 11
jl_object_id_ at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/builtins.c:1201
typekey_compare at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/jltypes.c:1849
lookup_type at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/jltypes.c:1912
jl_inst_concrete_tupletype_v at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/jltypes.c:2181
arg_type_tuple at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/gf.c:1389
jl_apply_generic at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/gf.c:1688
anonymous at /Users/harlan/.julia/v0.4/VennEuler/src/states.jl:87
nlopt_callback_wrapper at /Users/harlan/.julia/v0.4/NLopt/src/NLopt.jl:415
jlcapi_nlopt_callback_wrapper_21246 at  (unknown line)
crs_minimize at /Users/harlan/.julia/v0.4/Homebrew/deps/usr/lib/libnlopt_cxx.dylib (unknown line)
nlopt_optimize at /Users/harlan/.julia/v0.4/Homebrew/deps/usr/lib/libnlopt_cxx.dylib (unknown line)
optimize! at /Users/harlan/.julia/v0.4/NLopt/src/NLopt.jl:514
optimize at /Users/harlan/.julia/v0.4/VennEuler/src/optim.jl:40
jlcall___optimize#3___21606 at  (unknown line)
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia.h:1325
julia_optimize_21628 at  (unknown line)
optimize_iteratively at /Users/harlan/.julia/v0.4/VennEuler/src/optim.jl:21
jlcall___optimize_iteratively#2___21632 at  (unknown line)
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/gf.c:1691
julia_optimize_iteratively_21631 at  (unknown line)
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:55
eval at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:213
eval at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:219
eval_body at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:592
jl_interpret_toplevel_thunk_with at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/interpreter.c:612
jl_toplevel_eval_flex at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:542
jl_parse_eval_all at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:577
jl_load at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/toplevel.c:620
include at /Applications/Julia-0.4.3.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia.h:1325
include_from_node1 at /Applications/Julia-0.4.3.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia.h:1325
process_options at /Applications/Julia-0.4.3.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
_start at /Applications/Julia-0.4.3.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
jlcall__start_18626 at /Applications/Julia-0.4.3.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
jl_apply at /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/./julia.h:1325
true_main at /Users/harlan/bin/julia (unknown line)
main at /Users/harlan/bin/julia (unknown line)

Julia info:

Version 0.4.3 (2016-01-12 21:37 UTC)
x86_64-apple-darwin13.4.0

julia> Pkg.status()
2 required packages:
 - Cairo                         0.2.31
 - VennEuler                     0.0.1+             master
14 additional packages:
 - BinDeps                       0.3.21
 - ColorTypes                    0.2.1
 - Colors                        0.6.3
 - Compat                        0.7.12
 - FixedPointNumbers             0.1.2
 - Graphics                      0.1.3
 - Homebrew                      0.2.0
 - Iterators                     0.1.9
 - JSON                          0.5.0
 - MathProgBase                  0.4.2
 - NLopt                         0.3.1
 - Reexport                      0.0.3
 - SHA                           0.1.2
 - URIParser                     0.1.3

At least some optimization runs work -- but not this one. Any suggestions?

Add support for optional arguments

Can you please add support to pass in arguments to the optimization function to fully support as in the C interfaace of f_data, i.e.,

void nlopt::opt::set_min_objective(nlopt::vfunc f, void* f_data);

Thanks

tracing

Hi, this package works well for something I'm working on! But I wonder if it'd be possible to get support for tracing, ala the store_trace/show_trace options in Optim.jl. I can sorta fake it by adding print statements to my evaluation function, but that's obviously not a great solution.

Skimming through the NLopt docs, I'm not actually sure if this is possible, but if it is, it'd be a great-to-have. Thanks!

move to JuliaOpt?

Are you interested in moving this package to @JuliaOpt?

If so, the only issue we'd like to clean up is the handling of the binary dependencies. BinDeps is in a much more stable state now than when this package was originally written, and I'd be willing to help out with getting it set up to install NLopt on various platforms

Build error on OSX 10.9

I'm getting this when using the latest Julia and latest NLopt.jl:

julia> Pkg.build("NLopt")
INFO: Building Homebrew
HEAD is now at 7dbece7 Merge branch 'kegpkg' of github.com:staticfloat/homebrew into kegpkg
HEAD is now at e7a2203 Tab fix didn't work, revert to old behavior
INFO: Building NLopt
=================================================================================[ ERROR: NLopt ]==================================================================================

stack overflow
while loading /Users/malmaud/Dropbox/julia/NLopt/deps/build.jl, in expression starting on line 7

===================================================================================================================================================================================

=================================================================================[ BUILD ERRORS ]==================================================================================

WARNING: NLopt had build errors.

 - packages with build errors remain installed in /Users/malmaud/Dropbox/julia
 - build a package and all its dependencies with `Pkg.build(pkg)`
 - build a single package by running its `deps/build.jl` script

For reference, brew install nlopt from the command line works fine.

Build Error on OSX 10.11

I'm running Pkg.build("NLopt") and am getting a build error between Homebrew and NLopt.

I'm using El Capitan (OSX 10.11) and the latest Juno.

INFO: Building Homebrew
HEAD is now at dc5a7e7 passenger: fix caveats.
HEAD is now at ce3d0c3 Merge pull request #78 from staticfloat/staging
INFO: Building NLopt
==> Installing nlopt from staticfloat/homebrew-juliadeps
==> Downloading http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz
Already downloaded: /Users/ble/Library/Caches/Homebrew.jl/nlopt-2.4.2.tar.gz
==> ./configure --enable-shared --without-guile --without-python --without-octave --without-matlab --without-threadlocal --with-cxx --prefix=/Users/ble/.julia/v0.3/Homebrew/deps/usr/Cellar/nlopt/2.4.2
Last 15 lines from /Users/ble/Library/Logs/Homebrew/nlopt/01.configure:
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... configure: error: in `/private/tmp/nlopt20151022-15128-65wgmi/nlopt-2.4.2':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

READ THIS: https://git.io/brew-troubleshooting
If reporting this issue please do so at (not Homebrew/homebrew):
  https://github.com/staticfloat/homebrew-juliadeps/issues

Warning: 
================================[ ERROR: NLopt ]================================

failed process: Process(`/Users/ble/.julia/v0.3/Homebrew/deps/usr/bin/brew install --force-bottle staticfloat/juliadeps/nlopt`, ProcessExited(1)) [1]
while loading /Users/ble/.julia/v0.3/NLopt/deps/build.jl, in expression starting on line 54

================================================================================

================================[ BUILD ERRORS ]================================

WARNING: NLopt had build errors.

 - packages with build errors remain installed in /Users/ble/.julia/v0.3
 - build the package(s) and all dependencies with `Pkg.build("NLopt")`
 - build a single package by running its `deps/build.jl` script

================================================================================

LD_SLSQP does not terminate on NaN

using JuMP
using NLopt
m = Model(solver=NLoptSolver(algorithm=:LD_SLSQP))
@defVar(m, c[1:2] >= 0)
@addConstraint(m, sum(c) <= 2)
@setNLObjective(m, Max, (c[1] + 0.7*c[2])^0.5 - (0.7*c[2])^0.5 + (c[2] + 0.7*c[1])^0.5 - (0.7*c[1])^0.5)
solve(m)

This hangs for a while, and when I manually exit, I get

ERROR: InterruptException:
 in eval_g at /Users/huchette/.julia/v0.4/JuMP/src/nlp.jl:274
 in g_ineq at /Users/huchette/.julia/v0.4/NLopt/src/NLoptSolverInterface.jl:179
 in nlopt_vcallback_wrapper at /Users/huchette/.julia/v0.4/NLopt/src/NLopt.jl:469
 in optimize! at /Users/huchette/.julia/v0.4/NLopt/src/NLopt.jl:509
 in optimize! at /Users/huchette/.julia/v0.4/NLopt/src/NLoptSolverInterface.jl:203
 in solvenlp at /Users/huchette/.julia/v0.4/JuMP/src/nlp.jl:491
 in solve at /Users/huchette/.julia/v0.4/JuMP/src/solvers.jl:9

cc @mlubin

Type "inital_step"

NLopt.jl, line 76:
initial_step!(m.opt, m.inital_step)
should be fixed to
initial_step!(m.opt, m.initial_step)

[PkgEval] NLopt may have a testing issue on Julia 0.3 (2014-08-16)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.3) and the nightly build of the unstable version (0.4). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.3

  • On 2014-08-15 the testing status was Tests pass.
  • On 2014-08-16 the testing status changed to Package doesn't load.

Tests pass. means that PackageEvaluator found the tests for your package, executed them, and they all passed.

Package doesn't load. means that PackageEvaluator did not find tests for your package. Additionally, trying to load your package with using failed.

This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

>>> 'Pkg.add("NLopt")' log
INFO: Installing BinDeps v0.3.0
INFO: Installing MathProgBase v0.2.5
INFO: Installing NLopt v0.1.1
INFO: Installing SHA v0.0.2
INFO: Installing URIParser v0.0.2
INFO: Building NLopt
INFO: Package database updated
INFO: METADATA is out-of-date a you may not have the latest version of NLopt
INFO: Use `Pkg.update()` to get the latest versions of your packages

>>> 'using NLopt' log
ERROR: type: ccall: expected Symbol, got Array{Any,1}
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in reload_path at loading.jl:152
 in _require at loading.jl:67
 in require at loading.jl:51
 in include at ./boot.jl:245
 in include_from_node1 at loading.jl:128
 in process_options at ./client.jl:285
 in _start at ./client.jl:354
 in _start_3B_1699 at /home/idunning/julia03/usr/bin/../lib/julia/sys.so
while loading /home/idunning/pkgtest/.julia/v0.3/NLopt/src/NLopt.jl, in expression starting on line 375
while loading /home/idunning/pkgtest/.julia/v0.3/NLopt/testusing.jl, in expression starting on line 1


>>> test log
no tests to run
>>> end of log

Installation on Windows

Hi,
I'm trying to install NLopt on a Windows 7 (64 bit machine). I downloaded NLopt, built the libnlopt-0.lib (in c:\NLopt), it is 58,726 bytes. Then started Julia 0.2.0 (from the prebuilt Windows binaries (binaries only). Did the Pkg.add("NLopt'). Got a lot of messages, Then got 2 errors:
Error: failed processes:
Process('7z x 'C:\Users\Mark\AppData\Roaming\julia\packages\TK\deps\downloads\Tk.tar.gz' -y-so' ProcessExited(-1))[-1]
Process('7z x -si -y- -ttar' "-oC:\Users\Mark\AppData\Roaming\julia\packages\TK\deps' ' ,ProcessExited (-1)) [-1]

I tried installing the Tk package, was told
You've already required VersinoSet("Tk",[]), ignoring.

I tried the example in the tutorial anyway, got this error:

ERROR: error compiling version: could not load module libnlopt: The specified module could not be found.

at C:\Users\Mark\AppData\Roaming\julia\packages\NLopt\src\Nlopt.jl:314
at c:\julia2\nltest.jl:1

Any suggestions? Do I need to tell Julia where to find the libnlopt-0.lib?

thanks
Mark

Regression from 0.4 compared to 0.3?

I'm using NLopt for a pseudolikelihood maximization optimization (thanks for the package ... it works great!) . Now the function to optimize is long to write down here (in particular the gradient), but I observe a regression from 0.3 and 0.4:

Version 0.3.10-pre+4 (2015-06-04 13:19 UTC)
Commit c8804e8* (10 days old release-0.3)
x86_64-apple-darwin14.3.0

site = 1     pll = 2.0597    time(s) = 0.5386   exit status = FTOL_REACHED
site = 2     pll = 2.0424    time(s) = 0.4302   exit status = FTOL_REACHED
site = 3     pll = 2.0432    time(s) = 0.4318   exit status = FTOL_REACHED
site = 4     pll = 2.0466    time(s) = 0.4539   exit status = FTOL_REACHED
site = 5     pll = 2.0432    time(s) = 0.4434   exit status = FTOL_REACHED
site = 6     pll = 2.0533    time(s) = 0.4360   exit status = FTOL_REACHED
site = 7     pll = 2.0469    time(s) = 0.4386   exit status = FTOL_REACHED
site = 8     pll = 2.0437    time(s) = 0.4366   exit status = FTOL_REACHED
site = 9     pll = 2.0522    time(s) = 0.4228   exit status = FTOL_REACHED
site = 10    pll = 2.0357    time(s) = 0.4359   exit status = FTOL_REACHED


Version 0.4.0-dev+5383 (2015-06-15 08:27 UTC)
Commit 993adea* (0 days old master)
x86_64-apple-darwin14.3.0

site = 1     pll = 2.0597    time(s) = 2.3384   exit status = FTOL_REACHED
site = 2     pll = 2.0424    time(s) = 2.0590   exit status = FTOL_REACHED
site = 3     pll = 2.0432    time(s) = 2.1551   exit status = FTOL_REACHED
site = 4     pll = 2.0466    time(s) = 2.2462   exit status = FTOL_REACHED
site = 5     pll = 2.0432    time(s) = 2.1300   exit status = FTOL_REACHED
site = 6     pll = 2.0533    time(s) = 2.1375   exit status = FTOL_REACHED
site = 7     pll = 2.0469    time(s) = 2.3989   exit status = FTOL_REACHED
site = 8     pll = 2.0437    time(s) = 7.8286   exit status = FTOL_REACHED
site = 9     pll = 2.0522    time(s) = 2.0911   exit status = FTOL_REACHED
site = 10    pll = 2.0357    time(s) = 2.1382   exit status = FTOL_REACHED

As you can see the timing is much larger in 0.4 although the pseudolikelihood is the same between the two releases (also the solution vector within numerical precision). I know 0.4 is undergoing lots of changes and before start digging into the problem I wanted to know if there is any usual suspect you might address me to. BTHW I' using :LD_LBFGS optimization.

Also I can stick to 0.3 for the time being waiting a more consolidated 0.4 release.

Thanks again for making NLopt available in julia

"nlopt failure" should be recoverable

In the function "chk", you often throw which causes the final value of the optimum to be unavailable. In some cases, the optimum is still useful. It would be better to have access to this.

algorithm termination by maxeval results in Exception

Running one of the GN_ or GD_ algorithms so that they terminate due to maxeval settings results in an exception, rather than returning with the "ret" variable set appropriately. In particular I have been trying this with GD_STOGO. This does not appear to be an issue with the local algorithms.

Segfault in LN_SBPLX and LN_NELDERMEAD

If I am running the following code

using NLopt

function optimf(verbose::Bool=true)
    function f(x, g)
        println("Entering f")
        fx = dot(x, x)
        if length(g) > 0
            for i = 1:length(x)
                g[i] = 2x[i]
            end
        end
        println("Leaving f")
        return fx
    end

    opt = Opt(:LN_SBPLX, 2)
    min_objective!(opt, f)
    optf, optx, ret = optimize(opt, [2.0, 3.0])
end

optimf()

I get the output

$ julia optim_crash_test.jl
Entering f
Leaving f
Entering f
Leaving f
Entering f
Leaving f

signal (11): Segmentation fault: 11
unknown function (ip: 0x0)
Segmentation fault: 11

The same happens if I use LN_NELDERMEAD instead of LN_SBPLX. All other algorithms that I have tested seem to work. The Segfault always happens after 3 function evaluations.

The above happens with a fresh install of NLopt.jl on OS X with Julia 0.4.6:

julia> versioninfo()
Julia Version 0.4.6
Commit 2e358ce (2016-06-19 17:16 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin13.4.0)
  CPU: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

julia> Pkg.status()
1 required packages:
 - NLopt                         0.3.3
7 additional packages:
 - BinDeps                       0.4.5
 - Compat                        0.9.0
 - Homebrew                      0.3.5
 - JSON                          0.7.0
 - MathProgBase                  0.5.5
 - SHA                           0.2.1
 - URIParser                     0.1.6

Failed install on RedHat

Perhaps I am missing something simple. But when running Pkg.add("NLopt") I get the following build error:

File String["/homes/gws/slund1/.julia/v0.3/NLopt/deps/src/nlopt-2.4"] was not created successfully (Tried to run SynchronousStepCollection({`tar xzf /homes/gws/slund1/.julia/v0.3/NLopt/deps/downloads/nlopt-2.4.tar.gz --directory=/homes/gws/slund1/.julia/v0.3/NLopt/deps/src`},"","") )
while loading /homes/gws/slund1/.julia/v0.3/NLopt/deps/build.jl, in expression starting on line 54

which I confess I don't understand since /homes/gws/slund1/.julia/v0.3/NLopt/deps/src/nlopt-2.4 seems to be created. I am using v0.3 and have done a Pkg.update().

Problems loading library into multiple processes

julia> addprocs(1)
1-element Array{Any,1}:
 2

julia> require("NLopt.jl")
exception on 2: ERROR: Could not load library libnlopt. Try running Pkg.build() to install missing dependencies!
 in error at error.jl:21
 in include_string at loading.jl:89
while loading /home/tim/.julia/v0.3/NLopt/src/NLopt.jl, in expression starting on line 595

However, using NLopt works just fine. I won't have time to debug this tonight, but I may be able to make progress in the morning.

Error installing NLopt on Windows

When attempting to Pkg.add("NLopt") from a 64-bit Julia 0.4.2 session on Windows 8.1, I am seeing the following error:

julia> versioninfo()
Julia Version 0.4.2
Commit bb73f34 (2015-12-06 21:47 UTC)
Platform Info:
  System: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i5-3317U CPU @ 1.70GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

julia> Pkg.add("NLopt")
INFO: Cloning cache of NLopt from git://github.com/JuliaOpt/NLopt.jl.git
INFO: Installing NLopt v0.2.3
INFO: Building NLopt
INFO: Attempting to Create directory C:\Users\Andy\.julia\v0.4\NLopt\deps\downloads
INFO: Downloading file http://ab-initio.mit.edu/nlopt/nlopt-2.4.1-dll32.zip
INFO: Done downloading file http://ab-initio.mit.edu/nlopt/nlopt-2.4.1-dll32.zip
INFO: Attempting to Create directory C:\Users\Andy\.julia\v0.4\NLopt\deps\downloads
INFO: Directory C:\Users\Andy\.julia\v0.4\NLopt\deps\downloads already created
INFO: Downloading file http://ab-initio.mit.edu/nlopt/nlopt-2.4.1-dll64.zip
INFO: Done downloading file http://ab-initio.mit.edu/nlopt/nlopt-2.4.1-dll64.zip
INFO: Attempting to Create directory C:\Users\Andy\.julia\v0.4\NLopt\deps\src
INFO: Attempting to Create directory C:\Users\Andy\.julia\v0.4\NLopt\deps\src\w32
INFO: Attempting to Create directory C:\Users\Andy\.julia\v0.4\NLopt\deps\src\w64
INFO: Attempting to Create directory C:\Users\Andy\.julia\v0.4\NLopt\deps\src
INFO: Directory C:\Users\Andy\.julia\v0.4\NLopt\deps\src already created

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18

Processing archive: C:\Users\Andy\.julia\v0.4\NLopt\deps\downloads\nlopt-2.4.1-dll32.zip

Extracting  libnlopt-0.dll
Extracting  libnlopt-0.def
Extracting  nlopt.f
Extracting  nlopt.h
Extracting  nlopt.hpp
Extracting  nlopt.py
Extracting  nlopt-python.cpp
Extracting  setup.py
Extracting  README
Extracting  COPYING
Extracting  COPYRIGHT
Extracting  NEWS
Extracting  README-WINDOWS
Extracting  matlab\NLOPT_AUGLAG_EQ.m
Extracting  matlab\NLOPT_AUGLAG.m
Extracting  matlab\NLOPT_GD_MLSL_LDS.m
Extracting  matlab\NLOPT_GD_MLSL.m
Extracting  matlab\NLOPT_GD_STOGO.m
Extracting  matlab\NLOPT_GD_STOGO_RAND.m
Extracting  matlab\NLOPT_G_MLSL_LDS.m
Extracting  matlab\NLOPT_G_MLSL.m
Extracting  matlab\NLOPT_GN_CRS2_LM.m
Extracting  matlab\NLOPT_GN_DIRECT_L.m
Extracting  matlab\NLOPT_GN_DIRECT_L_NOSCAL.m
Extracting  matlab\NLOPT_GN_DIRECT_L_RAND.m
Extracting  matlab\NLOPT_GN_DIRECT_L_RAND_NOSCAL.m
Extracting  matlab\NLOPT_GN_DIRECT.m
Extracting  matlab\NLOPT_GN_DIRECT_NOSCAL.m
Extracting  matlab\NLOPT_GN_ESCH.m
Extracting  matlab\NLOPT_GN_ISRES.m
Extracting  matlab\NLOPT_GN_MLSL_LDS.m
Extracting  matlab\NLOPT_GN_MLSL.m
Extracting  matlab\NLOPT_GN_ORIG_DIRECT_L.m
Extracting  matlab\NLOPT_GN_ORIG_DIRECT.m
Extracting  matlab\NLOPT_LD_AUGLAG_EQ.m
Extracting  matlab\NLOPT_LD_AUGLAG.m
Extracting  matlab\NLOPT_LD_CCSAQ.m
Extracting  matlab\NLOPT_LD_LBFGS.m
Extracting  matlab\NLOPT_LD_LBFGS_NOCEDAL.m
Extracting  matlab\NLOPT_LD_MMA.m
Extracting  matlab\NLOPT_LD_SLSQP.m
Extracting  matlab\NLOPT_LD_TNEWTON.m
Extracting  matlab\NLOPT_LD_TNEWTON_PRECOND.m
Extracting  matlab\NLOPT_LD_TNEWTON_PRECOND_RESTART.m
Extracting  matlab\NLOPT_LD_TNEWTON_RESTART.m
Extracting  matlab\NLOPT_LD_VAR1.m
Extracting  matlab\NLOPT_LD_VAR2.m
Extracting  matlab\NLOPT_LN_AUGLAG_EQ.m
Extracting  matlab\NLOPT_LN_AUGLAG.m
Extracting  matlab\NLOPT_LN_BOBYQA.m
Extracting  matlab\NLOPT_LN_COBYLA.m
Extracting  matlab\NLOPT_LN_NELDERMEAD.m
Extracting  matlab\NLOPT_LN_NEWUOA_BOUND.m
Extracting  matlab\NLOPT_LN_NEWUOA.m
Extracting  matlab\NLOPT_LN_PRAXIS.m
Extracting  matlab\NLOPT_LN_SBPLX.m
Extracting  matlab\nlopt_minimize_constrained.m
Extracting  matlab\nlopt_minimize.m
Extracting  matlab\nlopt_optimize.c
Extracting  matlab\nlopt_optimize.m

Everything is Ok

Files: 60
Size:       1602081
Compressed: 495108
INFO: Attempting to Create directory C:\Users\Andy\.julia\v0.4\NLopt\deps\src
INFO: Directory C:\Users\Andy\.julia\v0.4\NLopt\deps\src already created

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18

Processing archive: C:\Users\Andy\.julia\v0.4\NLopt\deps\downloads\nlopt-2.4.1-dll64.zip

Extracting  libnlopt-0.dll
Extracting  libnlopt-0.def
Extracting  nlopt.f
Extracting  nlopt.h
Extracting  nlopt.hpp
Extracting  nlopt.py
Extracting  nlopt-python.cpp
Extracting  setup.py
Extracting  README
Extracting  COPYING
Extracting  COPYRIGHT
Extracting  NEWS
Extracting  README-WINDOWS
Extracting  matlab\NLOPT_AUGLAG_EQ.m
Extracting  matlab\NLOPT_AUGLAG.m
Extracting  matlab\NLOPT_GD_MLSL_LDS.m
Extracting  matlab\NLOPT_GD_MLSL.m
Extracting  matlab\NLOPT_GD_STOGO.m
Extracting  matlab\NLOPT_GD_STOGO_RAND.m
Extracting  matlab\NLOPT_G_MLSL_LDS.m
Extracting  matlab\NLOPT_G_MLSL.m
Extracting  matlab\NLOPT_GN_CRS2_LM.m
Extracting  matlab\NLOPT_GN_DIRECT_L.m
Extracting  matlab\NLOPT_GN_DIRECT_L_NOSCAL.m
Extracting  matlab\NLOPT_GN_DIRECT_L_RAND.m
Extracting  matlab\NLOPT_GN_DIRECT_L_RAND_NOSCAL.m
Extracting  matlab\NLOPT_GN_DIRECT.m
Extracting  matlab\NLOPT_GN_DIRECT_NOSCAL.m
Extracting  matlab\NLOPT_GN_ESCH.m
Extracting  matlab\NLOPT_GN_ISRES.m
Extracting  matlab\NLOPT_GN_MLSL_LDS.m
Extracting  matlab\NLOPT_GN_MLSL.m
Extracting  matlab\NLOPT_GN_ORIG_DIRECT_L.m
Extracting  matlab\NLOPT_GN_ORIG_DIRECT.m
Extracting  matlab\NLOPT_LD_AUGLAG_EQ.m
Extracting  matlab\NLOPT_LD_AUGLAG.m
Extracting  matlab\NLOPT_LD_CCSAQ.m
Extracting  matlab\NLOPT_LD_LBFGS.m
Extracting  matlab\NLOPT_LD_LBFGS_NOCEDAL.m
Extracting  matlab\NLOPT_LD_MMA.m
Extracting  matlab\NLOPT_LD_SLSQP.m
Extracting  matlab\NLOPT_LD_TNEWTON.m
Extracting  matlab\NLOPT_LD_TNEWTON_PRECOND.m
Extracting  matlab\NLOPT_LD_TNEWTON_PRECOND_RESTART.m
Extracting  matlab\NLOPT_LD_TNEWTON_RESTART.m
Extracting  matlab\NLOPT_LD_VAR1.m
Extracting  matlab\NLOPT_LD_VAR2.m
Extracting  matlab\NLOPT_LN_AUGLAG_EQ.m
Extracting  matlab\NLOPT_LN_AUGLAG.m
Extracting  matlab\NLOPT_LN_BOBYQA.m
Extracting  matlab\NLOPT_LN_COBYLA.m
Extracting  matlab\NLOPT_LN_NELDERMEAD.m
Extracting  matlab\NLOPT_LN_NEWUOA_BOUND.m
Extracting  matlab\NLOPT_LN_NEWUOA.m
Extracting  matlab\NLOPT_LN_PRAXIS.m
Extracting  matlab\NLOPT_LN_SBPLX.m
Extracting  matlab\nlopt_minimize_constrained.m
Extracting  matlab\nlopt_minimize.m
Extracting  matlab\nlopt_optimize.c
Extracting  matlab\nlopt_optimize.m

Everything is Ok

Files: 60
Size:       1932764
Compressed: 541555
INFO: Attempting to Create directory C:\Users\Andy\.julia\v0.4\NLopt\deps\usr\lib
INFO: Changing Directory to C:\Users\Andy\.julia\v0.4\NLopt\deps\src\w32
================================[ ERROR: NLopt ]================================


LoadError: could not spawn `cp libnlopt-0.dll 'C:\Users\Andy\.julia\v0.4\NLopt\deps\usr\lib\libnlopt32.dll'`: no such file or directory (ENOENT)
while loading C:\Users\Andy\.julia\v0.4\NLopt\deps\build.jl, in expression starting on line 54

================================================================================


================================[ BUILD ERRORS]================================


WARNING: NLopt had build errors.

 - packages with build errors remain installed in C:\Users\Andy\.julia\v0.4
 - build the package(s) and all dependencies with `Pkg.build("NLopt")`
 - build a single package by running its `deps/build.jl` script

================================================================================

INFO: Package database updated
INFO: METADATA is out-of-date - you may not have the latest version of NLopt
INFO: Use `Pkg.update()` to get the latest versions of your packages

Would the assumption that the end-user has the cp command available in their shell environment present a problem here?

Should the build steps above be special cased on Windows using copy or xcopy for executing within a Windows Command Prompt?

MethodError: `parseNLExpr_runtime` has no method matching parseNLExpr_runtime

I think the problem is at the last line (@NLobjective(....)) but which is the right way to do it?

LoadError: MethodError: parseNLExpr_runtime has no method matching parseNLExpr_runtime(::JuMP.Model, ::Function, ::Array{ReverseDiffSparse.NodeData,1}, ::Int64, ::Array{Float64,1})
Closest candidates are:
parseNLExpr_runtime(::JuMP.Model, !Matched::Number, ::Any, ::Any, ::Any)
parseNLExpr_runtime(::JuMP.Model, !Matched::JuMP.Variable, ::Any, ::Any, ::Any)
parseNLExpr_runtime(::JuMP.Model, !Matched::JuMP.NonlinearExpression, ::Any, ::Any, ::Any)
...
in include_string at loading.jl:282

using JuMP
using NLopt

function functs_MOP4(x::Vector)
    pi = 4.0*atan(1.0)
    n  = length(x)
    f  = zeros(2)
    f[1] = 0.0
    for i = 1:(n-1)
        f[1] = f[1] + (-10.0*exp(-0.20*sqrt(x[i]^2+x[i+1]^2)))
    end
    f[2] = 0.0
    for i = 1:n
        f[2] = f[2] + (abs(x[i])^0.8+5.0*sin(x[i]^3))
    end

    return f
end

function bounds_MOP4()
    return ([-5.0;-5.0;-5.0],[5.0;5.0;5.0])
end

m = Model(solver=NLoptSolver(algorithm=:LD_MMA))
@NLobjective(m, Min, functs_MOP4)

NLopt installing error on Windows

When trying to install NLopt on Windows (64 bits Windows 7 Pro), I get this error below.
I got basically the same error when trying Pkg.build("NLopt").

               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.3 (2016-01-12 21:37 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/                   |  x86_64-w64-mingw32

julia> Pkg.add("NLopt")
INFO: Initializing package repository C:\Users\Cecile Ane\.julia\v0.4
INFO: Cloning METADATA from git://github.com/JuliaLang/METADATA.jl
INFO: Cloning cache of BinDeps from git://github.com/JuliaLang/BinDeps.jl.git
INFO: Cloning cache of Compat from git://github.com/JuliaLang/Compat.jl.git
INFO: Cloning cache of MathProgBase from git://github.com/JuliaOpt/MathProgBase.
jl.git
INFO: Cloning cache of NLopt from git://github.com/JuliaOpt/NLopt.jl.git
INFO: Cloning cache of SHA from git://github.com/staticfloat/SHA.jl.git
INFO: Cloning cache of URIParser from git://github.com/JuliaWeb/URIParser.jl.git

INFO: Installing BinDeps v0.3.21
INFO: Installing Compat v0.7.12
INFO: Installing MathProgBase v0.4.2
INFO: Installing NLopt v0.3.1
INFO: Installing SHA v0.1.2
INFO: Installing URIParser v0.1.3
INFO: Building NLopt
INFO: Attempting to Create directory C:\Users\Cecile Ane\.julia\v0.4\NLopt\deps\
downloads
INFO: Downloading file http://ab-initio.mit.edu/nlopt/nlopt-2.4.1-dll32.zip
INFO: Done downloading file http://ab-initio.mit.edu/nlopt/nlopt-2.4.1-dll32.zip

INFO: Attempting to Create directory C:\Users\Cecile Ane\.julia\v0.4\NLopt\deps\
downloads
INFO: Directory C:\Users\Cecile Ane\.julia\v0.4\NLopt\deps\downloads already cre
ated
INFO: Downloading file http://ab-initio.mit.edu/nlopt/nlopt-2.4.1-dll64.zip
INFO: Done downloading file http://ab-initio.mit.edu/nlopt/nlopt-2.4.1-dll64.zip

INFO: Attempting to Create directory C:\Users\Cecile Ane\.julia\v0.4\NLopt\deps\
src
INFO: Attempting to Create directory C:\Users\Cecile Ane\.julia\v0.4\NLopt\deps\
src\w32
INFO: Attempting to Create directory C:\Users\Cecile Ane\.julia\v0.4\NLopt\deps\
src\w64
INFO: Attempting to Create directory C:\Users\Cecile Ane\.julia\v0.4\NLopt\deps\
src
INFO: Directory C:\Users\Cecile Ane\.julia\v0.4\NLopt\deps\src already created

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18

Processing archive: C:\Users\Cecile Ane\.julia\v0.4\NLopt\deps\downloads\nlopt-2
.4.1-dll32.zip

Extracting  libnlopt-0.dll
Extracting  libnlopt-0.def
Extracting  nlopt.f
Extracting  nlopt.h
Extracting  nlopt.hpp
Extracting  nlopt.py
Extracting  nlopt-python.cpp
Extracting  setup.py
Extracting  README
Extracting  COPYING
Extracting  COPYRIGHT
Extracting  NEWS
Extracting  README-WINDOWS
Extracting  matlab\NLOPT_AUGLAG_EQ.m
Extracting  matlab\NLOPT_AUGLAG.m
Extracting  matlab\NLOPT_GD_MLSL_LDS.m
Extracting  matlab\NLOPT_GD_MLSL.m
Extracting  matlab\NLOPT_GD_STOGO.m
Extracting  matlab\NLOPT_GD_STOGO_RAND.m
Extracting  matlab\NLOPT_G_MLSL_LDS.m
Extracting  matlab\NLOPT_G_MLSL.m
Extracting  matlab\NLOPT_GN_CRS2_LM.m
Extracting  matlab\NLOPT_GN_DIRECT_L.m
Extracting  matlab\NLOPT_GN_DIRECT_L_NOSCAL.m
Extracting  matlab\NLOPT_GN_DIRECT_L_RAND.m
Extracting  matlab\NLOPT_GN_DIRECT_L_RAND_NOSCAL.m
Extracting  matlab\NLOPT_GN_DIRECT.m
Extracting  matlab\NLOPT_GN_DIRECT_NOSCAL.m
Extracting  matlab\NLOPT_GN_ESCH.m
Extracting  matlab\NLOPT_GN_ISRES.m
Extracting  matlab\NLOPT_GN_MLSL_LDS.m
Extracting  matlab\NLOPT_GN_MLSL.m
Extracting  matlab\NLOPT_GN_ORIG_DIRECT_L.m
Extracting  matlab\NLOPT_GN_ORIG_DIRECT.m
Extracting  matlab\NLOPT_LD_AUGLAG_EQ.m
Extracting  matlab\NLOPT_LD_AUGLAG.m
Extracting  matlab\NLOPT_LD_CCSAQ.m
Extracting  matlab\NLOPT_LD_LBFGS.m
Extracting  matlab\NLOPT_LD_LBFGS_NOCEDAL.m
Extracting  matlab\NLOPT_LD_MMA.m
Extracting  matlab\NLOPT_LD_SLSQP.m
Extracting  matlab\NLOPT_LD_TNEWTON.m
Extracting  matlab\NLOPT_LD_TNEWTON_PRECOND.m
Extracting  matlab\NLOPT_LD_TNEWTON_PRECOND_RESTART.m
Extracting  matlab\NLOPT_LD_TNEWTON_RESTART.m
Extracting  matlab\NLOPT_LD_VAR1.m
Extracting  matlab\NLOPT_LD_VAR2.m
Extracting  matlab\NLOPT_LN_AUGLAG_EQ.m
Extracting  matlab\NLOPT_LN_AUGLAG.m
Extracting  matlab\NLOPT_LN_BOBYQA.m
Extracting  matlab\NLOPT_LN_COBYLA.m
Extracting  matlab\NLOPT_LN_NELDERMEAD.m
Extracting  matlab\NLOPT_LN_NEWUOA_BOUND.m
Extracting  matlab\NLOPT_LN_NEWUOA.m
Extracting  matlab\NLOPT_LN_PRAXIS.m
Extracting  matlab\NLOPT_LN_SBPLX.m
Extracting  matlab\nlopt_minimize_constrained.m
Extracting  matlab\nlopt_minimize.m
Extracting  matlab\nlopt_optimize.c
Extracting  matlab\nlopt_optimize.m

Everything is Ok

Files: 60
Size:       1602081
Compressed: 495108
INFO: Attempting to Create directory C:\Users\Cecile Ane\.julia\v0.4\NLopt\deps\
src
INFO: Directory C:\Users\Cecile Ane\.julia\v0.4\NLopt\deps\src already created

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18

Processing archive: C:\Users\Cecile Ane\.julia\v0.4\NLopt\deps\downloads\nlopt-2
.4.1-dll64.zip

Extracting  libnlopt-0.dll
Extracting  libnlopt-0.def
Extracting  nlopt.f
Extracting  nlopt.h
Extracting  nlopt.hpp
Extracting  nlopt.py
Extracting  nlopt-python.cpp
Extracting  setup.py
Extracting  README
Extracting  COPYING
Extracting  COPYRIGHT
Extracting  NEWS
Extracting  README-WINDOWS
Extracting  matlab\NLOPT_AUGLAG_EQ.m
Extracting  matlab\NLOPT_AUGLAG.m
Extracting  matlab\NLOPT_GD_MLSL_LDS.m
Extracting  matlab\NLOPT_GD_MLSL.m
Extracting  matlab\NLOPT_GD_STOGO.m
Extracting  matlab\NLOPT_GD_STOGO_RAND.m
Extracting  matlab\NLOPT_G_MLSL_LDS.m
Extracting  matlab\NLOPT_G_MLSL.m
Extracting  matlab\NLOPT_GN_CRS2_LM.m
Extracting  matlab\NLOPT_GN_DIRECT_L.m
Extracting  matlab\NLOPT_GN_DIRECT_L_NOSCAL.m
Extracting  matlab\NLOPT_GN_DIRECT_L_RAND.m
Extracting  matlab\NLOPT_GN_DIRECT_L_RAND_NOSCAL.m
Extracting  matlab\NLOPT_GN_DIRECT.m
Extracting  matlab\NLOPT_GN_DIRECT_NOSCAL.m
Extracting  matlab\NLOPT_GN_ESCH.m
Extracting  matlab\NLOPT_GN_ISRES.m
Extracting  matlab\NLOPT_GN_MLSL_LDS.m
Extracting  matlab\NLOPT_GN_MLSL.m
Extracting  matlab\NLOPT_GN_ORIG_DIRECT_L.m
Extracting  matlab\NLOPT_GN_ORIG_DIRECT.m
Extracting  matlab\NLOPT_LD_AUGLAG_EQ.m
Extracting  matlab\NLOPT_LD_AUGLAG.m
Extracting  matlab\NLOPT_LD_CCSAQ.m
Extracting  matlab\NLOPT_LD_LBFGS.m
Extracting  matlab\NLOPT_LD_LBFGS_NOCEDAL.m
Extracting  matlab\NLOPT_LD_MMA.m
Extracting  matlab\NLOPT_LD_SLSQP.m
Extracting  matlab\NLOPT_LD_TNEWTON.m
Extracting  matlab\NLOPT_LD_TNEWTON_PRECOND.m
Extracting  matlab\NLOPT_LD_TNEWTON_PRECOND_RESTART.m
Extracting  matlab\NLOPT_LD_TNEWTON_RESTART.m
Extracting  matlab\NLOPT_LD_VAR1.m
Extracting  matlab\NLOPT_LD_VAR2.m
Extracting  matlab\NLOPT_LN_AUGLAG_EQ.m
Extracting  matlab\NLOPT_LN_AUGLAG.m
Extracting  matlab\NLOPT_LN_BOBYQA.m
Extracting  matlab\NLOPT_LN_COBYLA.m
Extracting  matlab\NLOPT_LN_NELDERMEAD.m
Extracting  matlab\NLOPT_LN_NEWUOA_BOUND.m
Extracting  matlab\NLOPT_LN_NEWUOA.m
Extracting  matlab\NLOPT_LN_PRAXIS.m
Extracting  matlab\NLOPT_LN_SBPLX.m
Extracting  matlab\nlopt_minimize_constrained.m
Extracting  matlab\nlopt_minimize.m
Extracting  matlab\nlopt_optimize.c
Extracting  matlab\nlopt_optimize.m

Everything is Ok

Files: 60
Size:       1932764
Compressed: 541555
INFO: Attempting to Create directory C:\Users\Cecile Ane\.julia\v0.4\NLopt\deps\
usr\lib
INFO: Changing Directory to C:\Users\Cecile Ane\.julia\v0.4\NLopt\deps\src\w32
Copy-Item : A positional parameter cannot be found that accepts argument 'Ane\.
julia\v0.4\NLopt\deps\usr\lib\libnlopt32.dll'.
At line:1 char:3
+ cp <<<<  libnlopt-0.dll C:\Users\Cecile Ane\.julia\v0.4\NLopt\deps\usr\lib\li
bnlopt32.dll
    + CategoryInfo          : InvalidArgument: (:) [Copy-Item], ParameterBindi
   ngException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell
   .Commands.CopyItemCommand

================================[ ERROR: NLopt ]================================


LoadError: failed process: Process(`powershell -Command 'cp libnlopt-0.dll C:\Us
ers\Cecile Ane\.julia\v0.4\NLopt\deps\usr\lib\libnlopt32.dll'`, ProcessExited(1)
) [1]
while loading C:\Users\Cecile Ane\.julia\v0.4\NLopt\deps\build.jl, in expression
 starting on line 54

================================================================================


================================[ BUILD ERRORS ]================================


WARNING: NLopt had build errors.

 - packages with build errors remain installed in C:\Users\Cecile Ane\.julia\v0.
4
 - build the package(s) and all dependencies with `Pkg.build("NLopt")`
 - build a single package by running its `deps/build.jl` script

================================================================================

INFO: Package database updated

ERROR: NLoptSolver not defined -- need version bump?

Looks like the JuMP interface described in README.md is not yet provided from Pkg.add().
If it looks ready, could we get a version bump?

julia> using JuMP
julia> using NLopt

julia> m = Model(solver=NLoptSolver(algorithm=:LD_MMA))
ERROR: NLoptSolver not defined
julia> versioninfo()
Julia Version 0.3.0-rc1+284
Commit da17f92 (2014-07-30 21:54 UTC)
Platform Info:
  System: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-2720QM CPU @ 2.20GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

Complex number Optimization

Hi,
is it already implemented a optimization method for functions with complex number?

Using :LN_COBYLA with a derivative free optimization I get this error

in callback catch

type: Complex: in T, expected T<:Real, got Type{Any}
while loading In[15], in expression starting on line 15

 in CF_SVj at In[3]:9

as the function CF_SVj returns complex values.

Thanks

cannot load NLopt

julia> using NLopt

signal (11): Segmentation fault: 11
unknown function (ip: 0x0)
Segmentation fault: 11

julia version 0.4.2

Okay to drop julia 0.3?

We have some breaking changes coming to the MathProgBase interface (JuliaOpt/MathProgBase.jl#91) which will have a minimum requirement of Julia 0.4. So updating to the new changes will mean dropping support on master for Julia 0.3. I'm happy to do all the work, just want to double check that this is okay with you, @stevengj. The next release of NLopt.jl would be tagged as 0.3.0 so that it's still possible to release updates for Julia 0.3 users using 0.2.* tags if needed.

Pkg.add("NLopt") can't find libnlopt

julia> Pkg.add("NLopt")
INFO: Installing NLopt v0.0.0
INFO: REQUIRE updated.

julia> using NLopt
ERROR: error compiling version: could not load module libnlopt: dlopen(libnlopt.dylib, 1): image not found
 in include at boot.jl:238
 in include_from_node1 at loading.jl:114
 in reload_path at loading.jl:140
 in _require at loading.jl:58
 in require at loading.jl:43
at /Users/Administrator/.julia/NLopt/src/NLopt.jl:314

build failiure on OSX 10.9

When I run Pkg.build("NLopt"), I get the following:

julia> Pkg.build("NLopt")
INFO: Building Homebrew
HEAD is now at 7dbece7 Merge branch 'kegpkg' of github.com:staticfloat/homebrew into kegpkg
HEAD is now at e7a2203 Tab fix didn't work, revert to old behavior
INFO: Building NLopt
=============================================================================================[ ERROR: NLopt ]=============================================================================================

Provider PackageManager failed to satisfy dependency libnlopt
at /Users/james/.julia/NLopt/deps/build.jl:52

==========================================================================================================================================================================================================

=============================================================================================[ BUILD ERRORS ]=============================================================================================

WARNING: NLopt had build errors.

 - packages with build errors remain installed in /Users/james/.julia
 - build a package and all its dependencies with `Pkg.build(pkg)`
 - build a single package by running its `deps/build.jl` script

==========================================================================================================================================================================================================

I'm not familiar enough with BinDeps to know exactly what's going wrong here.

Build failure on OSX when conflicting Homebrew taps exist

I'm running Julia 0.4.3 and trying to install NLopt 0.3.2 but got these errors.The version of the osx in my Mac is EI Capitan 10.11.3

ERROR: failed process: Process(`/Users/paul/.julia/v0.4/Homebrew/deps/usr/bin/brew install --force-bottle staticfloat/juliadeps/NLopt`, ProcessExited(1)) [1]

and this

WARNING: NLopt had build errors.

 - packages with build errors remain installed in /Users/paul/.julia/v0.4
 - build the package(s) and all dependencies with `Pkg.build("NLopt")`
 - build a single package by running its `deps/build.jl` script

Pkg.build fails, (even after a Pkg.update). Any hint?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.