Skip to main content

JijLeapHybridCQMSampler

Leap's hybrid solver, provided by D-Wave, excels at solving optimization problems with numerous variables, utilizing a hybrid algorithm that combines quantum annealing machines and classical computers. Its capability to process Constrained Quadratic Models (CQMs) allows it to tackle a broad spectrum of problems, especially those centered around constrained quadratic optimization. For more details, please refer to this document.

Usage

  1. Update the config.toml by adding the [default.thirdparty-setting] section. Include the following two items:

    [default]
    url = "https://api.jijzept.com"
    token = "JIJ_ZEPT_API_KEY"

    [default.thirdparty-setting]
    leap_url = "https://jijcloud.leap.net/"
    leap_token = "D-Wave_API_TOKEN"
  2. Use the two classes provided by the jijzept and run the method sample_model in the JijLeapHybridCQMSampler class:

    • JijLeapHybridCQMSampler: a class to sample using the hybrid CQM solver.
    • JijLeapHybridCQMParameters: a class to set parameters specifically for the hybrid CQM solver.
    from jijzept import JijLeapHybridCQMSampler, JijLeapHybridCQMParameters

    sampler = JijLeapHybridCQMSampler(config="./config.toml")
    parameters = JijLeapHybridCQMParameters(time_limit=1)

    response = sampler.sample_model(
    problem=problem,
    feed_dict=instance_data,
    parameters=parameters,
    )

Parameters

JijLeapHybridCQMParameters

nametypedefaultdescription
time_limitOptional[Union[int, float]]NoneMaximum run time, in seconds, to allow the solver to work on the problem. For more details, please refer to the description of the time_limit in the API reference.
labelOptional[str]NoneIf you set a value, it will be contained in the SampleSet.metadata.info returned by the JijLeapHybridCQMSampler. For more details, please refer to this document.

JijLeapHybridCQMSampler.sample_model

nametypedefaultdescription
parametersOptional[JijLeapHybridCQMParameters]NoneParameters for JijLeapHybridCQMSampler.
relax_listOptional[list[str]]NoneInteger variables defined using JijModeling are added to a CQM as integer variables. If you want to add specific integer variables to CQM as real (or continuous) variables, add their names to the relax_list.
max_wait_timeOptional[Union[int, float]]NoneThe timeout duration (in seconds) for a post request. If None, 60 (one minute) will be set.
syncboolTrueIf True, synchronous mode is enabled.
queue_nameOptional[str]NoneQueue name