You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would be useful to have a time_limit argument for Neal and Greedy.
Both Neal (for a fixed num_sweeps) and Greedy can implement a run-to-time-limit feature by adding timing calls per read, i.e., variable number of reads depending on time constraint. Example from RandomSampler.
The text was updated successfully, but these errors were encountered:
Pau has implemented a smart runtime estimator that self-adjusts its convergence rate if necessary. It works pretty well, I believe, might want to ask him about it when he gets back. (Or maybe he has put it in github I dunno)
If you wish to evaluate a criteria only after each complete anneal this feature already exists through the interrupt function:
import time
t0 = time.perf_counter_ns()
def interrupt_function():
time_limit = 0 #Any value in nanoseconds
if time.perf_counter_ns() - t0 > delay:
return True
else:
return False
from dwave.samplers.sa import SimulatedAnnealingSampler
num_reads = 1000 #example
resp = SimulatedAnnealingSampler().sample_ising({i: 1}, {}, interrupt_function, num_reads = num_reads)
assert len(resp.record) == 1 # because time_limit of 0 nanoseconds is immediately exceeded.
For greater flexibility the code could be rewritten so that interrupt function takes sample information (in order to do things like time to energy/diversity criteria). Another possibility would be to evaluate the interrupt function before the anneal completes, but I think there wouldn't be many use cases for that.
Would be useful to have a
time_limit
argument for Neal and Greedy.Both Neal (for a fixed
num_sweeps
) and Greedy can implement a run-to-time-limit feature by adding timing calls per read, i.e., variable number of reads depending on time constraint. Example from RandomSampler.The text was updated successfully, but these errors were encountered: