Commit 71253f39 authored by Robert Ricci's avatar Robert Ricci

Add a much needed 'try harder' feature - pass, on the command line,

a floating point number that, roughly, scales the runtime.
parent 88a5c2f7
......@@ -181,7 +181,7 @@ REDO_SEARCH:
/* When this is finished the state will reflect the best solution found. */
void anneal(bool scoring_selftest)
void anneal(bool scoring_selftest, double scale_neighborhood)
{
cout << "Annealing." << endl;
......@@ -294,6 +294,11 @@ void anneal(bool scoring_selftest)
if (neighborsize < min_neighborhood_size) {
neighborsize = min_neighborhood_size;
}
// Allow scaling of the neighborhood size, so we can make assign try harder
// (or less hard)
neighborsize = (int)(neighborsize * scale_neighborhood);
#ifdef CHILL
double scores[neighborsize];
#endif
......
......@@ -72,6 +72,6 @@ inline int accept(double change, double temperature);
tb_pnode *find_pnode(tb_vnode *vn);
/* The big guy! */
void anneal(bool scoring_selftest);
void anneal(bool scoring_selftest, double scale_neighborhood);
#endif
......@@ -83,6 +83,9 @@ switch_dist_map_map switch_dist;
// Time started, finished, and the time limit
double timestart, timeend, timelimit, timetarget;
// An amount to scale the neighborhood size by
double scale_neighborhood = 1.0;
#ifdef GNUPLOT_OUTPUT
FILE *scoresout, *tempout, *deltaout;
#endif
......@@ -303,6 +306,7 @@ void print_help()
cerr << " -P - Prune unusable pclasses." << endl;
#endif
cerr << " -T - Doing some scoring self-testing." << endl;
cerr << " -H <float> - Try <float> times harder." << endl;
exit(2);
}
......@@ -534,7 +538,7 @@ int main(int argc,char **argv)
char ch;
timelimit = 0.0;
timetarget = 0.0;
while ((ch = getopt(argc,argv,"s:v:l:t:rpPTd")) != -1) {
while ((ch = getopt(argc,argv,"s:v:l:t:rpPTdH:")) != -1) {
switch (ch) {
case 's':
if (sscanf(optarg,"%d",&seed) != 1) {
......@@ -570,6 +574,11 @@ int main(int argc,char **argv)
scoring_selftest = true; break;
case 'd':
dynamic_pclasses = true; break;
case 'H':
if (sscanf(optarg,"%lf",&scale_neighborhood) != 1) {
print_help();
}
break;
default:
print_help();
}
......@@ -657,7 +666,7 @@ int main(int argc,char **argv)
}
timestart = used_time();
anneal(scoring_selftest);
anneal(scoring_selftest, scale_neighborhood);
timeend = used_time();
#ifdef GNUPLOT_OUTPUT
......
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