gemseo.algos.opt.nlopt.nlopt module#

The library of NLopt optimization algorithms.

Warning

If the objective, or a constraint, of the OptimizationProblem returns a value of type int then nlopt.opt.optimize will terminate with ValueError: nlopt invalid argument.

This behavior has been identified as a bug internal to NLopt 2.7.1 and has been fixed in the development version of NLopt.

Until a new version of NLopt including the bugfix is released, the user of GEMSEO shall provide objective and constraint functions that return values of type float and NDArray[float].

class NLoptAlgorithmDescription(algorithm_name, internal_algorithm_name, library_name='NLopt', description='', website='', Settings=<class 'gemseo.algos.opt.nlopt.settings.base_nlopt_settings.BaseNLoptSettings'>, handle_integer_variables=False, handle_equality_constraints=False, handle_inequality_constraints=False, handle_multiobjective=False, positive_constraints=False, for_linear_problems=False, require_gradient=False)[source]#

Bases: OptimizationAlgorithmDescription

The description of an optimization algorithm from the NLopt library.

Parameters:
  • algorithm_name (str)

  • internal_algorithm_name (str)

  • library_name (str) --

    By default it is set to "NLopt".

  • description (str) --

    By default it is set to "".

  • website (str) --

    By default it is set to "".

  • Settings (type[BaseNLoptSettings]) --

    By default it is set to <class 'gemseo.algos.opt.nlopt.settings.base_nlopt_settings.BaseNLoptSettings'>.

  • handle_integer_variables (bool) --

    By default it is set to False.

  • handle_equality_constraints (bool) --

    By default it is set to False.

  • handle_inequality_constraints (bool) --

    By default it is set to False.

  • handle_multiobjective (bool) --

    By default it is set to False.

  • positive_constraints (bool) --

    By default it is set to False.

  • for_linear_problems (bool) --

    By default it is set to False.

  • require_gradient (bool) --

    By default it is set to False.

Settings#

The option validation model for NLopt optimization library.

alias of BaseNLoptSettings

library_name: str = 'NLopt'#

The name of the wrapped library.

class Nlopt(algo_name)[source]#

Bases: BaseOptimizationLibrary

The library of NLopt optimization algorithms.

Notes

The missing current values of the DesignSpace attached to the OptimizationProblem are automatically initialized with the method DesignSpace.initialize_missing_current_values().

Parameters:

algo_name (str) -- The algorithm name.

Raises:

KeyError -- When the algorithm is not in the library.

ALGORITHM_INFOS: ClassVar[dict[str, NLoptAlgorithmDescription]] = {'NLOPT_BFGS': NLoptAlgorithmDescription(algorithm_name='BFGS', internal_algorithm_name=11, library_name='NLopt', description='Broyden-Fletcher-Goldfarb-Shanno method (BFGS) implemented in the NLOPT library', website='https://nlopt.readthedocs.io/en/latest/NLopt_Algorithms/#low-storage-bfgs', Settings=<class 'gemseo.algos.opt.nlopt.settings.nlopt_bfgs_settings.NLOPT_BFGS_Settings'>, handle_integer_variables=False, handle_equality_constraints=False, handle_inequality_constraints=False, handle_multiobjective=False, positive_constraints=False, for_linear_problems=False, require_gradient=True), 'NLOPT_BOBYQA': NLoptAlgorithmDescription(algorithm_name='BOBYQA', internal_algorithm_name=34, library_name='NLopt', description='Bound Optimization BY Quadratic Approximation (BOBYQA) implemented in the NLOPT library', website='https://nlopt.readthedocs.io/en/latest/NLopt_Algorithms/#bobyqa', Settings=<class 'gemseo.algos.opt.nlopt.settings.nlopt_bobyqa_settings.NLOPT_BOBYQA_Settings'>, handle_integer_variables=False, handle_equality_constraints=False, handle_inequality_constraints=False, handle_multiobjective=False, positive_constraints=False, for_linear_problems=False, require_gradient=False), 'NLOPT_COBYLA': NLoptAlgorithmDescription(algorithm_name='COBYLA', internal_algorithm_name=25, library_name='NLopt', description='Constrained Optimization BY Linear Approximations (COBYLA) implemented in the NLOPT library', website='https://nlopt.readthedocs.io/en/latest/NLopt_Algorithms/#cobyla-constrained-optimization-by-linear-approximations', Settings=<class 'gemseo.algos.opt.nlopt.settings.nlopt_cobyla_settings.NLOPT_COBYLA_Settings'>, handle_integer_variables=False, handle_equality_constraints=True, handle_inequality_constraints=True, handle_multiobjective=False, positive_constraints=False, for_linear_problems=False, require_gradient=False), 'NLOPT_MMA': NLoptAlgorithmDescription(algorithm_name='MMA', internal_algorithm_name=24, library_name='NLopt', description='Method of Moving Asymptotes (MMA)implemented in the NLOPT library', website='https://nlopt.readthedocs.io/en/latest/NLopt_Algorithms/#mma-method-of-moving-asymptotes-and-ccsa', Settings=<class 'gemseo.algos.opt.nlopt.settings.nlopt_mma_settings.NLOPT_MMA_Settings'>, handle_integer_variables=False, handle_equality_constraints=False, handle_inequality_constraints=True, handle_multiobjective=False, positive_constraints=False, for_linear_problems=False, require_gradient=True), 'NLOPT_NEWUOA': NLoptAlgorithmDescription(algorithm_name='NEWUOA', internal_algorithm_name=27, library_name='NLopt', description='NEWUOA + bound constraints implemented in the NLOPT library', website='https://nlopt.readthedocs.io/en/latest/NLopt_Algorithms/#newuoa-bound-constraints', Settings=<class 'gemseo.algos.opt.nlopt.settings.nlopt_newuoa_settings.NLOPT_NEWUOA_Settings'>, handle_integer_variables=False, handle_equality_constraints=False, handle_inequality_constraints=False, handle_multiobjective=False, positive_constraints=False, for_linear_problems=False, require_gradient=False), 'NLOPT_SLSQP': NLoptAlgorithmDescription(algorithm_name='SLSQP', internal_algorithm_name=40, library_name='NLopt', description='Sequential Least-Squares Quadratic Programming (SLSQP) implemented in the NLOPT library', website='https://nlopt.readthedocs.io/en/latest/NLopt_Algorithms/#slsqp', Settings=<class 'gemseo.algos.opt.nlopt.settings.nlopt_slsqp_settings.NLOPT_SLSQP_Settings'>, handle_integer_variables=False, handle_equality_constraints=True, handle_inequality_constraints=True, handle_multiobjective=False, positive_constraints=False, for_linear_problems=False, require_gradient=True)}#

The description of the algorithms contained in the library.