Open DevelopDaily opened 3 years ago
I am looking into this problem and will get back to you soon.
In order to improve the results, strength
parameter in make_quadratic(poly, strength = strength, dimod.Binary)
needs to be tuned. It is recommended to scale it with the problem biases.
Consider this trivial example, x = 2abc + bcd
. This is converted into a quadratic problem with objective 2ay + yd
and constraint y = bc
where y
is an auxiliary variable. The strength
parameter acts as a Lagrange parameter on the constraint. So, with lower value of strength
parameter, it becomes favorable to violate constraints in order to minimize the objective.
Also, given the complexity of the problem, it will be helpful to tune the chain_strength
parameter to the largest absolute value(bias) in your problem. Here is a document to help you tune this parameter: https://www.dwavesys.com/sites/default/files/14-1041A-A_Setting_The_Chain_Strength.pdf.
I do want to point out that I noticed a few challenges in this problem, for example in your equation, the linear biases range from 0 - 267946936 and the quadratic biases range from -2000 to 268435456 and this range cannot be preserved when scaling down to a range of [-2.0, 2.0] and [-1.0, 1.0] respectively.
This might be a reason that this formulation of factoring problem as minimization of (P-ab)**2
is not recommended, it is provided to help understand the intuition but in practice it gets very complex. So, users are encouraged to formulate it as Constrained Satisfaction Problem: https://github.com/dwave-examples/factoring-notebook/blob/master/01-factoring-overview.ipynb
I'll just add that the new default chain_strength
added in dwave-system 0.9.13 will automatically scale with your problem.
Thanks for the info. I understand the CSP would be more appropriate for the factoring problem. But, the CSP has its own problems. If you are interested in them, I am tracking the issue here.
My main purpose is to evaluate the capabilities of the D-Wave API. So, the more challenging the problem is, the better. After all, real life applications can be even more challenging and we don't know their true minimums. That is the reason why I want to use the well-known factoring problem to test the system because we know its minimum.
I tried many values of chain_strength
, but none of them worked. Does that mean some QUBO problems are not solvable?
By the way, it would be interesting to try the ExactSolver
to find out if the model returned from make_quadratic
is valid. Unfortunately, however, the problem is already too big for the ExactSolver
on my machine. I got this error when I ran it:
ValueError: Maximum allowed dimension exceeded
Would you please try to run it?
The ExactSolver()
calculates energy for every possible sample which increases exponentially with each additional variable. In your bqm, there are 80 variables this means 2^80 possible outputs which is beyond its capabilities. This is the reason ExactSolver()
is recommended for testing and debugging purposes only.
If you would like to verify the output from make_quadratic, I would suggest starting from a small problem like the one I mentioned in my previous comment x = 2abc + bcd
. In this problem, you can easily understand how make_quadratic is changing the higher order polynomial to the bqm
as well as the impact of the strength
parameter using ExactSolver()
.
As it is difficult to scale factoring on d-wave system, I am also looking for some other real-world verifiable problems to help you explore the power of the D-Wave QPU.
@tmittal7 Ah...I didn't realize it has already reached 2^80! Thanks for pointing that out.
My goal is indeed to look for some "verifiable problems"!
https://github.com/dwavesystems/dimod/blob/434f75d0fc958a6bc3e2658ec9bc758346a39f00/dimod/higherorder/utils.py#L102
That function does not lead to a correct sample set. Here is a simple test case (factoring).
I want to factor 15 to 3 and 5 and I know 6 variables are enough. But, I want to test the
make_quadratic
with more variables, so I use 16 variables.Expand
P = (15 - a*b)**2
, and you will get the polynomial shown below.Then, do this:
I tried the real QPU with
DWaveSampler
of various solvers on that binary quadratic model. The results are always wrong. Could you please help address the issue? Thanks.