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)ΒΆ
- 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:
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)
- 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.
- Return type:
- __init__(*args, **kwargs)ΒΆ
- property execution_time_msΒΆ
Time that the engine spent on the request, in milliseconds.
- Return type:
- 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:
- 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:
- property queue_time_msΒΆ
Time that the request waited in the queue, in milliseconds.
- Return type:
- 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)
- 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.- 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:
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:
- property objective_formatΒΆ
Format of the objective function in the request.
See
ObjectiveFormat. The answer does not depend on this choice.- 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:
- property versionΒΆ
Version of the service.
Reading this property sends a request to the service.
- Return type: