Metadata-Version: 2.4
Name: opfunu-core
Version: 2026.0
Summary: An Open-source Python Library for Optimization Benchmark Functions
Author-email: Thieu <nguyenthieu2102@gmail.com>
Maintainer-email: ltsim <tsim@cucei.udg.mx>
License: GPL-3.0-only
Project-URL: Homepage, https://github.com/ltsim/opfunu-core
Project-URL: Documentation, https://ltsim.github.io/opfunu-core/
Project-URL: Source Code, https://github.com/ltsim/opfunu-core
Project-URL: Bug Tracker, https://github.com/ltsim/opfunu-core/issues
Project-URL: Change Log, https://github.com/ltsim/opfunu-core/blob/master/CHANGELOG.md
Keywords: optimization functions,test functions,benchmark functions,mathematical functions,CEC competitions,CEC-2008,CEC-2009,CEC-2010,CEC-2011,CEC-2012,CEC-2013,CEC-2014,CEC-2015,CEC-2017,CEC-2019,CEC-2020,CEC-2021,CEC-2022,soft computing,Stochastic optimization,Global optimization,Convergence analysis,Search space exploration,Local search,Computational intelligence,Performance analysis,Exploration versus exploitation,Constrained optimization,Simulations
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: System :: Benchmark
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: numpy>=2.0.2
Provides-Extra: numba
Requires-Dist: numba>=0.68.0; implementation_name == "cpython" and extra == "numba"
Provides-Extra: plot
Requires-Dist: matplotlib>=3.8.0; extra == "plot"
Provides-Extra: interactive
Requires-Dist: pyvista>=0.43.0; extra == "interactive"
Dynamic: license-file

# opfunu-core

