- for (; break_idx< breaks.size(); break_idx++) {
- Array<int> candidates;
- Array<Col_hpositions> candidate_lines;
- Pointer_list<Line_spacer*> spacer_p_list;
-
- /*
- start with a short line, add measures. At some point
- the line becomes infeasible. Then we don't try to add more
- */
- for (int start_idx = break_idx; start_idx--;){
- if (break_idx - start_idx > max_measures_i_)
- break;
-
- if (optimal_paths[start_idx].prev_break_i_ < 0
- && optimal_paths[start_idx].line_config_.energy_f_)
-
- continue;
-
- Line_of_cols line = all.slice (breaks[start_idx], breaks[break_idx]+1);
-
- line[0] = line[0]->postbreak_p_;
- line.top() = line.top ()->prebreak_p_;
-
- if (!feasible (line))
- break;
-
- Col_hpositions approx;
- approx.cols = line;
-
- approx.spacer_l_ = generate_spacing_problem (line);
- spacer_p_list.bottom().add (approx.spacer_l_);
+ optimal_paths[0] = first_node;
+ int break_idx=1;
+
+ for (; break_idx< breaks.size (); break_idx++)
+ {
+ /*
+ start with a short line, add measures. At some point
+ the line becomes infeasible. Then we don't try to add more
+ */
+ int minimal_start_idx = -1;
+ Column_x_positions minimal_sol;
+ Column_x_positions backup_sol;
+
+ Real minimal_demerits = infinity_f;