-Tie_configuration
-Tie_formatting_problem::find_optimal_tie_configuration (Tie_specification const &spec) const
-{
- vector<Tie_configuration*> confs;
-
- int pos = spec.position_;
- Direction dir = spec.manual_dir_;
-
- for (int i = 0; i < details_.single_tie_region_size_; i ++)
- {
- confs.push_back (generate_configuration (pos + i * dir, dir,
- spec.column_ranks_));
-
- if (spec.has_manual_position_)
- {
- confs.back ()->delta_y_
- = (spec.manual_position_ - spec.position_)
- * 0.5 * details_.staff_space_;
-
- break;
- }
- }
-
- vector<Real> scores;
-
- int best_idx = -1;
- Real best_score = 1e6;
- for (vsize i = 0; i < confs.size (); i ++)
- {
- score_configuration (confs[i]);
- Real score = score_aptitude (confs[i], spec, 0, 0)
- + confs[i]->score ();
-
- if (score < best_score)
- {
- best_score = score;
- best_idx = i;
- }
- }
-
- if (best_idx < 0)
- programming_error ("No best tie configuration found.");
-
- Tie_configuration best
- = (best_idx >= 0) ? *confs[best_idx] : *confs[0];
-
- for (vsize i = 0; i < confs.size (); i++)
- delete confs[i];
-
- return best;
-}
-
-Tie_specification::Tie_specification ()
-{
- has_manual_position_ = false;
- has_manual_dir_ = false;
- position_ = 0;
- manual_position_ = 0;
- manual_dir_ = CENTER;
- note_head_drul_[LEFT] =
- note_head_drul_[RIGHT] = 0;
- column_ranks_[RIGHT] =
- column_ranks_[LEFT] = 0;
-}
-
-int
-Tie_specification::column_span () const
-{
- return column_ranks_[RIGHT] - column_ranks_[LEFT];
-}
-