GroverOptimizationResult#

class GroverOptimizationResult(x, fval, variables, operation_counts, n_input_qubits, n_output_qubits, intermediate_fval, threshold, status, samples=None, raw_samples=None)[source]#

Bases: OptimizationResult

A result object for Grover Optimization methods.

Constructs a result object with the specific Grover properties.

Parameters:
  • x (List[float] | ndarray) – The solution of the problem

  • fval (float) – The value of the objective function of the solution

  • variables (List[Variable]) – A list of variables defined in the problem

  • operation_counts (Dict[int, Dict[str, int]]) – The counts of each operation performed per iteration.

  • n_input_qubits (int) – The number of qubits used to represent the input.

  • n_output_qubits (int) – The number of qubits used to represent the output.

  • intermediate_fval (float) – The intermediate value of the objective function of the minimization qubo solution, that is expected to be consistent to fval.

  • threshold (float) – The threshold of Grover algorithm.

  • status (OptimizationResultStatus) – the termination status of the optimization algorithm.

  • samples (List[SolutionSample] | None) – the x values, the objective function value of the original problem, the probability, and the status of sampling.

  • raw_samples (List[SolutionSample] | None) – the x values of the QUBO, the objective function value of the minimization QUBO, and the probability of sampling.

Attributes

fval#

Returns the objective function value.

Returns:

The function value corresponding to the objective function value found in the optimization.

intermediate_fval#

Getter of the intermediate fval

Returns:

The intermediate value of fval before interpret.

n_input_qubits#

Getter of n_input_qubits

Returns:

The number of qubits used to represent the input.

n_output_qubits#

Getter of n_output_qubits

Returns:

The number of qubits used to represent the output.

operation_counts#

Get the operation counts.

Returns:

The counts of each operation performed per iteration.

raw_results#

Return the original results object from the optimization algorithm.

Currently a dump for any leftovers.

Returns:

Additional result information of the optimization algorithm.

raw_samples#

Returns the list of raw solution samples of GroverOptimizer.

Returns:

The list of raw solution samples of GroverOptimizer.

samples#

Returns the list of solution samples

Returns:

The list of solution samples.

status#

Returns the termination status of the optimization algorithm.

Returns:

The termination status of the algorithm.

threshold#

Getter of the threshold of Grover algorithm.

Returns:

The threshold of Grover algorithm.

variable_names#

Returns the list of variable names of the optimization problem.

Returns:

The list of variable names of the optimization problem.

variables#

Returns the list of variables of the optimization problem.

Returns:

The list of variables.

variables_dict#

Returns the variable values as a dictionary of the variable name and corresponding value.

Returns:

The variable values as a dictionary of the variable name and corresponding value.

x#

Returns the variable values found in the optimization or None in case of FAILURE.

Returns:

The variable values found in the optimization.

Methods

get_correlations()#

Get <Zi x Zj> correlation matrix from the samples.

Returns:

A correlation matrix.

Return type:

ndarray

prettyprint()#

Returns a pretty printed string of this optimization result.

Returns:

A pretty printed string representing the result.

Return type:

str