def sample_qubo()

in src/braket/ocean_plugin/braket_sampler.py [0:0]


    def sample_qubo(self, Q: Dict[Tuple[int, int], int], **kwargs) -> SampleSet:
        """
        Sample from the specified QUBO.

        Args:
            Q (dict):
                Coefficients of a quadratic unconstrained binary optimization (QUBO) model.
            **kwargs:
                Optional keyword arguments for the sampling method in Braket boto3 format

        Returns:
            :class:`dimod.SampleSet`: A `dimod` :obj:`~dimod.SampleSet` object.

        Raises:
            BinaryQuadraticModelStructureError: If problem graph is incompatible with solver
            ValueError: If keyword argument is unsupported by solver

        Examples:
            This example submits a two-variable QUBO mapped directly to qubits
            0 and 4 on a sampler on the D-Wave 2000Q device.

            >>> from braket.ocean_plugin import BraketSampler
            >>> device_arn_1 = "arn:aws:braket:::device/qpu/d-wave/DW_2000Q_6"
            >>> sampler = BraketSampler(s3_destination_folder, device_arn_1)
            >>> Q = {(0, 0): -1, (4, 4): -1, (0, 4): 2}
            >>> sampleset = sampler.sample_qubo(Q, postprocessingType="SAMPLING", shots=100)
            >>> for sample in sampleset.samples():
            ...    print(sample)
            ...
            {0: 0, 4: 1}
            {0: 1, 4: 0}

            This example submits a two-variable QUBO mapped directly to qubits
            30 and 31 on a sampler on the D-Wave Advantage4 device.
            >>> from braket.ocean_plugin import BraketSampler
            >>> device_arn_1 = "arn:aws:braket:::device/qpu/d-wave/Advantage_system4"
            >>> sampler = BraketSampler(s3_destination_folder, device_arn_1)
            >>> Q = {(30, 30): -1, (31, 31): -1, (30, 31): 2}
            >>> sampleset = sampler.sample_qubo(Q, shots=100)
            >>> for sample in sampleset.samples():
            ...    print(sample)
            ...
            {30: 0, 31: 1}
            {30: 1, 31: 0}

        """
        aws_task = self.sample_qubo_quantum_task(Q, **kwargs)
        variables = set().union(*Q)
        return BraketSampler.get_task_sample_set(aws_task, variables)