Commit 23acc318 authored by Robert Ricci's avatar Robert Ricci

Bring back version 1.31, with an important modification - terminate if

the temperature gets below zero, or becomes NaN (which can happen if
the solution stabilizes during melting.)
parent 196827a6
......@@ -34,6 +34,11 @@ name_name_map fixed_nodes;
// allowed to move these.
name_name_map node_hints;
// From assign.cc
#ifdef GNUPLOT_OUTPUT
extern FILE *scoresout, *tempout, *deltaout;
#endif
// Determines whether to accept a change of score difference 'change' at
// temperature 'temperature'.
inline int accept(double change, double temperature)
......@@ -889,11 +894,13 @@ void anneal(bool scoring_selftest, double scale_neighborhood,
if (accepttrans) {
bestscore = newscore;
bestviolated = violated;
#ifdef GNUPLOT_OUTPUT
fprintf(tempout,"%f\n",temp);
fprintf(scoresout,"%f\n",newscore);
fprintf(deltaout,"%f\n",-scorediff);
#endif
avgscore += newscore;
accepts++;
......@@ -1071,10 +1078,16 @@ NOTQUITEDONE:
printf("epsilon: (%f) %f / %f * %f / %f < %f (%f)\n", fabs(deltaavg), temp, initialavg,
deltaavg, deltatemp, epsilon,(temp / initialavg) * (deltaavg/ deltatemp));
);
cerr << "temp is " << temp << endl;
cerr << "initialavg is " << initialavg << endl;
cerr << "deltaavg is " << deltaavg << endl;
cerr << "deltatemp is " << deltatemp << endl;
cerr << "term is " << (temp / initialavg) * (deltaavg/ deltatemp) << endl;
if ((tsteps >= mintsteps) &&
#ifdef ALLOW_NEGATIVE_DELTA
((fabs(deltaavg) < 0.0000001)
|| (fabs((temp / initialavg) * (deltaavg/ deltatemp)) < epsilon))) {
((temp < 0) || isnan(temp) ||
// || (fabs((temp / initialavg) * (deltaavg/ deltatemp)) < epsilon))) {
((temp / initialavg) * (deltaavg/ deltatemp)) < epsilon)) {
#else
(deltaavg > 0) && ((temp / initialavg) * (deltaavg/ deltatemp) < epsilon)) {
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment