Mixed Integer (Linear) Programming Generation

generate_bqm(graph, table, decision, linear_energy_ranges=None, quadratic_energy_ranges=None, min_classical_gap=2, precision=7, max_decision=8, max_variables=10, return_auxiliary=False)[source]

Get a binary quadratic model with specific ground states.

Parameters:
  • graph (Graph) – Defines the structure of the generated binary quadratic model.
  • table (iterable) – Iterable of valid configurations (of spin-values). Each configuration is a tuple of variable assignments ordered by decision.
  • decision (list/tuple) – The variables in the binary quadratic model which have specified configurations.
  • linear_energy_ranges (dict, optional) – Dict 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, optional) – 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 (float) – The minimum energy gap between the highest feasible state and the lowest infeasible state.
  • precision (int, optional, default=7) – Values returned by the optimization solver are rounded to precision digits of precision.
  • max_decision (int, optional, default=4) – Maximum number of decision variables allowed. The algorithm is valid for arbitrary sizes of problem but can be extremely slow.
  • max_variables (int, optional, default=4) – Maximum number of variables allowed. The algorithm is valid for arbitrary sizes of problem but can be extremely slow.
  • return_auxiliary (bool, optional, False) – If True, the auxiliary configurations are returned for each configuration in table.
Returns:

dimod.BinaryQuadraticModel: The binary quadratic model.

float: The classical gap.

If return_auxiliary is True:

dimod.BinaryQuadraticModel: The binary quadratic model.

float: The classical gap.

dict: The auxiliary configurations, keyed on the configurations in table.

Return type:

If return_auxiliary is False

Raises:

ImpossiblePenaltyModel – If the penalty model cannot be built. Normally due to a non-zero infeasible gap.