[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg?style=flat-square)](https://www.gnu.org/licenses/gpl-3.0)
![PyPI - Version](https://img.shields.io/pypi/v/opfunu-core?style=flat-square)
![PyPI - Implementation](https://img.shields.io/pypi/implementation/opfunu-core?style=flat-square)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/opfunu-core?style=flat-square)
![PyPI - Wheel](https://img.shields.io/pypi/wheel/opfunu-core?style=flat-square)
![GitHub Release Date](https://img.shields.io/github/release-date/ltsim/opfunu-core.svg?style=flat-square)
![PyPI - Downloads](https://img.shields.io/pypi/dm/opfunu-core?style=flat-square)

![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/ltsim/opfunu-core/publish.yml?style=flat-square&logo=pypi&label=Publish)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/ltsim/opfunu-core/test.yml?style=flat-square&logo=pytest&label=Testing)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/ltsim/opfunu-core/type.yml?style=flat-square&logo=mypy&label=Type-checking)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/ltsim/opfunu-core/lint.yml?style=flat-square&logo=ruff&label=Linting)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/ltsim/opfunu-core/docs.yml?style=flat-square&logo=githubpages&label=Docs)

This library is a maintenance version, a fork of [OPFUNU (Optimization Reference Functions in NUMPy)](https://github.com/thieu1995/opfunu). Is one of the most comprehensive Python libraries of numerical optimization reference functions. It contains all the functions from the CEC competitions of 2005, 2008, 2010, 2013, 2014, 2015, 2017, 2019, 2020, 2021, and 2022. In addition, it implements over 300 traditional functions with varying dimensions.

* **Free software:** GNU General Public License (GPL) V3 license
* **Total problems**: > 500 problems
* **Documentation:** https://ltsim.github.io/opfunu-core/

# Citation Request 

Please include these citations if you plan to use this library:

**LaTeX Style**

```bibtex
  @article{Van_Thieu_2024_Opfunu,
      author = {Van Thieu, Nguyen},
      title = {Opfunu: An Open-source Python Library for Optimization Benchmark Functions},
      doi = {10.5334/jors.508},
      journal = {Journal of Open Research Software},
      month = {May},
      year = {2024}
  }
```

**APA Style**

Van Thieu, N. (2024). **Opfunu: An Open-source Python Library for Optimization Benchmark Functions.** _Journal of Open Research Software_, _12_(1), 8. https://doi.org/10.5334/jors.508

# Installation and Usage

### Install with pip

Install the [current PyPI release](https://pypi.python.org/pypi/opfunu-core):
```sh
$ pip install opfunu-core
```

For Numba-based vectorization (CPython only, faster batch evaluation):
```sh
$ pip install opfunu-core[numba]
```

Without the `[numba]` extra the library runs in pure-Python/NumPy mode, which also
works on PyPy. Check which mode is active via `opfunu.HAS_NUMBA`
(`problem.numba_compiled` reports it per instance).

Compilation stays optional even with the extra installed: every problem accepts
`precompile` (e.g. `Ackley01(ndim=10, precompile=False)`), and
`Benchmark.default_precompile` sets the policy for a whole session.

Install from Github:
```sh
$ pip install git+https://github.com/ltsim/opfunu-core
```

```sh
$ pip install "opfunu-core[numba] @ git+https://github.com/ltsim/opfunu-core"
```

Or, if you manage the project with [uv](https://github.com/astral-sh/uv):
```sh
$ uv add opfunu-core
$ uv add "opfunu-core[numba]"
```

After installation, you can import and check version of Opfunu:

```sh
$ python
>>> import opfunu
>>> opfunu.__version__

>>> dir(opfunu)
>>> help(opfunu)

>>> opfunu.FUNC_DATABASE      # List all name_based functions
>>> opfunu.CEC_DATABASE       # List all cec_based functions
>>> opfunu.ALL_DATABASE       # List all functions in this library

>>> opfunu.get_functions_by_classname("MiShra04")
>>> opfunu.get_functions_based_classname("2015")
>>> opfunu.get_functions_by_ndim(2)
>>> opfunu.get_functions_based_ndim(50)

>>> opfunu.get_name_based_functions(ndim=10, continuous=True)
>>> opfunu.get_cec_based_functions(ndim=2)
```

Let's go through some examples.

### Examples

How to get the function and use it

#### 1st way

```python
from opfunu.cec_based.cec2014 import F12014

func = F12014(ndim=30)
func.evaluate(func.create_solution())

## or

from opfunu.cec_based import F102014

func = F102014(ndim=50)
func.evaluate(func.create_solution())
```

#### 2nd way

```python
import opfunu

funcs = opfunu.get_functions_by_classname("F12014")
func = funcs[0](ndim=10)
func.evaluate(func.create_solution())

## or

all_funcs_2014 = opfunu.get_functions_based_classname("2014")
print(all_funcs_2014)
```

For more usage examples please look at [examples](/examples) folder.

# Contributing

There are lots of ways how you can contribute to opfunu-core's development, and you are welcome to join in! For example, 
you can report problems or make feature requests on the [issues](/issues) pages. To facilitate contributions, 
please check for the guidelines in the [CONTRIBUTING.md](/CONTRIBUTING.md) file.

# Development

The project is managed with [uv](https://github.com/astral-sh/uv):

```sh
$ uv sync                # install runtime + dev dependencies
$ uv sync --group docs   # additionally install the docs tooling
```

Ruff (lint and format):

```sh
$ uv run ruff check .            # lint
$ uv run ruff format .           # format
$ uv run ruff format --check .   # verify formatting
```

Mypy (type-checking):

```sh
$ uv run mypy          # type-check the package (config in pyproject.toml)
$ uv run mypy-coverage # report type-annotation coverage
```

MkDocs (documentation, Material theme):

```sh
$ uv run mkdocs serve                # live preview at http://127.0.0.1:8000
$ uv run mkdocs build                # build the static site into site/
$ uv run mkdocs gh-deploy --force    # publish to GitHub Pages
```

Run the test suite with:

```sh
$ uv run pytest
```

# Official channels 

* [Official source code repository](https://github.com/ltsim/opfunu-core)
* [Official document](https://ltsim.github.io/opfunu-core/)
* [Download releases](https://pypi.org/project/opfunu-core/) 
* [Issue tracker](https://github.com/ltsim/opfunu-core/issues) 
* [Notable changes log](/CHANGELOG.md)

---

* Maintained by: [LTSIM](mailto:tsim@cucei.udg.mx) @ 2026
* Developed by: [Thieu](mailto:nguyenthieu2102@gmail.com?Subject=Opfunu_QUESTIONS) @ 2023
