About use D-wave LeapHybridCQMSamplerhybrid to solve milp problem
Hello D - wave :
We all know that D-wave has its unique advantages in solving large-scale problems. I'm in the use of D - wave LeapHybridCQMSamplerhybrid solving milp problems encountered some troubling questions. I used the example of small-scale test (64 variables, 296 constraints) to test that there was no problem in my current solution. When I increased variables and constraints (704 variables, 1664 constraints), the minimum energy of annealing could not be found. The following is part of my code:
variable_num = 704
cqm = ConstrainedQuadraticModel()
fun = 0
file = open("./resultsave.txt", 'w').close()
for i in range(variable_num):
exec('s' + str(i + 1) + '=Binary(' + str(i + 1) + ')')
for i in range(objective_lower, objective_upper+1):
fun += eval('s' + str(i))
cqm.set_objective(fun)
with open('./demo.lp', 'r') as file:
for line in file:
line_ = eval(line.replace("\n", ""))
cqm.add_constraint(line_)
result = set()
for i in range(100):
response = LeapHybridCQMSampler(profile='vwly13').sample_cqm(cqm,time_limit=10)
for sample, satisfied, energy in response.data(['sample', 'is_feasible', 'energy']):
I would also like to ask if there is any way to save my resources. Looking forward to a reply.
Comments
Hello Kin,
Thank you for using D-Wave Systems. Looking at the code snippet, is part of the statement missing from the last "for loop" or is that not necessary for investigating this issue?
Also, can you please elaborate more on how the resources are being utilized and what you are looking for when you say you want to save your resources?
Please let us know!
Best Regards,
Tanjid
Thank you very much, this for loop statement is not important for problem solving. What I want to save is the resources used by D-wave. Now I'm converting the problem to cqm. Is there a way to use resources faster and less expensively? And I want to ask is time limite important for solving the problem? Does it affect the success rate of annealing?
Looking forward to hearing from you again
Hi Kin,
Thanks for elaborating it further.
As for finding the minimum energy/minimal solution, in general the required run time is expected to grow with the size of the problem. Trying the default or min_time_limit() could be a good start. If that does not find an optimal solution, then increasing the time limit would be the way to go.
Regarding the resources, it is not possible for users to adjust resource allocations and usage. The run-time and expense of the solution would depend on a lot of factors, such as how the code is written. However, there is no direct way to adjust how D-Wave would allocate and use resources to assist with that.
I hope this helps.
Best Regards,
Tanjid
Please sign in to leave a comment.