Amplify-BBOpt
Amplify-BBOpt is a powerful Python package by Fixstars Amplify, designed to streamline the implementation and execution of black-box optimization algorithms.
- Documentation:
https://amplify.fixstars.com/docs/amplify-bbopt/v1/ - Contributing (bug reports, improvements):
https://amplify.fixstars.com/en/contact
Features
Amplify-BBOpt is built upon the powerful Amplify SDK, bridging the gap between black-box optimization and specialized hardware. It uniquely offers annealing-based optimization methods, including Factorization Machine Quantum Annealing (FMQA) and Kernel-QA, which are designed to run on quantum annealers and various Ising machine backends.
- Intuitive API: A clean, straightforward interface enables rapid experimentation and allows users to easily swap between different optimization methods.
- High-Dimensional Scalability: Engineered to effectively solve complex optimization problems, even those with a high-dimensional parameter space.
- Built-in Constraint Handling: Natively supports both unconstrained and constrained optimization problems, providing a versatile framework for real-world applications.
Basic Usage
from amplify import AmplifyAEClient
from amplify_bbopt import FMTrainer, Optimizer, RealVariable, blackbox
# Define a test function
# (This represents a simulation or experiment)
def spherical_func(a: float, b: float) -> float:
return (a + 1) ** 2 + (b - 1) ** 2
# Make a black-box function and define relevant decision variables
@blackbox
def bb_func(
a: float = RealVariable((-5, 5)), # type: ignore
b: float = RealVariable((-5, 5)), # type: ignore
) -> float:
return spherical_func(a, b)
# Prepare solver client
client = AmplifyAEClient()
client.parameters.time_limit_ms = 1000
# Execute optimization
opt = Optimizer(bb_func, FMTrainer(), client)
opt.add_random_training_data(num_data=5)
opt.optimize(num_iterations=10)
# View results
print(opt.best.objective)
print(opt.best.values)
For Developers
Amplify-BBOpt requires Python 3.10 or later.
Also, it depends on the amplify package, which can be installed via pip.
After installing the dependencies, you can install Amplify-BBOpt in editable mode.
$ pip install -e amplify-bbopt
Instead, we recommend using uv for managing the development environment and running tests.
$ uv sync
Testing:
$ uv run pytest
Metadata
Release files for amplify-bbopt 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| amplify_bbopt-1.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / amplify_bbopt-1.3.0-py3-none-any.whl
| Download URL | amplify_bbopt-1.3.0-py3-none-any.whl |
|---|---|
| Size | 41.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a18ae4b0f7eb5bdafcfdfbc0accc82956a3ad5a8f82432f42ee114fce1169d0
|
|
BLAKE2b-256 checksum How to use checksums |
1f3ab93b8213ad08cc00bdb5849224e39bc1d28da9f4c417d95e6a053e207c4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|