When I run the following NLOPT example in python :

    import numpy as np
    import nlopt

    n = 2
    localopt_feval_max = 10
    lb = np.array([-1, -1])
    ub = np.array([1, 1])


    def myfunc(x, grad):
        return -1

    opt = nlopt.opt(nlopt.LN_NELDERMEAD, n)

    opt.set_lower_bounds(lb)
    opt.set_upper_bounds(ub)
    opt.set_maxeval(localopt_feval_max)

    opt.set_min_objective(myfunc)
    opt.set_xtol_rel(1e-8)
    x0 = np.array([0,0])

    x = opt.optimize(x0)

I get an error:

    "ValueError: nlopt invalid argument"

The only suggestion given by the reference here:

http://ab-initio.mit.edu/wiki/index.php/NLopt_Python_Reference

is that the lower bounds might be bigger than the upper bounds, or there is
an unknown algorithm (neither of which is the case here). I am running the
following versions of Python, NLOPT, and NumPy

    >>> sys.version
    '3.4.0 (default, Apr 11 2014, 13:05:11) \n[GCC 4.8.2]'
    >>> nlopt.__version__
    '2.4.2'
    >>> np.__version__
    '1.8.2'
_______________________________________________
NLopt-discuss mailing list
NLopt-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss

Reply via email to