Freezing the value of a subset of qubits


  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).




  • 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:

    from dimod import BinaryQuadraticModel, SPIN
    = BinaryQuadraticModel({'a': -.5, 'b': 0., 'c': 5}, {('a', 'b'): -1}, 0.0, SPIN) bqm.fix_variables({'a': -1, 'b': +1})

    I hope this was helpful!
    Please let us know if you have any questions.


    Comment actions Permalink
  • 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.


    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post