chiark / gitweb /
WIP routesearch; debugging is optional; bugfixes fixed the bug in TODO
authorIan Jackson <ian@liberator.(none)>
Sat, 3 Oct 2009 20:44:05 +0000 (21:44 +0100)
committerIan Jackson <ian@liberator.(none)>
Sat, 3 Oct 2009 20:44:05 +0000 (21:44 +0100)
yarrg/TODO
yarrg/common.c
yarrg/rsmain.c

index db4ce5ed4da9234723e38977cab9c73500af3b35..ec4daed8f1eea74ed1ba673df509f9a61e808b63 100644 (file)
@@ -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
 
index 3dc387ea4239b83e37393d7a532336ab75fa61d3..35b8969811f89cf7a10961dc1b4069638b8de246 100644 (file)
@@ -161,7 +161,6 @@ char *masprintf(const char *fmt, ...) {
   return r;
 }
 
-
 unsigned debug_flags;
 
 void debug_flush(void) {
index 7e5e5e8a2af2b06c5e1199ae075c31eb3f0e658c..7904c013c1362b622d13017d54ce6ed351e689b1 100644 (file)
@@ -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();