chiark / gitweb /
makefile representing current best effort
authorIan Jackson <ian@davenant.greenend.org.uk>
Sat, 19 Jan 2008 12:59:13 +0000 (12:59 +0000)
committerIan Jackson <ian@davenant.greenend.org.uk>
Sat, 19 Jan 2008 12:59:13 +0000 (12:59 +0000)
.bzrignore
Makefile
energy.c
minimise.c
minimise.h

index 28f0f63..fc57f20 100644 (file)
@@ -1,7 +1,7 @@
-minimise
 primer
 view-[1-9]*
 interpolate-[1-9]*
+minimise-[1-9]*
 *.d
 *.tmp
 *.new
index bb869a1..899bed6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,10 @@
 
 
-VIEWDIMS=33 64 125 246
-TARGETS= minimise primer lumpy.cfm sgtatham.cfm ring.cfm \
-       interpolate-64 interpolate-125 interpolate-246 \
-       $(addprefix view-, $(VIEWDIMS))
+ALLDIMS=33 64 125 246 487 968
+TARGETS= primer lumpy.cfm sgtatham.cfm ring.cfm \
+       minimise-33 minimise-64 \
+       $(addprefix interpolate-, $(ALLDIMS)) \
+       $(addprefix view-, $(ALLDIMS))
 SGTATHAM=sgtatham
 
 CWARNS=        -Wall -Wwrite-strings -Wpointer-arith -Werror -Wshadow
@@ -19,7 +20,9 @@ o= >$@.new && mv -f $@.new $@
 
 all:           $(TARGETS)
 
-compute:       best.CFM
+compute:       all
+               $(MAKE) best-33.CFM
+               $(MAKE) best-968.CFM
 
 minimise:      energy.o graph.o common.o mgraph.o minimise.o half.o
                $(CXX) $(CXXFLAGS) -o $@ $^ $(LIBGSL)
@@ -40,8 +43,25 @@ lumpy.cfm: oldmoebius-converter prime.data ../moebius/ins-new ../moebius/a.out
 ring.cfm: oldmoebius-converter prime.data /dev/null ../moebius/a.out
                ./$^ -o$@
 
-best.CFM:
-               ./minimise sgtatham.cfm -iwip.cfm -o$@
+
+best-33.CFM:
+               ./minimise-33 sgtatham.cfm -iwip-33.cfm -o$@
+
+start-64.cfm:  best-33.CFM
+               ./interpolate-64 -a4 $< -o$@
+
+best-64.CFM:
+               ./minimise-64 start-64.cfm -iwip-64.CFM -o$@
+
+define interpolate_aa
+best-$1.cfm:   interpolate-$1 $2
+               ./$$< -aa $2 -o$$@
+endef
+
+$(eval $(call interpolate_aa,968, best-487.cfm))
+$(eval $(call interpolate_aa,487, best-246.cfm))
+$(eval $(call interpolate_aa,246, best-125.cfm))
+$(eval $(call interpolate_aa,125, best-64.CFM))
 
 view-%:                view+%.o mgraph+%.o common.o
                $(CC) $(CFLAGS) -o $@ $^ $(LIBGSL) -L/usr/X11R6/lib -lX11
@@ -52,14 +72,6 @@ interpolate-%:       interpolate+%.o mgraph+%.o common.o
 minimise-%:    energy+%.o graph+%.o mgraph+%.o minimise+%.o half+%.o common.o
                $(CXX) $(CXXFLAGS) -o $@ $^ $(LIBGSL)
 
-define interpolate
-dense-$1.cfm:  interpolate-$1 $2
-               ./$$< <$2 $$o
-endef
-
-$(eval $(call interpolate,64, best.CFM))
-$(eval $(call interpolate,125, dense-64.cfm, dense-64.cfm))
-
 # this ridiculous repetition is due to make being too lame
 
 view+%.o: view.c
index 4f66e6c..80ac7e8 100644 (file)
--- a/energy.c
+++ b/energy.c
@@ -32,17 +32,24 @@ double compute_energy(const struct Vertices *vs) {
 
   if (printing) printf("%15lld c>e |", evaluations);
 
-#if YBITS==3
-  COST(  3e2,   line_bending_cost(vs->a));
-  COST(  1e3,   edge_length_variation_cost(vs->a));
-  COST( 0.2e3,  rim_proximity_cost(vs->a));
-  COST(  1e8,   noncircular_rim_cost(vs->a));
-#else
-  COST(  3e3,   line_bending_cost(vs->a));
-  COST(  1e4,   edge_length_variation_cost(vs->a));
-  COST( 0.2e3,  rim_proximity_cost(vs->a));
-  COST(  1e8,   noncircular_rim_cost(vs->a));
-#endif
+  if (XBITS==3) {
+    COST(  3e2,   line_bending_cost(vs->a));
+    COST(  1e3,   edge_length_variation_cost(vs->a));
+    COST( 0.2e3,  rim_proximity_cost(vs->a));
+    COST(  1e8,   noncircular_rim_cost(vs->a));
+    stop_epsilon= 1e-6;
+  } else if (XBITS==4) {
+    COST(  3e2,   line_bending_cost(vs->a));
+    COST(  3e3,   edge_length_variation_cost(vs->a));
+    COST( 3.8e1,  rim_proximity_cost(vs->a)); // 5e1 is too much
+                                                // 2.5e1 is too little
+    // 0.2e1 grows compared to previous ?
+    // 0.6e0 shrinks compared to previous ?
+    COST(  1e12,   noncircular_rim_cost(vs->a));
+    stop_epsilon= 1e-5;
+  } else {
+    abort();
+  }
 
   if (printing) printf("| total %# e |", energy);
 
index 8f6a261..d07af5e 100644 (file)
 const char *input_file, *best_file;
 char *best_file_tmp;
 long long evaluations;
+double stop_epsilon= 1e-20;
 
 static void printing_init(void);
 
-static const double stop_epsilon= 1e-6;
 static gsl_multimin_fminimizer *minimiser;
 static const char *final_file;
 static char *final_file_tmp;
index 28bef2c..a076125 100644 (file)
@@ -25,6 +25,7 @@ double rim_proximity_cost(const Vertices vertices);
 extern const char *input_file, *best_file;
 extern char *best_file_tmp;
 extern long long evaluations;
+extern double stop_epsilon;
 
 enum printing_instance { pr_cost, pr_size, pr__max };
 int printing_check(enum printing_instance, int indent);