Linear Programming Generation

get_item(dictionary, tuple_key, default_value)[source]

Grab values from a dictionary using an unordered tuple as a key.

Dictionary should not contain None, 0, or False as dictionary values.

  • dictionary – Dictionary that uses two-element tuple as keys
  • tuple_key – Unordered tuple of two elements
  • default_value – Value that is returned when the tuple_key is not found in the dictionary
generate_bqm(graph, table, decision_variables, linear_energy_ranges=None, quadratic_energy_ranges=None, min_classical_gap=2, catch_warnings=True)[source]
  • graph – A networkx.Graph
  • table – An iterable of valid spin configurations. Each configuration is a tuple of variable assignments ordered by decision.
  • decision_variables – An ordered iterable of the variables in the binary quadratic model.
  • linear_energy_ranges – Dictionary of the form {v: (min, max), …} where min and max are the range of values allowed to v. The default range is [-2, 2].
  • quadratic_energy_ranges – Dict of the form {(u, v): (min, max), …} where min and max are the range of values allowed to (u, v). The default range is [-1, 1].
  • min_classical_gap – A float. The minimum energy gap between the highest feasible state and the lowest infeasible state.