ResultΒΆ

class ResultΒΆ

Container of optimization solutions and conversion/runtime metadata.

Methods

__init__

sort

Sort solutions by feasibility and objective value.

Attributes

best

Best solution in the result set.

client_result

Solver/client result.

embedding

Graph embedding information.

execution_time

The time the solver used to solve the problem.

filter_solution

Whether to filter out infeasible solutions.

intermediate

Model conversion information.

num_solves

Number of solve executions aggregated.

response_time

The time between sending the request and receiving the response from the solver.

solutions

View of all solutions.

split

Split view for each independent solve.

total_time

Total time including conversion and solve.

class GraphConversionΒΆ

Graph embedding conversion details used during solving.

class ChainBreakFractionsΒΆ

List-like view of chain break fractions.

class IteratorΒΆ
__init__(*args, **kwargs)ΒΆ
__iter__(self) IteratorΒΆ
Return type:

Iterator

__next__(self) floatΒΆ
Return type:

float

__bool__(self) boolΒΆ
Return type:

bool

__getitem__(self, key: int) floatΒΆ

Return the element at the index.

A negative index counts from the end, as in a Python list.

Parameters:

key (int) – The index of the element.

Return type:

float

Raises:

IndexError – The index is out of range.

__init__(*args, **kwargs)ΒΆ
__iter__(self) IteratorΒΆ
Return type:

Iterator

__len__(self) intΒΆ
Return type:

int

__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

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

str

__str__(self) strΒΆ
Return type:

str

property chain_break_fractionsΒΆ

Chain break fraction for each solve.

Return type:

ChainBreakFractions

property chainsΒΆ

Embedding chains for each logical variable.

Return type:

list[ndarray[dtype=uint32, writable=False]]

property dst_graphΒΆ

Destination (physical) graph used for embedding.

Return type:

Graph

property num_variablesΒΆ

Number of physical variables used after embedding.

Return type:

int

property polyΒΆ

Embedded polynomial.

Return type:

Poly

property src_graphΒΆ

Source (input polynomial) graph for embedding.

Return type:

list[tuple[int, int]]

property values_listΒΆ

Physical variable assignments for each solve.

Return type:

ValuesList

class ModelConversionΒΆ

Model conversion details used during solving.

class IntermediateMappingΒΆ

Mapping between original and intermediate variables during model conversion.

class ItemsViewΒΆ

View of key-value pairs in IntermediateMapping.

__bool__(self) boolΒΆ
Return type:

bool

__init__(*args, **kwargs)ΒΆ
__iter__(self) ItemsViewΒΆ
Return type:

ItemsView

__len__(self) intΒΆ
Return type:

int

__next__(self) tuple[Poly, Poly]ΒΆ
Return type:

tuple[Poly, Poly]

__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

class KeysViewΒΆ

View of keys in IntermediateMapping.

__bool__(self) boolΒΆ
Return type:

bool

__contains__(self, arg: Poly, /) boolΒΆ
__contains__(self, arg: object, /) bool

__contains__

Overload 1.

Args:
  • arg (amplify.Poly)

Returns:

bool:

Overload 2.

Args:
  • arg (object)

Returns:

bool:

__init__(*args, **kwargs)ΒΆ
__iter__(self) KeysViewΒΆ
Return type:

KeysView

__len__(self) intΒΆ
Return type:

int

__next__(self) PolyΒΆ
Return type:

Poly

__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

class ValuesViewΒΆ

View of values in IntermediateMapping.

__bool__(self) boolΒΆ
Return type:

bool

__init__(*args, **kwargs)ΒΆ
__iter__(self) ValuesViewΒΆ
Return type:

ValuesView

__len__(self) intΒΆ
Return type:

int

__next__(self) PolyΒΆ
Return type:

Poly

__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

__bool__(self) boolΒΆ
Return type:

bool

__contains__(self, arg: Poly, /) boolΒΆ
__contains__(self, arg: object, /) bool

__contains__

Overload 1.

Args:
  • arg (amplify.Poly)

Returns:

bool:

Overload 2.

Args:
  • arg (object)

Returns:

bool:

__getitem__(self, arg: Poly, /) PolyΒΆ

Return the intermediate expression of the input variable.

Parameters:

arg (Poly) – The input variable to look up. It has to be a polynomial of one variable.

Returns:

The expression in the intermediate variables that replaced the input variable.

Return type:

Poly

Raises:

KeyError – The mapping holds no entry for the variable.

__init__(*args, **kwargs)ΒΆ
__iter__(self) KeysViewΒΆ
Return type:

KeysView

__len__(self) intΒΆ
Return type:

int

__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

items(self) ItemsViewΒΆ
Return type:

ItemsView

keys(self) KeysViewΒΆ
Return type:

KeysView

values(self) ValuesViewΒΆ
Return type:

ValuesView

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

str

__str__(self) strΒΆ
Return type:

str

property mappingΒΆ

