AmplifyAEClientΒΆ
- class AmplifyAEClientΒΆ
Bases:
BaseClientClient of the Amplify Annealing Engine. It sends the model to the service of Fixstars and returns the solutions that the engine found.
Methods
Attributes
Degrees of the polynomial that the engine accepts.
Time above which the client sends the request asynchronously, in milliseconds.
Whether the client compresses the body of the request.
Format of the objective function in the request.
Parameters that the client sends with every request.
URL of the proxy that the client goes through, or
Nonefor no proxy.Solver of the engine that runs the request.
API token of the user.
URL of the service that the client sends to.
Version of the service.
Path of the file that receives a copy of the request, or
Noneto write none.Path of the file that receives a copy of the response, or
Noneto write none.- 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 duplicate_solutionsΒΆ
Whether the response holds the duplicate solutions.
The engine drops the duplicates by default.
- Return type:
bool | None
- property num_gpusΒΆ
Number of the GPUs that the engine uses.
The engine uses one GPU by default.
0lets it use every GPU that the machine has.Noneleaves the choice to the engine.- Return type:
int | None
- Raises:
ValueError β The value is negative.
- property penalty_weight_calibrationΒΆ
Whether the engine calibrates the weight of every penalty function.
The engine calibrates by default. It reads this parameter only when
solverisPuboorQubo. TheConstraintsolver, which is the default, ignores it and gives a warning.- Return type:
bool | None
- property time_limit_msΒΆ
Limit of the execution time, in milliseconds.
The setter also takes a datetime.timedelta. The engine uses 10000 milliseconds when this parameter is
None.- Return type:
datetime.timedelta | None
- Raises:
ValueError β The value is negative.
- class ResultΒΆ
Raw response of the Amplify Annealing Engine.
- class SolutionΒΆ
One solution in the response.
- class StatusΒΆ
Bases:
EnumWhether a solution satisfies the constraints of the request.
- 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
- Feasible = 1ΒΆ
- Infeasible = 0ΒΆ
- Optimal = 2ΒΆ
- __members__ = mappingproxy({'Infeasible': AmplifyAEClientSolutionStatus.Infeasible, 'Feasible': AmplifyAEClientSolutionStatus.Feasible, 'Optimal': AmplifyAEClientSolutionStatus.Optimal})ΒΆ
- __name__ = 'Status'ΒΆ
- __nb_enum__ = <capsule object NULL>ΒΆ
- __qualname__ = 'AmplifyAEClient.Result.Solution.Status'ΒΆ
- __init__(*args, **kwargs)ΒΆ
- __repr__(self) strΒΆ
- Return type:
str
- __str__(self) strΒΆ
- Return type:
str
- property objectiveΒΆ
Value of the objective function of the solution.
- Return type:
float
- property time_stamp_msΒΆ
Time at which the engine found the solution, in milliseconds.
The time starts when the run starts.
- Return type:
datetime.timedelta
- __init__(*args, **kwargs)ΒΆ
- __repr__(self) strΒΆ
- Return type:
str
- __str__(self) strΒΆ
- Return type:
str
- property execution_time_msΒΆ
Time that the engine spent on the request, in milliseconds.
- Return type:
datetime.timedelta
- property num_flipsΒΆ
Number of the flips that all the GPUs ran, in total.
A flip makes the next state from the current one.
- Return type:
int
- property num_gpusΒΆ
Number of the GPUs that the engine used.
- Return type:
int
- property num_samplingsΒΆ
Number of the solutions that the run gave.
A GPU returns the best state that a group of the flips found. That step is one sampling.
- Return type:
int
- property queue_time_msΒΆ
Time that the request waited in the queue, in milliseconds.
- Return type:
datetime.timedelta
- property started_atΒΆ
Time at which the engine started to run the request.
- Return type:
datetime.datetime
- property submitted_atΒΆ
Time at which the service received the request.
- Return type:
datetime.datetime
- property versionΒΆ
Version of the engine that ran the request.
- Return type:
str
- property warningsΒΆ
Warnings that the service returned with the response.
- Return type:
list[str]
- class SolverΒΆ
Bases:
EnumSolver of the Amplify Annealing Engine that runs the request.
- 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
- Constraint = 0ΒΆ
- Pubo = 1ΒΆ
- Qubo = 2ΒΆ
- __members__ = mappingproxy({'Constraint': AmplifyAEClientSolver.Constraint, 'Pubo': AmplifyAEClientSolver.Pubo, 'Qubo': AmplifyAEClientSolver.Qubo})ΒΆ
- __name__ = 'Solver'ΒΆ
- __nb_enum__ = <capsule object NULL>ΒΆ
- __qualname__ = 'AmplifyAEClient.Solver'ΒΆ
- __init__(self) NoneΒΆ
- __init__(self, token: str = '', url: str = '', proxy: str | None = None) None
- Parameters:
token (str) β Defaults to
''.url (str) β Defaults to
''.proxy (str | None) β Defaults to
None.
- __repr__(self) strΒΆ
- Return type:
str
- __str__(self) strΒΆ
- Return type:
str
- solve( ) ResultΒΆ
- solve(
- self,
- constraint: Constraint | ConstraintList,
- dry_run: Literal[False] = False,
- solve(
- self,
- objective: Poly | Matrix,
- constraint: Constraint | ConstraintList,
- dry_run: Literal[False] = False,
- solve(self, objective: Poly | Matrix, dry_run: Literal[True]) None
- solve(self, constraint: Constraint | ConstraintList, dry_run: Literal[True]) None
- solve(
- self,
- objective: Poly | Matrix,
- constraint: Constraint | ConstraintList,
- dry_run: Literal[True],
Send the objective function and the constraints to the engine.
This method takes the polynomial that the engine 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 engine. Whendry_runisTrue, the client only asks the service to check the request, and it returnsNone.Overload 1.
- Args:
objective (amplify.Poly | amplify.Matrix): The objective function that the engine minimizes.
dry_run (typing.Literal[False]): When
True, ask the service to check the request, and returnNone. Defaults toFalse.
- Returns:
amplify.AmplifyAEClient.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 returnNone. Defaults toFalse.
- Returns:
amplify.AmplifyAEClient.Result:
Overload 3.
- Args:
objective (amplify.Poly | amplify.Matrix): The objective function that the engine 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 returnNone. Defaults toFalse.
- Returns:
amplify.AmplifyAEClient.Result:
Overload 4.
- Args:
objective (amplify.Poly | amplify.Matrix): The objective function that the engine minimizes.
dry_run (typing.Literal[True]): When
True, ask the service to check the request, and returnNone.
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 returnNone.
Overload 6.
- Args:
objective (amplify.Poly | amplify.Matrix): The objective function that the engine 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 returnNone.
- property acceptable_degreesΒΆ
Degrees of the polynomial that the engine accepts.
solve()reads it to decide the conversion of the model.- Return type:
- property async_threshold_msΒΆ
Time above which the client sends the request asynchronously, in milliseconds.
The client polls the service when
Parameters.time_limit_msis above this value, and it waits for one response otherwise. The setter also takes a datetime.timedelta.- Return type:
datetime.timedelta | None
- Raises:
ValueError β The value is negative.
- property compressionΒΆ
Whether the client compresses the body of the request.
The client compresses by default. Compression costs CPU time and it makes the request smaller.
- Return type:
bool
- property objective_formatΒΆ
Format of the objective function in the request.
See
ObjectiveFormat.- Return type:
- property parametersΒΆ
Parameters that the client sends with every request.
- Return type:
- property proxyΒΆ
URL of the proxy that the client goes through, or
Nonefor no proxy.- Return type:
str | None
- 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 urlΒΆ
URL of the service that the client sends to.
- Return type:
str
- property versionΒΆ
Version of the service.
Reading this property sends a request to the service.
- Return type:
str
- property write_request_dataΒΆ
Path of the file that receives a copy of the request, or
Noneto write none.Use it to inspect what the client sends.
- Return type:
pathlib.Path | None
- property write_response_dataΒΆ
Path of the file that receives a copy of the response, or
Noneto write none.- Return type:
pathlib.Path | None