Skip to content

Adds options to control probability type and threshold of QuantumAlgorithm #449

Open
@t-imamichi

Description

@t-imamichi

What should we add?

Follow-up #436 (comment) by @woodsp-ibm

If users apply Sampler to QuantumAlgorithm, the result QuasiDistribution is interpreted at the following method.
https://github.com/Qiskit/qiskit-optimization/blob/a752fd9e6af400a427a841952aac9555e454bc30/qiskit_optimization/algorithms/optimization_algorithm.py#L522-L525

QuasiDistribution can return both quasi-probabilities (can be negative values) and nearest probability. We need to think of 1) whether we provide an option to control quasi prob or nearest prob and 2) how to control it.

We also need to think of an option to control min_probability. We currently set 1e-6 and do not allow users control it. But, it might be necessary to control it especially for quasi-probabilities.

One idea is to add options to QuantumAlgorithm.__init__ as follows.

class ProbabilityType(Enum):
    QUASI = 0
    NEAREST = 1

class QuantumAlgorithm(ABC):
    def __init__(*, probability_type: ProbabilityType=ProbabilityType.QUASI, min_probability: float=1e-6):
        self._probability_type = probability_type
        self._min_probability = min_probability

I welcome your feedback and ideas.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions