ExactCover#

class ExactCover(subsets)[fuente]#

Bases: OptimizationApplication

Optimization application for the «exact cover» [1] problem.

Referencias

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

Parámetros:

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

Methods

interpret(result)[fuente]#

Interpret a result as a list of subsets

Parámetros:

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

Devuelve:

A list of subsets whose corresponding variable is 1

Tipo del valor devuelto:

List[List[int]]

static sample_most_likely(state_vector)#

Compute the most likely binary string from state vector.

Parámetros:

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

Devuelve:

binary string as numpy.ndarray of ints.

Muestra:

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

Tipo del valor devuelto:

ndarray

to_quadratic_program()[fuente]#

Convert an exact cover instance into a QuadraticProgram

Devuelve:

The QuadraticProgram created from the exact cover instance.

Tipo del valor devuelto:

QuadraticProgram