Skip to main contentIBM Quantum Documentation
You are viewing the API reference for an old version of Qiskit SDK. Switch to latest version

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(opens in a new tab)

check solution satisfiability

get_operator

get_operator(list_of_subsets)

GitHub(opens in a new tab)

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(opens in a new tab)

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.