FujitsuDA4ClientΒΆ

class FujitsuDA4ClientΒΆ

Bases: BaseClient

Client for the Fujitsu Digital Annealer DA4 solver. It takes a job asynchronously, so the client polls the service until the job ends.

Methods

__init__

async_solve

async_solve

cancel_job

delete_job_result

get_job_result

get_jobs

health_check

solve

Send the objective function and the constraints to the solver.

Attributes

acceptable_degrees

Degrees of the polynomial that the solver accepts.

parameters

Parameters that the client sends with every request.

proxy

URL of the proxy that the client goes through, or None for no proxy.

set_inequalities

set_one_way_one_hot_groups

set_penalty_binary_polynomial

set_two_way_one_hot_groups

token

API token of the user.

type_id

url

URL of the service that the client sends to.

version

Version of the API that the client speaks.

write_request_data

Path of the file that receives a copy of the request, or None to write none.

write_response_data

Path of the file that receives a copy of the response, or None to write none.

class CommonErrorΒΆ
__init__(*args, **kwargs)ΒΆ
__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

property codeΒΆ
property messageΒΆ
property titleΒΆ
class JobStatusΒΆ

Bases: Enum

classmethod __contains__(value)ΒΆ

Return True if value is in cls.

value is in cls if: 1) value is a member of cls, or 2) value is the value of one of the cls’s members. 3) value is a pseudo-member (flags)

classmethod __getitem__(name)ΒΆ

Return the member matching name.

classmethod __iter__()ΒΆ

Return members in definition order.

classmethod __len__()ΒΆ

Return the number of members (no aliases)

__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

Canceled = 3ΒΆ
Deleted = 5ΒΆ
Done = 0ΒΆ
Error = 4ΒΆ
Running = 1ΒΆ
Waiting = 2ΒΆ
__members__ = mappingproxy({'Done': FujitsuDA4ClientJobStatusEnum.Done, 'Running': FujitsuDA4ClientJobStatusEnum.Running, 'Waiting': FujitsuDA4ClientJobStatusEnum.Waiting, 'Canceled': FujitsuDA4ClientJobStatusEnum.Canceled, 'Error': FujitsuDA4ClientJobStatusEnum.Error, 'Deleted': FujitsuDA4ClientJobStatusEnum.Deleted})ΒΆ
__name__ = 'JobStatus'ΒΆ
__nb_enum__ = <capsule object NULL>ΒΆ
__qualname__ = 'FujitsuDA4Client.JobStatus'ΒΆ
class JobStatusInfoΒΆ
__init__(*args, **kwargs)ΒΆ
__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

property job_idΒΆ
property job_statusΒΆ
property start_timeΒΆ
class ParametersΒΆ

Parameters that the client sends with every request.

__init__(*args, **kwargs)ΒΆ
__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

property gs_cutoffΒΆ
property gs_levelΒΆ
property internal_penaltyΒΆ
property max_penalty_coefΒΆ
property num_groupΒΆ
property num_output_solutionΒΆ
property num_runΒΆ
property one_hot_cutoffΒΆ
property one_hot_levelΒΆ
property penalty_auto_modeΒΆ
property penalty_coefΒΆ
property penalty_inc_rateΒΆ
property target_energyΒΆ
property time_limit_secΒΆ
class ProgressΒΆ
__init__(*args, **kwargs)ΒΆ
__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

property energyΒΆ
property penalty_energyΒΆ
property timeΒΆ
QuboResponseΒΆ

alias of Result

class QuboSolutionΒΆ
__init__(*args, **kwargs)ΒΆ
__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

property configurationΒΆ
property energyΒΆ
property frequencyΒΆ
property penalty_energyΒΆ
class QuboSolutionListΒΆ
__init__(*args, **kwargs)ΒΆ
__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

property progressΒΆ
property result_statusΒΆ
property solutionsΒΆ
property timingΒΆ
class ResultΒΆ

Raw response that the solver returned.

__init__(*args, **kwargs)ΒΆ
__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

property messageΒΆ
property qubo_solutionΒΆ
property statusΒΆ
class SolverTimingΒΆ
__init__(*args, **kwargs)ΒΆ
__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

property solve_timeΒΆ
property total_elapsed_timeΒΆ
__init__(self) NoneΒΆ
__init__(self, token: str = '', type_id: str | None = None, url: str = '', proxy: str | None = None) None
Parameters:
  • token (str) – Defaults to ''.

  • type_id (str | None) – Defaults to None.

  • url (str) – Defaults to ''.

  • proxy (str | None) – Defaults to None.

__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

async_solve(self, objective: Poly) strΒΆ
async_solve(self, constraint: Constraint | ConstraintList) str
async_solve(self, objective: Poly, constraint: Constraint | ConstraintList) str

async_solve

Overload 1.

Args:
  • objective (amplify.Poly)

Returns:

str:

Overload 2.

Args:
  • constraint (amplify.Constraint | amplify.ConstraintList)

Returns:

str:

Overload 3.

Args:
  • objective (amplify.Poly)

  • constraint (amplify.Constraint | amplify.ConstraintList)

Returns:

str:

cancel_job(self, job_id: str) JobStatusΒΆ
Parameters:

job_id (str)

Return type:

JobStatus

delete_job_result(self, job_id: str) ResultΒΆ
Parameters:

job_id (str)

Return type:

Result

get_job_result(self, job_id: str) ResultΒΆ
Parameters:

job_id (str)

Return type:

Result

get_jobs(self) list[JobStatusInfo]ΒΆ
Return type:

list[JobStatusInfo]

health_check(self) CommonError | NoneΒΆ
Return type:

