# This file was automatically generated by SWIG (https://www.swig.org).
# Version 4.4.1
#
# Do not make changes to this file unless you know what you are doing - modify
# the SWIG interface file instead.

"""
NLopt is a multi-language library for nonlinear optimization (local or
global, with or without derivatives, and supporting nonlinear
constraints).  Complete documentation, including a Python tutorial,
can be found at the NLopt web page: http://ab-initio.mit.edu/nlopt
"""

from sys import version_info as _swig_python_version_info
# Import the low-level C/C++ module
if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__:
    from . import _nlopt
else:
    import _nlopt

try:
    import builtins as __builtin__
except ImportError:
    import __builtin__

def _swig_repr(self):
    try:
        strthis = "proxy of " + self.this.__repr__()
    except __builtin__.Exception:
        strthis = ""
    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)


def _swig_setattr_nondynamic_instance_variable(set):
    def set_instance_attr(self, name, value):
        if name == "this":
            set(self, name, value)
        elif name == "thisown":
            self.this.own(value)
        elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
            set(self, name, value)
        else:
            raise AttributeError("You cannot add instance attributes to %s" % self)
    return set_instance_attr


def _swig_setattr_nondynamic_class_variable(set):
    def set_class_attr(cls, name, value):
        if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
            set(cls, name, value)
        else:
            raise AttributeError("You cannot add class attributes to %s" % cls)
    return set_class_attr


def _swig_add_metaclass(metaclass):
    """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
    def wrapper(cls):
        return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
    return wrapper


class _SwigNonDynamicMeta(type):
    """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
    __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)


class exception(Exception):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr
    __swig_destroy__ = _nlopt.delete_exception

    def what(self):
        return _nlopt.exception_what(self)

    def __init__(self):
        _nlopt.exception_swiginit(self, _nlopt.new_exception())

# Register exception in _nlopt:
_nlopt.exception_swigregister(exception)
class bad_cast(exception):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):
        _nlopt.bad_cast_swiginit(self, _nlopt.new_bad_cast())
    __swig_destroy__ = _nlopt.delete_bad_cast

# Register bad_cast in _nlopt:
_nlopt.bad_cast_swigregister(bad_cast)
class bad_exception(exception):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):
        _nlopt.bad_exception_swiginit(self, _nlopt.new_bad_exception())
    __swig_destroy__ = _nlopt.delete_bad_exception

# Register bad_exception in _nlopt:
_nlopt.bad_exception_swigregister(bad_exception)
class logic_error(exception):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, msg):
        _nlopt.logic_error_swiginit(self, _nlopt.new_logic_error(msg))
    __swig_destroy__ = _nlopt.delete_logic_error

# Register logic_error in _nlopt:
_nlopt.logic_error_swigregister(logic_error)
class domain_error(logic_error):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, msg):
        _nlopt.domain_error_swiginit(self, _nlopt.new_domain_error(msg))
    __swig_destroy__ = _nlopt.delete_domain_error

# Register domain_error in _nlopt:
_nlopt.domain_error_swigregister(domain_error)
class invalid_argument(logic_error):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, msg):
        _nlopt.invalid_argument_swiginit(self, _nlopt.new_invalid_argument(msg))
    __swig_destroy__ = _nlopt.delete_invalid_argument

# Register invalid_argument in _nlopt:
_nlopt.invalid_argument_swigregister(invalid_argument)
class length_error(logic_error):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, msg):
        _nlopt.length_error_swiginit(self, _nlopt.new_length_error(msg))
    __swig_destroy__ = _nlopt.delete_length_error

# Register length_error in _nlopt:
_nlopt.length_error_swigregister(length_error)
class out_of_range(logic_error):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, msg):
        _nlopt.out_of_range_swiginit(self, _nlopt.new_out_of_range(msg))
    __swig_destroy__ = _nlopt.delete_out_of_range

# Register out_of_range in _nlopt:
_nlopt.out_of_range_swigregister(out_of_range)
class runtime_error(exception):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, msg):
        _nlopt.runtime_error_swiginit(self, _nlopt.new_runtime_error(msg))
    __swig_destroy__ = _nlopt.delete_runtime_error

