From: Ian Jackson Date: Sat, 3 Oct 2009 20:44:05 +0000 (+0100) Subject: WIP routesearch; debugging is optional; bugfixes fixed the bug in TODO X-Git-Tag: 5.0^2~79 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-live.git;a=commitdiff_plain;h=ea160a28fd378be423dfe60d9ad3bdfa6f0d8295 WIP routesearch; debugging is optional; bugfixes fixed the bug in TODO --- diff --git a/yarrg/TODO b/yarrg/TODO index db4ce5e..ec4daed 100644 --- a/yarrg/TODO +++ b/yarrg/TODO @@ -1,11 +1,4 @@ route optimiser - - strange results from - ./routesearch 13460 20210 -1 0 search 30 7 >u - ie - absolute 18423.760221** perleague 449.360005** route 7 5 7 5 7 5 7 5 7 5 7 - but routetrade disagrees violently - - - make debugging optional - fast version of rsvalue.c ? - performance improvements diff --git a/yarrg/common.c b/yarrg/common.c index 3dc387e..35b8969 100644 --- a/yarrg/common.c +++ b/yarrg/common.c @@ -161,7 +161,6 @@ char *masprintf(const char *fmt, ...) { return r; } - unsigned debug_flags; void debug_flush(void) { diff --git a/yarrg/rsmain.c b/yarrg/rsmain.c index 7e5e5e8..7904c01 100644 --- a/yarrg/rsmain.c +++ b/yarrg/rsmain.c @@ -12,30 +12,40 @@ int main(int argc, const char **argv) { debug_flags= ~( dbg_sql2 ); sysassert( !setvbuf(debug,0,_IOLBF,0) ); + + for (;;) { + arg= *++argv; + if (arg[0] != '-') break; + if (!strcmp(arg,"-DN")) { + debug_flags= 0; + } else { + abort(); + } + } setup_sql(); setup_value(); setup_search(); - max_mass= atof(*++argv); - max_volu= atof(*++argv); - max_capi= atof(*++argv); - double loss_per_league= atof(*++argv); + max_mass= atof(*argv++); + max_volu= atof(*argv++); + max_capi= atof(*argv++); + double loss_per_league= atof(*argv++); if (!loss_per_league) loss_per_league= 1e-7; distance_loss_factor_per_league= 1.0 - loss_per_league; - arg= *++argv; + arg= *argv++; if (!strcmp(arg,"specific")) { int ia[argc], ni=0; - while ((arg= *++argv)) + while ((arg= *argv++)) ia[ni++]= atoi(arg); double val= value_route(ni, ia); printf("route value is %g\n", val); } else if (!strcmp(arg,"search")) { - max_dist= atoi(*++argv); - while ((arg= *++argv)) + max_dist= atoi(*argv++); + while ((arg= *argv++)) search(atoi(arg)); } else { abort();