Skip to content

Fixstars Amplify

JijFixstarsAmplifyParameters dataclass

Manage Parameters for using Fixstars Amplify.


Name Type Description
amplify_timeout int

Set the timeout in milliseconds. Defaults to 1000.

num_gpus int

Set the number of GPUs to be used. The maximum number of GPUs available depends on the subscription plan, and 0 means the maximum number available. Defaults to 1.

penalty_calibration bool

Set whether to enable the automatic adjustment of the penalty function's multipliers. If multiplier is not set, it will be set true. Defaults to False.

duplicate bool

If True, all solutions with the same energy and the same feasibility are output. Otherwise, only one solution with the same energy and feasibility is output.

num_outputs int

The number of solutions to be output which have different energies and feasibility. Assumed 1 if no value is set. If set to 0, all the solutions are output. Defaults to 1.


Bases: JijZeptBaseSampler

__init__(token=None, url=None, proxy=None, config=None, config_env='default', fixstars_token='', fixstars_url='')

Sets Jijzept token and url and fixstars amplify token and url.


Name Type Description Default
token Optional[str]

Token string.

url Union[str, dict]


proxy Optional[str]

Proxy URL.

config Optional[str]

Config file path for JijZept.

config_env str

config env.

fixstars_token str

Token string for Fixstars Amplify.

fixstars_url str

Url string for Fixstars Ampplify.


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

Converts the given problem to amplify.BinaryQuadraticModel and run.

Fixstars Amplify Solver. Note here that the supported type of decision variables is only Binary when using Fixstars Ampplify Solver from Jijzept.


Name Type Description Default
model Problem

Mathematical expression of JijModeling.

feed_dict dict[str, Union[Number, list, np.ndarray]]

The actual values to be assigned to the placeholders.

multipliers dict[str, Number]

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

fixed_variables dict[str, dict[tuple[int, ...], Number]]

Dictionary of variables to fix.

parameters Optional[JijFixstarsAmplifyParameters]

Parameters used in Fixstars Amplify. If None, the default value of the JijFixstarsAmplifyParameters will be set.]

normalize_qubo bool

Option to normalize the QUBO coefficient. Defaults to False.

jm_sampleset bool

Selects whether the argument value should be JijModelingResponse.

timeout Optional[int]

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

sync bool

Synchronous mode.

queue_name Optional[str]

Queue name.



Type Description

Union[DimodResponse, JijModelingResponse]: Stores samples and other information.


import jijmodeling as jm
from jijzept import JijFixstarsAmplifySampler, JijFixstarsAmplifyParameters

w = jm.Placeholder("w", dim=1)
num_items = jm.Placeholder("num_items")
c = jm.Placeholder("c")
y = jm.Binary("y", shape=(num_items,))
x = jm.Binary("x", shape=(num_items, num_items))
i = jm.Element("i", num_items)
j = jm.Element("j", num_items)
problem = jm.Problem("bin_packing")
problem += y[:]
problem += jm.Constraint("onehot_constraint", jm.Sum(j, x[i, j]) - 1 == 0, forall=i)
problem += jm.Constraint("knapsack_constraint", jm.Sum(i, w[i] * x[i, j]) - y[j] * c <= 0, forall=j)

feed_dict = {"num_items": 2, "w": [9, 1], "c": 10}
multipliers = {"onehot_constraint": 11, "knapsack_constraint": 22}

sampler = JijFixstarsAmplifySampler(config="xx", fixstars_token="oo")
parameters = JijFixstarsAmplifyParameters(amplify_timeout=1000, num_outputs=1, filter_solution=False, penalty_calibration=False)
sampleset = sampler.sample_model(
    problem, feed_dict, multipliers, parameters=parameters

Last update: 2022年12月21日