How do add separate penalties to constraints when converting CQM into BQM?
I'm aware of the method "cqm_to_bqm" for converting a CQM into a BQM: https://docs.ocean.dwavesys.com/en/stable/docs_dimod/reference/generated/dimod.cqm_to_bqm.html
And there is a parameter for that method called "lagrange_multiplier" which multiplies all constraints by *the same* lagrange multiplier.
Now, I'm also aware that in a BQM model there is a way to add constraints with a *separate penalty* for each constraint. For example, the method "add_linear_equality_constraint" will add a constraint along with the specified penalty using "lagrange_multiplier".
I'd like to combine these two features. Is there a way to convert a CQM to a BQM, and specify a separate penalty for each constraint while doing so? It seems to me like it must be possible, but I can't find the necessary methods in the library to accomplish this.
Thanks.
Comments
Hello,
At present this feature does not exist, but it would be fairly easy to implement in your own code.
If you take a look at the code in the cqm_to_bqm function, specifically this loop, you could vary the lagrange_multiplier value for each iteration of the loop.
Also, please consider submitting a feature request or contributing a code change to our D-Wave Ocean software projects.
I hope this was helpful. Please feel free to reach out with more questions.
Please sign in to leave a comment.