Git Product home page Git Product logo

Comments (4)

perrygeo avatar perrygeo commented on August 19, 2024

@terrycojones Can you share a small python script to recreate it?

from simanneal.

terrycojones avatar terrycojones commented on August 19, 2024

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.

terrycojones avatar terrycojones commented on August 19, 2024

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.

terrycojones avatar terrycojones commented on August 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.