-
Notifications
You must be signed in to change notification settings - Fork 3
How to map an Ising solution back to the original QUBO solution #7
Description
I am using Kaiwu’s CIM solver to work on a QUBO/Ising hybrid optimization problem, and I have a question regarding how to correctly map an Ising solution back to the original QUBO solution. I would like to consult you on this.
Here is the relevant part of my code:
Ising, _ = kw.core.qubo_matrix_to_ising_matrix(Qubo_mat)
Ising = kw.preprocess.perform_precision_adaption_mutate(Ising)
Ising = kw.ising.adjust_ising_matrix_precision(Ising)
optimizer = kw.cim.CIMOptimizer(wait=True, user_id=self.user_id, sdk_code=self.sdk_code, task_name=task_name)
new_optimizer = kw.cim.PrecisionReducer(optimizer, precision=8)
solution = new_optimizer.solve(Ising)
In theory, there should be a one-to-one correspondence between QUBO variables and Ising spins. Therefore, a QUBO with 24 variables should correspond to an Ising model with 24 spins.
However, in practice, after the conversion (qubo_matrix_to_ising_matrix), the Ising matrix becomes 25×25, so the CIM solver also returns a 25-dimensional solution.
This additional dimension should be an auxiliary variable, but I would like to confirm:
To recover the original QUBO solution from the Ising solution, is it correct to simply discard the last component of the 25-spin solution and convert the remaining 24 spins into {0,1} using (s + 1) / 2?
Thank you very much for your time! I look forward to your guidance.