Skip to main content

An adapter for the Digital Annealer V4 from/to OMMX.

Project description

ommx-da4-adapter

This package provides an adapter for Fujitsu Digital Annealer(DA4) from OMMX. It allows you to solve optimization problems defined in OMMX format using DA4's powerful solver.

Installation

The ommx-da4-adapter can be installed from PyPI as follows:

pip install ommx-da4-adapter

Usage

Here's a simple example of how to use the adapter directly:

from ommx.v1 import Instance, DecisionVariable
from ommx_da4_adapter import OMMXDA4Adapter

x_0 = DecisionVariable.binary(id=0, name="x_0")
x_1 = DecisionVariable.binary(id=1, name="x_1")

ommx_instance = Instance.from_components(
    decision_variables=[x_0, x_1],
    objective=x_0 * x_1 + x_0 - x_1 + 1,
    constraints=[x_0 + x_1 == 1],
    sense=Instance.MINIMIZE,
)

ommx_sampleset = OMMXDA4Adapter.sample(
    ommx_instance=ommx_instance,
    token="*** your da4 api token ***",
    url="*** da4 url ***",
)

You can also use the adapter and client separately:

from ommx_da4_adapter import OMMXDA4Adapter, DA4Client

# Assuming ommx_instance is already defined as above
adapter = OMMXDA4Adapter(ommx_instance)

qubo_request = adapter.sampler_input

client = DA4Client(
    token="*** your da4 api token ***",
    url="*** da4 url ***",
)

qubo_response = client.sample(qubo_request=qubo_request)

ommx_sampleset = adapter.decode_to_sampleset(qubo_response)

Project details


Download files

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

Source Distribution

ommx_da4_adapter-0.1.1.tar.gz (26.7 kB view details)

Uploaded Source

File details

Details for the file ommx_da4_adapter-0.1.1.tar.gz.

File metadata

  • Download URL: ommx_da4_adapter-0.1.1.tar.gz
  • Upload date:
  • Size: 26.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ommx_da4_adapter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a2123a94706f8e36d46bc210b5747b1f130df47f275f6de5dd552ff68e273dee
MD5 c354f9da6b449b55e0d3bd3d7a7497b8
BLAKE2b-256 12cc902919da52eafaafc68fddbccd0385ccb290d4c599ef0c978dc62be630bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for ommx_da4_adapter-0.1.1.tar.gz:

Publisher: release.yaml on Jij-Inc/ommx-da4-adapter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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