powell-opt
Python bindings for the Powell's method optimisation algorithm from the scirs2-optimize Rust library.
Installation
pip install powell-opt
About Powell's Method
Powell's method is a derivative-free optimization algorithm that minimizes functions by performing sequential one-dimensional searches along different directions. It's particularly useful for functions that:
- Cannot be easily differentiated
- Have discontinuities or non-smooth regions
- Have relatively few dimensions
Usage
import powell_opt as po
def rosenbrock(x):
"""Rosenbrock function - a classical test case for optimization"""
return 100 * (x[1] - x[0]**2)**2 + (1 - x[0])**2
# Initial guess
x0 = [0.0, 0.0]
# Set options (optional)
options = po.Options(maxiter=1000, ftol=1e-6)
# Minimize using Powell's method
result = po.minimize(rosenbrock, x0, options)
print(f"Solution: {result.x}")
print(f"Function value: {result.fun}")
print(f"Number of iterations: {result.nit}")
print(f"Success: {result.success}")
⇣
Solution: [1.0000000000000002, 1.0000000000000007]
Function value: 4.979684464207637e-30
Number of iterations: 19
Success: True
- Find this at
examples/basic_usage.pyand in the tests astest_powell_rosenbrock()
API Reference
minimize(func, x0, options=None)
Minimizes a scalar function using Powell's method.
Parameters:
func: A callable that takes a list of parameters and returns a scalar valuex0: Initial guess (list of parameters)options: OptionalOptionsobject with algorithm parameters
Returns:
MinimizeResultobject containing the optimization results
Options
Class for configuring the Powell optimization algorithm.
Parameters:
maxiter: Maximum number of iterations (optional)ftol: Relative tolerance for convergence in function value (optional)gtol: Relative tolerance for convergence in gradient norm (optional)disp: Whether to print convergence progress messages (default: False)eps: Small value used for numerical stability in calculations (optional)finite_diff_rel_step: Relative step size for finite difference approximation of derivatives (optional)return_all: Whether to return intermediate solutions from all iterations (default: False)
MinimizeResult
Class containing optimization results.
Attributes:
x: Solution arrayfun: Value of the objective function at the solutionnfev: Number of function evaluationsnit: Number of iterationsmessage: Description of the termination reasonsuccess: Whether the optimizer exited successfully
Performance
This implementation leverages Rust's performance through PyO3 bindings, making it significantly faster than pure Python implementations for computationally intensive problems.
(TODO: benchmark!)
Contributing
Maintained by lmmx. Contributions welcome!
- Issues & Discussions: Please open a GitHub issue or discussion for bugs, feature requests, or questions.
- Pull Requests: PRs are welcome!
- Install the dev extra (e.g. with uv:
uv pip install -e .[dev]) - Run tests (when available) and include updates to docs or examples if relevant.
- If reporting a bug, please include the version and the error message/traceback if available.
- Install the dev extra (e.g. with uv:
License
MIT License
Copyright (c) 2025 Louis Maddox
Metadata
Release files for powell-opt 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| powell_opt-0.1.0.tar.gz | 72.0 kB | Details |
Built distributions (wheels)
Total release size: 2.8 MB
Release files / powell_opt-0.1.0.tar.gz
| Download URL | powell_opt-0.1.0.tar.gz |
|---|---|
| Size | 72.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9177dc23c5fdbc5acd2af6990651981349ca05f3fa46d8d08261b414d336617c
|
|
BLAKE2b-256 checksum How to use checksums |
1a2e0c9dbfad0002a704ba1645697d23e3b423a8edddb6b1d4615050784f1170
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
|
Release files / powell_opt-0.1.0-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | powell_opt-0.1.0-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 222.5 kB |
| Tags | Linux glibc 2.17+ x86-64 PyPy 3.11 PyPy 3.11 7.3 |
|
SHA-256 checksum How to use checksums |
e708dcdfd8e040d8340d96f8e370a35a8eeacb978fcc85de6ef176e1104962cf
|
|
BLAKE2b-256 checksum How to use checksums |
affb9beb92a4a21aa50db5a683ba55d83a541814ac7a2020a96ba8c7ecace283
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
|
Release files / powell_opt-0.1.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | powell_opt-0.1.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 222.5 kB |
| Tags | Linux glibc 2.17+ x86-64 PyPy 3.10 PyPy 3.10 7.3 |
|
SHA-256 checksum How to use checksums |
cc513a75362ce4cbbb6cab9b848832061cb8149a28bc94ff276a318291ae3f73
|
|
BLAKE2b-256 checksum How to use checksums |
2f44a0dcad560e8030334426a51ef3b75137b0f58a827e7055d8a2fec8cc4eb3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
|
Release files / powell_opt-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | powell_opt-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 220.4 kB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
d6f14aa7e6a0735cc618afc47034387270ca5a7e1e2b67cd1da830f8e7918e99
|
|
BLAKE2b-256 checksum How to use checksums |
c7ce6c7557e607db1adf6fba217c9acf3cb91ac3dd3711ab400278fdd6332aef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
|
Release files / powell_opt-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | powell_opt-0.1.0-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 187.2 kB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
dc95d1b0623d0818fe66b436d16b25c6a04d5311cc9c323730092f397a0b05d6
|
|
BLAKE2b-256 checksum How to use checksums |
182d756b2d3fc9f26400c653b530fca30d9102e3343a8a6431273af4579d081d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
|
Release files / powell_opt-0.1.0-cp313-cp313-macosx_10_12_x86_64.whl
| Download URL | powell_opt-0.1.0-cp313-cp313-macosx_10_12_x86_64.whl |
|---|---|
| Size | 197.2 kB |
| Tags | CPython 3.13 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
9dd1483b4737cb83ae1dba494c0c8a55fd3eb447804f3c4b12f858235adb0c4c
|
|
BLAKE2b-256 checksum How to use checksums |
91f4a1e6b13bb928fe8694703eecc5a4839f2f0a02450002444385d86c301f97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
|
Release files / powell_opt-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | powell_opt-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 220.7 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
b84d2b9bd60c93b9142cbe92bd8ef78da0ef7b3d0155d6c25b824b738511a688
|
|
BLAKE2b-256 checksum How to use checksums |
a58144021e82efa7a28f56e12d234194f49c1f6a8b47076e92f0dcfa08e04aa5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
|
Release files / powell_opt-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | powell_opt-0.1.0-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 187.3 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
fcfbb331523e4ab1bde9a322cf338c025417896f8e2dbd05402fc3a78c13edc4
|
|
BLAKE2b-256 checksum How to use checksums |
2d1a50ce2661f5d0ce4c8f51e01dd5db3a37cd5336fbab09bc87d1716607cedc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
|
Release files / powell_opt-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl
| Download URL | powell_opt-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl |
|---|---|
| Size | 197.4 kB |
| Tags | CPython 3.12 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
9acbd1ee76daf03419bb54617a937ff662e340f30a0259e07c2ca6901bc87a7e
|
|
BLAKE2b-256 checksum How to use checksums |
a3e6fbeab3fc5fcfa4ee821827d1a8f9668ea471ab5514adb1248d77e26bae6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
|
Release files / powell_opt-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | powell_opt-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 221.9 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
7245ee7ff883f74a588ba547b97320b45df0c6549e259cd29afaa311f03dcc4d
|
|
BLAKE2b-256 checksum How to use checksums |
bf821adf98c7a1ee94771f71c358b8b216d09c71a984ffebe770b826ed99b8d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
|
Release files / powell_opt-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | powell_opt-0.1.0-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 189.0 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
5b0d0b38c6164f644ab09a43669858992e4a6e082e89ca253f93f4c242d1564b
|
|
BLAKE2b-256 checksum How to use checksums |
f2127312a6fba19b040fcd3183cec96ca1189db706a221c97a7294d65497d8ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
|
Release files / powell_opt-0.1.0-cp311-cp311-macosx_10_12_x86_64.whl
| Download URL | powell_opt-0.1.0-cp311-cp311-macosx_10_12_x86_64.whl |
|---|---|
| Size | 199.8 kB |
| Tags | CPython 3.11 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
336a7c114e667c3b8cf86e930863557c6950c290f6c31c13b3ef5de3fd0df152
|
|
BLAKE2b-256 checksum How to use checksums |
d7fdf11dfe10e2e784bbe4da281fd997467af9ead50d658143832f180ba8410a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
|
Release files / powell_opt-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | powell_opt-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 221.9 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
7ff69cc3de0b86e667c2337a276c10f7a9c31c2b70bfa987ebb5cd4ffd222b47
|
|
BLAKE2b-256 checksum How to use checksums |
93233d41970c8242866da53cdd53a57d4e7af91fe4869c41e0b5110d2c93cea1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
|
Release files / powell_opt-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | powell_opt-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 222.1 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
234e85926cf2433211d99e6e42d6e4daabb8e552af2d75f79f7de7669ae08e58
|
|
BLAKE2b-256 checksum How to use checksums |
b45d25ba7229b0d33cec38e9778fb524648786760ab7711991e42ad91bd93be6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
|