Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.

qiskit.optimization.applications.ising.exact_cover

exact cover

Functions

check_solution_satisfiability(sol, …)check solution satisfiability
get_operator(list_of_subsets)Construct the Hamiltonian for the exact solver problem.
get_solution(x)param xbinary string as numpy array.

check_solution_satisfiability

check_solution_satisfiability(sol, list_of_subsets)

GitHub

check solution satisfiability

get_operator

get_operator(list_of_subsets)

GitHub

Construct the Hamiltonian for the exact solver problem.

Note

Assumption: the union of the subsets contains all the elements to cover.

The Hamiltonian is:

sum_{each element e}{(1-sum_{every subset_i that contains e}{Xi})^2},

where Xi (Xi=1 or 0) means whether should include the subset i.

Parameters

list_of_subsets (list) – list of lists (i.e., subsets)

Returns

operator for the Hamiltonian, a constant shift for the obj function.

Return type

tuple(WeightedPauliOperator, float)

get_solution

get_solution(x)

GitHub

Parameters

x (numpy.ndarray) – binary string as numpy array.

Returns

graph solution as binary numpy array.

Return type

numpy.ndarray

Was this page helpful?
Report a bug or request content on GitHub.