# Register runtime_error in _nlopt:
_nlopt.runtime_error_swigregister(runtime_error)
class range_error(runtime_error):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, msg):
        _nlopt.range_error_swiginit(self, _nlopt.new_range_error(msg))
    __swig_destroy__ = _nlopt.delete_range_error

# Register range_error in _nlopt:
_nlopt.range_error_swigregister(range_error)
class overflow_error(runtime_error):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, msg):
        _nlopt.overflow_error_swiginit(self, _nlopt.new_overflow_error(msg))
    __swig_destroy__ = _nlopt.delete_overflow_error

# Register overflow_error in _nlopt:
_nlopt.overflow_error_swigregister(overflow_error)
class underflow_error(runtime_error):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, msg):
        _nlopt.underflow_error_swiginit(self, _nlopt.new_underflow_error(msg))
    __swig_destroy__ = _nlopt.delete_underflow_error

# Register underflow_error in _nlopt:
_nlopt.underflow_error_swigregister(underflow_error)
class SwigPyIterator(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

    def __init__(self, *args, **kwargs):
        raise AttributeError("No constructor defined - class is abstract")
    __repr__ = _swig_repr
    __swig_destroy__ = _nlopt.delete_SwigPyIterator

    def value(self):
        return _nlopt.SwigPyIterator_value(self)

    def incr(self, n=1):
        return _nlopt.SwigPyIterator_incr(self, n)

    def decr(self, n=1):
        return _nlopt.SwigPyIterator_decr(self, n)

    def distance(self, x):
        return _nlopt.SwigPyIterator_distance(self, x)

    def equal(self, x):
        return _nlopt.SwigPyIterator_equal(self, x)

    def copy(self):
        return _nlopt.SwigPyIterator_copy(self)

    def next(self):
        return _nlopt.SwigPyIterator_next(self)

    def __next__(self):
        return _nlopt.SwigPyIterator___next__(self)

    def previous(self):
        return _nlopt.SwigPyIterator_previous(self)

    def advance(self, n):
        return _nlopt.SwigPyIterator_advance(self, n)

    def __eq__(self, x):
        return _nlopt.SwigPyIterator___eq__(self, x)

    def __ne__(self, x):
        return _nlopt.SwigPyIterator___ne__(self, x)

    def __iadd__(self, n):
        return _nlopt.SwigPyIterator___iadd__(self, n)

    def __isub__(self, n):
        return _nlopt.SwigPyIterator___isub__(self, n)

    def __add__(self, n):
        return _nlopt.SwigPyIterator___add__(self, n)

    def __sub__(self, *args):
        return _nlopt.SwigPyIterator___sub__(self, *args)
    def __iter__(self):
        return self

# Register SwigPyIterator in _nlopt:
_nlopt.SwigPyIterator_swigregister(SwigPyIterator)
class nlopt_doublevector(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def iterator(self):
        return _nlopt.nlopt_doublevector_iterator(self)
    def __iter__(self):
        return self.iterator()

    def __nonzero__(self):
        return _nlopt.nlopt_doublevector___nonzero__(self)

    def __bool__(self):
        return _nlopt.nlopt_doublevector___bool__(self)

    def __len__(self):
        return _nlopt.nlopt_doublevector___len__(self)

    def __getslice__(self, i, j):
        return _nlopt.nlopt_doublevector___getslice__(self, i, j)

    def __setslice__(self, *args):
        return _nlopt.nlopt_doublevector___setslice__(self, *args)

    def __delslice__(self, i, j):
        return _nlopt.nlopt_doublevector___delslice__(self, i, j)

    def __delitem__(self, *args):
        return _nlopt.nlopt_doublevector___delitem__(self, *args)

    def __getitem__(self, *args):
        return _nlopt.nlopt_doublevector___getitem__(self, *args)

    def __setitem__(self, *args):
        return _nlopt.nlopt_doublevector___setitem__(self, *args)

    def pop(self):
        return _nlopt.nlopt_doublevector_pop(self)

    def append(self, x):
        return _nlopt.nlopt_doublevector_append(self, x)

    def empty(self):
        return _nlopt.nlopt_doublevector_empty(self)

    def size(self):
        return _nlopt.nlopt_doublevector_size(self)

    def swap(self, v):
        return _nlopt.nlopt_doublevector_swap(self, v)

    def begin(self):
        return _nlopt.nlopt_doublevector_begin(self)

    def end(self):
        return _nlopt.nlopt_doublevector_end(self)

    def rbegin(self):
        return _nlopt.nlopt_doublevector_rbegin(self)

    def rend(self):
        return _nlopt.nlopt_doublevector_rend(self)

    def clear(self):
        return _nlopt.nlopt_doublevector_clear(self)

    def get_allocator(self):
        return _nlopt.nlopt_doublevector_get_allocator(self)

    def pop_back(self):
        return _nlopt.nlopt_doublevector_pop_back(self)

    def erase(self, *args):
        return _nlopt.nlopt_doublevector_erase(self, *args)

    def __init__(self, *args):
        _nlopt.nlopt_doublevector_swiginit(self, _nlopt.new_nlopt_doublevector(*args))

    def push_back(self, x):
        return _nlopt.nlopt_doublevector_push_back(self, x)

    def front(self):
        return _nlopt.nlopt_doublevector_front(self)

    def back(self):
        return _nlopt.nlopt_doublevector_back(self)

    def assign(self, n, x):
        return _nlopt.nlopt_doublevector_assign(self, n, x)

    def resize(self, *args):
        return _nlopt.nlopt_doublevector_resize(self, *args)

    def insert(self, *args):
        return _nlopt.nlopt_doublevector_insert(self, *args)

    def reserve(self, n):
        return _nlopt.nlopt_doublevector_reserve(self, n)

    def capacity(self):
        return _nlopt.nlopt_doublevector_capacity(self)
    __swig_destroy__ = _nlopt.delete_nlopt_doublevector

# Register nlopt_doublevector in _nlopt:
_nlopt.nlopt_doublevector_swigregister(nlopt_doublevector)

try:
    ForcedStop = _nlopt.ForcedStop
    RoundoffLimited = _nlopt.RoundoffLimited
except AttributeError:
    ForcedStop = RuntimeError
    RoundoffLimited = RuntimeError
__version__ = str(_nlopt.version_major())+'.'+str(_nlopt.version_minor())+'.'+str(_nlopt.version_bugfix())

GN_DIRECT = _nlopt.GN_DIRECT
GN_DIRECT_L = _nlopt.GN_DIRECT_L
GN_DIRECT_L_RAND = _nlopt.GN_DIRECT_L_RAND
GN_DIRECT_NOSCAL = _nlopt.GN_DIRECT_NOSCAL
GN_DIRECT_L_NOSCAL = _nlopt.GN_DIRECT_L_NOSCAL
GN_DIRECT_L_RAND_NOSCAL = _nlopt.GN_DIRECT_L_RAND_NOSCAL
GN_ORIG_DIRECT = _nlopt.GN_ORIG_DIRECT
GN_ORIG_DIRECT_L = _nlopt.GN_ORIG_DIRECT_L
GD_STOGO = _nlopt.GD_STOGO
GD_STOGO_RAND = _nlopt.GD_STOGO_RAND
LD_LBFGS_NOCEDAL = _nlopt.LD_LBFGS_NOCEDAL
LD_LBFGS = _nlopt.LD_LBFGS
LN_PRAXIS = _nlopt.LN_PRAXIS
LD_VAR1 = _nlopt.LD_VAR1
LD_VAR2 = _nlopt.LD_VAR2
LD_TNEWTON = _nlopt.LD_TNEWTON
LD_TNEWTON_RESTART = _nlopt.LD_TNEWTON_RESTART
LD_TNEWTON_PRECOND = _nlopt.LD_TNEWTON_PRECOND
LD_TNEWTON_PRECOND_RESTART = _nlopt.LD_TNEWTON_PRECOND_RESTART
GN_CRS2_LM = _nlopt.GN_CRS2_LM
GN_MLSL = _nlopt.GN_MLSL
GD_MLSL = _nlopt.GD_MLSL
GN_MLSL_LDS = _nlopt.GN_MLSL_LDS
GD_MLSL_LDS = _nlopt.GD_MLSL_LDS
LD_MMA = _nlopt.LD_MMA
LN_COBYLA = _nlopt.LN_COBYLA
LN_NEWUOA = _nlopt.LN_NEWUOA
LN_NEWUOA_BOUND = _nlopt.LN_NEWUOA_BOUND
LN_NELDERMEAD = _nlopt.LN_NELDERMEAD
LN_SBPLX = _nlopt.LN_SBPLX
LN_AUGLAG = _nlopt.LN_AUGLAG
LD_AUGLAG = _nlopt.LD_AUGLAG
LN_AUGLAG_EQ = _nlopt.LN_AUGLAG_EQ
LD_AUGLAG_EQ = _nlopt.LD_AUGLAG_EQ
LN_BOBYQA = _nlopt.LN_BOBYQA
GN_ISRES = _nlopt.GN_ISRES
AUGLAG = _nlopt.AUGLAG
AUGLAG_EQ = _nlopt.AUGLAG_EQ
G_MLSL = _nlopt.G_MLSL
G_MLSL_LDS = _nlopt.G_MLSL_LDS
LD_SLSQP = _nlopt.LD_SLSQP
LD_CCSAQ = _nlopt.LD_CCSAQ
GN_ESCH = _nlopt.GN_ESCH
GN_AGS = _nlopt.GN_AGS
NUM_ALGORITHMS = _nlopt.NUM_ALGORITHMS
FAILURE = _nlopt.FAILURE
INVALID_ARGS = _nlopt.INVALID_ARGS
OUT_OF_MEMORY = _nlopt.OUT_OF_MEMORY
ROUNDOFF_LIMITED = _nlopt.ROUNDOFF_LIMITED
FORCED_STOP = _nlopt.FORCED_STOP
NUM_FAILURES = _nlopt.NUM_FAILURES
SUCCESS = _nlopt.SUCCESS
STOPVAL_REACHED = _nlopt.STOPVAL_REACHED
FTOL_REACHED = _nlopt.FTOL_REACHED
XTOL_REACHED = _nlopt.XTOL_REACHED
MAXEVAL_REACHED = _nlopt.MAXEVAL_REACHED
MAXTIME_REACHED = _nlopt.MAXTIME_REACHED
NUM_RESULTS = _nlopt.NUM_RESULTS
class roundoff_limited(runtime_error):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):
        _nlopt.roundoff_limited_swiginit(self, _nlopt.new_roundoff_limited())
    __swig_destroy__ = _nlopt.delete_roundoff_limited

# Register roundoff_limited in _nlopt:
_nlopt.roundoff_limited_swigregister(roundoff_limited)
class forced_stop(runtime_error):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):
        _nlopt.forced_stop_swiginit(self, _nlopt.new_forced_stop())
    __swig_destroy__ = _nlopt.delete_forced_stop

