Comments (4)
@terrycojones Can you share a small python script to recreate it?
from simanneal.
Hi @perrygeo Unfortunately it's not so easy to get you a failing example. My code loads a ton of sensitive data and it's not simple to make a failing case. I get this error regularly, so this is definitely not a one-off issue. I just had one tonight and I've had dozens of them in a recent set of runs. At the moment I'm so busy that instead of digging in further I just restart the runs. Anyway, I would like to help figure this out & realize I'm not really helping that the moment! I am out here, though :-)
from simanneal.
I just spent a bit more time looking and playing around with bits of code. I don't think round_figures
can be the culprit. But there is this in the anneal function:
T = self.Tmax * math.exp(Tfactor * step / self.steps)
If Tfactor
is large and negative, math.exp
will return zero:
In [74]: exp(-1000) == 0.0
Out[74]: True
That results in T
being set to zero, which causes if dE > 0.0 and math.exp(-dE / T) < random.random():
to get the ZeroDivisionError
.
We're clearly dealing with some corner case here. I'm trying some fractions to get myself a large Tfactor
:
In [90]: log(1e205 / 1e-100)
Out[90]: 702.288453363184
I can't get it higher than that just in mucking around. But an infinite value gets us the problem:
In [92]: log(1e205 / 1e-105)
Out[92]: inf
In [98]: exp(-log(1e205 / 1e-105)) == 0.0
Out[98]: True
So exp
can give you back zero, in which case T
(very top of this comment) is set to zero, giving the error.
So Tmax / Tmin
would need to be extremely small to result in such a large value coming out of -math.log(self.Tmax / self.Tmin)
. I can't get such a high value in playing around, but getting close:
In [104]: -log(1e-300)
Out[104]: 690.7755278982137
All this would imply that Tmax
can be less than Tmin
at the end of auto
.
OK, leaving this here for now..... Thanks!
from simanneal.
I printed out the schedule I get back from some failing runs:
{'tmax': 33.0, 'tmin': 5e-324, 'steps': 22000, 'updates': 100}
{'tmax': 36.0, 'tmin': 5e-324, 'steps': 22000, 'updates': 100}
{'tmax': 45.0, 'tmin': 5e-324, 'steps': 21000, 'updates': 100}
{'tmax': 32.0, 'tmin': 5e-324, 'steps': 22000, 'updates': 100}
{'tmax': 32.0, 'tmin': 5e-324, 'steps': 22000, 'updates': 100}
{'tmax': 30.0, 'tmin': 5e-324, 'steps': 22000, 'updates': 100}
{'tmax': 32.0, 'tmin': 5e-324, 'steps': 22000, 'updates': 100}
{'tmax': 36.0, 'tmin': 3.3e-315, 'steps': 22000, 'updates': 100}
{'tmax': 33.0, 'tmin': 5e-324, 'steps': 22000, 'updates': 100}
{'tmax': 22.0, 'tmin': 5e-324, 'steps': 22000, 'updates': 100}
{'tmax': 33.0, 'tmin': 5e-324, 'steps': 14000, 'updates': 100}
{'tmax': 22.0, 'tmin': 5e-324, 'steps': 19000, 'updates': 100}
{'tmax': 27.0, 'tmin': 5e-324, 'steps': 18000, 'updates': 100}
{'tmax': 21.0, 'tmin': 5e-324, 'steps': 19000, 'updates': 100}
{'tmax': 48.0, 'tmin': 5e-324, 'steps': 35000, 'updates': 100}
{'tmax': 24.0, 'tmin': 3.9e-317, 'steps': 38000, 'updates': 100}
from simanneal.
Related Issues (20)
- .auto() yields tmax == tmin, and negative remaining time HOT 2
- Problem in code HOT 1
- copy_state() returns None HOT 1
- Allow any type of state variable HOT 1
- multithreading HOT 2
- updates not printed out HOT 4
- Is it possible to perform a continuous problem with this package?
- Dependency injection for external data
- Travis builds failing HOT 1
- tsp example move() needs a fix
- question on multi-objective HOT 1
- Unit tests HOT 1
- Litterature reference for auto scheduling HOT 2
- Temperature and Energy stuck at zero HOT 1
- Litterature reference for simulated annealing HOT 2
- Pass current temperature to move function HOT 2
- Annealing problem HOT 1
- Speeding Up the Calculation HOT 2
- Replacing lines to shorten output HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simanneal.