+ COST( 1e12, edge_angle_cost)
+ #define EDGE_ANGLE_COST_CIRCCIRCRAT (0.5/1.3)
+ COST( 1e18, noncircular_rim_cost)
+#endif
+
+};
+
+const double edge_angle_cost_circcircrat= EDGE_ANGLE_COST_CIRCCIRCRAT;
+
+void energy_init(void) {
+ stop_epsilon= STOP_EPSILON;
+}
+
+/*---------- energy computation machinery ----------*/
+
+void compute_energy_separately(const struct Vertices *vs,
+ int section, void *energies_v, void *totals_v) {
+ double *energies= energies_v;
+ int ci;
+
+ for (ci=0; ci<NPRECOMPS; ci++) {
+ costs[ci].fn(vs->a, section);
+ inparallel_barrier();
+ }
+ for (ci=0; ci<NCOSTS; ci++)
+ energies[ci]= costs[ci].fn(vs->a, section);
+}
+
+void compute_energy_combine(const struct Vertices *vertices,
+ int section, void *energies_v, void *totals_v) {
+ int ci;
+ double *energies= energies_v;
+ double *totals= totals_v;
+
+ for (ci=0; ci<NCOSTS; ci++)
+ totals[ci] += energies[ci];
+}
+
+double compute_energy(const struct Vertices *vs) {
+ static int bests_unprinted;
+
+ double totals[NCOSTS], energy;
+ int ci, printing;
+
+ printing= printing_check(pr_cost,0);
+
+ if (printing) printf("%15lld c>e |", evaluations);
+
+ for (ci=0; ci<NCOSTS; ci++)
+ totals[ci]= 0;
+
+ inparallel(vs,
+ compute_energy_separately,
+ compute_energy_combine,
+ sizeof(totals) /* really, size of energies */,
+ totals);