classmethod AdjMapBQM.from_numpy_matrix(mat, variable_order=None, offset=0.0, interactions=None)[source]

Create a binary quadratic model from a NumPy array.

  • mat (numpy.ndarray) – Coefficients of a quadratic unconstrained binary optimization (QUBO) model formatted as a square NumPy 2D array.

  • variable_order (list, optional) – If provided, labels the QUBO variables; otherwise, row/column indices are used. If variable_order is longer than the array, extra values are ignored.

  • offset (optional, default=0.0) – Constant offset for the binary quadratic model.

  • interactions (iterable, optional, default=[]) – Any additional 0.0-bias interactions to be added to the binary quadratic model. Only works for shapeable binary quadratic models.


Binary quadratic model with vartype set to Vartype.BINARY.


This method will be deprecated in the future. The preferred pattern is to use the constructor directly.