Skip to main content

Black box optimization library based on Amplify SDK

Project description

Amplify-BBOpt

Amplify-BBOpt is a powerful Python package by Fixstars Amplify, designed to streamline the implementation and execution of black-box optimization algorithms.

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 FixstarsClient

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 = FixstarsClient()
client.parameters.timeout = 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 amplify and torch packages, 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

amplify_bbopt-1.1.0.tar.gz (26.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

amplify_bbopt-1.1.0-py3-none-any.whl (29.9 kB view details)

Uploaded Python 3

File details

Details for the file amplify_bbopt-1.1.0.tar.gz.

File metadata

  • Download URL: amplify_bbopt-1.1.0.tar.gz
  • Upload date:
  • Size: 26.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","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}

File hashes

Hashes for amplify_bbopt-1.1.0.tar.gz
Algorithm Hash digest
SHA256 14e65b0fbaaa52de3e54537f75df9ab42a015726fe7ab76af156b7a3c0ff30a6
MD5 95a291394aa9fdf6d045fdcbc06cad44
BLAKE2b-256 39829979f2b02fa3557544f0b8235adc8dc81e5207088618b22534989ad212df

See more details on using hashes here.

File details

Details for the file amplify_bbopt-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: amplify_bbopt-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","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}

File hashes

Hashes for amplify_bbopt-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d62dec0dd28bf78a7e9e668255cd6b83023fe8fdb2a4b9aeb4afc59f17d3fe08
MD5 c020cf0c4e76730d261e9933f0702d7f
BLAKE2b-256 36aa59326189d065221e8b5e191328277f8ec4fc4b7e93b5ff25b67340496ded

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page