# Register forced_stop in _nlopt:
_nlopt.forced_stop_swigregister(forced_stop)
class opt(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr
    __swig_destroy__ = _nlopt.delete_opt

    def __init__(self, *args):
        _nlopt.opt_swiginit(self, _nlopt.new_opt(*args))

    def optimize(self, *args):
        return _nlopt.opt_optimize(self, *args)

    def last_optimize_result(self):
        return _nlopt.opt_last_optimize_result(self)

    def last_optimum_value(self):
        return _nlopt.opt_last_optimum_value(self)

    def get_algorithm(self):
        return _nlopt.opt_get_algorithm(self)

    def get_algorithm_name(self):
        return _nlopt.opt_get_algorithm_name(self)

    def get_dimension(self):
        return _nlopt.opt_get_dimension(self)

    def set_min_objective(self, *args):
        return _nlopt.opt_set_min_objective(self, *args)

    def set_max_objective(self, *args):
        return _nlopt.opt_set_max_objective(self, *args)

    def remove_inequality_constraints(self):
        return _nlopt.opt_remove_inequality_constraints(self)

    def remove_equality_constraints(self):
        return _nlopt.opt_remove_equality_constraints(self)

    def add_inequality_constraint(self, *args):
        return _nlopt.opt_add_inequality_constraint(self, *args)

    def add_equality_constraint(self, *args):
        return _nlopt.opt_add_equality_constraint(self, *args)

    def add_inequality_mconstraint(self, *args):
        return _nlopt.opt_add_inequality_mconstraint(self, *args)

    def add_equality_mconstraint(self, *args):
        return _nlopt.opt_add_equality_mconstraint(self, *args)

    def set_param(self, name, val):
        return _nlopt.opt_set_param(self, name, val)

    def get_param(self, name, defaultval):
        return _nlopt.opt_get_param(self, name, defaultval)

    def has_param(self, name):
        return _nlopt.opt_has_param(self, name)

    def nth_param(self, n):
        return _nlopt.opt_nth_param(self, n)

    def num_params(self):
        return _nlopt.opt_num_params(self)

    def get_lower_bounds(self, *args):
        return _nlopt.opt_get_lower_bounds(self, *args)

    def set_lower_bounds(self, *args):
        return _nlopt.opt_set_lower_bounds(self, *args)

    def get_upper_bounds(self, *args):
        return _nlopt.opt_get_upper_bounds(self, *args)

    def set_upper_bounds(self, *args):
        return _nlopt.opt_set_upper_bounds(self, *args)

    def get_stopval(self):
        return _nlopt.opt_get_stopval(self)

    def set_stopval(self, stopval):
        return _nlopt.opt_set_stopval(self, stopval)

    def get_ftol_rel(self):
        return _nlopt.opt_get_ftol_rel(self)

    def set_ftol_rel(self, ftol_rel):
        return _nlopt.opt_set_ftol_rel(self, ftol_rel)

    def get_ftol_abs(self):
        return _nlopt.opt_get_ftol_abs(self)

    def set_ftol_abs(self, ftol_abs):
        return _nlopt.opt_set_ftol_abs(self, ftol_abs)

    def get_xtol_rel(self):
        return _nlopt.opt_get_xtol_rel(self)

    def set_xtol_rel(self, xtol_rel):
        return _nlopt.opt_set_xtol_rel(self, xtol_rel)

    def get_xtol_abs(self, *args):
        return _nlopt.opt_get_xtol_abs(self, *args)

    def set_xtol_abs(self, *args):
        return _nlopt.opt_set_xtol_abs(self, *args)

    def get_x_weights(self, *args):
        return _nlopt.opt_get_x_weights(self, *args)

    def set_x_weights(self, *args):
        return _nlopt.opt_set_x_weights(self, *args)

    def get_maxeval(self):
        return _nlopt.opt_get_maxeval(self)

    def set_maxeval(self, maxeval):
        return _nlopt.opt_set_maxeval(self, maxeval)

    def get_numevals(self):
        return _nlopt.opt_get_numevals(self)

    def get_maxtime(self):
        return _nlopt.opt_get_maxtime(self)

    def set_maxtime(self, maxtime):
        return _nlopt.opt_set_maxtime(self, maxtime)

    def get_force_stop(self):
        return _nlopt.opt_get_force_stop(self)

    def set_force_stop(self, force_stop):
        return _nlopt.opt_set_force_stop(self, force_stop)

    def force_stop(self):
        return _nlopt.opt_force_stop(self)

    def get_errmsg(self):
        return _nlopt.opt_get_errmsg(self)

    def set_local_optimizer(self, lo):
        return _nlopt.opt_set_local_optimizer(self, lo)

    def get_population(self):
        return _nlopt.opt_get_population(self)

    def set_population(self, population):
        return _nlopt.opt_set_population(self, population)

    def get_vector_storage(self):
        return _nlopt.opt_get_vector_storage(self)

    def set_vector_storage(self, vector_storage):
        return _nlopt.opt_set_vector_storage(self, vector_storage)

    def set_initial_step(self, *args):
        return _nlopt.opt_set_initial_step(self, *args)

    def set_default_initial_step(self, x):
        return _nlopt.opt_set_default_initial_step(self, x)

    def get_initial_step(self, x):
        return _nlopt.opt_get_initial_step(self, x)

    def get_exceptions_enabled(self):
        return _nlopt.opt_get_exceptions_enabled(self)

    def set_exceptions_enabled(self, enable):
        return _nlopt.opt_set_exceptions_enabled(self, enable)

# Register opt in _nlopt:
_nlopt.opt_swigregister(opt)

def srand(seed):
    return _nlopt.srand(seed)

def srand_time():
    return _nlopt.srand_time()

def version(major, minor, bugfix):
    return _nlopt.version(major, minor, bugfix)

def version_major():
    return _nlopt.version_major()

def version_minor():
    return _nlopt.version_minor()

def version_bugfix():
    return _nlopt.version_bugfix()

def algorithm_name(a):
    return _nlopt.algorithm_name(a)

