Skip to main content

JiJ

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

Solvers

ModelsBackends (see catalog for complete list)
BinaryQuadraticModel, JiJProblemjij.SA, jij.SQA
JiJProblemjij.LeapHybridCQM

The maximum calculation time before solver timeout is 600.0s.

JiJProblem

See https://www.documentation.jijzept.com/docs/jijmodeling/ for details.

JijSAParameterModel

Parameters:

  • feed_dict (dict): Dictionary of coefficients for jm.Problem. If None, an empty dictionary will be set.
  • num_search (int): Number of times algorithm will be run. If None, 1 will be set.
  • multipliers (dict): Multipliers for any constraints in jm.Problem
  • beta_min (float): inverse temperature. If None, this will be set automatically.
  • beta_max (float): inverse temperature. If None, this will be set automatically.
  • num_sweeps (int): The number of Monte-Carlo steps. If None, 1000 will be set.
  • num_reads (int): The number of samples. If None, 1 will be set.
  • initial_state (list | dict): Initial state. If None, this will be set automatically.
  • updater (str): Updater algorithm. "single spin flip" or "swendsen wang". If None, "single spin flip" will be set.
  • sparse (bool): If True, only non-zero matrix elements are stored, which will save memory. If None, False will be set.
  • reinitialize_state (bool): If True, reinitialize state for each run. If None, True will be set.
  • seed (int): Seed for Monte Carlo algorithm. If None, this will be set automatically.
  • needs_square_constraints (dict[str, bool]): This 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. By default, the value is set to True for linear constraints, and to False for non-linear ones.
  • relax_as_penalties (dict[str, bool]): This 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. By default, all constraint conditions have this value set to True.

JijSQAParameterModel

Parameters:

  • feed_dict (dict): Dictionary of coefficients for jm.Problem. If None, an empty dictionary will be set.
  • num_search (int): Number of times algorithm will be run. If None, 1 will be set.
  • multipliers (dict): Multipliers for any constraints in jm.Problem
  • beta (float): inverse temperature. If None, this will be set automatically.
  • gamma (float): Strength of transverse field. this will be set automatically.
  • num_sweeps (int): The number of Monte-Carlo steps. If None, 1000 will be set.
  • num_reads (int): The number of samples. If None, 1 will be set.
  • sparse (bool): If True, only non-zero matrix elements are stored, which will save memory. If None, False will be set.
  • reinitialize_state (bool): If True, reinitialize state for each run. If None, True will be set.
  • seed (int): Seed for Monte Carlo algorithm. If None, this will be set automatically.
  • needs_square_constraints (dict[str, bool]): This 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. By default, the value is set to True for linear constraints, and to False for non-linear ones.
  • relax_as_penalties (dict[str, bool]): This 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. By default, all constraint conditions have this value set to True.

JijLeapHybridCQMParameterModel

Parameters:

  • feed_dict (dict): Dictionary of coefficients for jm.Problem. If None, an empty dictionary will be set.
  • num_search (int): Number of times algorithm will be run. If None, 1 will be set.
  • time_limit (int): Time limit in seconds. If None, this will be set automatically.

Binary Quadratic Model

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

sw.authenticate('your-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)

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

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

results = optimizer.results(sw_job.slug)

Constrained Quadratic Model

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)

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

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

results = optimizer.results(sw_job.slug)