diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dd05b6a1f..16c26083f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -60,6 +60,7 @@ jobs: - name: create build environment uses: mamba-org/setup-micromamba@v1 with: + micromamba-version: 1.5.6-0 environment-file: ./.tools/envs/testenv-others.yml cache-environment: true create-args: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aacd207c6..1c4202393 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,6 +18,18 @@ repos: language: python always_run: true require_serial: true + - repo: local + hooks: + - id: update-algo-selection-code + name: update algo selection code + entry: bash .tools/create_and_format_algo_selection_code.sh + language: python + files: (src/optimagic/optimizers/.|src/optimagic/algorithms.py|.tools/.) + always_run: false + require_serial: true + additional_dependencies: + - hatchling + - ruff - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: @@ -107,6 +119,7 @@ repos: - --wrap - '88' files: (docs/.) + exclude: docs/source/how_to/how_to_specify_algorithm_and_algo_options.md - repo: https://github.com/kynan/nbstripout rev: 0.8.0 hooks: @@ -135,3 +148,5 @@ repos: - --config=pyproject.toml ci: autoupdate_schedule: monthly + skip: + - update-algo-selection-code diff --git a/.tools/create_algo_selection_code.py b/.tools/create_algo_selection_code.py new file mode 100644 index 000000000..6d28fde6d --- /dev/null +++ b/.tools/create_algo_selection_code.py @@ -0,0 +1,442 @@ +import importlib +import inspect +import pkgutil +import textwrap +from itertools import combinations +from types import ModuleType +from typing import Callable, Type + +from optimagic.config import OPTIMAGIC_ROOT +from optimagic.optimization.algorithm import Algorithm +from optimagic.typing import AggregationLevel + + +def main() -> None: + """Create the source code for algorithms.py. + + The main part of the generated code are nested dataclasses that enable filtered + autocomplete for algorithm selection. Creating them entails the following steps: + + - Discover all modules that contain optimizer classes + - Collect all optimizer classes + - Create a mapping from a tuple of categories (e.g. Global, Bounded, ...) to the + optimizer classes that belong to them. To find out which optimizers need to be + included we use the attributes stored in optimizer_class.__algo_info__. + - Create the dataclasses that enable autocomplete for algorithm selection + + In addition we need to create the code for import statements, a AlgoSelection base + class and some code to instantiate the dataclasses. + + """ + # create some basic inputs + docstring = _get_docstring_code() + modules = _import_optimizer_modules("optimagic.optimizers") + all_algos = _get_all_algorithms(modules) + filters = _get_filters() + all_categories = list(filters) + selection_info = _create_selection_info(all_algos, all_categories) + + # create the code for imports + imports = _get_imports(modules) + + # create the code for the ABC AlgoSelection class + parent_class_snippet = _get_base_class_code() + + # create the code for the dataclasses + dataclass_snippets = [] + for active_categories in selection_info: + new_snippet = create_dataclass_code( + active_categories=active_categories, + all_categories=all_categories, + selection_info=selection_info, + ) + dataclass_snippets.append(new_snippet) + + # create the code for the instantiation + instantiation_snippet = _get_instantiation_code() + + # Combine all the content into a single string + content = ( + docstring + + imports + + "\n\n" + + parent_class_snippet + + "\n" + + "\n\n".join(dataclass_snippets) + + "\n\n" + + instantiation_snippet + ) + + # Write the combined content to the file + with (OPTIMAGIC_ROOT / "algorithms.py").open("w") as f: + f.write(content) + + +# ====================================================================================== +# Functions to collect algorithms +# ====================================================================================== + + +def _import_optimizer_modules(package_name: str) -> list[ModuleType]: + """Collect all public modules in a given package in a list.""" + package = importlib.import_module(package_name) + modules = [] + + for _, module_name, is_pkg in pkgutil.walk_packages( + package.__path__, package.__name__ + "." + ): + module_parts = module_name.split(".") + if all(not part.startswith("_") for part in module_parts) and not is_pkg: + module = importlib.import_module(module_name) + modules.append(module) + + return modules + + +def _get_all_algorithms(modules: list[ModuleType]) -> dict[str, Type[Algorithm]]: + """Collect all algorithms in modules.""" + out = {} + for module in modules: + out.update(_get_algorithms_in_module(module)) + return out + + +def _get_algorithms_in_module(module: ModuleType) -> dict[str, Type[Algorithm]]: + """Collect all algorithms in a single module.""" + candidate_dict = dict(inspect.getmembers(module, inspect.isclass)) + candidate_dict = { + k: v for k, v in candidate_dict.items() if hasattr(v, "__algo_info__") + } + algos = {} + for candidate in candidate_dict.values(): + name = candidate.__algo_info__.name + if issubclass(candidate, Algorithm) and candidate is not Algorithm: + algos[name] = candidate + return algos + + +# ====================================================================================== +# Functions to filter algorithms by selectors +# ====================================================================================== +def _is_gradient_based(algo: Type[Algorithm]) -> bool: + return algo.__algo_info__.needs_jac # type: ignore + + +def _is_gradient_free(algo: Type[Algorithm]) -> bool: + return not _is_gradient_based(algo) + + +def _is_global(algo: Type[Algorithm]) -> bool: + return algo.__algo_info__.is_global # type: ignore + + +def _is_local(algo: Type[Algorithm]) -> bool: + return not _is_global(algo) + + +def _is_bounded(algo: Type[Algorithm]) -> bool: + return algo.__algo_info__.supports_bounds # type: ignore + + +def _is_linear_constrained(algo: Type[Algorithm]) -> bool: + return algo.__algo_info__.supports_linear_constraints # type: ignore + + +def _is_nonlinear_constrained(algo: Type[Algorithm]) -> bool: + return algo.__algo_info__.supports_nonlinear_constraints # type: ignore + + +def _is_scalar(algo: Type[Algorithm]) -> bool: + return algo.__algo_info__.solver_type == AggregationLevel.SCALAR # type: ignore + + +def _is_least_squares(algo: Type[Algorithm]) -> bool: + return algo.__algo_info__.solver_type == AggregationLevel.LEAST_SQUARES # type: ignore + + +def _is_likelihood(algo: Type[Algorithm]) -> bool: + return algo.__algo_info__.solver_type == AggregationLevel.LIKELIHOOD # type: ignore + + +def _is_parallel(algo: Type[Algorithm]) -> bool: + return algo.__algo_info__.supports_parallelism # type: ignore + + +def _get_filters() -> dict[str, Callable[[Type[Algorithm]], bool]]: + """Create a dict mapping from category names to filter functions.""" + filters: dict[str, Callable[[Type[Algorithm]], bool]] = { + "GradientBased": _is_gradient_based, + "GradientFree": _is_gradient_free, + "Global": _is_global, + "Local": _is_local, + "Bounded": _is_bounded, + "LinearConstrained": _is_linear_constrained, + "NonlinearConstrained": _is_nonlinear_constrained, + "Scalar": _is_scalar, + "LeastSquares": _is_least_squares, + "Likelihood": _is_likelihood, + "Parallel": _is_parallel, + } + return filters + + +# ====================================================================================== +# Functions to create a mapping from a tuple of selectors to subsets of the dict +# mapping algorithm names to algorithm classes +# ====================================================================================== + + +def _create_selection_info( + all_algos: dict[str, Type[Algorithm]], + categories: list[str], +) -> dict[tuple[str, ...], dict[str, Type[Algorithm]]]: + """Create a dict mapping from a tuple of selectors to subsets of the all_algos dict. + + Args: + all_algos: Dictionary mapping algorithm names to algorithm classes. + categories: List of categories to filter by. + + Returns: + A dictionary mapping tuples of selectors to dictionaries of algorithm names + and their corresponding classes. + + """ + category_combinations = _generate_category_combinations(categories) + out = {} + for comb in category_combinations: + filtered_algos = _apply_filters(all_algos, comb) + if filtered_algos: + out[comb] = filtered_algos + return out + + +def _generate_category_combinations(categories: list[str]) -> list[tuple[str, ...]]: + """Generate all combinations of categories, sorted by length in descending order. + + Args: + categories: A list of category names. + + Returns: + A list of tuples, where each tuple represents a combination of categories. + + """ + result: list[tuple[str, ...]] = [] + for r in range(len(categories) + 1): + result.extend(map(tuple, map(sorted, combinations(categories, r)))) + return sorted(result, key=len, reverse=True) + + +def _apply_filters( + all_algos: dict[str, Type[Algorithm]], categories: tuple[str, ...] +) -> dict[str, Type[Algorithm]]: + """Apply filters to the algorithms based on the given categories. + + Args: + all_algos: A dictionary mapping algorithm names to algorithm classes. + categories: A tuple of category names to filter by. + + Returns: + filtered dictionary of algorithms that match all given categories. + + """ + filtered = all_algos + filters = _get_filters() + for category in categories: + filter_func = filters[category] + filtered = {name: algo for name, algo in filtered.items() if filter_func(algo)} + return filtered + + +# ====================================================================================== +# Functions to create code for the dataclasses +# ====================================================================================== + + +def create_dataclass_code( + active_categories: tuple[str, ...], + all_categories: list[str], + selection_info: dict[tuple[str, ...], dict[str, Type[Algorithm]]], +) -> str: + """Create the source code for a dataclass representing a selection of algorithms. + + Args: + active_categories: A tuple of active category names. + all_categories: A list of all category names. + selection_info: A dictionary that maps tuples of category names to dictionaries + of algorithm names and their corresponding classes. + + Returns: + A string containing the source code for the dataclass. + + """ + # get the children of the active categories + children = _get_children(active_categories, all_categories, selection_info) + + # get the name of the class to be generated + class_name = _get_class_name(active_categories) + + # get code for the dataclass fields + field_template = " {name}: Type[{class_name}] = {class_name}" + field_strings = [] + for name, algo_class in selection_info[active_categories].items(): + field_strings.append( + field_template.format(name=name, class_name=algo_class.__name__) + ) + fields = "\n".join(field_strings) + + # get code for the properties to select children + child_template = textwrap.dedent(""" + @property + def {new_category}(self) -> {class_name}: + return {class_name}() + """) + child_template = textwrap.indent(child_template, " ") + child_strings = [] + for new_category, categories in children.items(): + child_class_name = _get_class_name(categories) + child_strings.append( + child_template.format( + new_category=new_category, class_name=child_class_name + ) + ) + children_code = "\n".join(child_strings) + + # assemble the class + out = "@dataclass(frozen=True)\n" + out += f"class {class_name}(AlgoSelection):\n" + out += fields + "\n" + if children: + out += children_code + + return out + + +def _get_class_name(active_categories: tuple[str, ...]) -> str: + """Get the name of the class based on the active categories.""" + return "".join(active_categories) + "Algorithms" + + +def _get_children( + active_categories: tuple[str, ...], + all_categories: list[str], + selection_info: dict[tuple[str, ...], dict[str, Type[Algorithm]]], +) -> dict[str, tuple[str, ...]]: + """Get the children of the active categories. + + Args: + active_categories: A tuple of active category names. + all_categories: A list of all category names. + selection_info: A dictionary that maps tuples of category names to dictionaries + of algorithm names and their corresponding classes. + + Returns: + A dict mapping additional categories to a sorted tuple of categories + that contains all active categories and the additional category. Entries + are only included if the selected categories are in `selection_info`, i.e. + if there exist algorithms that are compatible with all categories. + + """ + inactive_categories = sorted(set(all_categories) - set(active_categories)) + out = {} + for new_cat in inactive_categories: + new_comb = tuple(sorted(active_categories + (new_cat,))) + if new_comb in selection_info: + out[new_cat] = new_comb + return out + + +# ====================================================================================== +# Functions to create the imports +# ====================================================================================== + + +def _get_imports(modules: list[ModuleType]) -> str: + """Create source code to import all algorithms.""" + snippets = [ + "from typing import Type", + "from dataclasses import dataclass", + "from optimagic.optimization.algorithm import Algorithm", + "from typing import cast", + ] + for module in modules: + algorithms = _get_algorithms_in_module(module) + class_names = [algo.__name__ for algo in algorithms.values()] + for class_name in class_names: + snippets.append(f"from {module.__name__} import {class_name}") + return "\n".join(snippets) + + +# ====================================================================================== +# Functions to create the static parts of the code +# ====================================================================================== + + +def _get_base_class_code() -> str: + """Get the source code for the AlgoSelection class.""" + out = textwrap.dedent(""" + @dataclass(frozen=True) + class AlgoSelection: + + def _all(self) -> list[Type[Algorithm]]: + raw = [field.default for field in self.__dataclass_fields__.values()] + return cast(list[Type[Algorithm]], raw) + + + def _available(self) -> list[Type[Algorithm]]: + _all = self._all() + return [ + a for a in _all if a.__algo_info__.is_available # type: ignore + ] + + @property + def All(self) -> list[str]: + return [a.__algo_info__.name for a in self._all()] # type: ignore + + @property + def Available(self) -> list[str]: + return [a.__algo_info__.name for a in self._available()] # type: ignore + + @property + def _all_algorithms_dict(self) -> dict[str, Type[Algorithm]]: + return {a.__algo_info__.name: a for a in self._all()} # type: ignore + + @property + def _available_algorithms_dict(self) -> dict[str, Type[Algorithm]]: + return { + a.__algo_info__.name: a # type: ignore + for a in self._available() + } + + """) + return out + + +def _get_docstring_code() -> str: + """Get the source code for the docstring of the AlgoSelection class.""" + raw = ( + '"""This code was auto-generated by a pre-commit hook and should not be ' + "changed.\n\nIf you manually change this code, all of your changes will be " + "overwritten the next time\nthe pre-commit hook runs.\n\nDetailed information " + "on the purpose of the code can be found here:\n" + "https://optimagic.readthedocs.io/en/latest/development/ep-02-typing.html#" + 'algorithm-selection\n\n"""\n' + ) + out = textwrap.dedent(raw) + return out + + +def _get_instantiation_code() -> str: + """Get the source code for instantiating some classes at the end of the module.""" + out = textwrap.dedent(""" + algos = Algorithms() + global_algos = GlobalAlgorithms() + + ALL_ALGORITHMS = algos._all_algorithms_dict + AVAILABLE_ALGORITHMS = algos._available_algorithms_dict + GLOBAL_ALGORITHMS = global_algos._available_algorithms_dict + """) + return out + + +if __name__ == "__main__": + main() diff --git a/.tools/create_and_format_algo_selection_code.sh b/.tools/create_and_format_algo_selection_code.sh new file mode 100644 index 000000000..a8c721312 --- /dev/null +++ b/.tools/create_and_format_algo_selection_code.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -e # Exit immediately if a command exits with a non-zero status + +# Check if the project is already installed locally +if ! pip show optimagic &> /dev/null; then + # install the project locally + pip install -e . +fi + +# Run the Python script to create algo_selection.py +python .tools/create_algo_selection_code.py + +# Run ruff format on the created file +ruff format src/optimagic/algorithms.py --silent --config pyproject.toml + +# Run ruff lint with fixes on the created file +ruff check src/optimagic/algorithms.py --fix --silent --config pyproject.toml diff --git a/.tools/envs/testenv-linux.yml b/.tools/envs/testenv-linux.yml index 1e1c0846f..68a5bdb8b 100644 --- a/.tools/envs/testenv-linux.yml +++ b/.tools/envs/testenv-linux.yml @@ -19,7 +19,7 @@ dependencies: - numpy >= 2 # run, tests - pandas # run, tests - plotly # run, tests - - pybaum >= 0.1.2 # run, tests + - pybaum>=0.1.2 # run, tests - scipy>=1.2.1 # run, tests - sqlalchemy # run, tests - seaborn # dev, tests diff --git a/.tools/envs/testenv-numpy.yml b/.tools/envs/testenv-numpy.yml index 34681b9ba..0e811e586 100644 --- a/.tools/envs/testenv-numpy.yml +++ b/.tools/envs/testenv-numpy.yml @@ -17,7 +17,7 @@ dependencies: - cloudpickle # run, tests - joblib # run, tests - plotly # run, tests - - pybaum >= 0.1.2 # run, tests + - pybaum>=0.1.2 # run, tests - scipy>=1.2.1 # run, tests - sqlalchemy # run, tests - seaborn # dev, tests diff --git a/.tools/envs/testenv-others.yml b/.tools/envs/testenv-others.yml index 444205593..33be68ecc 100644 --- a/.tools/envs/testenv-others.yml +++ b/.tools/envs/testenv-others.yml @@ -17,7 +17,7 @@ dependencies: - numpy >= 2 # run, tests - pandas # run, tests - plotly # run, tests - - pybaum >= 0.1.2 # run, tests + - pybaum>=0.1.2 # run, tests - scipy>=1.2.1 # run, tests - sqlalchemy # run, tests - seaborn # dev, tests diff --git a/.tools/envs/testenv-pandas.yml b/.tools/envs/testenv-pandas.yml index ff4996dc5..23f5f4055 100644 --- a/.tools/envs/testenv-pandas.yml +++ b/.tools/envs/testenv-pandas.yml @@ -17,7 +17,7 @@ dependencies: - cloudpickle # run, tests - joblib # run, tests - plotly # run, tests - - pybaum >= 0.1.2 # run, tests + - pybaum>=0.1.2 # run, tests - scipy>=1.2.1 # run, tests - sqlalchemy # run, tests - seaborn # dev, tests diff --git a/.tools/test_create_algo_selection_code.py b/.tools/test_create_algo_selection_code.py new file mode 100644 index 000000000..b578ee8f4 --- /dev/null +++ b/.tools/test_create_algo_selection_code.py @@ -0,0 +1,16 @@ +from create_algo_selection_code import _generate_category_combinations + + +def test_generate_category_combinations() -> None: + categories = ["a", "b", "c"] + got = _generate_category_combinations(categories) + expected = [ + ("a", "b", "c"), + ("a", "b"), + ("a", "c"), + ("b", "c"), + ("a",), + ("b",), + ("c",), + ] + assert got == expected diff --git a/.tools/update_envs.py b/.tools/update_envs.py index a62a44e3d..11d54d3ad 100644 --- a/.tools/update_envs.py +++ b/.tools/update_envs.py @@ -14,7 +14,7 @@ def _keep_line(line: str, flag: str) -> bool: return flag in line or "#" not in line -def main(): +def main() -> None: lines = Path("environment.yml").read_text().splitlines() # create standard testing environments diff --git a/docs/source/_static/images/autocomplete_1.png b/docs/source/_static/images/autocomplete_1.png new file mode 100644 index 000000000..98c57769a Binary files /dev/null and b/docs/source/_static/images/autocomplete_1.png differ diff --git a/docs/source/_static/images/autocomplete_2.png b/docs/source/_static/images/autocomplete_2.png new file mode 100644 index 000000000..115cca25e Binary files /dev/null and b/docs/source/_static/images/autocomplete_2.png differ diff --git a/docs/source/how_to/how_to_algorithm_selection.ipynb b/docs/source/how_to/how_to_algorithm_selection.ipynb index fceb44038..d6bbeb15c 100644 --- a/docs/source/how_to/how_to_algorithm_selection.ipynb +++ b/docs/source/how_to/how_to_algorithm_selection.ipynb @@ -76,6 +76,48 @@ "problems and which one works best needs to be found out through experimentation.\n", "```\n", "\n", + "## Filtering algorithms \n", + "\n", + "An even more fine-grained version of the decision tree is built into optimagic's \n", + "algorithm selection tool, which can filter algorithms based on the properties of \n", + "your problem. To make this concrete, assume we are looking for a **local** optimizer for \n", + "a **differentiable** problem with a **scalar** objective function and \n", + "**bound constraints**. \n", + "\n", + "To find all algorithms that match our criteria, we can simply type:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import optimagic as om\n", + "\n", + "om.algos.Local.GradientBased.Scalar.Bounded.All" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The available filters are: GradientBased, GradientFree, Global, Local, Bounded, \n", + "LinearConstrained, NonlinearConstrained, Scalar, LeastSquares, Likelihood, and Parallel.\n", + "You can apply them in any order your want. They are also discoverable, i.e. the \n", + "autocomplete feature of your editor will show you all filters you can apply on top of \n", + "your current selection.\n", + "\n", + "Using `.All` after applying filters shows you all algorithms optimagic knows of that \n", + "satisfy your criteria. Some of them require optional dependencies. To show only the \n", + "algorithms that are available with the packages you have currently installed, use \n", + "`.Available` instead of `.All`." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ "(algo-selection-example-problem)=\n", "\n", "## An example problem\n", @@ -106,8 +148,6 @@ "source": [ "import numpy as np\n", "\n", - "import optimagic as om\n", - "\n", "\n", "def trid_scalar(x):\n", " \"\"\"Implement Trid function: https://www.sfu.ca/~ssurjano/trid.html.\"\"\"\n", diff --git a/docs/source/how_to/how_to_specify_algorithm_and_algo_options.md b/docs/source/how_to/how_to_specify_algorithm_and_algo_options.md index 885a994f2..b9275d22f 100644 --- a/docs/source/how_to/how_to_specify_algorithm_and_algo_options.md +++ b/docs/source/how_to/how_to_specify_algorithm_and_algo_options.md @@ -1,46 +1,160 @@ (specify-algorithm)= -# How to specify algorithms and algorithm specific options +# How to specify and configure algorithms -## The *algorithm* argument +This how-to guide is about the mechanics of specifying and configuring optimizers in +optimagic. It is not about choosing the right algorithm for your problem. For a +discussion on choosing algorithms, see +[this how-to guide](how_to_algorithm_selection.ipynb) -The `algorithm` argument can either be a string with the name of an algorithm that is -implemented in optimagic, or a function that fulfills the interface laid out in -{ref}`internal_optimizer_interface`. +There are two ways to specify and configure optimizers. The *optimagic way* and the +*scipy way*. Both use the `algorithm` argument of `minimize` and `maximize` to specify +an optimizer and both are super easy to use. -Which algorithms are available in optimagic depends on the packages a user has -installed. We list all supported algorithms in {ref}`list_of_algorithms`. +As the name suggests, the *scipy way* is more familiar for users of scipy.optimize. The +*optimagic way* adds discoverability and autocomplete. Using the *optimagic +way*, you don't need to look things up in the documentation and rarely have to leave +your editor, notebook or IDE. -## The *algo_options* argument +::::{tab-set} +:::{tab-item} The optimagic way +:sync: optimagic -`algo_options` is a dictionary with options that are passed to the optimization -algorithm. +## Selecting an algorithm -We align the names of all `algo_options` across algorithms as far as that is possible. +```python +import optimagic as om +import numpy as np + + +def fun(x): + return x @ x + + +om.minimize( + fun=fun, + params=np.arange(3), + algorithm=om.algos.scipy_neldermead, +) +``` + +The algorithm is selected by passing an algorithm class. This class is usually not +imported manually, but discovered using `om.algos`. After typing `om.algos.`, your +editor will show you all algorithms you can choose from. + +## Configuring an algorithm + +To configure an algorithm with advanced options, you can create an instance of the +class: + +```python +algo = om.algos.scipy_neldermead( + stopping_maxiter=100, + adaptive=True, +) + +om.minimize( + fun=fun, + params=np.arange(3), + algorithm=algo, +) +``` + +Again, you can use your editor's autocomplete to discover all options that your chosen +algorithm supports. When the instance is created, the types and values of all options +are checked. Should you make a mistake, you will get an error before you run your +optimization. + +## Advanced autocomplete in action + +Assume you need a gradient-free optimizer that supports bounds on the parameters. +Moreover, you have a fixed computational budget, so you want to set stopping options. + +If you type `om.algos.`, your editor will show you all available optimizers and a list +of categories you can use to filter the results. In our case, we select `GradientFree` +and `Bounded`, and we could do that in any order we want. + +![autocomplete_1](../_static/images/autocomplete_1.png) + +After selecting one of the displayed algorithms, in our case `scipy_neldermead`, the +editor shows all tuning parameters of that optimizer. If you start to type `stopping`, +you will see all stopping criteria that are available. + +![autocomplete_2](../_static/images/autocomplete_2.png) -To make it easier to understand which aspect of the optimization is influenced by an -option, we group them with prefixes. For example, the name of all convergence criteria -starts with `"convergence."`. In general, the prefix is separated from the option name -by a dot. +## Modifying an algorithm -Which options are supported, depends on the algorithm you selected and is documented in -{ref}`list_of_algorithms`. +Given an algorithm, you can easily create a **modified copy** by using the `with_option` +method. + +```python +# using copy constructors to create variants +base_algo = om.algorithms.fides(stopping_maxiter=1000) +algorithms = [ + base_algo.with_option(trustregion_initial_radius=r) for r in [0.1, 0.2, 0.5] +] + +for algo in algorithms: + minimize( + fun=fun, + params=np.arange(3), + algorithm=algo, + ) +``` + +::: +:::{tab-item} The scipy way +:sync: scipy + +## Selecting an algorithm + +```python +import optimagic as om +import numpy as np + + +def fun(x): + return x @ x -An example could look like this: + +om.minimize( + fun=fun, + params=np.arange(3), + algorithm="scipy_lbfgsb", +) +``` + + +For a list of all supported algorithm names, see {ref}`list_of_algorithms`. + +```{note} +To provide full compatibility with scipy, you can also select algorithms with the +argument `method` under their original scipy name, e.g. `method="L-BFGS-B"` instead +of `algorithm="scipy_lbfgsb"`. +``` + +## Configuring an algorithm + +To configure an algorithm, you can pass a dictionary to the `algo_options` argument. ```python -algo_options = { - "trustregion.threshold_successful": 0.2, - "trustregion.threshold_very_successful": 0.9, - "trustregion.shrinking_factor.not_successful": 0.4, - "trustregion.shrinking_factor.lower_radius": 0.2, - "trustregion.shrinking_factor.upper_radius": 0.8, - "convergence.noise_corrected_criterion_tolerance": 1.1, +options = { + "stopping_maxiter": 100, + "adaptive": True, } + +om.minimize( + fun=fun, + params=np.arange(3), + algorithm="scipy_neldermead", + algo_options=options, +) ``` -To make it easier to switch between algorithms, we simply ignore non-supported options -and issue a warning that explains which options have been ignored. +If `algo_options` contains options that are not supported by the optimizer, they will be +ignored and you get a warning. + +To find out which options are supported by an optimizer, see {ref}`list_of_algorithms`. -To find more information on `algo_options` that are supported by many optimizers, see -{ref}`algo_options`. +::: +:::: diff --git a/docs/source/how_to/index.md b/docs/source/how_to/index.md index 412b0f252..fc1677cb5 100644 --- a/docs/source/how_to/index.md +++ b/docs/source/how_to/index.md @@ -12,13 +12,13 @@ maxdepth: 1 how_to_criterion_function how_to_start_parameters how_to_derivatives +how_to_specify_algorithm_and_algo_options how_to_algorithm_selection how_to_bounds how_to_constraints how_to_globalization how_to_multistart how_to_visualize_histories -how_to_specify_algorithm_and_algo_options how_to_scaling how_to_logging how_to_errors_during_optimization diff --git a/docs/source/tutorials/optimization_overview.ipynb b/docs/source/tutorials/optimization_overview.ipynb index c65c63e8b..250b9f567 100644 --- a/docs/source/tutorials/optimization_overview.ipynb +++ b/docs/source/tutorials/optimization_overview.ipynb @@ -151,7 +151,31 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## You can add bounds\n", + "## Amazing autocomplete \n", + "\n", + "Assume you need a gradient-free optimizer that supports bounds on the parameters. Moreover, you have a fixed computational budget, so you want to set stopping options. \n", + "\n", + "In most optimizer libraries, you would have to spend a few minutes with the docs to find an optimizer that fits your needs and the stopping options it supports. In optimagic, all of this is discoverable in your editor!\n", + "\n", + "If you type `om.algos.`, your editor will show you all available optimizers and a list of categories you can use to filter the results. In our case, we select `GradientFree` and `Bounded`, and we could do that in any order we want.\n", + "\n", + "\n", + "![autocomplete_1](../_static/images/autocomplete_1.png)\n", + "\n", + "\n", + "After selecting one of the displayed algorithms, in our case `scipy_neldermead`, the editor shows all tuning parameters of that optimizer. If you start to type `stopping`, you will see all stopping criteria that are available.\n", + "\n", + "\n", + "![autocomplete_2](../_static/images/autocomplete_2.png)\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Adding bounds\n", "\n", "As any optimizer library, optimagic lets you specify bounds for the parameters." ] @@ -178,7 +202,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## You can fix parameters \n", + "## Fixing parameters \n", "\n", "On top of bounds, you can also fix one or more parameters during the optimization. " ] @@ -203,7 +227,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Or impose other constraints\n", + "## Other constraints\n", "\n", "As an example, let's impose the constraint that the first three parameters are valid probabilities, i.e. they are between zero and one and sum to one:" ] @@ -278,7 +302,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## You can provide closed form derivatives" + "## Speeding up your optimization with derivatives \n", + "\n", + "You can speed up your optimization by providing closed form derivatives. Those derivatives can be hand-coded or calculated with JAX!" ] }, { @@ -288,15 +314,9 @@ "outputs": [], "source": [ "def sphere_gradient(params):\n", - " return 2 * params" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ + " return 2 * params\n", + "\n", + "\n", "res = om.minimize(\n", " fun=sphere,\n", " params=np.arange(5),\n", @@ -310,7 +330,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Or use parallelized numerical derivatives" + "Alternatively, you can let optimagic calculate numerical derivatives with parallelized finite differences. This is very handy if you do not want to invest the time to derive the derivatives of your criterion function. " ] }, { @@ -329,6 +349,13 @@ "res.params.round(5)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "For more details and examples check out [how-to speed up your optimization with derivatives](../how_to/how_to_derivatives.ipynb)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -361,7 +388,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## And plot the criterion history of all local optimizations" + "## And plot the history of all local optimizations" ] }, { @@ -471,35 +498,6 @@ "\n", "The persistent log file is always instantly synchronized when the optimizer tries a new parameter vector. This is very handy if an optimization has to be aborted and you want to extract the current status. It can be displayed in `criterion_plot` and `params_plot`, even while the optimization is running. " ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Customize your optimizer\n", - "\n", - "Most algorithms have a few optional arguments. Examples are convergence criteria or tuning parameters. You can find an overview of supported arguments [here](../how_to/how_to_specify_algorithm_and_algo_options.md)." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "algo_options = {\n", - " \"convergence.ftol_rel\": 1e-9,\n", - " \"stopping.maxiter\": 100_000,\n", - "}\n", - "\n", - "res = om.minimize(\n", - " fun=sphere,\n", - " params=np.arange(5),\n", - " algorithm=\"scipy_lbfgsb\",\n", - " algo_options=algo_options,\n", - ")\n", - "res.params.round(5)" - ] } ], "metadata": { diff --git a/environment.yml b/environment.yml index cfd6bf6eb..da24f2ee1 100644 --- a/environment.yml +++ b/environment.yml @@ -22,7 +22,7 @@ dependencies: - numpy >= 2 # run, tests - pandas # run, tests - plotly # run, tests - - pybaum >= 0.1.2 # run, tests + - pybaum>=0.1.2 # run, tests - scipy>=1.2.1 # run, tests - sqlalchemy # run, tests - myst-nb # docs diff --git a/pyproject.toml b/pyproject.toml index fe3c69225..deedaf17b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -151,6 +151,7 @@ extend-ignore = [ "docs/source/conf.py" = ["E501", "ERA001", "DTZ005"] "src/optimagic/parameters/kernel_transformations.py" = ["ARG001", "N806"] "docs/source/*" = ["B018"] +"src/optimagic/algorithms.py" = ["E501"] [tool.ruff.lint.pydocstyle] convention = "google" @@ -207,7 +208,7 @@ none_representation = "null" # Mypy configuration # ====================================================================================== [tool.mypy] -files = ["src", "tests"] +files = ["src", "tests", ".tools"] check_untyped_defs = true disallow_any_generics = true disallow_untyped_defs = true @@ -321,6 +322,7 @@ module = [ "estimagic.msm_sensitivity", "estimagic.estimation_table", "estimagic.lollipop_plot", + ] check_untyped_defs = false disallow_any_generics = false diff --git a/src/estimagic/py.typed b/src/estimagic/py.typed new file mode 100644 index 000000000..e69de29bb diff --git a/src/optimagic/__init__.py b/src/optimagic/__init__.py index bfb02c1b2..28e912234 100644 --- a/src/optimagic/__init__.py +++ b/src/optimagic/__init__.py @@ -1,6 +1,7 @@ from __future__ import annotations from optimagic import constraints, mark, utilities +from optimagic.algorithms import algos from optimagic.benchmarking.benchmark_reports import ( convergence_report, rank_report, @@ -100,4 +101,5 @@ "EqualityConstraint", "History", "__version__", + "algos", ] diff --git a/src/optimagic/algorithms.py b/src/optimagic/algorithms.py index 9e42ea828..748189786 100644 --- a/src/optimagic/algorithms.py +++ b/src/optimagic/algorithms.py @@ -1,51 +1,3731 @@ -import inspect +"""This code was auto-generated by a pre-commit hook and should not be changed. + +If you manually change this code, all of your changes will be overwritten the next time +the pre-commit hook runs. + +Detailed information on the purpose of the code can be found here: +https://optimagic.readthedocs.io/en/latest/development/ep-02-typing.html#algorithm-selection + +""" + +from dataclasses import dataclass +from typing import Type, cast from optimagic.optimization.algorithm import Algorithm -from optimagic.optimizers import ( - bhhh, - fides, - ipopt, - nag_optimizers, - neldermead, - nlopt_optimizers, - pounders, - pygmo_optimizers, - scipy_optimizers, - tao_optimizers, - tranquilo, +from optimagic.optimizers.bhhh import BHHH +from optimagic.optimizers.fides import Fides +from optimagic.optimizers.ipopt import Ipopt +from optimagic.optimizers.nag_optimizers import NagDFOLS, NagPyBOBYQA +from optimagic.optimizers.neldermead import NelderMeadParallel +from optimagic.optimizers.nlopt_optimizers import ( + NloptBOBYQA, + NloptCCSAQ, + NloptCOBYLA, + NloptCRS2LM, + NloptDirect, + NloptESCH, + NloptISRES, + NloptLBFGSB, + NloptMMA, + NloptNelderMead, + NloptNEWUOA, + NloptPRAXIS, + NloptSbplx, + NloptSLSQP, + NloptTNewton, + NloptVAR, ) +from optimagic.optimizers.pounders import Pounders +from optimagic.optimizers.pygmo_optimizers import ( + PygmoBeeColony, + PygmoCmaes, + PygmoCompassSearch, + PygmoDe, + PygmoDe1220, + PygmoGaco, + PygmoGwo, + PygmoIhs, + PygmoMbh, + PygmoPso, + PygmoPsoGen, + PygmoSade, + PygmoSea, + PygmoSga, + PygmoSimulatedAnnealing, + PygmoXnes, +) +from optimagic.optimizers.scipy_optimizers import ( + ScipyBasinhopping, + ScipyBFGS, + ScipyBrute, + ScipyCOBYLA, + ScipyConjugateGradient, + ScipyDifferentialEvolution, + ScipyDirect, + ScipyDualAnnealing, + ScipyLBFGSB, + ScipyLSDogbox, + ScipyLSLM, + ScipyLSTRF, + ScipyNelderMead, + ScipyNewtonCG, + ScipyPowell, + ScipySHGO, + ScipySLSQP, + ScipyTruncatedNewton, + ScipyTrustConstr, +) +from optimagic.optimizers.tao_optimizers import TAOPounders +from optimagic.optimizers.tranquilo import Tranquilo, TranquiloLS + + +@dataclass(frozen=True) +class AlgoSelection: + def _all(self) -> list[Type[Algorithm]]: + raw = [field.default for field in self.__dataclass_fields__.values()] + return cast(list[Type[Algorithm]], raw) + + def _available(self) -> list[Type[Algorithm]]: + _all = self._all() + return [ + a + for a in _all + if a.__algo_info__.is_available # type: ignore + ] + + @property + def All(self) -> list[str]: + return [a.__algo_info__.name for a in self._all()] # type: ignore + + @property + def Available(self) -> list[str]: + return [a.__algo_info__.name for a in self._available()] # type: ignore + + @property + def _all_algorithms_dict(self) -> dict[str, Type[Algorithm]]: + return {a.__algo_info__.name: a for a in self._all()} # type: ignore + + @property + def _available_algorithms_dict(self) -> dict[str, Type[Algorithm]]: + return { + a.__algo_info__.name: a # type: ignore + for a in self._available() + } + + +@dataclass(frozen=True) +class BoundedGlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms( + AlgoSelection +): + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + +@dataclass(frozen=True) +class BoundedGlobalGradientBasedNonlinearConstrainedScalarAlgorithms(AlgoSelection): + scipy_shgo: Type[ScipySHGO] = ScipySHGO + + +@dataclass(frozen=True) +class BoundedGradientBasedLocalNonlinearConstrainedScalarAlgorithms(AlgoSelection): + ipopt: Type[Ipopt] = Ipopt + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + +@dataclass(frozen=True) +class BoundedGlobalGradientFreeNonlinearConstrainedScalarAlgorithms(AlgoSelection): + nlopt_isres: Type[NloptISRES] = NloptISRES + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Parallel( + self, + ) -> BoundedGlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms: + return BoundedGlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGlobalGradientFreeNonlinearConstrainedParallelAlgorithms(AlgoSelection): + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Scalar( + self, + ) -> BoundedGlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms: + return BoundedGlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGlobalGradientFreeParallelScalarAlgorithms(AlgoSelection): + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def NonlinearConstrained( + self, + ) -> BoundedGlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms: + return BoundedGlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class GlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms(AlgoSelection): + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Bounded( + self, + ) -> BoundedGlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms: + return BoundedGlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientFreeLocalNonlinearConstrainedScalarAlgorithms(AlgoSelection): + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + + +@dataclass(frozen=True) +class BoundedGradientFreeLocalParallelScalarAlgorithms(AlgoSelection): + tranquilo: Type[Tranquilo] = Tranquilo + + +@dataclass(frozen=True) +class BoundedGradientFreeLeastSquaresLocalParallelAlgorithms(AlgoSelection): + pounders: Type[Pounders] = Pounders + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + +@dataclass(frozen=True) +class BoundedGradientFreeNonlinearConstrainedParallelScalarAlgorithms(AlgoSelection): + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Global( + self, + ) -> BoundedGlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms: + return BoundedGlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGlobalNonlinearConstrainedParallelScalarAlgorithms(AlgoSelection): + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def GradientFree( + self, + ) -> BoundedGlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms: + return BoundedGlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGlobalGradientBasedNonlinearConstrainedAlgorithms(AlgoSelection): + scipy_shgo: Type[ScipySHGO] = ScipySHGO + + @property + def Scalar(self) -> BoundedGlobalGradientBasedNonlinearConstrainedScalarAlgorithms: + return BoundedGlobalGradientBasedNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGlobalGradientBasedScalarAlgorithms(AlgoSelection): + scipy_basinhopping: Type[ScipyBasinhopping] = ScipyBasinhopping + scipy_dual_annealing: Type[ScipyDualAnnealing] = ScipyDualAnnealing + scipy_shgo: Type[ScipySHGO] = ScipySHGO + + @property + def NonlinearConstrained( + self, + ) -> BoundedGlobalGradientBasedNonlinearConstrainedScalarAlgorithms: + return BoundedGlobalGradientBasedNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class GlobalGradientBasedNonlinearConstrainedScalarAlgorithms(AlgoSelection): + scipy_shgo: Type[ScipySHGO] = ScipySHGO + + @property + def Bounded(self) -> BoundedGlobalGradientBasedNonlinearConstrainedScalarAlgorithms: + return BoundedGlobalGradientBasedNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientBasedLocalNonlinearConstrainedAlgorithms(AlgoSelection): + ipopt: Type[Ipopt] = Ipopt + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def Scalar(self) -> BoundedGradientBasedLocalNonlinearConstrainedScalarAlgorithms: + return BoundedGradientBasedLocalNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientBasedLocalScalarAlgorithms(AlgoSelection): + fides: Type[Fides] = Fides + ipopt: Type[Ipopt] = Ipopt + nlopt_ccsaq: Type[NloptCCSAQ] = NloptCCSAQ + nlopt_lbfgsb: Type[NloptLBFGSB] = NloptLBFGSB + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + nlopt_tnewton: Type[NloptTNewton] = NloptTNewton + nlopt_var: Type[NloptVAR] = NloptVAR + scipy_lbfgsb: Type[ScipyLBFGSB] = ScipyLBFGSB + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_truncated_newton: Type[ScipyTruncatedNewton] = ScipyTruncatedNewton + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def NonlinearConstrained( + self, + ) -> BoundedGradientBasedLocalNonlinearConstrainedScalarAlgorithms: + return BoundedGradientBasedLocalNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientBasedLeastSquaresLocalAlgorithms(AlgoSelection): + scipy_ls_dogbox: Type[ScipyLSDogbox] = ScipyLSDogbox + scipy_ls_trf: Type[ScipyLSTRF] = ScipyLSTRF + + +@dataclass(frozen=True) +class GradientBasedLocalNonlinearConstrainedScalarAlgorithms(AlgoSelection): + ipopt: Type[Ipopt] = Ipopt + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def Bounded(self) -> BoundedGradientBasedLocalNonlinearConstrainedScalarAlgorithms: + return BoundedGradientBasedLocalNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientBasedNonlinearConstrainedScalarAlgorithms(AlgoSelection): + ipopt: Type[Ipopt] = Ipopt + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + scipy_shgo: Type[ScipySHGO] = ScipySHGO + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def Global(self) -> BoundedGlobalGradientBasedNonlinearConstrainedScalarAlgorithms: + return BoundedGlobalGradientBasedNonlinearConstrainedScalarAlgorithms() + + @property + def Local(self) -> BoundedGradientBasedLocalNonlinearConstrainedScalarAlgorithms: + return BoundedGradientBasedLocalNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGlobalGradientFreeNonlinearConstrainedAlgorithms(AlgoSelection): + nlopt_isres: Type[NloptISRES] = NloptISRES + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Parallel( + self, + ) -> BoundedGlobalGradientFreeNonlinearConstrainedParallelAlgorithms: + return BoundedGlobalGradientFreeNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> BoundedGlobalGradientFreeNonlinearConstrainedScalarAlgorithms: + return BoundedGlobalGradientFreeNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGlobalGradientFreeScalarAlgorithms(AlgoSelection): + nlopt_crs2_lm: Type[NloptCRS2LM] = NloptCRS2LM + nlopt_direct: Type[NloptDirect] = NloptDirect + nlopt_esch: Type[NloptESCH] = NloptESCH + nlopt_isres: Type[NloptISRES] = NloptISRES + pygmo_bee_colony: Type[PygmoBeeColony] = PygmoBeeColony + pygmo_cmaes: Type[PygmoCmaes] = PygmoCmaes + pygmo_compass_search: Type[PygmoCompassSearch] = PygmoCompassSearch + pygmo_de: Type[PygmoDe] = PygmoDe + pygmo_de1220: Type[PygmoDe1220] = PygmoDe1220 + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_gwo: Type[PygmoGwo] = PygmoGwo + pygmo_ihs: Type[PygmoIhs] = PygmoIhs + pygmo_mbh: Type[PygmoMbh] = PygmoMbh + pygmo_pso: Type[PygmoPso] = PygmoPso + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + pygmo_sade: Type[PygmoSade] = PygmoSade + pygmo_sea: Type[PygmoSea] = PygmoSea + pygmo_sga: Type[PygmoSga] = PygmoSga + pygmo_simulated_annealing: Type[PygmoSimulatedAnnealing] = PygmoSimulatedAnnealing + pygmo_xnes: Type[PygmoXnes] = PygmoXnes + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_direct: Type[ScipyDirect] = ScipyDirect + + @property + def NonlinearConstrained( + self, + ) -> BoundedGlobalGradientFreeNonlinearConstrainedScalarAlgorithms: + return BoundedGlobalGradientFreeNonlinearConstrainedScalarAlgorithms() + + @property + def Parallel(self) -> BoundedGlobalGradientFreeParallelScalarAlgorithms: + return BoundedGlobalGradientFreeParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGlobalGradientFreeParallelAlgorithms(AlgoSelection): + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def NonlinearConstrained( + self, + ) -> BoundedGlobalGradientFreeNonlinearConstrainedParallelAlgorithms: + return BoundedGlobalGradientFreeNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> BoundedGlobalGradientFreeParallelScalarAlgorithms: + return BoundedGlobalGradientFreeParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class GlobalGradientFreeNonlinearConstrainedScalarAlgorithms(AlgoSelection): + nlopt_isres: Type[NloptISRES] = NloptISRES + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Bounded(self) -> BoundedGlobalGradientFreeNonlinearConstrainedScalarAlgorithms: + return BoundedGlobalGradientFreeNonlinearConstrainedScalarAlgorithms() + + @property + def Parallel( + self, + ) -> GlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms: + return GlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class GlobalGradientFreeNonlinearConstrainedParallelAlgorithms(AlgoSelection): + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Bounded( + self, + ) -> BoundedGlobalGradientFreeNonlinearConstrainedParallelAlgorithms: + return BoundedGlobalGradientFreeNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> GlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms: + return GlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class GlobalGradientFreeParallelScalarAlgorithms(AlgoSelection): + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Bounded(self) -> BoundedGlobalGradientFreeParallelScalarAlgorithms: + return BoundedGlobalGradientFreeParallelScalarAlgorithms() + + @property + def NonlinearConstrained( + self, + ) -> GlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms: + return GlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientFreeLocalNonlinearConstrainedAlgorithms(AlgoSelection): + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + + @property + def Scalar(self) -> BoundedGradientFreeLocalNonlinearConstrainedScalarAlgorithms: + return BoundedGradientFreeLocalNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientFreeLocalScalarAlgorithms(AlgoSelection): + nag_pybobyqa: Type[NagPyBOBYQA] = NagPyBOBYQA + nlopt_bobyqa: Type[NloptBOBYQA] = NloptBOBYQA + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_newuoa: Type[NloptNEWUOA] = NloptNEWUOA + nlopt_neldermead: Type[NloptNelderMead] = NloptNelderMead + nlopt_sbplx: Type[NloptSbplx] = NloptSbplx + scipy_neldermead: Type[ScipyNelderMead] = ScipyNelderMead + scipy_powell: Type[ScipyPowell] = ScipyPowell + tranquilo: Type[Tranquilo] = Tranquilo + + @property + def NonlinearConstrained( + self, + ) -> BoundedGradientFreeLocalNonlinearConstrainedScalarAlgorithms: + return BoundedGradientFreeLocalNonlinearConstrainedScalarAlgorithms() + + @property + def Parallel(self) -> BoundedGradientFreeLocalParallelScalarAlgorithms: + return BoundedGradientFreeLocalParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientFreeLeastSquaresLocalAlgorithms(AlgoSelection): + nag_dfols: Type[NagDFOLS] = NagDFOLS + pounders: Type[Pounders] = Pounders + tao_pounders: Type[TAOPounders] = TAOPounders + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Parallel(self) -> BoundedGradientFreeLeastSquaresLocalParallelAlgorithms: + return BoundedGradientFreeLeastSquaresLocalParallelAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientFreeLocalParallelAlgorithms(AlgoSelection): + pounders: Type[Pounders] = Pounders + tranquilo: Type[Tranquilo] = Tranquilo + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def LeastSquares(self) -> BoundedGradientFreeLeastSquaresLocalParallelAlgorithms: + return BoundedGradientFreeLeastSquaresLocalParallelAlgorithms() + + @property + def Scalar(self) -> BoundedGradientFreeLocalParallelScalarAlgorithms: + return BoundedGradientFreeLocalParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientFreeLocalNonlinearConstrainedScalarAlgorithms(AlgoSelection): + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + scipy_cobyla: Type[ScipyCOBYLA] = ScipyCOBYLA + + @property + def Bounded(self) -> BoundedGradientFreeLocalNonlinearConstrainedScalarAlgorithms: + return BoundedGradientFreeLocalNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientFreeLocalParallelScalarAlgorithms(AlgoSelection): + neldermead_parallel: Type[NelderMeadParallel] = NelderMeadParallel + tranquilo: Type[Tranquilo] = Tranquilo + + @property + def Bounded(self) -> BoundedGradientFreeLocalParallelScalarAlgorithms: + return BoundedGradientFreeLocalParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientFreeLeastSquaresLocalParallelAlgorithms(AlgoSelection): + pounders: Type[Pounders] = Pounders + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Bounded(self) -> BoundedGradientFreeLeastSquaresLocalParallelAlgorithms: + return BoundedGradientFreeLeastSquaresLocalParallelAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientFreeNonlinearConstrainedScalarAlgorithms(AlgoSelection): + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_isres: Type[NloptISRES] = NloptISRES + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Global(self) -> BoundedGlobalGradientFreeNonlinearConstrainedScalarAlgorithms: + return BoundedGlobalGradientFreeNonlinearConstrainedScalarAlgorithms() + + @property + def Local(self) -> BoundedGradientFreeLocalNonlinearConstrainedScalarAlgorithms: + return BoundedGradientFreeLocalNonlinearConstrainedScalarAlgorithms() + + @property + def Parallel( + self, + ) -> BoundedGradientFreeNonlinearConstrainedParallelScalarAlgorithms: + return BoundedGradientFreeNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientFreeNonlinearConstrainedParallelAlgorithms(AlgoSelection): + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Global(self) -> BoundedGlobalGradientFreeNonlinearConstrainedParallelAlgorithms: + return BoundedGlobalGradientFreeNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> BoundedGradientFreeNonlinearConstrainedParallelScalarAlgorithms: + return BoundedGradientFreeNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientFreeParallelScalarAlgorithms(AlgoSelection): + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + tranquilo: Type[Tranquilo] = Tranquilo + + @property + def Global(self) -> BoundedGlobalGradientFreeParallelScalarAlgorithms: + return BoundedGlobalGradientFreeParallelScalarAlgorithms() + + @property + def Local(self) -> BoundedGradientFreeLocalParallelScalarAlgorithms: + return BoundedGradientFreeLocalParallelScalarAlgorithms() + + @property + def NonlinearConstrained( + self, + ) -> BoundedGradientFreeNonlinearConstrainedParallelScalarAlgorithms: + return BoundedGradientFreeNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientFreeLeastSquaresParallelAlgorithms(AlgoSelection): + pounders: Type[Pounders] = Pounders + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Local(self) -> BoundedGradientFreeLeastSquaresLocalParallelAlgorithms: + return BoundedGradientFreeLeastSquaresLocalParallelAlgorithms() + + +@dataclass(frozen=True) +class GradientFreeNonlinearConstrainedParallelScalarAlgorithms(AlgoSelection): + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Bounded( + self, + ) -> BoundedGradientFreeNonlinearConstrainedParallelScalarAlgorithms: + return BoundedGradientFreeNonlinearConstrainedParallelScalarAlgorithms() + + @property + def Global(self) -> GlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms: + return GlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGlobalNonlinearConstrainedScalarAlgorithms(AlgoSelection): + nlopt_isres: Type[NloptISRES] = NloptISRES + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_shgo: Type[ScipySHGO] = ScipySHGO + + @property + def GradientBased( + self, + ) -> BoundedGlobalGradientBasedNonlinearConstrainedScalarAlgorithms: + return BoundedGlobalGradientBasedNonlinearConstrainedScalarAlgorithms() + + @property + def GradientFree( + self, + ) -> BoundedGlobalGradientFreeNonlinearConstrainedScalarAlgorithms: + return BoundedGlobalGradientFreeNonlinearConstrainedScalarAlgorithms() + + @property + def Parallel(self) -> BoundedGlobalNonlinearConstrainedParallelScalarAlgorithms: + return BoundedGlobalNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGlobalNonlinearConstrainedParallelAlgorithms(AlgoSelection): + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def GradientFree( + self, + ) -> BoundedGlobalGradientFreeNonlinearConstrainedParallelAlgorithms: + return BoundedGlobalGradientFreeNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> BoundedGlobalNonlinearConstrainedParallelScalarAlgorithms: + return BoundedGlobalNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGlobalParallelScalarAlgorithms(AlgoSelection): + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def GradientFree(self) -> BoundedGlobalGradientFreeParallelScalarAlgorithms: + return BoundedGlobalGradientFreeParallelScalarAlgorithms() + + @property + def NonlinearConstrained( + self, + ) -> BoundedGlobalNonlinearConstrainedParallelScalarAlgorithms: + return BoundedGlobalNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class GlobalNonlinearConstrainedParallelScalarAlgorithms(AlgoSelection): + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Bounded(self) -> BoundedGlobalNonlinearConstrainedParallelScalarAlgorithms: + return BoundedGlobalNonlinearConstrainedParallelScalarAlgorithms() + + @property + def GradientFree( + self, + ) -> GlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms: + return GlobalGradientFreeNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedLocalNonlinearConstrainedScalarAlgorithms(AlgoSelection): + ipopt: Type[Ipopt] = Ipopt + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def GradientBased( + self, + ) -> BoundedGradientBasedLocalNonlinearConstrainedScalarAlgorithms: + return BoundedGradientBasedLocalNonlinearConstrainedScalarAlgorithms() + + @property + def GradientFree( + self, + ) -> BoundedGradientFreeLocalNonlinearConstrainedScalarAlgorithms: + return BoundedGradientFreeLocalNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedLocalParallelScalarAlgorithms(AlgoSelection): + tranquilo: Type[Tranquilo] = Tranquilo + + @property + def GradientFree(self) -> BoundedGradientFreeLocalParallelScalarAlgorithms: + return BoundedGradientFreeLocalParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedLeastSquaresLocalParallelAlgorithms(AlgoSelection): + pounders: Type[Pounders] = Pounders + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def GradientFree(self) -> BoundedGradientFreeLeastSquaresLocalParallelAlgorithms: + return BoundedGradientFreeLeastSquaresLocalParallelAlgorithms() + + +@dataclass(frozen=True) +class BoundedNonlinearConstrainedParallelScalarAlgorithms(AlgoSelection): + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Global(self) -> BoundedGlobalNonlinearConstrainedParallelScalarAlgorithms: + return BoundedGlobalNonlinearConstrainedParallelScalarAlgorithms() + + @property + def GradientFree( + self, + ) -> BoundedGradientFreeNonlinearConstrainedParallelScalarAlgorithms: + return BoundedGradientFreeNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGlobalGradientBasedAlgorithms(AlgoSelection): + scipy_basinhopping: Type[ScipyBasinhopping] = ScipyBasinhopping + scipy_dual_annealing: Type[ScipyDualAnnealing] = ScipyDualAnnealing + scipy_shgo: Type[ScipySHGO] = ScipySHGO + + @property + def NonlinearConstrained( + self, + ) -> BoundedGlobalGradientBasedNonlinearConstrainedAlgorithms: + return BoundedGlobalGradientBasedNonlinearConstrainedAlgorithms() + + @property + def Scalar(self) -> BoundedGlobalGradientBasedScalarAlgorithms: + return BoundedGlobalGradientBasedScalarAlgorithms() + + +@dataclass(frozen=True) +class GlobalGradientBasedNonlinearConstrainedAlgorithms(AlgoSelection): + scipy_shgo: Type[ScipySHGO] = ScipySHGO + + @property + def Bounded(self) -> BoundedGlobalGradientBasedNonlinearConstrainedAlgorithms: + return BoundedGlobalGradientBasedNonlinearConstrainedAlgorithms() + + @property + def Scalar(self) -> GlobalGradientBasedNonlinearConstrainedScalarAlgorithms: + return GlobalGradientBasedNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class GlobalGradientBasedScalarAlgorithms(AlgoSelection): + scipy_basinhopping: Type[ScipyBasinhopping] = ScipyBasinhopping + scipy_dual_annealing: Type[ScipyDualAnnealing] = ScipyDualAnnealing + scipy_shgo: Type[ScipySHGO] = ScipySHGO + + @property + def Bounded(self) -> BoundedGlobalGradientBasedScalarAlgorithms: + return BoundedGlobalGradientBasedScalarAlgorithms() + + @property + def NonlinearConstrained( + self, + ) -> GlobalGradientBasedNonlinearConstrainedScalarAlgorithms: + return GlobalGradientBasedNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientBasedLocalAlgorithms(AlgoSelection): + fides: Type[Fides] = Fides + ipopt: Type[Ipopt] = Ipopt + nlopt_ccsaq: Type[NloptCCSAQ] = NloptCCSAQ + nlopt_lbfgsb: Type[NloptLBFGSB] = NloptLBFGSB + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + nlopt_tnewton: Type[NloptTNewton] = NloptTNewton + nlopt_var: Type[NloptVAR] = NloptVAR + scipy_lbfgsb: Type[ScipyLBFGSB] = ScipyLBFGSB + scipy_ls_dogbox: Type[ScipyLSDogbox] = ScipyLSDogbox + scipy_ls_trf: Type[ScipyLSTRF] = ScipyLSTRF + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_truncated_newton: Type[ScipyTruncatedNewton] = ScipyTruncatedNewton + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def LeastSquares(self) -> BoundedGradientBasedLeastSquaresLocalAlgorithms: + return BoundedGradientBasedLeastSquaresLocalAlgorithms() + + @property + def NonlinearConstrained( + self, + ) -> BoundedGradientBasedLocalNonlinearConstrainedAlgorithms: + return BoundedGradientBasedLocalNonlinearConstrainedAlgorithms() + + @property + def Scalar(self) -> BoundedGradientBasedLocalScalarAlgorithms: + return BoundedGradientBasedLocalScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientBasedLocalNonlinearConstrainedAlgorithms(AlgoSelection): + ipopt: Type[Ipopt] = Ipopt + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def Bounded(self) -> BoundedGradientBasedLocalNonlinearConstrainedAlgorithms: + return BoundedGradientBasedLocalNonlinearConstrainedAlgorithms() + + @property + def Scalar(self) -> GradientBasedLocalNonlinearConstrainedScalarAlgorithms: + return GradientBasedLocalNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientBasedLocalScalarAlgorithms(AlgoSelection): + fides: Type[Fides] = Fides + ipopt: Type[Ipopt] = Ipopt + nlopt_ccsaq: Type[NloptCCSAQ] = NloptCCSAQ + nlopt_lbfgsb: Type[NloptLBFGSB] = NloptLBFGSB + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + nlopt_tnewton: Type[NloptTNewton] = NloptTNewton + nlopt_var: Type[NloptVAR] = NloptVAR + scipy_bfgs: Type[ScipyBFGS] = ScipyBFGS + scipy_conjugate_gradient: Type[ScipyConjugateGradient] = ScipyConjugateGradient + scipy_lbfgsb: Type[ScipyLBFGSB] = ScipyLBFGSB + scipy_newton_cg: Type[ScipyNewtonCG] = ScipyNewtonCG + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_truncated_newton: Type[ScipyTruncatedNewton] = ScipyTruncatedNewton + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def Bounded(self) -> BoundedGradientBasedLocalScalarAlgorithms: + return BoundedGradientBasedLocalScalarAlgorithms() + + @property + def NonlinearConstrained( + self, + ) -> GradientBasedLocalNonlinearConstrainedScalarAlgorithms: + return GradientBasedLocalNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientBasedLeastSquaresLocalAlgorithms(AlgoSelection): + scipy_ls_dogbox: Type[ScipyLSDogbox] = ScipyLSDogbox + scipy_ls_lm: Type[ScipyLSLM] = ScipyLSLM + scipy_ls_trf: Type[ScipyLSTRF] = ScipyLSTRF + + @property + def Bounded(self) -> BoundedGradientBasedLeastSquaresLocalAlgorithms: + return BoundedGradientBasedLeastSquaresLocalAlgorithms() + + +@dataclass(frozen=True) +class GradientBasedLikelihoodLocalAlgorithms(AlgoSelection): + bhhh: Type[BHHH] = BHHH + + +@dataclass(frozen=True) +class BoundedGradientBasedNonlinearConstrainedAlgorithms(AlgoSelection): + ipopt: Type[Ipopt] = Ipopt + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + scipy_shgo: Type[ScipySHGO] = ScipySHGO + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def Global(self) -> BoundedGlobalGradientBasedNonlinearConstrainedAlgorithms: + return BoundedGlobalGradientBasedNonlinearConstrainedAlgorithms() + + @property + def Local(self) -> BoundedGradientBasedLocalNonlinearConstrainedAlgorithms: + return BoundedGradientBasedLocalNonlinearConstrainedAlgorithms() + + @property + def Scalar(self) -> BoundedGradientBasedNonlinearConstrainedScalarAlgorithms: + return BoundedGradientBasedNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientBasedScalarAlgorithms(AlgoSelection): + fides: Type[Fides] = Fides + ipopt: Type[Ipopt] = Ipopt + nlopt_ccsaq: Type[NloptCCSAQ] = NloptCCSAQ + nlopt_lbfgsb: Type[NloptLBFGSB] = NloptLBFGSB + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + nlopt_tnewton: Type[NloptTNewton] = NloptTNewton + nlopt_var: Type[NloptVAR] = NloptVAR + scipy_basinhopping: Type[ScipyBasinhopping] = ScipyBasinhopping + scipy_dual_annealing: Type[ScipyDualAnnealing] = ScipyDualAnnealing + scipy_lbfgsb: Type[ScipyLBFGSB] = ScipyLBFGSB + scipy_shgo: Type[ScipySHGO] = ScipySHGO + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_truncated_newton: Type[ScipyTruncatedNewton] = ScipyTruncatedNewton + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def Global(self) -> BoundedGlobalGradientBasedScalarAlgorithms: + return BoundedGlobalGradientBasedScalarAlgorithms() + + @property + def Local(self) -> BoundedGradientBasedLocalScalarAlgorithms: + return BoundedGradientBasedLocalScalarAlgorithms() + + @property + def NonlinearConstrained( + self, + ) -> BoundedGradientBasedNonlinearConstrainedScalarAlgorithms: + return BoundedGradientBasedNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientBasedLeastSquaresAlgorithms(AlgoSelection): + scipy_ls_dogbox: Type[ScipyLSDogbox] = ScipyLSDogbox + scipy_ls_trf: Type[ScipyLSTRF] = ScipyLSTRF + + @property + def Local(self) -> BoundedGradientBasedLeastSquaresLocalAlgorithms: + return BoundedGradientBasedLeastSquaresLocalAlgorithms() + + +@dataclass(frozen=True) +class GradientBasedNonlinearConstrainedScalarAlgorithms(AlgoSelection): + ipopt: Type[Ipopt] = Ipopt + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + scipy_shgo: Type[ScipySHGO] = ScipySHGO + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def Bounded(self) -> BoundedGradientBasedNonlinearConstrainedScalarAlgorithms: + return BoundedGradientBasedNonlinearConstrainedScalarAlgorithms() + + @property + def Global(self) -> GlobalGradientBasedNonlinearConstrainedScalarAlgorithms: + return GlobalGradientBasedNonlinearConstrainedScalarAlgorithms() + + @property + def Local(self) -> GradientBasedLocalNonlinearConstrainedScalarAlgorithms: + return GradientBasedLocalNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGlobalGradientFreeAlgorithms(AlgoSelection): + nlopt_crs2_lm: Type[NloptCRS2LM] = NloptCRS2LM + nlopt_direct: Type[NloptDirect] = NloptDirect + nlopt_esch: Type[NloptESCH] = NloptESCH + nlopt_isres: Type[NloptISRES] = NloptISRES + pygmo_bee_colony: Type[PygmoBeeColony] = PygmoBeeColony + pygmo_cmaes: Type[PygmoCmaes] = PygmoCmaes + pygmo_compass_search: Type[PygmoCompassSearch] = PygmoCompassSearch + pygmo_de: Type[PygmoDe] = PygmoDe + pygmo_de1220: Type[PygmoDe1220] = PygmoDe1220 + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_gwo: Type[PygmoGwo] = PygmoGwo + pygmo_ihs: Type[PygmoIhs] = PygmoIhs + pygmo_mbh: Type[PygmoMbh] = PygmoMbh + pygmo_pso: Type[PygmoPso] = PygmoPso + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + pygmo_sade: Type[PygmoSade] = PygmoSade + pygmo_sea: Type[PygmoSea] = PygmoSea + pygmo_sga: Type[PygmoSga] = PygmoSga + pygmo_simulated_annealing: Type[PygmoSimulatedAnnealing] = PygmoSimulatedAnnealing + pygmo_xnes: Type[PygmoXnes] = PygmoXnes + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_direct: Type[ScipyDirect] = ScipyDirect + + @property + def NonlinearConstrained( + self, + ) -> BoundedGlobalGradientFreeNonlinearConstrainedAlgorithms: + return BoundedGlobalGradientFreeNonlinearConstrainedAlgorithms() + + @property + def Parallel(self) -> BoundedGlobalGradientFreeParallelAlgorithms: + return BoundedGlobalGradientFreeParallelAlgorithms() + + @property + def Scalar(self) -> BoundedGlobalGradientFreeScalarAlgorithms: + return BoundedGlobalGradientFreeScalarAlgorithms() + + +@dataclass(frozen=True) +class GlobalGradientFreeNonlinearConstrainedAlgorithms(AlgoSelection): + nlopt_isres: Type[NloptISRES] = NloptISRES + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Bounded(self) -> BoundedGlobalGradientFreeNonlinearConstrainedAlgorithms: + return BoundedGlobalGradientFreeNonlinearConstrainedAlgorithms() + + @property + def Parallel(self) -> GlobalGradientFreeNonlinearConstrainedParallelAlgorithms: + return GlobalGradientFreeNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> GlobalGradientFreeNonlinearConstrainedScalarAlgorithms: + return GlobalGradientFreeNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class GlobalGradientFreeScalarAlgorithms(AlgoSelection): + nlopt_crs2_lm: Type[NloptCRS2LM] = NloptCRS2LM + nlopt_direct: Type[NloptDirect] = NloptDirect + nlopt_esch: Type[NloptESCH] = NloptESCH + nlopt_isres: Type[NloptISRES] = NloptISRES + pygmo_bee_colony: Type[PygmoBeeColony] = PygmoBeeColony + pygmo_cmaes: Type[PygmoCmaes] = PygmoCmaes + pygmo_compass_search: Type[PygmoCompassSearch] = PygmoCompassSearch + pygmo_de: Type[PygmoDe] = PygmoDe + pygmo_de1220: Type[PygmoDe1220] = PygmoDe1220 + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_gwo: Type[PygmoGwo] = PygmoGwo + pygmo_ihs: Type[PygmoIhs] = PygmoIhs + pygmo_mbh: Type[PygmoMbh] = PygmoMbh + pygmo_pso: Type[PygmoPso] = PygmoPso + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + pygmo_sade: Type[PygmoSade] = PygmoSade + pygmo_sea: Type[PygmoSea] = PygmoSea + pygmo_sga: Type[PygmoSga] = PygmoSga + pygmo_simulated_annealing: Type[PygmoSimulatedAnnealing] = PygmoSimulatedAnnealing + pygmo_xnes: Type[PygmoXnes] = PygmoXnes + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_direct: Type[ScipyDirect] = ScipyDirect + + @property + def Bounded(self) -> BoundedGlobalGradientFreeScalarAlgorithms: + return BoundedGlobalGradientFreeScalarAlgorithms() + + @property + def NonlinearConstrained( + self, + ) -> GlobalGradientFreeNonlinearConstrainedScalarAlgorithms: + return GlobalGradientFreeNonlinearConstrainedScalarAlgorithms() + + @property + def Parallel(self) -> GlobalGradientFreeParallelScalarAlgorithms: + return GlobalGradientFreeParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class GlobalGradientFreeParallelAlgorithms(AlgoSelection): + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Bounded(self) -> BoundedGlobalGradientFreeParallelAlgorithms: + return BoundedGlobalGradientFreeParallelAlgorithms() + + @property + def NonlinearConstrained( + self, + ) -> GlobalGradientFreeNonlinearConstrainedParallelAlgorithms: + return GlobalGradientFreeNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> GlobalGradientFreeParallelScalarAlgorithms: + return GlobalGradientFreeParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientFreeLocalAlgorithms(AlgoSelection): + nag_dfols: Type[NagDFOLS] = NagDFOLS + nag_pybobyqa: Type[NagPyBOBYQA] = NagPyBOBYQA + nlopt_bobyqa: Type[NloptBOBYQA] = NloptBOBYQA + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_newuoa: Type[NloptNEWUOA] = NloptNEWUOA + nlopt_neldermead: Type[NloptNelderMead] = NloptNelderMead + nlopt_sbplx: Type[NloptSbplx] = NloptSbplx + pounders: Type[Pounders] = Pounders + scipy_neldermead: Type[ScipyNelderMead] = ScipyNelderMead + scipy_powell: Type[ScipyPowell] = ScipyPowell + tao_pounders: Type[TAOPounders] = TAOPounders + tranquilo: Type[Tranquilo] = Tranquilo + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def LeastSquares(self) -> BoundedGradientFreeLeastSquaresLocalAlgorithms: + return BoundedGradientFreeLeastSquaresLocalAlgorithms() + + @property + def NonlinearConstrained( + self, + ) -> BoundedGradientFreeLocalNonlinearConstrainedAlgorithms: + return BoundedGradientFreeLocalNonlinearConstrainedAlgorithms() + + @property + def Parallel(self) -> BoundedGradientFreeLocalParallelAlgorithms: + return BoundedGradientFreeLocalParallelAlgorithms() + + @property + def Scalar(self) -> BoundedGradientFreeLocalScalarAlgorithms: + return BoundedGradientFreeLocalScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientFreeLocalNonlinearConstrainedAlgorithms(AlgoSelection): + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + scipy_cobyla: Type[ScipyCOBYLA] = ScipyCOBYLA + + @property + def Bounded(self) -> BoundedGradientFreeLocalNonlinearConstrainedAlgorithms: + return BoundedGradientFreeLocalNonlinearConstrainedAlgorithms() + + @property + def Scalar(self) -> GradientFreeLocalNonlinearConstrainedScalarAlgorithms: + return GradientFreeLocalNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientFreeLocalScalarAlgorithms(AlgoSelection): + nag_pybobyqa: Type[NagPyBOBYQA] = NagPyBOBYQA + neldermead_parallel: Type[NelderMeadParallel] = NelderMeadParallel + nlopt_bobyqa: Type[NloptBOBYQA] = NloptBOBYQA + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_newuoa: Type[NloptNEWUOA] = NloptNEWUOA + nlopt_neldermead: Type[NloptNelderMead] = NloptNelderMead + nlopt_praxis: Type[NloptPRAXIS] = NloptPRAXIS + nlopt_sbplx: Type[NloptSbplx] = NloptSbplx + scipy_cobyla: Type[ScipyCOBYLA] = ScipyCOBYLA + scipy_neldermead: Type[ScipyNelderMead] = ScipyNelderMead + scipy_powell: Type[ScipyPowell] = ScipyPowell + tranquilo: Type[Tranquilo] = Tranquilo + + @property + def Bounded(self) -> BoundedGradientFreeLocalScalarAlgorithms: + return BoundedGradientFreeLocalScalarAlgorithms() + + @property + def NonlinearConstrained( + self, + ) -> GradientFreeLocalNonlinearConstrainedScalarAlgorithms: + return GradientFreeLocalNonlinearConstrainedScalarAlgorithms() + + @property + def Parallel(self) -> GradientFreeLocalParallelScalarAlgorithms: + return GradientFreeLocalParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientFreeLeastSquaresLocalAlgorithms(AlgoSelection): + nag_dfols: Type[NagDFOLS] = NagDFOLS + pounders: Type[Pounders] = Pounders + tao_pounders: Type[TAOPounders] = TAOPounders + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Bounded(self) -> BoundedGradientFreeLeastSquaresLocalAlgorithms: + return BoundedGradientFreeLeastSquaresLocalAlgorithms() + + @property + def Parallel(self) -> GradientFreeLeastSquaresLocalParallelAlgorithms: + return GradientFreeLeastSquaresLocalParallelAlgorithms() + + +@dataclass(frozen=True) +class GradientFreeLocalParallelAlgorithms(AlgoSelection): + neldermead_parallel: Type[NelderMeadParallel] = NelderMeadParallel + pounders: Type[Pounders] = Pounders + tranquilo: Type[Tranquilo] = Tranquilo + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Bounded(self) -> BoundedGradientFreeLocalParallelAlgorithms: + return BoundedGradientFreeLocalParallelAlgorithms() + + @property + def LeastSquares(self) -> GradientFreeLeastSquaresLocalParallelAlgorithms: + return GradientFreeLeastSquaresLocalParallelAlgorithms() + + @property + def Scalar(self) -> GradientFreeLocalParallelScalarAlgorithms: + return GradientFreeLocalParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientFreeNonlinearConstrainedAlgorithms(AlgoSelection): + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_isres: Type[NloptISRES] = NloptISRES + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Global(self) -> BoundedGlobalGradientFreeNonlinearConstrainedAlgorithms: + return BoundedGlobalGradientFreeNonlinearConstrainedAlgorithms() + + @property + def Local(self) -> BoundedGradientFreeLocalNonlinearConstrainedAlgorithms: + return BoundedGradientFreeLocalNonlinearConstrainedAlgorithms() + + @property + def Parallel(self) -> BoundedGradientFreeNonlinearConstrainedParallelAlgorithms: + return BoundedGradientFreeNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> BoundedGradientFreeNonlinearConstrainedScalarAlgorithms: + return BoundedGradientFreeNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientFreeScalarAlgorithms(AlgoSelection): + nag_pybobyqa: Type[NagPyBOBYQA] = NagPyBOBYQA + nlopt_bobyqa: Type[NloptBOBYQA] = NloptBOBYQA + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_crs2_lm: Type[NloptCRS2LM] = NloptCRS2LM + nlopt_direct: Type[NloptDirect] = NloptDirect + nlopt_esch: Type[NloptESCH] = NloptESCH + nlopt_isres: Type[NloptISRES] = NloptISRES + nlopt_newuoa: Type[NloptNEWUOA] = NloptNEWUOA + nlopt_neldermead: Type[NloptNelderMead] = NloptNelderMead + nlopt_sbplx: Type[NloptSbplx] = NloptSbplx + pygmo_bee_colony: Type[PygmoBeeColony] = PygmoBeeColony + pygmo_cmaes: Type[PygmoCmaes] = PygmoCmaes + pygmo_compass_search: Type[PygmoCompassSearch] = PygmoCompassSearch + pygmo_de: Type[PygmoDe] = PygmoDe + pygmo_de1220: Type[PygmoDe1220] = PygmoDe1220 + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_gwo: Type[PygmoGwo] = PygmoGwo + pygmo_ihs: Type[PygmoIhs] = PygmoIhs + pygmo_mbh: Type[PygmoMbh] = PygmoMbh + pygmo_pso: Type[PygmoPso] = PygmoPso + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + pygmo_sade: Type[PygmoSade] = PygmoSade + pygmo_sea: Type[PygmoSea] = PygmoSea + pygmo_sga: Type[PygmoSga] = PygmoSga + pygmo_simulated_annealing: Type[PygmoSimulatedAnnealing] = PygmoSimulatedAnnealing + pygmo_xnes: Type[PygmoXnes] = PygmoXnes + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_direct: Type[ScipyDirect] = ScipyDirect + scipy_neldermead: Type[ScipyNelderMead] = ScipyNelderMead + scipy_powell: Type[ScipyPowell] = ScipyPowell + tranquilo: Type[Tranquilo] = Tranquilo + + @property + def Global(self) -> BoundedGlobalGradientFreeScalarAlgorithms: + return BoundedGlobalGradientFreeScalarAlgorithms() + + @property + def Local(self) -> BoundedGradientFreeLocalScalarAlgorithms: + return BoundedGradientFreeLocalScalarAlgorithms() + + @property + def NonlinearConstrained( + self, + ) -> BoundedGradientFreeNonlinearConstrainedScalarAlgorithms: + return BoundedGradientFreeNonlinearConstrainedScalarAlgorithms() + + @property + def Parallel(self) -> BoundedGradientFreeParallelScalarAlgorithms: + return BoundedGradientFreeParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientFreeLeastSquaresAlgorithms(AlgoSelection): + nag_dfols: Type[NagDFOLS] = NagDFOLS + pounders: Type[Pounders] = Pounders + tao_pounders: Type[TAOPounders] = TAOPounders + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Local(self) -> BoundedGradientFreeLeastSquaresLocalAlgorithms: + return BoundedGradientFreeLeastSquaresLocalAlgorithms() + + @property + def Parallel(self) -> BoundedGradientFreeLeastSquaresParallelAlgorithms: + return BoundedGradientFreeLeastSquaresParallelAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientFreeParallelAlgorithms(AlgoSelection): + pounders: Type[Pounders] = Pounders + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + tranquilo: Type[Tranquilo] = Tranquilo + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Global(self) -> BoundedGlobalGradientFreeParallelAlgorithms: + return BoundedGlobalGradientFreeParallelAlgorithms() + + @property + def LeastSquares(self) -> BoundedGradientFreeLeastSquaresParallelAlgorithms: + return BoundedGradientFreeLeastSquaresParallelAlgorithms() + + @property + def Local(self) -> BoundedGradientFreeLocalParallelAlgorithms: + return BoundedGradientFreeLocalParallelAlgorithms() + + @property + def NonlinearConstrained( + self, + ) -> BoundedGradientFreeNonlinearConstrainedParallelAlgorithms: + return BoundedGradientFreeNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> BoundedGradientFreeParallelScalarAlgorithms: + return BoundedGradientFreeParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientFreeNonlinearConstrainedScalarAlgorithms(AlgoSelection): + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_isres: Type[NloptISRES] = NloptISRES + scipy_cobyla: Type[ScipyCOBYLA] = ScipyCOBYLA + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Bounded(self) -> BoundedGradientFreeNonlinearConstrainedScalarAlgorithms: + return BoundedGradientFreeNonlinearConstrainedScalarAlgorithms() + + @property + def Global(self) -> GlobalGradientFreeNonlinearConstrainedScalarAlgorithms: + return GlobalGradientFreeNonlinearConstrainedScalarAlgorithms() + + @property + def Local(self) -> GradientFreeLocalNonlinearConstrainedScalarAlgorithms: + return GradientFreeLocalNonlinearConstrainedScalarAlgorithms() + + @property + def Parallel(self) -> GradientFreeNonlinearConstrainedParallelScalarAlgorithms: + return GradientFreeNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientFreeNonlinearConstrainedParallelAlgorithms(AlgoSelection): + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Bounded(self) -> BoundedGradientFreeNonlinearConstrainedParallelAlgorithms: + return BoundedGradientFreeNonlinearConstrainedParallelAlgorithms() + + @property + def Global(self) -> GlobalGradientFreeNonlinearConstrainedParallelAlgorithms: + return GlobalGradientFreeNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> GradientFreeNonlinearConstrainedParallelScalarAlgorithms: + return GradientFreeNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientFreeParallelScalarAlgorithms(AlgoSelection): + neldermead_parallel: Type[NelderMeadParallel] = NelderMeadParallel + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + tranquilo: Type[Tranquilo] = Tranquilo + + @property + def Bounded(self) -> BoundedGradientFreeParallelScalarAlgorithms: + return BoundedGradientFreeParallelScalarAlgorithms() + + @property + def Global(self) -> GlobalGradientFreeParallelScalarAlgorithms: + return GlobalGradientFreeParallelScalarAlgorithms() + + @property + def Local(self) -> GradientFreeLocalParallelScalarAlgorithms: + return GradientFreeLocalParallelScalarAlgorithms() + + @property + def NonlinearConstrained( + self, + ) -> GradientFreeNonlinearConstrainedParallelScalarAlgorithms: + return GradientFreeNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientFreeLeastSquaresParallelAlgorithms(AlgoSelection): + pounders: Type[Pounders] = Pounders + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Bounded(self) -> BoundedGradientFreeLeastSquaresParallelAlgorithms: + return BoundedGradientFreeLeastSquaresParallelAlgorithms() + + @property + def Local(self) -> GradientFreeLeastSquaresLocalParallelAlgorithms: + return GradientFreeLeastSquaresLocalParallelAlgorithms() + + +@dataclass(frozen=True) +class BoundedGlobalNonlinearConstrainedAlgorithms(AlgoSelection): + nlopt_isres: Type[NloptISRES] = NloptISRES + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_shgo: Type[ScipySHGO] = ScipySHGO + + @property + def GradientBased(self) -> BoundedGlobalGradientBasedNonlinearConstrainedAlgorithms: + return BoundedGlobalGradientBasedNonlinearConstrainedAlgorithms() + + @property + def GradientFree(self) -> BoundedGlobalGradientFreeNonlinearConstrainedAlgorithms: + return BoundedGlobalGradientFreeNonlinearConstrainedAlgorithms() + + @property + def Parallel(self) -> BoundedGlobalNonlinearConstrainedParallelAlgorithms: + return BoundedGlobalNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> BoundedGlobalNonlinearConstrainedScalarAlgorithms: + return BoundedGlobalNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGlobalScalarAlgorithms(AlgoSelection): + nlopt_crs2_lm: Type[NloptCRS2LM] = NloptCRS2LM + nlopt_direct: Type[NloptDirect] = NloptDirect + nlopt_esch: Type[NloptESCH] = NloptESCH + nlopt_isres: Type[NloptISRES] = NloptISRES + pygmo_bee_colony: Type[PygmoBeeColony] = PygmoBeeColony + pygmo_cmaes: Type[PygmoCmaes] = PygmoCmaes + pygmo_compass_search: Type[PygmoCompassSearch] = PygmoCompassSearch + pygmo_de: Type[PygmoDe] = PygmoDe + pygmo_de1220: Type[PygmoDe1220] = PygmoDe1220 + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_gwo: Type[PygmoGwo] = PygmoGwo + pygmo_ihs: Type[PygmoIhs] = PygmoIhs + pygmo_mbh: Type[PygmoMbh] = PygmoMbh + pygmo_pso: Type[PygmoPso] = PygmoPso + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + pygmo_sade: Type[PygmoSade] = PygmoSade + pygmo_sea: Type[PygmoSea] = PygmoSea + pygmo_sga: Type[PygmoSga] = PygmoSga + pygmo_simulated_annealing: Type[PygmoSimulatedAnnealing] = PygmoSimulatedAnnealing + pygmo_xnes: Type[PygmoXnes] = PygmoXnes + scipy_basinhopping: Type[ScipyBasinhopping] = ScipyBasinhopping + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_direct: Type[ScipyDirect] = ScipyDirect + scipy_dual_annealing: Type[ScipyDualAnnealing] = ScipyDualAnnealing + scipy_shgo: Type[ScipySHGO] = ScipySHGO + + @property + def GradientBased(self) -> BoundedGlobalGradientBasedScalarAlgorithms: + return BoundedGlobalGradientBasedScalarAlgorithms() + + @property + def GradientFree(self) -> BoundedGlobalGradientFreeScalarAlgorithms: + return BoundedGlobalGradientFreeScalarAlgorithms() + + @property + def NonlinearConstrained(self) -> BoundedGlobalNonlinearConstrainedScalarAlgorithms: + return BoundedGlobalNonlinearConstrainedScalarAlgorithms() + + @property + def Parallel(self) -> BoundedGlobalParallelScalarAlgorithms: + return BoundedGlobalParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGlobalParallelAlgorithms(AlgoSelection): + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def GradientFree(self) -> BoundedGlobalGradientFreeParallelAlgorithms: + return BoundedGlobalGradientFreeParallelAlgorithms() + + @property + def NonlinearConstrained( + self, + ) -> BoundedGlobalNonlinearConstrainedParallelAlgorithms: + return BoundedGlobalNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> BoundedGlobalParallelScalarAlgorithms: + return BoundedGlobalParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class GlobalNonlinearConstrainedScalarAlgorithms(AlgoSelection): + nlopt_isres: Type[NloptISRES] = NloptISRES + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_shgo: Type[ScipySHGO] = ScipySHGO + + @property + def Bounded(self) -> BoundedGlobalNonlinearConstrainedScalarAlgorithms: + return BoundedGlobalNonlinearConstrainedScalarAlgorithms() + + @property + def GradientBased(self) -> GlobalGradientBasedNonlinearConstrainedScalarAlgorithms: + return GlobalGradientBasedNonlinearConstrainedScalarAlgorithms() + + @property + def GradientFree(self) -> GlobalGradientFreeNonlinearConstrainedScalarAlgorithms: + return GlobalGradientFreeNonlinearConstrainedScalarAlgorithms() + + @property + def Parallel(self) -> GlobalNonlinearConstrainedParallelScalarAlgorithms: + return GlobalNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class GlobalNonlinearConstrainedParallelAlgorithms(AlgoSelection): + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Bounded(self) -> BoundedGlobalNonlinearConstrainedParallelAlgorithms: + return BoundedGlobalNonlinearConstrainedParallelAlgorithms() + + @property + def GradientFree(self) -> GlobalGradientFreeNonlinearConstrainedParallelAlgorithms: + return GlobalGradientFreeNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> GlobalNonlinearConstrainedParallelScalarAlgorithms: + return GlobalNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class GlobalParallelScalarAlgorithms(AlgoSelection): + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Bounded(self) -> BoundedGlobalParallelScalarAlgorithms: + return BoundedGlobalParallelScalarAlgorithms() + + @property + def GradientFree(self) -> GlobalGradientFreeParallelScalarAlgorithms: + return GlobalGradientFreeParallelScalarAlgorithms() + + @property + def NonlinearConstrained( + self, + ) -> GlobalNonlinearConstrainedParallelScalarAlgorithms: + return GlobalNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedLocalNonlinearConstrainedAlgorithms(AlgoSelection): + ipopt: Type[Ipopt] = Ipopt + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def GradientBased(self) -> BoundedGradientBasedLocalNonlinearConstrainedAlgorithms: + return BoundedGradientBasedLocalNonlinearConstrainedAlgorithms() + + @property + def GradientFree(self) -> BoundedGradientFreeLocalNonlinearConstrainedAlgorithms: + return BoundedGradientFreeLocalNonlinearConstrainedAlgorithms() + + @property + def Scalar(self) -> BoundedLocalNonlinearConstrainedScalarAlgorithms: + return BoundedLocalNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedLocalScalarAlgorithms(AlgoSelection): + fides: Type[Fides] = Fides + ipopt: Type[Ipopt] = Ipopt + nag_pybobyqa: Type[NagPyBOBYQA] = NagPyBOBYQA + nlopt_bobyqa: Type[NloptBOBYQA] = NloptBOBYQA + nlopt_ccsaq: Type[NloptCCSAQ] = NloptCCSAQ + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_lbfgsb: Type[NloptLBFGSB] = NloptLBFGSB + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_newuoa: Type[NloptNEWUOA] = NloptNEWUOA + nlopt_neldermead: Type[NloptNelderMead] = NloptNelderMead + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + nlopt_sbplx: Type[NloptSbplx] = NloptSbplx + nlopt_tnewton: Type[NloptTNewton] = NloptTNewton + nlopt_var: Type[NloptVAR] = NloptVAR + scipy_lbfgsb: Type[ScipyLBFGSB] = ScipyLBFGSB + scipy_neldermead: Type[ScipyNelderMead] = ScipyNelderMead + scipy_powell: Type[ScipyPowell] = ScipyPowell + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_truncated_newton: Type[ScipyTruncatedNewton] = ScipyTruncatedNewton + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + tranquilo: Type[Tranquilo] = Tranquilo + + @property + def GradientBased(self) -> BoundedGradientBasedLocalScalarAlgorithms: + return BoundedGradientBasedLocalScalarAlgorithms() + + @property + def GradientFree(self) -> BoundedGradientFreeLocalScalarAlgorithms: + return BoundedGradientFreeLocalScalarAlgorithms() + + @property + def NonlinearConstrained(self) -> BoundedLocalNonlinearConstrainedScalarAlgorithms: + return BoundedLocalNonlinearConstrainedScalarAlgorithms() + + @property + def Parallel(self) -> BoundedLocalParallelScalarAlgorithms: + return BoundedLocalParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedLeastSquaresLocalAlgorithms(AlgoSelection): + nag_dfols: Type[NagDFOLS] = NagDFOLS + pounders: Type[Pounders] = Pounders + scipy_ls_dogbox: Type[ScipyLSDogbox] = ScipyLSDogbox + scipy_ls_trf: Type[ScipyLSTRF] = ScipyLSTRF + tao_pounders: Type[TAOPounders] = TAOPounders + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def GradientBased(self) -> BoundedGradientBasedLeastSquaresLocalAlgorithms: + return BoundedGradientBasedLeastSquaresLocalAlgorithms() + + @property + def GradientFree(self) -> BoundedGradientFreeLeastSquaresLocalAlgorithms: + return BoundedGradientFreeLeastSquaresLocalAlgorithms() + + @property + def Parallel(self) -> BoundedLeastSquaresLocalParallelAlgorithms: + return BoundedLeastSquaresLocalParallelAlgorithms() + + +@dataclass(frozen=True) +class BoundedLocalParallelAlgorithms(AlgoSelection): + pounders: Type[Pounders] = Pounders + tranquilo: Type[Tranquilo] = Tranquilo + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def GradientFree(self) -> BoundedGradientFreeLocalParallelAlgorithms: + return BoundedGradientFreeLocalParallelAlgorithms() + + @property + def LeastSquares(self) -> BoundedLeastSquaresLocalParallelAlgorithms: + return BoundedLeastSquaresLocalParallelAlgorithms() + + @property + def Scalar(self) -> BoundedLocalParallelScalarAlgorithms: + return BoundedLocalParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class LocalNonlinearConstrainedScalarAlgorithms(AlgoSelection): + ipopt: Type[Ipopt] = Ipopt + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + scipy_cobyla: Type[ScipyCOBYLA] = ScipyCOBYLA + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def Bounded(self) -> BoundedLocalNonlinearConstrainedScalarAlgorithms: + return BoundedLocalNonlinearConstrainedScalarAlgorithms() + + @property + def GradientBased(self) -> GradientBasedLocalNonlinearConstrainedScalarAlgorithms: + return GradientBasedLocalNonlinearConstrainedScalarAlgorithms() + + @property + def GradientFree(self) -> GradientFreeLocalNonlinearConstrainedScalarAlgorithms: + return GradientFreeLocalNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class LocalParallelScalarAlgorithms(AlgoSelection): + neldermead_parallel: Type[NelderMeadParallel] = NelderMeadParallel + tranquilo: Type[Tranquilo] = Tranquilo + + @property + def Bounded(self) -> BoundedLocalParallelScalarAlgorithms: + return BoundedLocalParallelScalarAlgorithms() + + @property + def GradientFree(self) -> GradientFreeLocalParallelScalarAlgorithms: + return GradientFreeLocalParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class LeastSquaresLocalParallelAlgorithms(AlgoSelection): + pounders: Type[Pounders] = Pounders + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Bounded(self) -> BoundedLeastSquaresLocalParallelAlgorithms: + return BoundedLeastSquaresLocalParallelAlgorithms() + + @property + def GradientFree(self) -> GradientFreeLeastSquaresLocalParallelAlgorithms: + return GradientFreeLeastSquaresLocalParallelAlgorithms() + + +@dataclass(frozen=True) +class BoundedNonlinearConstrainedScalarAlgorithms(AlgoSelection): + ipopt: Type[Ipopt] = Ipopt + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_isres: Type[NloptISRES] = NloptISRES + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_shgo: Type[ScipySHGO] = ScipySHGO + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def Global(self) -> BoundedGlobalNonlinearConstrainedScalarAlgorithms: + return BoundedGlobalNonlinearConstrainedScalarAlgorithms() + + @property + def GradientBased(self) -> BoundedGradientBasedNonlinearConstrainedScalarAlgorithms: + return BoundedGradientBasedNonlinearConstrainedScalarAlgorithms() + + @property + def GradientFree(self) -> BoundedGradientFreeNonlinearConstrainedScalarAlgorithms: + return BoundedGradientFreeNonlinearConstrainedScalarAlgorithms() + + @property + def Local(self) -> BoundedLocalNonlinearConstrainedScalarAlgorithms: + return BoundedLocalNonlinearConstrainedScalarAlgorithms() + + @property + def Parallel(self) -> BoundedNonlinearConstrainedParallelScalarAlgorithms: + return BoundedNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedNonlinearConstrainedParallelAlgorithms(AlgoSelection): + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Global(self) -> BoundedGlobalNonlinearConstrainedParallelAlgorithms: + return BoundedGlobalNonlinearConstrainedParallelAlgorithms() + + @property + def GradientFree(self) -> BoundedGradientFreeNonlinearConstrainedParallelAlgorithms: + return BoundedGradientFreeNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> BoundedNonlinearConstrainedParallelScalarAlgorithms: + return BoundedNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedParallelScalarAlgorithms(AlgoSelection): + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + tranquilo: Type[Tranquilo] = Tranquilo + + @property + def Global(self) -> BoundedGlobalParallelScalarAlgorithms: + return BoundedGlobalParallelScalarAlgorithms() + + @property + def GradientFree(self) -> BoundedGradientFreeParallelScalarAlgorithms: + return BoundedGradientFreeParallelScalarAlgorithms() + + @property + def Local(self) -> BoundedLocalParallelScalarAlgorithms: + return BoundedLocalParallelScalarAlgorithms() + + @property + def NonlinearConstrained( + self, + ) -> BoundedNonlinearConstrainedParallelScalarAlgorithms: + return BoundedNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedLeastSquaresParallelAlgorithms(AlgoSelection): + pounders: Type[Pounders] = Pounders + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def GradientFree(self) -> BoundedGradientFreeLeastSquaresParallelAlgorithms: + return BoundedGradientFreeLeastSquaresParallelAlgorithms() + + @property + def Local(self) -> BoundedLeastSquaresLocalParallelAlgorithms: + return BoundedLeastSquaresLocalParallelAlgorithms() + + +@dataclass(frozen=True) +class NonlinearConstrainedParallelScalarAlgorithms(AlgoSelection): + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Bounded(self) -> BoundedNonlinearConstrainedParallelScalarAlgorithms: + return BoundedNonlinearConstrainedParallelScalarAlgorithms() + + @property + def Global(self) -> GlobalNonlinearConstrainedParallelScalarAlgorithms: + return GlobalNonlinearConstrainedParallelScalarAlgorithms() + + @property + def GradientFree(self) -> GradientFreeNonlinearConstrainedParallelScalarAlgorithms: + return GradientFreeNonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class GlobalGradientBasedAlgorithms(AlgoSelection): + scipy_basinhopping: Type[ScipyBasinhopping] = ScipyBasinhopping + scipy_dual_annealing: Type[ScipyDualAnnealing] = ScipyDualAnnealing + scipy_shgo: Type[ScipySHGO] = ScipySHGO + + @property + def Bounded(self) -> BoundedGlobalGradientBasedAlgorithms: + return BoundedGlobalGradientBasedAlgorithms() + + @property + def NonlinearConstrained(self) -> GlobalGradientBasedNonlinearConstrainedAlgorithms: + return GlobalGradientBasedNonlinearConstrainedAlgorithms() + + @property + def Scalar(self) -> GlobalGradientBasedScalarAlgorithms: + return GlobalGradientBasedScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientBasedLocalAlgorithms(AlgoSelection): + bhhh: Type[BHHH] = BHHH + fides: Type[Fides] = Fides + ipopt: Type[Ipopt] = Ipopt + nlopt_ccsaq: Type[NloptCCSAQ] = NloptCCSAQ + nlopt_lbfgsb: Type[NloptLBFGSB] = NloptLBFGSB + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + nlopt_tnewton: Type[NloptTNewton] = NloptTNewton + nlopt_var: Type[NloptVAR] = NloptVAR + scipy_bfgs: Type[ScipyBFGS] = ScipyBFGS + scipy_conjugate_gradient: Type[ScipyConjugateGradient] = ScipyConjugateGradient + scipy_lbfgsb: Type[ScipyLBFGSB] = ScipyLBFGSB + scipy_ls_dogbox: Type[ScipyLSDogbox] = ScipyLSDogbox + scipy_ls_lm: Type[ScipyLSLM] = ScipyLSLM + scipy_ls_trf: Type[ScipyLSTRF] = ScipyLSTRF + scipy_newton_cg: Type[ScipyNewtonCG] = ScipyNewtonCG + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_truncated_newton: Type[ScipyTruncatedNewton] = ScipyTruncatedNewton + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def Bounded(self) -> BoundedGradientBasedLocalAlgorithms: + return BoundedGradientBasedLocalAlgorithms() + + @property + def LeastSquares(self) -> GradientBasedLeastSquaresLocalAlgorithms: + return GradientBasedLeastSquaresLocalAlgorithms() + + @property + def Likelihood(self) -> GradientBasedLikelihoodLocalAlgorithms: + return GradientBasedLikelihoodLocalAlgorithms() + + @property + def NonlinearConstrained(self) -> GradientBasedLocalNonlinearConstrainedAlgorithms: + return GradientBasedLocalNonlinearConstrainedAlgorithms() + + @property + def Scalar(self) -> GradientBasedLocalScalarAlgorithms: + return GradientBasedLocalScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientBasedAlgorithms(AlgoSelection): + fides: Type[Fides] = Fides + ipopt: Type[Ipopt] = Ipopt + nlopt_ccsaq: Type[NloptCCSAQ] = NloptCCSAQ + nlopt_lbfgsb: Type[NloptLBFGSB] = NloptLBFGSB + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + nlopt_tnewton: Type[NloptTNewton] = NloptTNewton + nlopt_var: Type[NloptVAR] = NloptVAR + scipy_basinhopping: Type[ScipyBasinhopping] = ScipyBasinhopping + scipy_dual_annealing: Type[ScipyDualAnnealing] = ScipyDualAnnealing + scipy_lbfgsb: Type[ScipyLBFGSB] = ScipyLBFGSB + scipy_ls_dogbox: Type[ScipyLSDogbox] = ScipyLSDogbox + scipy_ls_trf: Type[ScipyLSTRF] = ScipyLSTRF + scipy_shgo: Type[ScipySHGO] = ScipySHGO + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_truncated_newton: Type[ScipyTruncatedNewton] = ScipyTruncatedNewton + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def Global(self) -> BoundedGlobalGradientBasedAlgorithms: + return BoundedGlobalGradientBasedAlgorithms() + + @property + def LeastSquares(self) -> BoundedGradientBasedLeastSquaresAlgorithms: + return BoundedGradientBasedLeastSquaresAlgorithms() + + @property + def Local(self) -> BoundedGradientBasedLocalAlgorithms: + return BoundedGradientBasedLocalAlgorithms() + + @property + def NonlinearConstrained( + self, + ) -> BoundedGradientBasedNonlinearConstrainedAlgorithms: + return BoundedGradientBasedNonlinearConstrainedAlgorithms() + + @property + def Scalar(self) -> BoundedGradientBasedScalarAlgorithms: + return BoundedGradientBasedScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientBasedNonlinearConstrainedAlgorithms(AlgoSelection): + ipopt: Type[Ipopt] = Ipopt + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + scipy_shgo: Type[ScipySHGO] = ScipySHGO + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def Bounded(self) -> BoundedGradientBasedNonlinearConstrainedAlgorithms: + return BoundedGradientBasedNonlinearConstrainedAlgorithms() + + @property + def Global(self) -> GlobalGradientBasedNonlinearConstrainedAlgorithms: + return GlobalGradientBasedNonlinearConstrainedAlgorithms() + + @property + def Local(self) -> GradientBasedLocalNonlinearConstrainedAlgorithms: + return GradientBasedLocalNonlinearConstrainedAlgorithms() + + @property + def Scalar(self) -> GradientBasedNonlinearConstrainedScalarAlgorithms: + return GradientBasedNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientBasedScalarAlgorithms(AlgoSelection): + fides: Type[Fides] = Fides + ipopt: Type[Ipopt] = Ipopt + nlopt_ccsaq: Type[NloptCCSAQ] = NloptCCSAQ + nlopt_lbfgsb: Type[NloptLBFGSB] = NloptLBFGSB + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + nlopt_tnewton: Type[NloptTNewton] = NloptTNewton + nlopt_var: Type[NloptVAR] = NloptVAR + scipy_bfgs: Type[ScipyBFGS] = ScipyBFGS + scipy_basinhopping: Type[ScipyBasinhopping] = ScipyBasinhopping + scipy_conjugate_gradient: Type[ScipyConjugateGradient] = ScipyConjugateGradient + scipy_dual_annealing: Type[ScipyDualAnnealing] = ScipyDualAnnealing + scipy_lbfgsb: Type[ScipyLBFGSB] = ScipyLBFGSB + scipy_newton_cg: Type[ScipyNewtonCG] = ScipyNewtonCG + scipy_shgo: Type[ScipySHGO] = ScipySHGO + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_truncated_newton: Type[ScipyTruncatedNewton] = ScipyTruncatedNewton + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def Bounded(self) -> BoundedGradientBasedScalarAlgorithms: + return BoundedGradientBasedScalarAlgorithms() + + @property + def Global(self) -> GlobalGradientBasedScalarAlgorithms: + return GlobalGradientBasedScalarAlgorithms() + + @property + def Local(self) -> GradientBasedLocalScalarAlgorithms: + return GradientBasedLocalScalarAlgorithms() + + @property + def NonlinearConstrained(self) -> GradientBasedNonlinearConstrainedScalarAlgorithms: + return GradientBasedNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientBasedLeastSquaresAlgorithms(AlgoSelection): + scipy_ls_dogbox: Type[ScipyLSDogbox] = ScipyLSDogbox + scipy_ls_lm: Type[ScipyLSLM] = ScipyLSLM + scipy_ls_trf: Type[ScipyLSTRF] = ScipyLSTRF + + @property + def Bounded(self) -> BoundedGradientBasedLeastSquaresAlgorithms: + return BoundedGradientBasedLeastSquaresAlgorithms() + + @property + def Local(self) -> GradientBasedLeastSquaresLocalAlgorithms: + return GradientBasedLeastSquaresLocalAlgorithms() + + +@dataclass(frozen=True) +class GradientBasedLikelihoodAlgorithms(AlgoSelection): + bhhh: Type[BHHH] = BHHH + + @property + def Local(self) -> GradientBasedLikelihoodLocalAlgorithms: + return GradientBasedLikelihoodLocalAlgorithms() + + +@dataclass(frozen=True) +class GlobalGradientFreeAlgorithms(AlgoSelection): + nlopt_crs2_lm: Type[NloptCRS2LM] = NloptCRS2LM + nlopt_direct: Type[NloptDirect] = NloptDirect + nlopt_esch: Type[NloptESCH] = NloptESCH + nlopt_isres: Type[NloptISRES] = NloptISRES + pygmo_bee_colony: Type[PygmoBeeColony] = PygmoBeeColony + pygmo_cmaes: Type[PygmoCmaes] = PygmoCmaes + pygmo_compass_search: Type[PygmoCompassSearch] = PygmoCompassSearch + pygmo_de: Type[PygmoDe] = PygmoDe + pygmo_de1220: Type[PygmoDe1220] = PygmoDe1220 + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_gwo: Type[PygmoGwo] = PygmoGwo + pygmo_ihs: Type[PygmoIhs] = PygmoIhs + pygmo_mbh: Type[PygmoMbh] = PygmoMbh + pygmo_pso: Type[PygmoPso] = PygmoPso + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + pygmo_sade: Type[PygmoSade] = PygmoSade + pygmo_sea: Type[PygmoSea] = PygmoSea + pygmo_sga: Type[PygmoSga] = PygmoSga + pygmo_simulated_annealing: Type[PygmoSimulatedAnnealing] = PygmoSimulatedAnnealing + pygmo_xnes: Type[PygmoXnes] = PygmoXnes + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_direct: Type[ScipyDirect] = ScipyDirect + + @property + def Bounded(self) -> BoundedGlobalGradientFreeAlgorithms: + return BoundedGlobalGradientFreeAlgorithms() + + @property + def NonlinearConstrained(self) -> GlobalGradientFreeNonlinearConstrainedAlgorithms: + return GlobalGradientFreeNonlinearConstrainedAlgorithms() + + @property + def Parallel(self) -> GlobalGradientFreeParallelAlgorithms: + return GlobalGradientFreeParallelAlgorithms() + + @property + def Scalar(self) -> GlobalGradientFreeScalarAlgorithms: + return GlobalGradientFreeScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientFreeLocalAlgorithms(AlgoSelection): + nag_dfols: Type[NagDFOLS] = NagDFOLS + nag_pybobyqa: Type[NagPyBOBYQA] = NagPyBOBYQA + neldermead_parallel: Type[NelderMeadParallel] = NelderMeadParallel + nlopt_bobyqa: Type[NloptBOBYQA] = NloptBOBYQA + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_newuoa: Type[NloptNEWUOA] = NloptNEWUOA + nlopt_neldermead: Type[NloptNelderMead] = NloptNelderMead + nlopt_praxis: Type[NloptPRAXIS] = NloptPRAXIS + nlopt_sbplx: Type[NloptSbplx] = NloptSbplx + pounders: Type[Pounders] = Pounders + scipy_cobyla: Type[ScipyCOBYLA] = ScipyCOBYLA + scipy_neldermead: Type[ScipyNelderMead] = ScipyNelderMead + scipy_powell: Type[ScipyPowell] = ScipyPowell + tao_pounders: Type[TAOPounders] = TAOPounders + tranquilo: Type[Tranquilo] = Tranquilo + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Bounded(self) -> BoundedGradientFreeLocalAlgorithms: + return BoundedGradientFreeLocalAlgorithms() + + @property + def LeastSquares(self) -> GradientFreeLeastSquaresLocalAlgorithms: + return GradientFreeLeastSquaresLocalAlgorithms() + + @property + def NonlinearConstrained(self) -> GradientFreeLocalNonlinearConstrainedAlgorithms: + return GradientFreeLocalNonlinearConstrainedAlgorithms() + + @property + def Parallel(self) -> GradientFreeLocalParallelAlgorithms: + return GradientFreeLocalParallelAlgorithms() + + @property + def Scalar(self) -> GradientFreeLocalScalarAlgorithms: + return GradientFreeLocalScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGradientFreeAlgorithms(AlgoSelection): + nag_dfols: Type[NagDFOLS] = NagDFOLS + nag_pybobyqa: Type[NagPyBOBYQA] = NagPyBOBYQA + nlopt_bobyqa: Type[NloptBOBYQA] = NloptBOBYQA + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_crs2_lm: Type[NloptCRS2LM] = NloptCRS2LM + nlopt_direct: Type[NloptDirect] = NloptDirect + nlopt_esch: Type[NloptESCH] = NloptESCH + nlopt_isres: Type[NloptISRES] = NloptISRES + nlopt_newuoa: Type[NloptNEWUOA] = NloptNEWUOA + nlopt_neldermead: Type[NloptNelderMead] = NloptNelderMead + nlopt_sbplx: Type[NloptSbplx] = NloptSbplx + pounders: Type[Pounders] = Pounders + pygmo_bee_colony: Type[PygmoBeeColony] = PygmoBeeColony + pygmo_cmaes: Type[PygmoCmaes] = PygmoCmaes + pygmo_compass_search: Type[PygmoCompassSearch] = PygmoCompassSearch + pygmo_de: Type[PygmoDe] = PygmoDe + pygmo_de1220: Type[PygmoDe1220] = PygmoDe1220 + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_gwo: Type[PygmoGwo] = PygmoGwo + pygmo_ihs: Type[PygmoIhs] = PygmoIhs + pygmo_mbh: Type[PygmoMbh] = PygmoMbh + pygmo_pso: Type[PygmoPso] = PygmoPso + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + pygmo_sade: Type[PygmoSade] = PygmoSade + pygmo_sea: Type[PygmoSea] = PygmoSea + pygmo_sga: Type[PygmoSga] = PygmoSga + pygmo_simulated_annealing: Type[PygmoSimulatedAnnealing] = PygmoSimulatedAnnealing + pygmo_xnes: Type[PygmoXnes] = PygmoXnes + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_direct: Type[ScipyDirect] = ScipyDirect + scipy_neldermead: Type[ScipyNelderMead] = ScipyNelderMead + scipy_powell: Type[ScipyPowell] = ScipyPowell + tao_pounders: Type[TAOPounders] = TAOPounders + tranquilo: Type[Tranquilo] = Tranquilo + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Global(self) -> BoundedGlobalGradientFreeAlgorithms: + return BoundedGlobalGradientFreeAlgorithms() + + @property + def LeastSquares(self) -> BoundedGradientFreeLeastSquaresAlgorithms: + return BoundedGradientFreeLeastSquaresAlgorithms() + + @property + def Local(self) -> BoundedGradientFreeLocalAlgorithms: + return BoundedGradientFreeLocalAlgorithms() + + @property + def NonlinearConstrained(self) -> BoundedGradientFreeNonlinearConstrainedAlgorithms: + return BoundedGradientFreeNonlinearConstrainedAlgorithms() + + @property + def Parallel(self) -> BoundedGradientFreeParallelAlgorithms: + return BoundedGradientFreeParallelAlgorithms() + + @property + def Scalar(self) -> BoundedGradientFreeScalarAlgorithms: + return BoundedGradientFreeScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientFreeNonlinearConstrainedAlgorithms(AlgoSelection): + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_isres: Type[NloptISRES] = NloptISRES + scipy_cobyla: Type[ScipyCOBYLA] = ScipyCOBYLA + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Bounded(self) -> BoundedGradientFreeNonlinearConstrainedAlgorithms: + return BoundedGradientFreeNonlinearConstrainedAlgorithms() + + @property + def Global(self) -> GlobalGradientFreeNonlinearConstrainedAlgorithms: + return GlobalGradientFreeNonlinearConstrainedAlgorithms() + + @property + def Local(self) -> GradientFreeLocalNonlinearConstrainedAlgorithms: + return GradientFreeLocalNonlinearConstrainedAlgorithms() + + @property + def Parallel(self) -> GradientFreeNonlinearConstrainedParallelAlgorithms: + return GradientFreeNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> GradientFreeNonlinearConstrainedScalarAlgorithms: + return GradientFreeNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientFreeScalarAlgorithms(AlgoSelection): + nag_pybobyqa: Type[NagPyBOBYQA] = NagPyBOBYQA + neldermead_parallel: Type[NelderMeadParallel] = NelderMeadParallel + nlopt_bobyqa: Type[NloptBOBYQA] = NloptBOBYQA + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_crs2_lm: Type[NloptCRS2LM] = NloptCRS2LM + nlopt_direct: Type[NloptDirect] = NloptDirect + nlopt_esch: Type[NloptESCH] = NloptESCH + nlopt_isres: Type[NloptISRES] = NloptISRES + nlopt_newuoa: Type[NloptNEWUOA] = NloptNEWUOA + nlopt_neldermead: Type[NloptNelderMead] = NloptNelderMead + nlopt_praxis: Type[NloptPRAXIS] = NloptPRAXIS + nlopt_sbplx: Type[NloptSbplx] = NloptSbplx + pygmo_bee_colony: Type[PygmoBeeColony] = PygmoBeeColony + pygmo_cmaes: Type[PygmoCmaes] = PygmoCmaes + pygmo_compass_search: Type[PygmoCompassSearch] = PygmoCompassSearch + pygmo_de: Type[PygmoDe] = PygmoDe + pygmo_de1220: Type[PygmoDe1220] = PygmoDe1220 + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_gwo: Type[PygmoGwo] = PygmoGwo + pygmo_ihs: Type[PygmoIhs] = PygmoIhs + pygmo_mbh: Type[PygmoMbh] = PygmoMbh + pygmo_pso: Type[PygmoPso] = PygmoPso + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + pygmo_sade: Type[PygmoSade] = PygmoSade + pygmo_sea: Type[PygmoSea] = PygmoSea + pygmo_sga: Type[PygmoSga] = PygmoSga + pygmo_simulated_annealing: Type[PygmoSimulatedAnnealing] = PygmoSimulatedAnnealing + pygmo_xnes: Type[PygmoXnes] = PygmoXnes + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_cobyla: Type[ScipyCOBYLA] = ScipyCOBYLA + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_direct: Type[ScipyDirect] = ScipyDirect + scipy_neldermead: Type[ScipyNelderMead] = ScipyNelderMead + scipy_powell: Type[ScipyPowell] = ScipyPowell + tranquilo: Type[Tranquilo] = Tranquilo + + @property + def Bounded(self) -> BoundedGradientFreeScalarAlgorithms: + return BoundedGradientFreeScalarAlgorithms() + + @property + def Global(self) -> GlobalGradientFreeScalarAlgorithms: + return GlobalGradientFreeScalarAlgorithms() + + @property + def Local(self) -> GradientFreeLocalScalarAlgorithms: + return GradientFreeLocalScalarAlgorithms() + + @property + def NonlinearConstrained(self) -> GradientFreeNonlinearConstrainedScalarAlgorithms: + return GradientFreeNonlinearConstrainedScalarAlgorithms() + + @property + def Parallel(self) -> GradientFreeParallelScalarAlgorithms: + return GradientFreeParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientFreeLeastSquaresAlgorithms(AlgoSelection): + nag_dfols: Type[NagDFOLS] = NagDFOLS + pounders: Type[Pounders] = Pounders + tao_pounders: Type[TAOPounders] = TAOPounders + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Bounded(self) -> BoundedGradientFreeLeastSquaresAlgorithms: + return BoundedGradientFreeLeastSquaresAlgorithms() + + @property + def Local(self) -> GradientFreeLeastSquaresLocalAlgorithms: + return GradientFreeLeastSquaresLocalAlgorithms() + + @property + def Parallel(self) -> GradientFreeLeastSquaresParallelAlgorithms: + return GradientFreeLeastSquaresParallelAlgorithms() + + +@dataclass(frozen=True) +class GradientFreeParallelAlgorithms(AlgoSelection): + neldermead_parallel: Type[NelderMeadParallel] = NelderMeadParallel + pounders: Type[Pounders] = Pounders + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + tranquilo: Type[Tranquilo] = Tranquilo + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Bounded(self) -> BoundedGradientFreeParallelAlgorithms: + return BoundedGradientFreeParallelAlgorithms() + + @property + def Global(self) -> GlobalGradientFreeParallelAlgorithms: + return GlobalGradientFreeParallelAlgorithms() + + @property + def LeastSquares(self) -> GradientFreeLeastSquaresParallelAlgorithms: + return GradientFreeLeastSquaresParallelAlgorithms() + + @property + def Local(self) -> GradientFreeLocalParallelAlgorithms: + return GradientFreeLocalParallelAlgorithms() + + @property + def NonlinearConstrained( + self, + ) -> GradientFreeNonlinearConstrainedParallelAlgorithms: + return GradientFreeNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> GradientFreeParallelScalarAlgorithms: + return GradientFreeParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedGlobalAlgorithms(AlgoSelection): + nlopt_crs2_lm: Type[NloptCRS2LM] = NloptCRS2LM + nlopt_direct: Type[NloptDirect] = NloptDirect + nlopt_esch: Type[NloptESCH] = NloptESCH + nlopt_isres: Type[NloptISRES] = NloptISRES + pygmo_bee_colony: Type[PygmoBeeColony] = PygmoBeeColony + pygmo_cmaes: Type[PygmoCmaes] = PygmoCmaes + pygmo_compass_search: Type[PygmoCompassSearch] = PygmoCompassSearch + pygmo_de: Type[PygmoDe] = PygmoDe + pygmo_de1220: Type[PygmoDe1220] = PygmoDe1220 + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_gwo: Type[PygmoGwo] = PygmoGwo + pygmo_ihs: Type[PygmoIhs] = PygmoIhs + pygmo_mbh: Type[PygmoMbh] = PygmoMbh + pygmo_pso: Type[PygmoPso] = PygmoPso + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + pygmo_sade: Type[PygmoSade] = PygmoSade + pygmo_sea: Type[PygmoSea] = PygmoSea + pygmo_sga: Type[PygmoSga] = PygmoSga + pygmo_simulated_annealing: Type[PygmoSimulatedAnnealing] = PygmoSimulatedAnnealing + pygmo_xnes: Type[PygmoXnes] = PygmoXnes + scipy_basinhopping: Type[ScipyBasinhopping] = ScipyBasinhopping + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_direct: Type[ScipyDirect] = ScipyDirect + scipy_dual_annealing: Type[ScipyDualAnnealing] = ScipyDualAnnealing + scipy_shgo: Type[ScipySHGO] = ScipySHGO + + @property + def GradientBased(self) -> BoundedGlobalGradientBasedAlgorithms: + return BoundedGlobalGradientBasedAlgorithms() + + @property + def GradientFree(self) -> BoundedGlobalGradientFreeAlgorithms: + return BoundedGlobalGradientFreeAlgorithms() + + @property + def NonlinearConstrained(self) -> BoundedGlobalNonlinearConstrainedAlgorithms: + return BoundedGlobalNonlinearConstrainedAlgorithms() + + @property + def Parallel(self) -> BoundedGlobalParallelAlgorithms: + return BoundedGlobalParallelAlgorithms() + + @property + def Scalar(self) -> BoundedGlobalScalarAlgorithms: + return BoundedGlobalScalarAlgorithms() + + +@dataclass(frozen=True) +class GlobalNonlinearConstrainedAlgorithms(AlgoSelection): + nlopt_isres: Type[NloptISRES] = NloptISRES + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_shgo: Type[ScipySHGO] = ScipySHGO + + @property + def Bounded(self) -> BoundedGlobalNonlinearConstrainedAlgorithms: + return BoundedGlobalNonlinearConstrainedAlgorithms() + + @property + def GradientBased(self) -> GlobalGradientBasedNonlinearConstrainedAlgorithms: + return GlobalGradientBasedNonlinearConstrainedAlgorithms() + + @property + def GradientFree(self) -> GlobalGradientFreeNonlinearConstrainedAlgorithms: + return GlobalGradientFreeNonlinearConstrainedAlgorithms() + + @property + def Parallel(self) -> GlobalNonlinearConstrainedParallelAlgorithms: + return GlobalNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> GlobalNonlinearConstrainedScalarAlgorithms: + return GlobalNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class GlobalScalarAlgorithms(AlgoSelection): + nlopt_crs2_lm: Type[NloptCRS2LM] = NloptCRS2LM + nlopt_direct: Type[NloptDirect] = NloptDirect + nlopt_esch: Type[NloptESCH] = NloptESCH + nlopt_isres: Type[NloptISRES] = NloptISRES + pygmo_bee_colony: Type[PygmoBeeColony] = PygmoBeeColony + pygmo_cmaes: Type[PygmoCmaes] = PygmoCmaes + pygmo_compass_search: Type[PygmoCompassSearch] = PygmoCompassSearch + pygmo_de: Type[PygmoDe] = PygmoDe + pygmo_de1220: Type[PygmoDe1220] = PygmoDe1220 + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_gwo: Type[PygmoGwo] = PygmoGwo + pygmo_ihs: Type[PygmoIhs] = PygmoIhs + pygmo_mbh: Type[PygmoMbh] = PygmoMbh + pygmo_pso: Type[PygmoPso] = PygmoPso + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + pygmo_sade: Type[PygmoSade] = PygmoSade + pygmo_sea: Type[PygmoSea] = PygmoSea + pygmo_sga: Type[PygmoSga] = PygmoSga + pygmo_simulated_annealing: Type[PygmoSimulatedAnnealing] = PygmoSimulatedAnnealing + pygmo_xnes: Type[PygmoXnes] = PygmoXnes + scipy_basinhopping: Type[ScipyBasinhopping] = ScipyBasinhopping + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_direct: Type[ScipyDirect] = ScipyDirect + scipy_dual_annealing: Type[ScipyDualAnnealing] = ScipyDualAnnealing + scipy_shgo: Type[ScipySHGO] = ScipySHGO + + @property + def Bounded(self) -> BoundedGlobalScalarAlgorithms: + return BoundedGlobalScalarAlgorithms() + + @property + def GradientBased(self) -> GlobalGradientBasedScalarAlgorithms: + return GlobalGradientBasedScalarAlgorithms() + + @property + def GradientFree(self) -> GlobalGradientFreeScalarAlgorithms: + return GlobalGradientFreeScalarAlgorithms() + + @property + def NonlinearConstrained(self) -> GlobalNonlinearConstrainedScalarAlgorithms: + return GlobalNonlinearConstrainedScalarAlgorithms() + + @property + def Parallel(self) -> GlobalParallelScalarAlgorithms: + return GlobalParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class GlobalParallelAlgorithms(AlgoSelection): + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Bounded(self) -> BoundedGlobalParallelAlgorithms: + return BoundedGlobalParallelAlgorithms() + + @property + def GradientFree(self) -> GlobalGradientFreeParallelAlgorithms: + return GlobalGradientFreeParallelAlgorithms() + + @property + def NonlinearConstrained(self) -> GlobalNonlinearConstrainedParallelAlgorithms: + return GlobalNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> GlobalParallelScalarAlgorithms: + return GlobalParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedLocalAlgorithms(AlgoSelection): + fides: Type[Fides] = Fides + ipopt: Type[Ipopt] = Ipopt + nag_dfols: Type[NagDFOLS] = NagDFOLS + nag_pybobyqa: Type[NagPyBOBYQA] = NagPyBOBYQA + nlopt_bobyqa: Type[NloptBOBYQA] = NloptBOBYQA + nlopt_ccsaq: Type[NloptCCSAQ] = NloptCCSAQ + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_lbfgsb: Type[NloptLBFGSB] = NloptLBFGSB + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_newuoa: Type[NloptNEWUOA] = NloptNEWUOA + nlopt_neldermead: Type[NloptNelderMead] = NloptNelderMead + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + nlopt_sbplx: Type[NloptSbplx] = NloptSbplx + nlopt_tnewton: Type[NloptTNewton] = NloptTNewton + nlopt_var: Type[NloptVAR] = NloptVAR + pounders: Type[Pounders] = Pounders + scipy_lbfgsb: Type[ScipyLBFGSB] = ScipyLBFGSB + scipy_ls_dogbox: Type[ScipyLSDogbox] = ScipyLSDogbox + scipy_ls_trf: Type[ScipyLSTRF] = ScipyLSTRF + scipy_neldermead: Type[ScipyNelderMead] = ScipyNelderMead + scipy_powell: Type[ScipyPowell] = ScipyPowell + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_truncated_newton: Type[ScipyTruncatedNewton] = ScipyTruncatedNewton + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + tao_pounders: Type[TAOPounders] = TAOPounders + tranquilo: Type[Tranquilo] = Tranquilo + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def GradientBased(self) -> BoundedGradientBasedLocalAlgorithms: + return BoundedGradientBasedLocalAlgorithms() + + @property + def GradientFree(self) -> BoundedGradientFreeLocalAlgorithms: + return BoundedGradientFreeLocalAlgorithms() + + @property + def LeastSquares(self) -> BoundedLeastSquaresLocalAlgorithms: + return BoundedLeastSquaresLocalAlgorithms() + + @property + def NonlinearConstrained(self) -> BoundedLocalNonlinearConstrainedAlgorithms: + return BoundedLocalNonlinearConstrainedAlgorithms() + + @property + def Parallel(self) -> BoundedLocalParallelAlgorithms: + return BoundedLocalParallelAlgorithms() + + @property + def Scalar(self) -> BoundedLocalScalarAlgorithms: + return BoundedLocalScalarAlgorithms() + + +@dataclass(frozen=True) +class LocalNonlinearConstrainedAlgorithms(AlgoSelection): + ipopt: Type[Ipopt] = Ipopt + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + scipy_cobyla: Type[ScipyCOBYLA] = ScipyCOBYLA + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def Bounded(self) -> BoundedLocalNonlinearConstrainedAlgorithms: + return BoundedLocalNonlinearConstrainedAlgorithms() + + @property + def GradientBased(self) -> GradientBasedLocalNonlinearConstrainedAlgorithms: + return GradientBasedLocalNonlinearConstrainedAlgorithms() + + @property + def GradientFree(self) -> GradientFreeLocalNonlinearConstrainedAlgorithms: + return GradientFreeLocalNonlinearConstrainedAlgorithms() + + @property + def Scalar(self) -> LocalNonlinearConstrainedScalarAlgorithms: + return LocalNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class LocalScalarAlgorithms(AlgoSelection): + fides: Type[Fides] = Fides + ipopt: Type[Ipopt] = Ipopt + nag_pybobyqa: Type[NagPyBOBYQA] = NagPyBOBYQA + neldermead_parallel: Type[NelderMeadParallel] = NelderMeadParallel + nlopt_bobyqa: Type[NloptBOBYQA] = NloptBOBYQA + nlopt_ccsaq: Type[NloptCCSAQ] = NloptCCSAQ + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_lbfgsb: Type[NloptLBFGSB] = NloptLBFGSB + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_newuoa: Type[NloptNEWUOA] = NloptNEWUOA + nlopt_neldermead: Type[NloptNelderMead] = NloptNelderMead + nlopt_praxis: Type[NloptPRAXIS] = NloptPRAXIS + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + nlopt_sbplx: Type[NloptSbplx] = NloptSbplx + nlopt_tnewton: Type[NloptTNewton] = NloptTNewton + nlopt_var: Type[NloptVAR] = NloptVAR + scipy_bfgs: Type[ScipyBFGS] = ScipyBFGS + scipy_cobyla: Type[ScipyCOBYLA] = ScipyCOBYLA + scipy_conjugate_gradient: Type[ScipyConjugateGradient] = ScipyConjugateGradient + scipy_lbfgsb: Type[ScipyLBFGSB] = ScipyLBFGSB + scipy_neldermead: Type[ScipyNelderMead] = ScipyNelderMead + scipy_newton_cg: Type[ScipyNewtonCG] = ScipyNewtonCG + scipy_powell: Type[ScipyPowell] = ScipyPowell + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_truncated_newton: Type[ScipyTruncatedNewton] = ScipyTruncatedNewton + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + tranquilo: Type[Tranquilo] = Tranquilo + + @property + def Bounded(self) -> BoundedLocalScalarAlgorithms: + return BoundedLocalScalarAlgorithms() + + @property + def GradientBased(self) -> GradientBasedLocalScalarAlgorithms: + return GradientBasedLocalScalarAlgorithms() + + @property + def GradientFree(self) -> GradientFreeLocalScalarAlgorithms: + return GradientFreeLocalScalarAlgorithms() + + @property + def NonlinearConstrained(self) -> LocalNonlinearConstrainedScalarAlgorithms: + return LocalNonlinearConstrainedScalarAlgorithms() + + @property + def Parallel(self) -> LocalParallelScalarAlgorithms: + return LocalParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class LeastSquaresLocalAlgorithms(AlgoSelection): + nag_dfols: Type[NagDFOLS] = NagDFOLS + pounders: Type[Pounders] = Pounders + scipy_ls_dogbox: Type[ScipyLSDogbox] = ScipyLSDogbox + scipy_ls_lm: Type[ScipyLSLM] = ScipyLSLM + scipy_ls_trf: Type[ScipyLSTRF] = ScipyLSTRF + tao_pounders: Type[TAOPounders] = TAOPounders + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Bounded(self) -> BoundedLeastSquaresLocalAlgorithms: + return BoundedLeastSquaresLocalAlgorithms() + + @property + def GradientBased(self) -> GradientBasedLeastSquaresLocalAlgorithms: + return GradientBasedLeastSquaresLocalAlgorithms() + + @property + def GradientFree(self) -> GradientFreeLeastSquaresLocalAlgorithms: + return GradientFreeLeastSquaresLocalAlgorithms() + + @property + def Parallel(self) -> LeastSquaresLocalParallelAlgorithms: + return LeastSquaresLocalParallelAlgorithms() + + +@dataclass(frozen=True) +class LikelihoodLocalAlgorithms(AlgoSelection): + bhhh: Type[BHHH] = BHHH + + @property + def GradientBased(self) -> GradientBasedLikelihoodLocalAlgorithms: + return GradientBasedLikelihoodLocalAlgorithms() + + +@dataclass(frozen=True) +class LocalParallelAlgorithms(AlgoSelection): + neldermead_parallel: Type[NelderMeadParallel] = NelderMeadParallel + pounders: Type[Pounders] = Pounders + tranquilo: Type[Tranquilo] = Tranquilo + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Bounded(self) -> BoundedLocalParallelAlgorithms: + return BoundedLocalParallelAlgorithms() + + @property + def GradientFree(self) -> GradientFreeLocalParallelAlgorithms: + return GradientFreeLocalParallelAlgorithms() + + @property + def LeastSquares(self) -> LeastSquaresLocalParallelAlgorithms: + return LeastSquaresLocalParallelAlgorithms() + + @property + def Scalar(self) -> LocalParallelScalarAlgorithms: + return LocalParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedNonlinearConstrainedAlgorithms(AlgoSelection): + ipopt: Type[Ipopt] = Ipopt + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_isres: Type[NloptISRES] = NloptISRES + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_shgo: Type[ScipySHGO] = ScipySHGO + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def Global(self) -> BoundedGlobalNonlinearConstrainedAlgorithms: + return BoundedGlobalNonlinearConstrainedAlgorithms() + + @property + def GradientBased(self) -> BoundedGradientBasedNonlinearConstrainedAlgorithms: + return BoundedGradientBasedNonlinearConstrainedAlgorithms() + + @property + def GradientFree(self) -> BoundedGradientFreeNonlinearConstrainedAlgorithms: + return BoundedGradientFreeNonlinearConstrainedAlgorithms() + + @property + def Local(self) -> BoundedLocalNonlinearConstrainedAlgorithms: + return BoundedLocalNonlinearConstrainedAlgorithms() + + @property + def Parallel(self) -> BoundedNonlinearConstrainedParallelAlgorithms: + return BoundedNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> BoundedNonlinearConstrainedScalarAlgorithms: + return BoundedNonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedScalarAlgorithms(AlgoSelection): + fides: Type[Fides] = Fides + ipopt: Type[Ipopt] = Ipopt + nag_pybobyqa: Type[NagPyBOBYQA] = NagPyBOBYQA + nlopt_bobyqa: Type[NloptBOBYQA] = NloptBOBYQA + nlopt_ccsaq: Type[NloptCCSAQ] = NloptCCSAQ + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_crs2_lm: Type[NloptCRS2LM] = NloptCRS2LM + nlopt_direct: Type[NloptDirect] = NloptDirect + nlopt_esch: Type[NloptESCH] = NloptESCH + nlopt_isres: Type[NloptISRES] = NloptISRES + nlopt_lbfgsb: Type[NloptLBFGSB] = NloptLBFGSB + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_newuoa: Type[NloptNEWUOA] = NloptNEWUOA + nlopt_neldermead: Type[NloptNelderMead] = NloptNelderMead + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + nlopt_sbplx: Type[NloptSbplx] = NloptSbplx + nlopt_tnewton: Type[NloptTNewton] = NloptTNewton + nlopt_var: Type[NloptVAR] = NloptVAR + pygmo_bee_colony: Type[PygmoBeeColony] = PygmoBeeColony + pygmo_cmaes: Type[PygmoCmaes] = PygmoCmaes + pygmo_compass_search: Type[PygmoCompassSearch] = PygmoCompassSearch + pygmo_de: Type[PygmoDe] = PygmoDe + pygmo_de1220: Type[PygmoDe1220] = PygmoDe1220 + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_gwo: Type[PygmoGwo] = PygmoGwo + pygmo_ihs: Type[PygmoIhs] = PygmoIhs + pygmo_mbh: Type[PygmoMbh] = PygmoMbh + pygmo_pso: Type[PygmoPso] = PygmoPso + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + pygmo_sade: Type[PygmoSade] = PygmoSade + pygmo_sea: Type[PygmoSea] = PygmoSea + pygmo_sga: Type[PygmoSga] = PygmoSga + pygmo_simulated_annealing: Type[PygmoSimulatedAnnealing] = PygmoSimulatedAnnealing + pygmo_xnes: Type[PygmoXnes] = PygmoXnes + scipy_basinhopping: Type[ScipyBasinhopping] = ScipyBasinhopping + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_direct: Type[ScipyDirect] = ScipyDirect + scipy_dual_annealing: Type[ScipyDualAnnealing] = ScipyDualAnnealing + scipy_lbfgsb: Type[ScipyLBFGSB] = ScipyLBFGSB + scipy_neldermead: Type[ScipyNelderMead] = ScipyNelderMead + scipy_powell: Type[ScipyPowell] = ScipyPowell + scipy_shgo: Type[ScipySHGO] = ScipySHGO + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_truncated_newton: Type[ScipyTruncatedNewton] = ScipyTruncatedNewton + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + tranquilo: Type[Tranquilo] = Tranquilo + + @property + def Global(self) -> BoundedGlobalScalarAlgorithms: + return BoundedGlobalScalarAlgorithms() + + @property + def GradientBased(self) -> BoundedGradientBasedScalarAlgorithms: + return BoundedGradientBasedScalarAlgorithms() + + @property + def GradientFree(self) -> BoundedGradientFreeScalarAlgorithms: + return BoundedGradientFreeScalarAlgorithms() + + @property + def Local(self) -> BoundedLocalScalarAlgorithms: + return BoundedLocalScalarAlgorithms() + + @property + def NonlinearConstrained(self) -> BoundedNonlinearConstrainedScalarAlgorithms: + return BoundedNonlinearConstrainedScalarAlgorithms() + + @property + def Parallel(self) -> BoundedParallelScalarAlgorithms: + return BoundedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedLeastSquaresAlgorithms(AlgoSelection): + nag_dfols: Type[NagDFOLS] = NagDFOLS + pounders: Type[Pounders] = Pounders + scipy_ls_dogbox: Type[ScipyLSDogbox] = ScipyLSDogbox + scipy_ls_trf: Type[ScipyLSTRF] = ScipyLSTRF + tao_pounders: Type[TAOPounders] = TAOPounders + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def GradientBased(self) -> BoundedGradientBasedLeastSquaresAlgorithms: + return BoundedGradientBasedLeastSquaresAlgorithms() + + @property + def GradientFree(self) -> BoundedGradientFreeLeastSquaresAlgorithms: + return BoundedGradientFreeLeastSquaresAlgorithms() + + @property + def Local(self) -> BoundedLeastSquaresLocalAlgorithms: + return BoundedLeastSquaresLocalAlgorithms() + + @property + def Parallel(self) -> BoundedLeastSquaresParallelAlgorithms: + return BoundedLeastSquaresParallelAlgorithms() + + +@dataclass(frozen=True) +class BoundedParallelAlgorithms(AlgoSelection): + pounders: Type[Pounders] = Pounders + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + tranquilo: Type[Tranquilo] = Tranquilo + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Global(self) -> BoundedGlobalParallelAlgorithms: + return BoundedGlobalParallelAlgorithms() + + @property + def GradientFree(self) -> BoundedGradientFreeParallelAlgorithms: + return BoundedGradientFreeParallelAlgorithms() + + @property + def LeastSquares(self) -> BoundedLeastSquaresParallelAlgorithms: + return BoundedLeastSquaresParallelAlgorithms() + + @property + def Local(self) -> BoundedLocalParallelAlgorithms: + return BoundedLocalParallelAlgorithms() + + @property + def NonlinearConstrained(self) -> BoundedNonlinearConstrainedParallelAlgorithms: + return BoundedNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> BoundedParallelScalarAlgorithms: + return BoundedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class NonlinearConstrainedScalarAlgorithms(AlgoSelection): + ipopt: Type[Ipopt] = Ipopt + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_isres: Type[NloptISRES] = NloptISRES + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + scipy_cobyla: Type[ScipyCOBYLA] = ScipyCOBYLA + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_shgo: Type[ScipySHGO] = ScipySHGO + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def Bounded(self) -> BoundedNonlinearConstrainedScalarAlgorithms: + return BoundedNonlinearConstrainedScalarAlgorithms() + + @property + def Global(self) -> GlobalNonlinearConstrainedScalarAlgorithms: + return GlobalNonlinearConstrainedScalarAlgorithms() + + @property + def GradientBased(self) -> GradientBasedNonlinearConstrainedScalarAlgorithms: + return GradientBasedNonlinearConstrainedScalarAlgorithms() + + @property + def GradientFree(self) -> GradientFreeNonlinearConstrainedScalarAlgorithms: + return GradientFreeNonlinearConstrainedScalarAlgorithms() + + @property + def Local(self) -> LocalNonlinearConstrainedScalarAlgorithms: + return LocalNonlinearConstrainedScalarAlgorithms() + + @property + def Parallel(self) -> NonlinearConstrainedParallelScalarAlgorithms: + return NonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class NonlinearConstrainedParallelAlgorithms(AlgoSelection): + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + + @property + def Bounded(self) -> BoundedNonlinearConstrainedParallelAlgorithms: + return BoundedNonlinearConstrainedParallelAlgorithms() + + @property + def Global(self) -> GlobalNonlinearConstrainedParallelAlgorithms: + return GlobalNonlinearConstrainedParallelAlgorithms() + + @property + def GradientFree(self) -> GradientFreeNonlinearConstrainedParallelAlgorithms: + return GradientFreeNonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> NonlinearConstrainedParallelScalarAlgorithms: + return NonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class ParallelScalarAlgorithms(AlgoSelection): + neldermead_parallel: Type[NelderMeadParallel] = NelderMeadParallel + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + tranquilo: Type[Tranquilo] = Tranquilo + + @property + def Bounded(self) -> BoundedParallelScalarAlgorithms: + return BoundedParallelScalarAlgorithms() + + @property + def Global(self) -> GlobalParallelScalarAlgorithms: + return GlobalParallelScalarAlgorithms() + + @property + def GradientFree(self) -> GradientFreeParallelScalarAlgorithms: + return GradientFreeParallelScalarAlgorithms() + + @property + def Local(self) -> LocalParallelScalarAlgorithms: + return LocalParallelScalarAlgorithms() + + @property + def NonlinearConstrained(self) -> NonlinearConstrainedParallelScalarAlgorithms: + return NonlinearConstrainedParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class LeastSquaresParallelAlgorithms(AlgoSelection): + pounders: Type[Pounders] = Pounders + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Bounded(self) -> BoundedLeastSquaresParallelAlgorithms: + return BoundedLeastSquaresParallelAlgorithms() + + @property + def GradientFree(self) -> GradientFreeLeastSquaresParallelAlgorithms: + return GradientFreeLeastSquaresParallelAlgorithms() + + @property + def Local(self) -> LeastSquaresLocalParallelAlgorithms: + return LeastSquaresLocalParallelAlgorithms() + + +@dataclass(frozen=True) +class GradientBasedAlgorithms(AlgoSelection): + bhhh: Type[BHHH] = BHHH + fides: Type[Fides] = Fides + ipopt: Type[Ipopt] = Ipopt + nlopt_ccsaq: Type[NloptCCSAQ] = NloptCCSAQ + nlopt_lbfgsb: Type[NloptLBFGSB] = NloptLBFGSB + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + nlopt_tnewton: Type[NloptTNewton] = NloptTNewton + nlopt_var: Type[NloptVAR] = NloptVAR + scipy_bfgs: Type[ScipyBFGS] = ScipyBFGS + scipy_basinhopping: Type[ScipyBasinhopping] = ScipyBasinhopping + scipy_conjugate_gradient: Type[ScipyConjugateGradient] = ScipyConjugateGradient + scipy_dual_annealing: Type[ScipyDualAnnealing] = ScipyDualAnnealing + scipy_lbfgsb: Type[ScipyLBFGSB] = ScipyLBFGSB + scipy_ls_dogbox: Type[ScipyLSDogbox] = ScipyLSDogbox + scipy_ls_lm: Type[ScipyLSLM] = ScipyLSLM + scipy_ls_trf: Type[ScipyLSTRF] = ScipyLSTRF + scipy_newton_cg: Type[ScipyNewtonCG] = ScipyNewtonCG + scipy_shgo: Type[ScipySHGO] = ScipySHGO + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_truncated_newton: Type[ScipyTruncatedNewton] = ScipyTruncatedNewton + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def Bounded(self) -> BoundedGradientBasedAlgorithms: + return BoundedGradientBasedAlgorithms() + + @property + def Global(self) -> GlobalGradientBasedAlgorithms: + return GlobalGradientBasedAlgorithms() + + @property + def LeastSquares(self) -> GradientBasedLeastSquaresAlgorithms: + return GradientBasedLeastSquaresAlgorithms() + + @property + def Likelihood(self) -> GradientBasedLikelihoodAlgorithms: + return GradientBasedLikelihoodAlgorithms() + + @property + def Local(self) -> GradientBasedLocalAlgorithms: + return GradientBasedLocalAlgorithms() + + @property + def NonlinearConstrained(self) -> GradientBasedNonlinearConstrainedAlgorithms: + return GradientBasedNonlinearConstrainedAlgorithms() + + @property + def Scalar(self) -> GradientBasedScalarAlgorithms: + return GradientBasedScalarAlgorithms() + + +@dataclass(frozen=True) +class GradientFreeAlgorithms(AlgoSelection): + nag_dfols: Type[NagDFOLS] = NagDFOLS + nag_pybobyqa: Type[NagPyBOBYQA] = NagPyBOBYQA + neldermead_parallel: Type[NelderMeadParallel] = NelderMeadParallel + nlopt_bobyqa: Type[NloptBOBYQA] = NloptBOBYQA + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_crs2_lm: Type[NloptCRS2LM] = NloptCRS2LM + nlopt_direct: Type[NloptDirect] = NloptDirect + nlopt_esch: Type[NloptESCH] = NloptESCH + nlopt_isres: Type[NloptISRES] = NloptISRES + nlopt_newuoa: Type[NloptNEWUOA] = NloptNEWUOA + nlopt_neldermead: Type[NloptNelderMead] = NloptNelderMead + nlopt_praxis: Type[NloptPRAXIS] = NloptPRAXIS + nlopt_sbplx: Type[NloptSbplx] = NloptSbplx + pounders: Type[Pounders] = Pounders + pygmo_bee_colony: Type[PygmoBeeColony] = PygmoBeeColony + pygmo_cmaes: Type[PygmoCmaes] = PygmoCmaes + pygmo_compass_search: Type[PygmoCompassSearch] = PygmoCompassSearch + pygmo_de: Type[PygmoDe] = PygmoDe + pygmo_de1220: Type[PygmoDe1220] = PygmoDe1220 + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_gwo: Type[PygmoGwo] = PygmoGwo + pygmo_ihs: Type[PygmoIhs] = PygmoIhs + pygmo_mbh: Type[PygmoMbh] = PygmoMbh + pygmo_pso: Type[PygmoPso] = PygmoPso + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + pygmo_sade: Type[PygmoSade] = PygmoSade + pygmo_sea: Type[PygmoSea] = PygmoSea + pygmo_sga: Type[PygmoSga] = PygmoSga + pygmo_simulated_annealing: Type[PygmoSimulatedAnnealing] = PygmoSimulatedAnnealing + pygmo_xnes: Type[PygmoXnes] = PygmoXnes + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_cobyla: Type[ScipyCOBYLA] = ScipyCOBYLA + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_direct: Type[ScipyDirect] = ScipyDirect + scipy_neldermead: Type[ScipyNelderMead] = ScipyNelderMead + scipy_powell: Type[ScipyPowell] = ScipyPowell + tao_pounders: Type[TAOPounders] = TAOPounders + tranquilo: Type[Tranquilo] = Tranquilo + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Bounded(self) -> BoundedGradientFreeAlgorithms: + return BoundedGradientFreeAlgorithms() + + @property + def Global(self) -> GlobalGradientFreeAlgorithms: + return GlobalGradientFreeAlgorithms() + + @property + def LeastSquares(self) -> GradientFreeLeastSquaresAlgorithms: + return GradientFreeLeastSquaresAlgorithms() + + @property + def Local(self) -> GradientFreeLocalAlgorithms: + return GradientFreeLocalAlgorithms() + + @property + def NonlinearConstrained(self) -> GradientFreeNonlinearConstrainedAlgorithms: + return GradientFreeNonlinearConstrainedAlgorithms() + + @property + def Parallel(self) -> GradientFreeParallelAlgorithms: + return GradientFreeParallelAlgorithms() + + @property + def Scalar(self) -> GradientFreeScalarAlgorithms: + return GradientFreeScalarAlgorithms() + + +@dataclass(frozen=True) +class GlobalAlgorithms(AlgoSelection): + nlopt_crs2_lm: Type[NloptCRS2LM] = NloptCRS2LM + nlopt_direct: Type[NloptDirect] = NloptDirect + nlopt_esch: Type[NloptESCH] = NloptESCH + nlopt_isres: Type[NloptISRES] = NloptISRES + pygmo_bee_colony: Type[PygmoBeeColony] = PygmoBeeColony + pygmo_cmaes: Type[PygmoCmaes] = PygmoCmaes + pygmo_compass_search: Type[PygmoCompassSearch] = PygmoCompassSearch + pygmo_de: Type[PygmoDe] = PygmoDe + pygmo_de1220: Type[PygmoDe1220] = PygmoDe1220 + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_gwo: Type[PygmoGwo] = PygmoGwo + pygmo_ihs: Type[PygmoIhs] = PygmoIhs + pygmo_mbh: Type[PygmoMbh] = PygmoMbh + pygmo_pso: Type[PygmoPso] = PygmoPso + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + pygmo_sade: Type[PygmoSade] = PygmoSade + pygmo_sea: Type[PygmoSea] = PygmoSea + pygmo_sga: Type[PygmoSga] = PygmoSga + pygmo_simulated_annealing: Type[PygmoSimulatedAnnealing] = PygmoSimulatedAnnealing + pygmo_xnes: Type[PygmoXnes] = PygmoXnes + scipy_basinhopping: Type[ScipyBasinhopping] = ScipyBasinhopping + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_direct: Type[ScipyDirect] = ScipyDirect + scipy_dual_annealing: Type[ScipyDualAnnealing] = ScipyDualAnnealing + scipy_shgo: Type[ScipySHGO] = ScipySHGO + + @property + def Bounded(self) -> BoundedGlobalAlgorithms: + return BoundedGlobalAlgorithms() + + @property + def GradientBased(self) -> GlobalGradientBasedAlgorithms: + return GlobalGradientBasedAlgorithms() + + @property + def GradientFree(self) -> GlobalGradientFreeAlgorithms: + return GlobalGradientFreeAlgorithms() + + @property + def NonlinearConstrained(self) -> GlobalNonlinearConstrainedAlgorithms: + return GlobalNonlinearConstrainedAlgorithms() + + @property + def Parallel(self) -> GlobalParallelAlgorithms: + return GlobalParallelAlgorithms() + + @property + def Scalar(self) -> GlobalScalarAlgorithms: + return GlobalScalarAlgorithms() + + +@dataclass(frozen=True) +class LocalAlgorithms(AlgoSelection): + bhhh: Type[BHHH] = BHHH + fides: Type[Fides] = Fides + ipopt: Type[Ipopt] = Ipopt + nag_dfols: Type[NagDFOLS] = NagDFOLS + nag_pybobyqa: Type[NagPyBOBYQA] = NagPyBOBYQA + neldermead_parallel: Type[NelderMeadParallel] = NelderMeadParallel + nlopt_bobyqa: Type[NloptBOBYQA] = NloptBOBYQA + nlopt_ccsaq: Type[NloptCCSAQ] = NloptCCSAQ + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_lbfgsb: Type[NloptLBFGSB] = NloptLBFGSB + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_newuoa: Type[NloptNEWUOA] = NloptNEWUOA + nlopt_neldermead: Type[NloptNelderMead] = NloptNelderMead + nlopt_praxis: Type[NloptPRAXIS] = NloptPRAXIS + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + nlopt_sbplx: Type[NloptSbplx] = NloptSbplx + nlopt_tnewton: Type[NloptTNewton] = NloptTNewton + nlopt_var: Type[NloptVAR] = NloptVAR + pounders: Type[Pounders] = Pounders + scipy_bfgs: Type[ScipyBFGS] = ScipyBFGS + scipy_cobyla: Type[ScipyCOBYLA] = ScipyCOBYLA + scipy_conjugate_gradient: Type[ScipyConjugateGradient] = ScipyConjugateGradient + scipy_lbfgsb: Type[ScipyLBFGSB] = ScipyLBFGSB + scipy_ls_dogbox: Type[ScipyLSDogbox] = ScipyLSDogbox + scipy_ls_lm: Type[ScipyLSLM] = ScipyLSLM + scipy_ls_trf: Type[ScipyLSTRF] = ScipyLSTRF + scipy_neldermead: Type[ScipyNelderMead] = ScipyNelderMead + scipy_newton_cg: Type[ScipyNewtonCG] = ScipyNewtonCG + scipy_powell: Type[ScipyPowell] = ScipyPowell + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_truncated_newton: Type[ScipyTruncatedNewton] = ScipyTruncatedNewton + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + tao_pounders: Type[TAOPounders] = TAOPounders + tranquilo: Type[Tranquilo] = Tranquilo + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Bounded(self) -> BoundedLocalAlgorithms: + return BoundedLocalAlgorithms() + + @property + def GradientBased(self) -> GradientBasedLocalAlgorithms: + return GradientBasedLocalAlgorithms() + + @property + def GradientFree(self) -> GradientFreeLocalAlgorithms: + return GradientFreeLocalAlgorithms() + + @property + def LeastSquares(self) -> LeastSquaresLocalAlgorithms: + return LeastSquaresLocalAlgorithms() + + @property + def Likelihood(self) -> LikelihoodLocalAlgorithms: + return LikelihoodLocalAlgorithms() + + @property + def NonlinearConstrained(self) -> LocalNonlinearConstrainedAlgorithms: + return LocalNonlinearConstrainedAlgorithms() + + @property + def Parallel(self) -> LocalParallelAlgorithms: + return LocalParallelAlgorithms() + + @property + def Scalar(self) -> LocalScalarAlgorithms: + return LocalScalarAlgorithms() + + +@dataclass(frozen=True) +class BoundedAlgorithms(AlgoSelection): + fides: Type[Fides] = Fides + ipopt: Type[Ipopt] = Ipopt + nag_dfols: Type[NagDFOLS] = NagDFOLS + nag_pybobyqa: Type[NagPyBOBYQA] = NagPyBOBYQA + nlopt_bobyqa: Type[NloptBOBYQA] = NloptBOBYQA + nlopt_ccsaq: Type[NloptCCSAQ] = NloptCCSAQ + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_crs2_lm: Type[NloptCRS2LM] = NloptCRS2LM + nlopt_direct: Type[NloptDirect] = NloptDirect + nlopt_esch: Type[NloptESCH] = NloptESCH + nlopt_isres: Type[NloptISRES] = NloptISRES + nlopt_lbfgsb: Type[NloptLBFGSB] = NloptLBFGSB + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_newuoa: Type[NloptNEWUOA] = NloptNEWUOA + nlopt_neldermead: Type[NloptNelderMead] = NloptNelderMead + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + nlopt_sbplx: Type[NloptSbplx] = NloptSbplx + nlopt_tnewton: Type[NloptTNewton] = NloptTNewton + nlopt_var: Type[NloptVAR] = NloptVAR + pounders: Type[Pounders] = Pounders + pygmo_bee_colony: Type[PygmoBeeColony] = PygmoBeeColony + pygmo_cmaes: Type[PygmoCmaes] = PygmoCmaes + pygmo_compass_search: Type[PygmoCompassSearch] = PygmoCompassSearch + pygmo_de: Type[PygmoDe] = PygmoDe + pygmo_de1220: Type[PygmoDe1220] = PygmoDe1220 + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_gwo: Type[PygmoGwo] = PygmoGwo + pygmo_ihs: Type[PygmoIhs] = PygmoIhs + pygmo_mbh: Type[PygmoMbh] = PygmoMbh + pygmo_pso: Type[PygmoPso] = PygmoPso + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + pygmo_sade: Type[PygmoSade] = PygmoSade + pygmo_sea: Type[PygmoSea] = PygmoSea + pygmo_sga: Type[PygmoSga] = PygmoSga + pygmo_simulated_annealing: Type[PygmoSimulatedAnnealing] = PygmoSimulatedAnnealing + pygmo_xnes: Type[PygmoXnes] = PygmoXnes + scipy_basinhopping: Type[ScipyBasinhopping] = ScipyBasinhopping + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_direct: Type[ScipyDirect] = ScipyDirect + scipy_dual_annealing: Type[ScipyDualAnnealing] = ScipyDualAnnealing + scipy_lbfgsb: Type[ScipyLBFGSB] = ScipyLBFGSB + scipy_ls_dogbox: Type[ScipyLSDogbox] = ScipyLSDogbox + scipy_ls_trf: Type[ScipyLSTRF] = ScipyLSTRF + scipy_neldermead: Type[ScipyNelderMead] = ScipyNelderMead + scipy_powell: Type[ScipyPowell] = ScipyPowell + scipy_shgo: Type[ScipySHGO] = ScipySHGO + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_truncated_newton: Type[ScipyTruncatedNewton] = ScipyTruncatedNewton + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + tao_pounders: Type[TAOPounders] = TAOPounders + tranquilo: Type[Tranquilo] = Tranquilo + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Global(self) -> BoundedGlobalAlgorithms: + return BoundedGlobalAlgorithms() + + @property + def GradientBased(self) -> BoundedGradientBasedAlgorithms: + return BoundedGradientBasedAlgorithms() + + @property + def GradientFree(self) -> BoundedGradientFreeAlgorithms: + return BoundedGradientFreeAlgorithms() + + @property + def LeastSquares(self) -> BoundedLeastSquaresAlgorithms: + return BoundedLeastSquaresAlgorithms() + + @property + def Local(self) -> BoundedLocalAlgorithms: + return BoundedLocalAlgorithms() + + @property + def NonlinearConstrained(self) -> BoundedNonlinearConstrainedAlgorithms: + return BoundedNonlinearConstrainedAlgorithms() + + @property + def Parallel(self) -> BoundedParallelAlgorithms: + return BoundedParallelAlgorithms() + + @property + def Scalar(self) -> BoundedScalarAlgorithms: + return BoundedScalarAlgorithms() + + +@dataclass(frozen=True) +class NonlinearConstrainedAlgorithms(AlgoSelection): + ipopt: Type[Ipopt] = Ipopt + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_isres: Type[NloptISRES] = NloptISRES + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + scipy_cobyla: Type[ScipyCOBYLA] = ScipyCOBYLA + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_shgo: Type[ScipySHGO] = ScipySHGO + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + + @property + def Bounded(self) -> BoundedNonlinearConstrainedAlgorithms: + return BoundedNonlinearConstrainedAlgorithms() + + @property + def Global(self) -> GlobalNonlinearConstrainedAlgorithms: + return GlobalNonlinearConstrainedAlgorithms() + + @property + def GradientBased(self) -> GradientBasedNonlinearConstrainedAlgorithms: + return GradientBasedNonlinearConstrainedAlgorithms() + + @property + def GradientFree(self) -> GradientFreeNonlinearConstrainedAlgorithms: + return GradientFreeNonlinearConstrainedAlgorithms() + + @property + def Local(self) -> LocalNonlinearConstrainedAlgorithms: + return LocalNonlinearConstrainedAlgorithms() + + @property + def Parallel(self) -> NonlinearConstrainedParallelAlgorithms: + return NonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> NonlinearConstrainedScalarAlgorithms: + return NonlinearConstrainedScalarAlgorithms() + + +@dataclass(frozen=True) +class ScalarAlgorithms(AlgoSelection): + fides: Type[Fides] = Fides + ipopt: Type[Ipopt] = Ipopt + nag_pybobyqa: Type[NagPyBOBYQA] = NagPyBOBYQA + neldermead_parallel: Type[NelderMeadParallel] = NelderMeadParallel + nlopt_bobyqa: Type[NloptBOBYQA] = NloptBOBYQA + nlopt_ccsaq: Type[NloptCCSAQ] = NloptCCSAQ + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_crs2_lm: Type[NloptCRS2LM] = NloptCRS2LM + nlopt_direct: Type[NloptDirect] = NloptDirect + nlopt_esch: Type[NloptESCH] = NloptESCH + nlopt_isres: Type[NloptISRES] = NloptISRES + nlopt_lbfgsb: Type[NloptLBFGSB] = NloptLBFGSB + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_newuoa: Type[NloptNEWUOA] = NloptNEWUOA + nlopt_neldermead: Type[NloptNelderMead] = NloptNelderMead + nlopt_praxis: Type[NloptPRAXIS] = NloptPRAXIS + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + nlopt_sbplx: Type[NloptSbplx] = NloptSbplx + nlopt_tnewton: Type[NloptTNewton] = NloptTNewton + nlopt_var: Type[NloptVAR] = NloptVAR + pygmo_bee_colony: Type[PygmoBeeColony] = PygmoBeeColony + pygmo_cmaes: Type[PygmoCmaes] = PygmoCmaes + pygmo_compass_search: Type[PygmoCompassSearch] = PygmoCompassSearch + pygmo_de: Type[PygmoDe] = PygmoDe + pygmo_de1220: Type[PygmoDe1220] = PygmoDe1220 + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_gwo: Type[PygmoGwo] = PygmoGwo + pygmo_ihs: Type[PygmoIhs] = PygmoIhs + pygmo_mbh: Type[PygmoMbh] = PygmoMbh + pygmo_pso: Type[PygmoPso] = PygmoPso + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + pygmo_sade: Type[PygmoSade] = PygmoSade + pygmo_sea: Type[PygmoSea] = PygmoSea + pygmo_sga: Type[PygmoSga] = PygmoSga + pygmo_simulated_annealing: Type[PygmoSimulatedAnnealing] = PygmoSimulatedAnnealing + pygmo_xnes: Type[PygmoXnes] = PygmoXnes + scipy_bfgs: Type[ScipyBFGS] = ScipyBFGS + scipy_basinhopping: Type[ScipyBasinhopping] = ScipyBasinhopping + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_cobyla: Type[ScipyCOBYLA] = ScipyCOBYLA + scipy_conjugate_gradient: Type[ScipyConjugateGradient] = ScipyConjugateGradient + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_direct: Type[ScipyDirect] = ScipyDirect + scipy_dual_annealing: Type[ScipyDualAnnealing] = ScipyDualAnnealing + scipy_lbfgsb: Type[ScipyLBFGSB] = ScipyLBFGSB + scipy_neldermead: Type[ScipyNelderMead] = ScipyNelderMead + scipy_newton_cg: Type[ScipyNewtonCG] = ScipyNewtonCG + scipy_powell: Type[ScipyPowell] = ScipyPowell + scipy_shgo: Type[ScipySHGO] = ScipySHGO + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_truncated_newton: Type[ScipyTruncatedNewton] = ScipyTruncatedNewton + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + tranquilo: Type[Tranquilo] = Tranquilo + + @property + def Bounded(self) -> BoundedScalarAlgorithms: + return BoundedScalarAlgorithms() + + @property + def Global(self) -> GlobalScalarAlgorithms: + return GlobalScalarAlgorithms() + + @property + def GradientBased(self) -> GradientBasedScalarAlgorithms: + return GradientBasedScalarAlgorithms() + + @property + def GradientFree(self) -> GradientFreeScalarAlgorithms: + return GradientFreeScalarAlgorithms() + + @property + def Local(self) -> LocalScalarAlgorithms: + return LocalScalarAlgorithms() + + @property + def NonlinearConstrained(self) -> NonlinearConstrainedScalarAlgorithms: + return NonlinearConstrainedScalarAlgorithms() + + @property + def Parallel(self) -> ParallelScalarAlgorithms: + return ParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class LeastSquaresAlgorithms(AlgoSelection): + nag_dfols: Type[NagDFOLS] = NagDFOLS + pounders: Type[Pounders] = Pounders + scipy_ls_dogbox: Type[ScipyLSDogbox] = ScipyLSDogbox + scipy_ls_lm: Type[ScipyLSLM] = ScipyLSLM + scipy_ls_trf: Type[ScipyLSTRF] = ScipyLSTRF + tao_pounders: Type[TAOPounders] = TAOPounders + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Bounded(self) -> BoundedLeastSquaresAlgorithms: + return BoundedLeastSquaresAlgorithms() + + @property + def GradientBased(self) -> GradientBasedLeastSquaresAlgorithms: + return GradientBasedLeastSquaresAlgorithms() + + @property + def GradientFree(self) -> GradientFreeLeastSquaresAlgorithms: + return GradientFreeLeastSquaresAlgorithms() + + @property + def Local(self) -> LeastSquaresLocalAlgorithms: + return LeastSquaresLocalAlgorithms() + + @property + def Parallel(self) -> LeastSquaresParallelAlgorithms: + return LeastSquaresParallelAlgorithms() + + +@dataclass(frozen=True) +class LikelihoodAlgorithms(AlgoSelection): + bhhh: Type[BHHH] = BHHH + + @property + def GradientBased(self) -> GradientBasedLikelihoodAlgorithms: + return GradientBasedLikelihoodAlgorithms() + + @property + def Local(self) -> LikelihoodLocalAlgorithms: + return LikelihoodLocalAlgorithms() + + +@dataclass(frozen=True) +class ParallelAlgorithms(AlgoSelection): + neldermead_parallel: Type[NelderMeadParallel] = NelderMeadParallel + pounders: Type[Pounders] = Pounders + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + tranquilo: Type[Tranquilo] = Tranquilo + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Bounded(self) -> BoundedParallelAlgorithms: + return BoundedParallelAlgorithms() + + @property + def Global(self) -> GlobalParallelAlgorithms: + return GlobalParallelAlgorithms() + + @property + def GradientFree(self) -> GradientFreeParallelAlgorithms: + return GradientFreeParallelAlgorithms() + + @property + def LeastSquares(self) -> LeastSquaresParallelAlgorithms: + return LeastSquaresParallelAlgorithms() + + @property + def Local(self) -> LocalParallelAlgorithms: + return LocalParallelAlgorithms() + + @property + def NonlinearConstrained(self) -> NonlinearConstrainedParallelAlgorithms: + return NonlinearConstrainedParallelAlgorithms() + + @property + def Scalar(self) -> ParallelScalarAlgorithms: + return ParallelScalarAlgorithms() + + +@dataclass(frozen=True) +class Algorithms(AlgoSelection): + bhhh: Type[BHHH] = BHHH + fides: Type[Fides] = Fides + ipopt: Type[Ipopt] = Ipopt + nag_dfols: Type[NagDFOLS] = NagDFOLS + nag_pybobyqa: Type[NagPyBOBYQA] = NagPyBOBYQA + neldermead_parallel: Type[NelderMeadParallel] = NelderMeadParallel + nlopt_bobyqa: Type[NloptBOBYQA] = NloptBOBYQA + nlopt_ccsaq: Type[NloptCCSAQ] = NloptCCSAQ + nlopt_cobyla: Type[NloptCOBYLA] = NloptCOBYLA + nlopt_crs2_lm: Type[NloptCRS2LM] = NloptCRS2LM + nlopt_direct: Type[NloptDirect] = NloptDirect + nlopt_esch: Type[NloptESCH] = NloptESCH + nlopt_isres: Type[NloptISRES] = NloptISRES + nlopt_lbfgsb: Type[NloptLBFGSB] = NloptLBFGSB + nlopt_mma: Type[NloptMMA] = NloptMMA + nlopt_newuoa: Type[NloptNEWUOA] = NloptNEWUOA + nlopt_neldermead: Type[NloptNelderMead] = NloptNelderMead + nlopt_praxis: Type[NloptPRAXIS] = NloptPRAXIS + nlopt_slsqp: Type[NloptSLSQP] = NloptSLSQP + nlopt_sbplx: Type[NloptSbplx] = NloptSbplx + nlopt_tnewton: Type[NloptTNewton] = NloptTNewton + nlopt_var: Type[NloptVAR] = NloptVAR + pounders: Type[Pounders] = Pounders + pygmo_bee_colony: Type[PygmoBeeColony] = PygmoBeeColony + pygmo_cmaes: Type[PygmoCmaes] = PygmoCmaes + pygmo_compass_search: Type[PygmoCompassSearch] = PygmoCompassSearch + pygmo_de: Type[PygmoDe] = PygmoDe + pygmo_de1220: Type[PygmoDe1220] = PygmoDe1220 + pygmo_gaco: Type[PygmoGaco] = PygmoGaco + pygmo_gwo: Type[PygmoGwo] = PygmoGwo + pygmo_ihs: Type[PygmoIhs] = PygmoIhs + pygmo_mbh: Type[PygmoMbh] = PygmoMbh + pygmo_pso: Type[PygmoPso] = PygmoPso + pygmo_pso_gen: Type[PygmoPsoGen] = PygmoPsoGen + pygmo_sade: Type[PygmoSade] = PygmoSade + pygmo_sea: Type[PygmoSea] = PygmoSea + pygmo_sga: Type[PygmoSga] = PygmoSga + pygmo_simulated_annealing: Type[PygmoSimulatedAnnealing] = PygmoSimulatedAnnealing + pygmo_xnes: Type[PygmoXnes] = PygmoXnes + scipy_bfgs: Type[ScipyBFGS] = ScipyBFGS + scipy_basinhopping: Type[ScipyBasinhopping] = ScipyBasinhopping + scipy_brute: Type[ScipyBrute] = ScipyBrute + scipy_cobyla: Type[ScipyCOBYLA] = ScipyCOBYLA + scipy_conjugate_gradient: Type[ScipyConjugateGradient] = ScipyConjugateGradient + scipy_differential_evolution: Type[ScipyDifferentialEvolution] = ( + ScipyDifferentialEvolution + ) + scipy_direct: Type[ScipyDirect] = ScipyDirect + scipy_dual_annealing: Type[ScipyDualAnnealing] = ScipyDualAnnealing + scipy_lbfgsb: Type[ScipyLBFGSB] = ScipyLBFGSB + scipy_ls_dogbox: Type[ScipyLSDogbox] = ScipyLSDogbox + scipy_ls_lm: Type[ScipyLSLM] = ScipyLSLM + scipy_ls_trf: Type[ScipyLSTRF] = ScipyLSTRF + scipy_neldermead: Type[ScipyNelderMead] = ScipyNelderMead + scipy_newton_cg: Type[ScipyNewtonCG] = ScipyNewtonCG + scipy_powell: Type[ScipyPowell] = ScipyPowell + scipy_shgo: Type[ScipySHGO] = ScipySHGO + scipy_slsqp: Type[ScipySLSQP] = ScipySLSQP + scipy_truncated_newton: Type[ScipyTruncatedNewton] = ScipyTruncatedNewton + scipy_trust_constr: Type[ScipyTrustConstr] = ScipyTrustConstr + tao_pounders: Type[TAOPounders] = TAOPounders + tranquilo: Type[Tranquilo] = Tranquilo + tranquilo_ls: Type[TranquiloLS] = TranquiloLS + + @property + def Bounded(self) -> BoundedAlgorithms: + return BoundedAlgorithms() + + @property + def Global(self) -> GlobalAlgorithms: + return GlobalAlgorithms() + + @property + def GradientBased(self) -> GradientBasedAlgorithms: + return GradientBasedAlgorithms() + + @property + def GradientFree(self) -> GradientFreeAlgorithms: + return GradientFreeAlgorithms() + + @property + def LeastSquares(self) -> LeastSquaresAlgorithms: + return LeastSquaresAlgorithms() + + @property + def Likelihood(self) -> LikelihoodAlgorithms: + return LikelihoodAlgorithms() + + @property + def Local(self) -> LocalAlgorithms: + return LocalAlgorithms() + + @property + def NonlinearConstrained(self) -> NonlinearConstrainedAlgorithms: + return NonlinearConstrainedAlgorithms() + + @property + def Parallel(self) -> ParallelAlgorithms: + return ParallelAlgorithms() + + @property + def Scalar(self) -> ScalarAlgorithms: + return ScalarAlgorithms() + + +algos = Algorithms() +global_algos = GlobalAlgorithms() -MODULES = [ - ipopt, - fides, - nag_optimizers, - nlopt_optimizers, - pygmo_optimizers, - scipy_optimizers, - tao_optimizers, - bhhh, - neldermead, - pounders, - tranquilo, -] - -ALL_ALGORITHMS = {} -AVAILABLE_ALGORITHMS = {} -for module in MODULES: - candidate_dict = dict(inspect.getmembers(module, inspect.isclass)) - candidate_dict = { - k: v for k, v in candidate_dict.items() if hasattr(v, "__algo_info__") - } - for candidate in candidate_dict.values(): - name = candidate.__algo_info__.name - if issubclass(candidate, Algorithm) and candidate is not Algorithm: - ALL_ALGORITHMS[name] = candidate - if candidate.__algo_info__.is_available: # type: ignore[attr-defined] - AVAILABLE_ALGORITHMS[name] = candidate - - -GLOBAL_ALGORITHMS = [ - name - for name, algo in ALL_ALGORITHMS.items() - if algo.__algo_info__.is_global # type: ignore[attr-defined] -] +ALL_ALGORITHMS = algos._all_algorithms_dict +AVAILABLE_ALGORITHMS = algos._available_algorithms_dict +GLOBAL_ALGORITHMS = global_algos._available_algorithms_dict diff --git a/src/optimagic/config.py b/src/optimagic/config.py index 3cae61374..d63ef54ac 100644 --- a/src/optimagic/config.py +++ b/src/optimagic/config.py @@ -5,6 +5,7 @@ from packaging import version DOCS_DIR = Path(__file__).parent.parent / "docs" +OPTIMAGIC_ROOT = Path(__file__).parent PLOTLY_TEMPLATE = "simple_white" PLOTLY_PALETTE = px.colors.qualitative.Set2 diff --git a/src/optimagic/py.typed b/src/optimagic/py.typed new file mode 100644 index 000000000..e69de29bb diff --git a/tests/optimagic/optimization/test_with_nonlinear_constraints.py b/tests/optimagic/optimization/test_with_nonlinear_constraints.py index bc28a2dcf..1df8bef3a 100644 --- a/tests/optimagic/optimization/test_with_nonlinear_constraints.py +++ b/tests/optimagic/optimization/test_with_nonlinear_constraints.py @@ -7,15 +7,11 @@ import optimagic as om from optimagic import maximize, minimize -from optimagic.algorithms import AVAILABLE_ALGORITHMS +from optimagic.algorithms import NonlinearConstrainedAlgorithms from optimagic.config import IS_CYIPOPT_INSTALLED from optimagic.parameters.bounds import Bounds -NLC_ALGORITHMS = [ - name - for name, algo in AVAILABLE_ALGORITHMS.items() - if algo.__algo_info__.supports_nonlinear_constraints -] +NLC_ALGORITHMS = NonlinearConstrainedAlgorithms()._available_algorithms_dict # ====================================================================================== # Two-dimension example with equality and inequality constraints @@ -125,7 +121,7 @@ def test_nonlinear_optimization(nlc_2d_example, algorithm, constr_type): warnings.simplefilter("ignore") result = maximize(algorithm=algorithm, **kwargs[constr_type]) - if AVAILABLE_ALGORITHMS[algorithm].__algo_info__.is_global: + if NLC_ALGORITHMS[algorithm].__algo_info__.is_global: decimal = 0 else: decimal = 4 diff --git a/tests/optimagic/test_algo_selection.py b/tests/optimagic/test_algo_selection.py new file mode 100644 index 000000000..c42cdae87 --- /dev/null +++ b/tests/optimagic/test_algo_selection.py @@ -0,0 +1,26 @@ +from optimagic import algos + + +def test_dfols_is_present(): + assert hasattr(algos, "nag_dfols") + assert hasattr(algos.Bounded, "nag_dfols") + assert hasattr(algos.LeastSquares, "nag_dfols") + assert hasattr(algos.Local, "nag_dfols") + assert hasattr(algos.Bounded.Local.LeastSquares, "nag_dfols") + assert hasattr(algos.Local.Bounded.LeastSquares, "nag_dfols") + assert hasattr(algos.LeastSquares.Bounded.Local, "nag_dfols") + + +def test_scipy_cobyla_is_present(): + assert hasattr(algos, "scipy_cobyla") + assert hasattr(algos.Local, "scipy_cobyla") + assert hasattr(algos.NonlinearConstrained, "scipy_cobyla") + assert hasattr(algos.GradientFree, "scipy_cobyla") + assert hasattr(algos.Local.NonlinearConstrained, "scipy_cobyla") + assert hasattr(algos.NonlinearConstrained.Local, "scipy_cobyla") + assert hasattr(algos.GradientFree.NonlinearConstrained, "scipy_cobyla") + assert hasattr(algos.GradientFree.NonlinearConstrained.Local, "scipy_cobyla") + assert hasattr(algos.Local.GradientFree.NonlinearConstrained, "scipy_cobyla") + assert hasattr(algos.NonlinearConstrained.GradientFree.Local, "scipy_cobyla") + assert hasattr(algos.NonlinearConstrained.Local.GradientFree, "scipy_cobyla") + assert hasattr(algos.Local.NonlinearConstrained.GradientFree, "scipy_cobyla")