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 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 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.2.0.tar.gz (29.9 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.2.0-py3-none-any.whl (33.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: amplify_bbopt-1.2.0.tar.gz
  • Upload date:
  • Size: 29.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","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.2.0.tar.gz
Algorithm Hash digest
SHA256 46b1b4e318b63f47e47fdcbc60975338c07e18275aa0981ca93c358560809531
MD5 6961fd9cb7787d55f8b1b3f793ca8e2f
BLAKE2b-256 32601bf20409b29d4e1dbb731eee1e3e64ce633fa1eb5d3b50199a07a9ebddb7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: amplify_bbopt-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 33.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 94135833fcae1bd99713137e81201ac080fa515d335544d4851ecc61e3025ac5
MD5 44253827cc5599e748fffb8f35f589e8
BLAKE2b-256 77954054c815e2c11651191110f325284e29c6786835ada46d91d444a033be4c

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