from_ising#

from_ising(qubit_op, offset=0.0, linear=False)[source]#

Create a quadratic program from a qubit operator and a shift value.

Variables are mapped to qubits in the same order, i.e., i-th variable is mapped to i-th qubit. See https://github.com/Qiskit/qiskit-terra/issues/1148 for details.

Parameters:
  • qubit_op (BaseOperator) – The qubit operator of the problem.

  • offset (float) – The constant term in the Ising Hamiltonian.

  • linear (bool) – If linear is True, \(x^2\) is treated as a linear term since \(x^2 = x\) for \(x \in \{0,1\}\). Otherwise, \(x^2\) is treat as a quadratic term. The default value is False.

Returns:

The quadratic program corresponding to the qubit operator.

Raises:
Return type:

QuadraticProgram