CommonError | None

solve(
self,
objective: Poly | Matrix,
dry_run: Literal[False] = False,
retry_after_delete: bool = True,
delete_after_solve: bool = True,
) ResultΒΆ
solve(
self,
constraint: Constraint | ConstraintList,
dry_run: Literal[False] = False,
retry_after_delete: bool = True,
delete_after_solve: bool = True,
) Result
solve(
self,
objective: Poly | Matrix,
constraint: Constraint | ConstraintList,
dry_run: Literal[False] = False,
retry_after_delete: bool = True,
delete_after_solve: bool = True,
) Result
solve(
self,
objective: Poly | Matrix,
dry_run: Literal[True],
retry_after_delete: bool = True,
delete_after_solve: bool = True,
) None
solve(
self,
constraint: Constraint | ConstraintList,
dry_run: Literal[True],
retry_after_delete: bool = True,
delete_after_solve: bool = True,
) None
solve(
self,
objective: Poly | Matrix,
constraint: Constraint | ConstraintList,
dry_run: Literal[True],
retry_after_delete: bool = True,
delete_after_solve: bool = True,
) None

Send the objective function and the constraints to the solver.

This method takes the polynomial that the solver accepts, so it runs no conversion of the model. Use solve() to solve a model that needs a conversion. It returns the raw response of the solver.

Overload 1.

Args:
  • objective (amplify.Poly | amplify.Matrix): The objective function that the solver minimizes.

  • dry_run (typing.Literal[False]): When True, ask the service to check the request, and return None. Defaults to False.

  • retry_after_delete (bool): When True, delete a job that already finished and send the request again after the service refuses a new job. When False, raise the error of the service instead. Defaults to True.

  • delete_after_solve (bool): When True, delete the job from the service after the client reads the answer. Defaults to True.

Returns:

amplify.FujitsuDA4Client.Result:

Overload 2.

Args:
  • constraint (amplify.Constraint | amplify.ConstraintList): The constraints that the solution must satisfy.

  • dry_run (typing.Literal[False]): When True, ask the service to check the request, and return None. Defaults to False.

  • retry_after_delete (bool): When True, delete a job that already finished and send the request again after the service refuses a new job. When False, raise the error of the service instead. Defaults to True.

  • delete_after_solve (bool): When True, delete the job from the service after the client reads the answer. Defaults to True.

Returns:

amplify.FujitsuDA4Client.Result:

Overload 3.

Args:
  • objective (amplify.Poly | amplify.Matrix): The objective function that the solver minimizes.

  • constraint (amplify.Constraint | amplify.ConstraintList): The constraints that the solution must satisfy.

  • dry_run (typing.Literal[False]): When True, ask the service to check the request, and return None. Defaults to False.

  • retry_after_delete (bool): When True, delete a job that already finished and send the request again after the service refuses a new job. When False, raise the error of the service instead. Defaults to True.

  • delete_after_solve (bool): When True, delete the job from the service after the client reads the answer. Defaults to True.

Returns:

amplify.FujitsuDA4Client.Result:

Overload 4.

Args:
  • objective (amplify.Poly | amplify.Matrix): The objective function that the solver minimizes.

  • dry_run (typing.Literal[True]): When True, ask the service to check the request, and return None.

  • retry_after_delete (bool): When True, delete a job that already finished and send the request again after the service refuses a new job. When False, raise the error of the service instead. Defaults to True.

  • delete_after_solve (bool): When True, delete the job from the service after the client reads the answer. Defaults to True.

Overload 5.

Args:
  • constraint (amplify.Constraint | amplify.ConstraintList): The constraints that the solution must satisfy.

  • dry_run (typing.Literal[True]): When True, ask the service to check the request, and return None.

  • retry_after_delete (bool): When True, delete a job that already finished and send the request again after the service refuses a new job. When False, raise the error of the service instead. Defaults to True.

  • delete_after_solve (bool): When True, delete the job from the service after the client reads the answer. Defaults to True.

Overload 6.

Args:
  • objective (amplify.Poly | amplify.Matrix): The objective function that the solver minimizes.

  • constraint (amplify.Constraint | amplify.ConstraintList): The constraints that the solution must satisfy.

  • dry_run (typing.Literal[True]): When True, ask the service to check the request, and return None.

  • retry_after_delete (bool): When True, delete a job that already finished and send the request again after the service refuses a new job. When False, raise the error of the service instead. Defaults to True.

  • delete_after_solve (bool): When True, delete the job from the service after the client reads the answer. Defaults to True.

property acceptable_degreesΒΆ

Degrees of the polynomial that the solver accepts.

solve() reads it to decide the conversion of the model.

Return type:

AcceptableDegrees

property parametersΒΆ

Parameters that the client sends with every request.

Return type:

Parameters

property proxyΒΆ

URL of the proxy that the client goes through, or None for no proxy.

Return type:

str | None

property set_inequalitiesΒΆ
property set_one_way_one_hot_groupsΒΆ
property set_penalty_binary_polynomialΒΆ
property set_two_way_one_hot_groupsΒΆ
property tokenΒΆ

API token of the user.

The client needs it for every request. Its text never appears in the output of repr().

Return type:

str

property type_idΒΆ
property urlΒΆ

URL of the service that the client sends to.

Return type:

str

property versionΒΆ

Version of the API that the client speaks.

The client holds this text, so reading it sends no request.

Return type:

str

property write_request_dataΒΆ

Path of the file that receives a copy of the request, or None to write none.

Use it to inspect what the client sends.

Return type:

Path | None

property write_response_dataΒΆ

Path of the file that receives a copy of the response, or None to write none.

Return type:

Path | None