Skip to main content

Jij

Jij is part of the Strangeworks Syndicate and is working on developing quantum annealing devices.

Solvers

ModelSolvers
Quadratic Unconstrained Binary Optimization (QUBO)jij.SA, jij.SQA
Constrained Quadratic Model (CQM)jij.LeapHybridCQM
note

The maximum calculation time before solver timeout is 600.0s.

Simulated Annealing

QUBO

import strangeworks as sw
from strangeworks_optimization import StrangeworksOptimizer
from strangeworks_optimization_models.parameter_models import JijSAParameterModel
from dimod import BinaryQuadraticModel

sw.authenticate(api_key)

linear = {1: -2, 2: -2, 3: -3, 4: -3, 5: -2}
quadratic = {(1, 2): 2, (1, 3): 2, (2, 4): 2, (3, 4): 2, (3, 5): 2, (4, 5): 2}
model = BinaryQuadraticModel(linear, quadratic, "BINARY")

solver = "jij.SA"
options = JijSAParameterModel(num_sweeps=2000, num_reads=100)

so = StrangeworksOptimizer(
model=model,
solver=solver,
options=options)
sw_job = so.run()

print(f"Job slug: {sw_job.slug}")
print(f"Job status: {so.status(sw_job.slug)}")

results = so.results(sw_job.slug)

Parameters

from strangeworks_optimization_models.parameter_models import JijSAParameterModel

options = JijSAParameterModel(.....)
NameDescriptionDefault Value
feed_dictDictionary of coefficients for jm.Problem.None
num_searchNumber of times algorithm will be run.1
multipliersMultipliers for any constraints in jm.ProblemNone
beta_minInverse temperature.None
beta_maxInverse temperature.None
num_sweepsThe number of Monte-Carlo steps.1000
num_readsThe number of samples. If `None`, 1 will be set.1
initial_stateInitial state.None
updaterUpdater algorithm. "single spin flip" or "swendsen wang".single spin flip
sparseIf `True`, only non-zero matrix elements are stored, which will save memory.False
reinitialize_stateIf `True`, reinitialize state for each run.True
seedSeed for Monte Carlo algorithm.None
needs_square_constraintsThis dictionary object is utilized to determine whether to square the constraint condition while incorporating it into the QUBO/HUBO penalty term. Here, the constraint's name is used as the key. If the value is set to True, the corresponding constraint is squared upon its addition to the QUBO/HUBO penalty term.True for linear constraints, and to False for non-linear ones.
relax_as_penaltiesThis dictionary object is designed to regulate the incorporation of constraint conditions into the QUBO/HUBO penalty term, with the constraint's name functioning as the key. If the key's value is True, the respective constraint is added to the QUBO/HUBO penalty term. If the value is False, the constraint is excluded from the penalty term, though it remains subject to evaluation to verify if it meets the constraint conditions.True

Solvers

  • jij.SA

Simulated Quantum Annealing

QUBO

import strangeworks as sw
from strangeworks_optimization import StrangeworksOptimizer
from strangeworks_optimization_models.parameter_models import JijSQAParameterModel
from dimod import BinaryQuadraticModel

sw.authenticate(api_key)

linear = {1: -2, 2: -2, 3: -3, 4: -3, 5: -2}
quadratic = {(1, 2): 2, (1, 3): 2, (2, 4): 2, (3, 4): 2, (3, 5): 2, (4, 5): 2}
model = BinaryQuadraticModel(linear, quadratic, "BINARY")

solver = "jij.SQA"
options = JijSQAParameterModel(num_sweeps=2000, num_reads=100)

so = StrangeworksOptimizer(
model=model,
solver=solver,
options=options)
sw_job = so.run()

print(f"Job slug: {sw_job.slug}")
print(f"Job status: {so.status(sw_job.slug)}")

results = so.results(sw_job.slug)

Parameters

from strangeworks_optimization_models.parameter_models import JijSQAParameterModel

