# Freezing the value of a subset of qubits

Hi,

in the application I'm working on, the solution seems degenerate, so that different minima correspond to valid solutions.

I would like to run the sampling once, fix the fist M<N qubits to a given value, then run the sampling multiple times to see how the remaining N-M qbits change. Is this technically possible? From a conceptual point of view I believe one can introduce an additional constrain gamma*| x - y | but I'm not sure if this is a viable solution (e.g. if gamma is too large, smaller weights in my problem can be rescaled to too small values).

Thanks,

Riccardo

## Comments

David J(Report)Hello,

If you use the BinaryQuadraticModel (BQM) to represent your problem, you can use the fix_variable and fix_variables functions to set the qubit values to a specific fixed value.

It is worth noting that the values are removed from the BQM.

The qubit value is set to the desired fixed value, causing the quadratic terms associated with it to become linear, and the linear terms to become constant.

Here is an example of how to use the functions:

I hope this was helpful!

Please let us know if you have any questions.

Ed C(Report)Riccardo,

With regards to fixing the value of qubits as one refines the solution, you may find the paper Effective optimization using sample persistence: A case study on quantum annealers and various Monte Carlo optimization methods of interest.

Good luck on your application.

Ed

Please sign in to leave a comment.