# qiskit: convert from ising result to qubo result?

I have a very simple qubo problem:

Minimize
obj: - 0.015284386652 x_0 + 0.000780952145 x_1 + [ 0.002541388592 x_0^2
+ 0.000146804433 x_0*x_1 + 0.000258486713 x_1^2 ]/2
Subject To
c0: x_0 + x_1 = 1

Bounds
0 <= x_0 <= 1
0 <= x_1 <= 1

Binaries
x_0 x_1
End


Then I got below ISING matrix from above QUBO:

[[ 0.51530274+0.j  0.        +0.j  0.        +0.j  0.        +0.j]
[ 0.        +0.j -0.51624963+0.j  0.        +0.j  0.        +0.j]
[ 0.        +0.j  0.        +0.j -0.50132575+0.j  0.        +0.j]
[ 0.        +0.j  0.        +0.j  0.        +0.j  0.50227264+0.j]]


and this is ISING formula:

(PauliSumOp(SparsePauliOp(['IZ', 'ZI', 'ZZ'],coeffs=[ 6.98849562e-03+0.j, -4.73448305e-04+0.j,  5.08787690e-01+0.j]),coeff=1.0), 0.5022359414602106)


Then I submit my ISING matrix to a ISING solver, then this is what is get for best result [0,1,1,0]. SO how can I convert this result from ISING result to QUBO result ?

Below is my full code, using qiskit:

from qiskit_finance.applications.optimization import PortfolioOptimization
from qiskit_finance.data_providers import RandomDataProvider
import datetime

num_assets = 2
seed = 123
stocks = [("TICKER%s" % i) for i in range(num_assets)]
data = RandomDataProvider(
tickers=stocks,
start=datetime.datetime(2016, 1, 1),
end=datetime.datetime(2016, 1, 30),
seed=seed,
)
data.run()
mu = data.get_period_return_mean_vector()
sigma = data.get_period_return_covariance_matrix()
q = 0.5
budget = 1
portfolio = PortfolioOptimization(
expected_returns=mu, covariances=sigma, risk_factor=q, budget=budget
)
print(qp)

problem2 = conv.convert(qp)
test = problem2.to_ising()
print(test)
print(problem2)
matrix = test[0].to_matrix()
print(matrix)

• The result [0,1,1,0] is already in terms of binary variables, not Ising variables (which would be -1 and +1). Jul 8, 2022 at 18:43

I suspect you are looking for either

• conv.interpret([0,1,1,0]); or
• qp.objective.evaluate([0,1,1,0])