chiark / gitweb /
smaller minimisations
authorIan Jackson <ian@davenant.greenend.org.uk>
Sat, 19 Jan 2008 01:34:58 +0000 (01:34 +0000)
committerIan Jackson <ian@davenant.greenend.org.uk>
Sat, 19 Jan 2008 01:34:58 +0000 (01:34 +0000)
Makefile
energy.c

index ecccd72524fcd94b895bfd509ddc5e4ccd7da876..79e8edf99fa47d5f9313821e85644a976d32b6b3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -49,6 +49,9 @@ view-%:               view+%.o mgraph+%.o common.o
 interpolate-%: interpolate+%.o mgraph+%.o common.o
                $(CC) $(CFLAGS) -o $@ $^ $(LIBGSL)
 
+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
@@ -65,6 +68,18 @@ view+%.o: view.c
 mgraph+%.o: mgraph.c
                $(CC) -c $(CPPFLAGS) $(CFLAGS) -DDEFSZ=$* $< -o $@
 
+minimise+%.o: minimise.c
+               $(CC) -c $(CPPFLAGS) $(CFLAGS) -DDEFSZ=$* $< -o $@
+
+graph+%.o: graph.c
+               $(CC) -c $(CPPFLAGS) $(CFLAGS) -DDEFSZ=$* $< -o $@
+
+energy+%.o: energy.c
+               $(CC) -c $(CPPFLAGS) $(CFLAGS) -DDEFSZ=$* $< -o $@
+
+half+%.o: half.c
+               $(CC) -c $(CPPFLAGS) $(CFLAGS) -DDEFSZ=$* $< -o $@
+
 interpolate+%.o: interpolate.c
                $(CC) -c $(CPPFLAGS) $(CFLAGS) -DDEFSZ=$* $< -o $@
 
index dd9206f4b7a5cb80c3178cfc9f35ae603982158f..4f66e6c0aa6b3a253d7e0eda715d6a510126d494 100644 (file)
--- a/energy.c
+++ b/energy.c
@@ -32,10 +32,17 @@ 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 (printing) printf("| total %# e |", energy);
 
@@ -167,7 +174,7 @@ double line_bending_cost(const Vertices vertices) {
     double delta= atan2(magnD(axb) + axb_epsilon, dotprod(a,b));
     double cost= pow(delta,exponent_r);
 
-    if (!e && !(qi & YMASK))
+    if (!e && !(qi & ~XMASK))
       cost *= 10;
 
     total_cost += cost;