6 double max_mass=-1, max_volu=-1, max_capi=-1;
7 double distance_loss_factor_per_league;
10 #define CTR(x) int ctr_##x;
14 static PotentialResult ****results;
15 /* results[start_isle_ix][finalisle][midisle]-> */
17 int main(int argc, const char **argv) {
21 debug_flags= ~( dbg_sql2 );
23 sysassert( !setvbuf(debug,0,_IOLBF,0) );
27 if (arg[0] != '-') break;
29 if (!strcmp(arg,"-DN")) {
38 max_mass= atof(*argv++);
39 max_volu= atof(*argv++);
40 max_capi= atof(*argv++);
41 double loss_per_league= atof(*argv++);
43 if (!loss_per_league) loss_per_league= 1e-7;
44 distance_loss_factor_per_league= 1.0 - loss_per_league;
50 fprintf(stderr,"setup complete, starting search\n");
53 if (!strcmp(arg,"specific")) {
55 while ((arg= *argv++))
58 double val= value_route(ni, ia, 0);
59 printf("route value is %g\n", val);
60 } else if (!strcmp(arg,"search")) {
61 MCALLOC(results, argc);
63 max_dist= atoi(*argv++);
64 nhighscores_absolute= atoi(*argv++);
65 nhighscores_perleague= atoi(*argv++);
67 MCALLOC(highscores_absolute, nhighscores_absolute);
68 MCALLOC(highscores_perleague, nhighscores_perleague);
71 while ((arg= argv[resultsix])) {
72 search(atoi(arg), &results[resultsix]);
76 int i, midarch, finarch;
77 for (i=0; i<resultsix; i++) {
78 fprintf(stderr,"============== start #%d %s ==============\n",
80 PotentialResult ***strat_resultsix= results[i];
81 if (!strat_resultsix) continue;
83 for (midarch=0; midarch<narches; midarch++) {
84 fprintf(stderr,"| mid %d ",midarch);
87 for (finarch=0; finarch<narches; finarch++) {
88 PotentialResult **strat_finarch= strat_resultsix[finarch];
89 if (!strat_finarch) continue;
90 fprintf(stderr,"f%d",finarch);
91 for (midarch=0; midarch<narches; midarch++) {
92 PotentialResult *result= strat_finarch[midarch];
96 fprintf(stderr,"|%5d",(int)(result->absolute));
98 fprintf(stderr,"%4d",(int)(result->perleague));
101 fprintf(stderr,"\n");
106 #define OUT(absperl) \
107 fprintf(stderr,"\n================== " #absperl " ==================\n"); \
108 for (pos=0; pos<nhighscores_##absperl; pos++) { \
109 HighScoreEntry *hs= &highscores_##absperl[pos]; \
110 PotentialResult *pr= hs->pr; \
112 const int *const ports= pr->absperl##_ports; \
114 for (nports=0; nports<MAX_ROUTELEN && ports[nports]>=0; nports++); \
115 int finisle= ports[nports-1]; int finarch= isle2arch(finisle); \
116 int midarch= route2midarch(ports,nports); \
118 " @%2d #%2d | start%3d mid%d f%d:%3d | %5d %5d %4d |", \
119 pos, nhighscores_##absperl - 1 - pos, \
120 ports[0], midarch, finarch,finisle, \
121 (int)hs->value, (int)pr->absolute, (int)pr->perleague); \
122 for (i=0; i<nports; i++) fprintf(stderr," %d",ports[i]); \
123 fprintf(stderr,"\n"); \
132 #define CTR(x) fprintf(stderr," %-30s %10d\n",#x,ctr_##x);