Skip to content

Microsoft QIO

JijQIOBaseSampler

Bases: JijZeptBaseSampler, typ.Generic[P]

sample_hubo(J, parameters=None, timeout=None, sync=True, queue_name=None, **kwargs)

Microsoft QIO simulated annealing solver is performed for binary polynomial models.

Parameters:

Name Type Description Default
J Dict

Polynomial interactions.

required
vartype str

The variable type. "SPIN" or "BINARY".

required
num_sweeps Optional[int]

The number of Monte-Carlo steps. If None, this will be set automatically.

required
beta_min Optional[float]

Minimum (initial) inverse temperature. If None, this will be set automatically.

required
beta_max Optional[float]

Maximum (final) inverse temperature. If None, this will be set automatically.

required
num_reads Optional[int]

The number of samples. If None, this will be set automatically.

required
seed Optional[int]

Seed for Monte Carlo algorithm. If None, this will be set automatically.

required
platform Optional[str]

"CPU" or "FPGA". If None, "CPU" will be set.

required
timeout Optional[int]

The number of timeout [sec] for post request. If None, 3600 (one hour) will be set.

None
sync bool

Synchronous mode.

True

Returns:

Type Description
JijModelingResponse

dimod.SampleSet: Stores minimum energy samples and other information.

Examples:

import jijzept as jz
sampler = jz.JijQIOSASampler(config='config.toml')
response = sampler.sample_hubo(J={(0,1,2,3,4): -1}, vartype="SPIN")

sample_model(model, feed_dict, multipliers={}, fixed_variables={}, search=False, num_search=15, algorithm=None, parameters=None, timeout=None, sync=True, queue_name=None, **kwargs)

Sample using JijModeling by means of Microsoft QIO Simulated Annealing solver.

Parameters:

Name Type Description Default
model jijmodeling.Problem

Mathematical model is constracted by JijModeling.

required
feed_dict Dict[str, Union[Number, list, np.ndarray]]

The actual values to be assigned to the placeholders.

required
multipliers Dict[str, Number]

The actual multipliers for penalty terms, derived from constraint conditions.

{}
fixed_variables Dict[str, Dict[Tuple[int, ...], Union[int, float]]]

dictionary of variables to fix.

{}
search bool

If True, the parameter search will be carried out, which tries to find better values of multipliers for penalty terms.

False
num_search int

The number of parameter search iteration. Defaults to set 15. This option works if search is True.

15
algorithm Optional[str]

Algorithm for parameter search. Defaults to None.

None
parameters P | None

(P | None, optional): parameters for QIO. Defaults to None.

None
timeout Optional[int]

The number of timeout [sec] for post request. If None, 3600 (one hour) will be set.

None
sync bool

Synchronous mode.

True

Returns:

Name Type Description
JijModelingResponse JijModelingResponse

Stores minimum energy samples and other information.

Examples:

import jijzept as jz
import jijmodeling as jm
n = jm.Placeholder('n')
x = jm.Binary('x', shape=n)
d = jm.Placeholder('d', shape=n)
i = jm.Element("i", n)
problem = jm.Problem('problem')
problem += jm.Sum(i, d[i] * x[i])
sampler = jz.JijQIOSASampler(config='config.toml')
response = sampler.sample_model(problem, feed_dict={'n': 5, 'd': [1,2,3,4,5]})

sample_qubo(Q, parameters=None, timeout=None, sync=True, queue_name=None, **kwargs)

Microsoft QIO solver is performed for binary quadratic models.

Parameters:

Name Type Description Default
Q Dict

The linear or quadratic terms.

required
num_sweeps Optional[int]

The number of Monte-Carlo steps. If None, this will be set automatically.

required
beta_min Optional[float]

Minimum (initial) inverse temperature. If None, this will be set automatically.

required
beta_max Optional[float]

Maximum (final) inverse temperature. If None, this will be set automatically.

required
num_reads Optional[int]

The number of samples. If None, this will be set automatically.

required
seed Optional[int]

Seed for Monte Carlo algorithm. If None, this will be set automatically.

required
platform Optional[str]

"CPU" or "FPGA". If None, "CPU" will be set.

required
timeout Optional[int]

The number of timeout [sec] for post request. If None, 3600 (one hour) will be set.

None
sync bool

Synchronous mode.

True

Returns:

Type Description
JijModelingResponse

dimod.SampleSet: Stores minimum energy samples and other information.

Examples:

import jijzept as jz
sampler = jz.JijQIOSASampler(config='config.toml')
response = sampler.sample_qubo(Q={(0,0): -0.5, (0,1): -1, (0,2): -1, (2,3): -1})

Last update: 2022年12月21日