- return best.systems_per_page_;
-}
-
-SCM
-Optimal_page_breaking::solve ()
-{
- vector<vsize> systems_per_page;
+ for (vsize i = 0; i < current_configuration_count (); i++)
+ {
+ vsize min_p_count = min_page_count (i, first_page_num);
+ Page_spacing_result cur;
+
+ if (min_p_count > page_count)
+ continue;
+ else if (scm_is_integer (forced_page_count))
+ cur = space_systems_on_n_pages (i, page_count, first_page_num);
+ else
+ cur = space_systems_on_best_pages (i, first_page_num);
+
+ if (cur.demerits_ < best.demerits_)
+ {
+ best = cur;
+ best_division = current_configuration (i);
+ }
+
+ if (cur.demerits_ < best_demerits_for_this_sys_count)
+ {
+ best_demerits_for_this_sys_count = cur.demerits_;
+ bound = current_configuration (i);
+ }
+ }
+
+ if (debug_page_breaking_scoring)
+ message (_f ("best score for this sys-count: %f", best_demerits_for_this_sys_count));