options = JijSQAParameterModel(.....)
NameDescriptionDefault Value
feed_dictDictionary of coefficients for jm.Problem.None
num_searchNumber of times algorithm will be run.1
multipliersMultipliers for any constraints in jm.ProblemNone
betaInverse temperature.None
gammaStrength of transverse field.None
num_sweepsThe number of Monte-Carlo steps.1000
num_readsThe number of samples.1
sparseIf `True`, only non-zero matrix elements are stored, which will save memory.False
reinitialize_stateIf `True`, reinitialize state for each run.True
seedSeed for Monte Carlo algorithm.None
needs_square_constraintsThis dictionary object is utilized to determine whether to square the constraint condition while incorporating it into the QUBO/HUBO penalty term. Here, the constraint's name is used as the key. If the value is set to True, the corresponding constraint is squared upon its addition to the QUBO/HUBO penalty term.True for linear constraints, and to False for non-linear ones.
relax_as_penaltiesThis dictionary object is designed to regulate the incorporation of constraint conditions into the QUBO/HUBO penalty term, with the constraint's name functioning as the key. If the key's value is True, the respective constraint is added to the QUBO/HUBO penalty term. If the value is False, the constraint is excluded from the penalty term, though it remains subject to evaluation to verify if it meets the constraint conditions.True

Solvers

  • jij.SQA
NameDescriptionDefault Value
feed_dictDictionary of coefficients for jm.Problem.None
num_searchNumber of times algorithm will be run.1
multipliersMultipliers for any constraints in jm.ProblemNone
betaInverse temperature.None
gammaStrength of transverse field.None
num_sweepsThe number of Monte-Carlo steps.1000
num_readsThe number of samples.1
sparseIf True, only non-zero matrix elements are stored, which will save memory.False
reinitialize_stateIf True, reinitialize state for each run.True
seedSeed for Monte Carlo algorithm.None
needs_square_constraintsThis dictionary object is utilized to determine whether to square the constraint condition while incorporating it into the QUBO/HUBO penalty term. Here, the constraint's name is used as the key. If the value is set to True, the corresponding constraint is squared upon its addition to the QUBO/HUBO penalty term.True for linear constraints, and to False for non-linear ones.
relax_as_penaltiesThis dictionary object is designed to regulate the incorporation of constraint conditions into the QUBO/HUBO penalty term, with the constraint's name functioning as the key. If the key's value is True, the respective constraint is added to the QUBO/HUBO penalty term. If the value is False, the constraint is excluded from the penalty term, though it remains subject to evaluation to verify if it meets the constraint conditions.True

Leap Hybrid CQM

CQM

To submit a constrained quadratic model to the LeapHybridCQM solver through Jij, we must use JijModeling to define the problem.

import strangeworks as sw
from strangeworks_optimization import StrangeworksOptimizer
from strangeworks_optimization_models.parameter_models import JijLeapHybridCQMParameterModel
import jijmodeling as jm

d = jm.Placeholder("d", ndim=1) # Define variable d
d.len_at(0, latex="N") # Set latex expression of the length of d
x = jm.BinaryVar("x", shape=(d.shape[0],)) # Define binary variable
i = jm.Element("i", belong_to=(0, d.shape[0])) # Define dummy index in summation
model = jm.Problem("simple problem") # Create problem instance
model += jm.sum(i, d[i] * x[i]) # Add objective function
model += jm.Constraint("one hot", jm.sum(i, x[i]) == 1) # Add constraint condition
model # Display the problem

solver = "jij.LeapHybridCQM"
options = JijLeapHybridCQMParameterModel(feed_dict={"d": [1.0, 0.1, -2.0, 1.0]}, time_limit=10)

so = StrangeworksOptimizer(
model=model,
solver=solver,
options=options)
sw_job = so.run()

print(f"Job slug: {sw_job.slug}")
print(f"Job status: {so.status(sw_job.slug)}")

results = so.results(sw_job.slug)

Parameters

from strangeworks_optimization_models.parameter_models import JijLeapHybridCQMParameterModel

options = JijLeapHybridCQMParameterModel(.....)
NameDescriptionDefault Value
feed_dictDictionary of coefficients for jm.Problem. If `None`, an empty dictionary will be set.{}
num_searchNumber of times algorithm will be run. If `None`, 1 will be set.1
time_limitTime limit in seconds. If `None`, this will be set automatically.None

Solvers

  • jij.LeapHybridCQM