From: Ian Jackson Date: Sat, 19 Jan 2008 01:34:58 +0000 (+0000) Subject: smaller minimisations X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=moebius2.git;a=commitdiff_plain;h=f5c44e57feae26a81c416d9d7cc69f0accbac8b6 smaller minimisations --- diff --git a/Makefile b/Makefile index ecccd72..79e8edf 100644 --- 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 $@ diff --git a/energy.c b/energy.c index dd9206f..4f66e6c 100644 --- 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;