qiskit.optimization.applications.ising.set_packing

set packing module

Functions

check_disjoint(sol, list_of_subsets)

check disjoint

get_operator(list_of_subsets)

Construct the Hamiltonian for the set packing.

get_solution(x)

param x

binary string as numpy array.

check_disjoint(sol, list_of_subsets)[source]

check disjoint

get_operator(list_of_subsets)[source]

Construct the Hamiltonian for the set packing.

Notes

find the maximal number of subsets which are disjoint pairwise.

Hamiltonian: H = A Ha + B Hb Ha = sum_{Si and Sj overlaps}{XiXj} Hb = -sum_{i}{Xi}

Ha is to ensure the disjoint condition, while Hb is to achieve the maximal number. Ha is hard constraint that must be satisfied. Therefore A >> B. In the following, we set A=10 and B = 1

where Xi = (Zi + 1)/2

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(x)[source]
Parameters

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

Returns

graph solution as binary numpy array.

Return type

numpy.ndarray