AmplifyAEClient¶
- class AmplifyAEClient¶
ベースクラス:
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)¶
- property duplicate_solutions¶
Whether the response holds the duplicate solutions.
The engine drops the duplicates by default.
- 戻り値の型:
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.- 戻り値の型:
int | None
- 例外:
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.- 戻り値の型:
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.- 戻り値の型:
timedelta | None
- 例外:
ValueError -- The value is negative.
- class Result¶
Raw response of the Amplify Annealing Engine.
- class Solution¶
One solution in the response.
- class Status¶
ベースクラス:
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)
- 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)¶
- property time_stamp_ms¶
Time at which the engine found the solution, in milliseconds.
The time starts when the run starts.
- 戻り値の型:
- __init__(*args, **kwargs)¶
- property execution_time_ms¶
Time that the engine spent on the request, in milliseconds.
- 戻り値の型:
- property num_flips¶
Number of the flips that all the GPUs ran, in total.
A flip makes the next state from the current one.
- 戻り値の型:
- 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.
- 戻り値の型:
- property queue_time_ms¶
Time that the request waited in the queue, in milliseconds.
- 戻り値の型:
- class Solver¶
ベースクラス:
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)
- 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'¶
- 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.- 戻り値の型:
- 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.- 戻り値の型:
timedelta | None
- 例外:
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.
- 戻り値の型:
- property objective_format¶
Format of the objective function in the request.
See
ObjectiveFormat. The answer does not depend on this choice.- 戻り値の型:
- property parameters¶
Parameters that the client sends with every request.
- 戻り値の型:
- property proxy¶
URL of the proxy that the client goes through, or
Nonefor no proxy.- 戻り値の型:
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().- 戻り値の型:
- property version¶
Version of the service.
Reading this property sends a request to the service.
- 戻り値の型: