ExactCover#

class ExactCover(subsets)[source]#

Bases: OptimizationApplication

Optimization application for the "exact cover" [1] problem.

References

[1]: "Exact cover", https://en.wikipedia.org/wiki/Exact_cover

প্যারামিটার:

subsets (List[List[int]]) -- A list of subsets

Methods

interpret(result)[source]#

Interpret a result as a list of subsets

প্যারামিটার:

result (OptimizationResult | ndarray) -- The calculated result of the problem

রিটার্নস:

A list of subsets whose corresponding variable is 1

রিটার্ন টাইপ:

List[List[int]]

static sample_most_likely(state_vector)#

Compute the most likely binary string from state vector.

প্যারামিটার:

state_vector (QuasiDistribution | Statevector | ndarray | Dict) -- state vector or counts or quasi-probabilities.

রিটার্নস:

binary string as numpy.ndarray of ints.

রেইজেস:

ValueError -- if state_vector is not QuasiDistribution, Statevector, np.ndarray, or dict.

রিটার্ন টাইপ:

ndarray

to_quadratic_program()[source]#

Convert an exact cover instance into a QuadraticProgram

রিটার্নস:

The QuadraticProgram created from the exact cover instance.

রিটার্ন টাইপ:

QuadraticProgram