Mapping from input variables to intermediate expressions.

Return type:

IntermediateMapping

property modelΒΆ

Intermediate model.

Return type:

Model

property num_variablesΒΆ

Number of variables in the intermediate model.

Return type:

int

property values_listΒΆ

Intermediate variable assignments for each solve.

Return type:

ValuesList

class SolutionΒΆ

Single solution entry in Result.

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

str

__str__(self) strΒΆ
Return type:

str

property feasibleΒΆ

Whether all constraints are satisfied.

Return type:

bool

property objectiveΒΆ

Objective function value.

Return type:

float

property timeΒΆ

Time at which the solver found this solution.

Return type:

timedelta

property valuesΒΆ

Variable assignments of the solution.

Return type:

Values

class SolutionListΒΆ

List-like view of solutions.

class IteratorΒΆ
__init__(*args, **kwargs)ΒΆ
__iter__(self) IteratorΒΆ
Return type:

Iterator

__next__(self) SolutionΒΆ
Return type:

Solution

__bool__(self) boolΒΆ
Return type:

bool

__getitem__(self, key: int) SolutionΒΆ

Return the element at the index.

A negative index counts from the end, as in a Python list.

Parameters:

key (int) – The index of the element.

Return type:

Solution

Raises:

IndexError – The index is out of range.

__init__(*args, **kwargs)ΒΆ
__iter__(self) IteratorΒΆ
Return type:

Iterator

__len__(self) intΒΆ
Return type:

int

__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

class SplitViewΒΆ

List-of-list-like view of solutions that splits solutions by independent solves.

__bool__(self) boolΒΆ
Return type:

bool

__getitem__(self, key: int) ResultΒΆ

Return the element at the index.

A negative index counts from the end, as in a Python list.

Parameters:

key (int) – The index of the element.

Return type:

Result

Raises:

IndexError – The index is out of range.

__init__(*args, **kwargs)ΒΆ
__iter__(self) SplitViewΒΆ
Return type:

SplitView

__len__(self) intΒΆ
Return type:

int

__next__(self) ResultΒΆ
Return type:

Result

__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

class ValuesListΒΆ

List-like view of value mappings for solutions.

class IteratorΒΆ
__init__(*args, **kwargs)ΒΆ
__iter__(self) IteratorΒΆ
Return type:

Iterator

__next__(self) ValuesΒΆ
Return type:

Values

__bool__(self) boolΒΆ
Return type:

bool

__getitem__(self, key: int) ValuesΒΆ

Return the element at the index.

A negative index counts from the end, as in a Python list.

Parameters:

key (int) – The index of the element.

Return type:

Values

Raises:

IndexError – The index is out of range.

__init__(*args, **kwargs)ΒΆ
__iter__(self) IteratorΒΆ
Return type:

Iterator

__len__(self) intΒΆ
Return type:

int

__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

__getitem__(self, key: int) SolutionΒΆ

Return the element at the index.

A negative index counts from the end, as in a Python list.

Parameters:

key (int) – The index of the element.

Return type:

Solution

Raises:

IndexError – The index is out of range.

__init__(*args, **kwargs)ΒΆ
__iter__(self) IteratorΒΆ
Return type:

Iterator

__len__(self) intΒΆ
Return type:

int

__repr__(self) strΒΆ
Return type:

str

__str__(self) strΒΆ
Return type:

str

sort(self) NoneΒΆ

Sort solutions by feasibility and objective value.

__nb_signature__ = 'class Result(typing.Generic[_BaseClient_co])'ΒΆ
property bestΒΆ

Best solution in the result set.

The best solution is the feasible solution with the smallest objective value. When filter_solution is True, the result holds only the feasible solutions, so this property raises as soon as the result is empty.

Returns:

The solution that has the smallest objective value among the feasible solutions.

Return type:

Solution

Raises:

RuntimeError – The result holds no solution, or it holds no feasible solution.

property client_resultΒΆ

Solver/client result.

The raw response of the machine. Its type depends on the client that solved the model. It is None when the solve kept no client result, as after a conversion only run.

Return type:

Result | Result | SampleSet | SampleSet | SampleSet | Result | Result | Result | Result | object | None

property embeddingΒΆ

Graph embedding information.

Return type:

GraphConversion | None

property execution_timeΒΆ

The time the solver used to solve the problem.

Return type:

timedelta

property filter_solutionΒΆ

Whether to filter out infeasible solutions.

Return type:

bool

property intermediateΒΆ

Model conversion information.

Return type:

ModelConversion

property num_solvesΒΆ

Number of solve executions aggregated.

Return type:

int

property response_timeΒΆ

The time between sending the request and receiving the response from the solver.

Return type:

timedelta

property solutionsΒΆ

View of all solutions.

Return type:

SolutionList

property splitΒΆ

Split view for each independent solve.

Return type:

SplitView

property total_timeΒΆ

Total time including conversion and solve.

Return type:

timedelta