diff --git a/assign/anneal.cc b/assign/anneal.cc index 8013d0975ab92af4cf78070b6f368f14410259cd..0a67ff16580b22f7af36fa89557aa2b6903a32d2 100644 --- a/assign/anneal.cc +++ b/assign/anneal.cc @@ -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 diff --git a/assign/anneal.h b/assign/anneal.h index 517297805512a4d951d215f50f66c47c176124de..49b1a0c1e41dbffa238fccafad4e8749749182c1 100644 --- a/assign/anneal.h +++ b/assign/anneal.h @@ -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 diff --git a/assign/assign.cc b/assign/assign.cc index 3b5bcc23d28105e1417eae1f5badf515da09d89c..eb0a370e9437e64ab65ba531d2ea0a33ba66e6be 100644 --- a/assign/assign.cc +++ b/assign/assign.cc @@ -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 - Try 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