qiskit.optimization.applications.ising.stable_set

Convert stable set instances into Pauli list. We read instances in the Gset format, see https://web.stanford.edu/~yyye/yyye/Gset/ , for compatibility with the maxcut format, but the weights on the edges as they are not really used and are always assumed to be 1. The graph is represented by an adjacency matrix.

Functions

get_graph_solution(x)

Get graph solution from binary string.

get_operator(w)

Generate Hamiltonian for the maximum stable set in a graph.

stable_set_value(x, w)

Compute the value of a stable set, and its feasibility.

get_graph_solution(x)[source]

Get graph solution from binary string.

Parameters

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

Returns

graph solution as binary numpy array.

Return type

numpy.ndarray

get_operator(w)[source]

Generate Hamiltonian for the maximum stable set in a graph.

Parameters

w (numpy.ndarray) – adjacency matrix.

Returns

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

Return type

tuple(WeightedPauliOperator, float)

stable_set_value(x, w)[source]

Compute the value of a stable set, and its feasibility.

Parameters
  • x (numpy.ndarray) – binary string in original format – not graph solution!.

  • w (numpy.ndarray) – adjacency matrix.

Returns

size of the stable set, and Boolean indicating

feasibility.

Return type

tuple(float, bool)