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