braket.tasks.annealing_quantum_task_result module¶
-
class
braket.tasks.annealing_quantum_task_result.
AnnealingQuantumTaskResult
(record_array: numpy.recarray, variable_count: int, problem_type: str, task_metadata: Dict[str, Any], additional_metadata: Dict[str, Any])[source]¶ Bases:
object
Result of an annealing problem quantum task execution. This class is intended to be initialized by a QuantumTask class.
- Parameters
record_array (numpy.recarray) – numpy array with keys ‘solution’ (numpy.ndarray)
row is solution, column is value of the variable, 'solution_count' (where) –
number of times the solutions occurred, and 'value' (the) –
or energy of the solutions. (output) –
variable_count (int) – the number of variables
problem_type (str) – the type of problem (‘ising’ or ‘qubo’)
task_metadata (Dict[str, Any]) – Dictionary of task metadata.
additional_metadata (Dict[str, Any]) – A dictionary of additional device-specific metadata
-
record_array
: numpy.recarray = None¶
-
variable_count
: int = None¶
-
problem_type
: str = None¶
-
task_metadata
: Dict[str, Any] = None¶
-
additional_metadata
: Dict[str, Any] = None¶
-
data
(selected_fields=None, sorted_by='value', reverse=False)[source]¶ Iterate over the data in record_array
- Parameters
selected_fields (List[str], optional, default=None) – selected fields to return. Options are ‘solution’, ‘value’, and ‘solution_count’
sorted_by (str, optional, default='value') – Sorts the data by this field. Options are ‘solution’, ‘value’, and ‘solution_count’
reverse (bool, optional, default=False) – If True, returns the data in reverse order.
- Yields
tuple – data in record_array
-
static
from_string
(result: str) → braket.tasks.annealing_quantum_task_result.AnnealingQuantumTaskResult[source]¶ Create AnnealingQuantumTaskResult from string
- Parameters
result (str) – JSON object string
- Returns
AnnealingQuantumTaskResult – An AnnealingQuantumTaskResult based on a string.
-
static
create_record_array
(solutions: numpy.ndarray, solution_counts: numpy.ndarray, values: numpy.ndarray) → numpy.recarray[source]¶ Create a solutions record for AnnealingQuantumTaskResult
- Parameters
solutions (numpy.ndarray) – row is solution, column is value of the variable
solution_counts (numpy.ndarray) – list of number of times the solutions occurred
values (numpy.ndarray) – list of the output or energy of the solutions