Python bindings for the Powell method from scirs2-optimize
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file powell_opt-0.1.0.tar.gz.
File metadata
- Download URL: powell_opt-0.1.0.tar.gz
- Upload date:
- Size: 72.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9177dc23c5fdbc5acd2af6990651981349ca05f3fa46d8d08261b414d336617c
|
|
| MD5 |
9029907a7f8968b19b000f382cf54811
|
|
| BLAKE2b-256 |
1a2e0c9dbfad0002a704ba1645697d23e3b423a8edddb6b1d4615050784f1170
|
File details
Details for the file powell_opt-0.1.0-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: powell_opt-0.1.0-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 222.5 kB
- Tags: PyPy, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e708dcdfd8e040d8340d96f8e370a35a8eeacb978fcc85de6ef176e1104962cf
|
|
| MD5 |
fb4009217afd712d1d2caa77d7e18d2f
|
|
| BLAKE2b-256 |
affb9beb92a4a21aa50db5a683ba55d83a541814ac7a2020a96ba8c7ecace283
|
File details
Details for the file powell_opt-0.1.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: powell_opt-0.1.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 222.5 kB
- Tags: PyPy, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc513a75362ce4cbbb6cab9b848832061cb8149a28bc94ff276a318291ae3f73
|
|
| MD5 |
65d34c63ed385a6ec4d398dfbc99f850
|
|
| BLAKE2b-256 |
2f44a0dcad560e8030334426a51ef3b75137b0f58a827e7055d8a2fec8cc4eb3
|
File details
Details for the file powell_opt-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: powell_opt-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 220.4 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6f14aa7e6a0735cc618afc47034387270ca5a7e1e2b67cd1da830f8e7918e99
|
|
| MD5 |
89eb2d341ae42a3ed67f19e59550a259
|
|
| BLAKE2b-256 |
c7ce6c7557e607db1adf6fba217c9acf3cb91ac3dd3711ab400278fdd6332aef
|
File details
Details for the file powell_opt-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: powell_opt-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 187.2 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc95d1b0623d0818fe66b436d16b25c6a04d5311cc9c323730092f397a0b05d6
|
|
| MD5 |
28c14b379b41687e5cfd8b082bce5151
|
|
| BLAKE2b-256 |
182d756b2d3fc9f26400c653b530fca30d9102e3343a8a6431273af4579d081d
|
File details
Details for the file powell_opt-0.1.0-cp313-cp313-macosx_10_12_x86_64.whl.
File metadata
- Download URL: powell_opt-0.1.0-cp313-cp313-macosx_10_12_x86_64.whl
- Upload date:
- Size: 197.2 kB
- Tags: CPython 3.13, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dd1483b4737cb83ae1dba494c0c8a55fd3eb447804f3c4b12f858235adb0c4c
|
|
| MD5 |
2fce1bd8abc76b16d02e9d9b6f7a4547
|
|
| BLAKE2b-256 |
91f4a1e6b13bb928fe8694703eecc5a4839f2f0a02450002444385d86c301f97
|
File details
Details for the file powell_opt-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: powell_opt-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 220.7 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b84d2b9bd60c93b9142cbe92bd8ef78da0ef7b3d0155d6c25b824b738511a688
|
|
| MD5 |
468c96e48004477daa24cefcc3ff984a
|
|
| BLAKE2b-256 |
a58144021e82efa7a28f56e12d234194f49c1f6a8b47076e92f0dcfa08e04aa5
|
File details
Details for the file powell_opt-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: powell_opt-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 187.3 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcfbb331523e4ab1bde9a322cf338c025417896f8e2dbd05402fc3a78c13edc4
|
|
| MD5 |
c4dcec1a7b5268aafbeb1324d3d587fe
|
|
| BLAKE2b-256 |
2d1a50ce2661f5d0ce4c8f51e01dd5db3a37cd5336fbab09bc87d1716607cedc
|
File details
Details for the file powell_opt-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl.
File metadata
- Download URL: powell_opt-0.1.0-cp312-cp312-macosx_10_12_x86_64.whl
- Upload date:
- Size: 197.4 kB
- Tags: CPython 3.12, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9acbd1ee76daf03419bb54617a937ff662e340f30a0259e07c2ca6901bc87a7e
|
|
| MD5 |
76442a89a81febad493c5af5a1f60c9a
|
|
| BLAKE2b-256 |
a3e6fbeab3fc5fcfa4ee821827d1a8f9668ea471ab5514adb1248d77e26bae6c
|
File details
Details for the file powell_opt-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: powell_opt-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 221.9 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7245ee7ff883f74a588ba547b97320b45df0c6549e259cd29afaa311f03dcc4d
|
|
| MD5 |
536837589a9f83b9a1a43f29da618364
|
|
| BLAKE2b-256 |
bf821adf98c7a1ee94771f71c358b8b216d09c71a984ffebe770b826ed99b8d0
|
File details
Details for the file powell_opt-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: powell_opt-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 189.0 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b0d0b38c6164f644ab09a43669858992e4a6e082e89ca253f93f4c242d1564b
|
|
| MD5 |
5985be5fbb672818ac1c97551d6b21e1
|
|
| BLAKE2b-256 |
f2127312a6fba19b040fcd3183cec96ca1189db706a221c97a7294d65497d8ed
|
File details
Details for the file powell_opt-0.1.0-cp311-cp311-macosx_10_12_x86_64.whl.
File metadata
- Download URL: powell_opt-0.1.0-cp311-cp311-macosx_10_12_x86_64.whl
- Upload date:
- Size: 199.8 kB
- Tags: CPython 3.11, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
336a7c114e667c3b8cf86e930863557c6950c290f6c31c13b3ef5de3fd0df152
|
|
| MD5 |
9bea760c9f0e2eb9885df26717ab2903
|
|
| BLAKE2b-256 |
d7fdf11dfe10e2e784bbe4da281fd997467af9ead50d658143832f180ba8410a
|
File details
Details for the file powell_opt-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: powell_opt-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 221.9 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ff69cc3de0b86e667c2337a276c10f7a9c31c2b70bfa987ebb5cd4ffd222b47
|
|
| MD5 |
26261fd50ab81de6ec79bc36c3d84ec0
|
|
| BLAKE2b-256 |
93233d41970c8242866da53cdd53a57d4e7af91fe4869c41e0b5110d2c93cea1
|
File details
Details for the file powell_opt-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: powell_opt-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 222.1 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.24.1 CPython/3.11.11 Linux/6.8.0-57-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
234e85926cf2433211d99e6e42d6e4daabb8e552af2d75f79f7de7669ae08e58
|
|
| MD5 |
7f2ec180b59ef842b80b8fd247ea45ed
|
|
| BLAKE2b-256 |
b45d25ba7229b0d33cec38e9778fb524648786760ab7711991e42ad91bd93be6
|