def annealing_result( solutions, values, solution_counts, variable_count, problem_type, additional_metadata, task_metadata, ): solutions = np.asarray(solutions, dtype=int) values = np.asarray(values, dtype=float) solution_counts = np.asarray(solution_counts, dtype=int) record_array = AnnealingQuantumTaskResult._create_record_array( solutions, solution_counts, values) return AnnealingQuantumTaskResult( record_array=record_array, variable_count=variable_count, problem_type=problem_type, task_metadata=task_metadata, additional_metadata=additional_metadata, )
def test_from_string( result_str_1, solutions, values, solution_counts, variable_count, problem_type, task_metadata, additional_metadata, ): result = AnnealingQuantumTaskResult.from_string(result_str_1) solutions = np.asarray(solutions, dtype=int) values = np.asarray(values, dtype=float) solution_counts = np.asarray(solution_counts, dtype=int) assert result.variable_count == variable_count assert result.problem_type == problem_type assert result.task_metadata == task_metadata assert result.additional_metadata == additional_metadata np.testing.assert_equal( result.record_array, AnnealingQuantumTaskResult._create_record_array( solutions, solution_counts, values), )