Skip to content

Commit

Permalink
Skip some impossible act ends in optimiser
Browse files Browse the repository at this point in the history
  • Loading branch information
GenericMadScientist committed Nov 26, 2020
1 parent dffd6c4 commit 6b7d976
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/optimiser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ Optimiser::try_previous_best_subpaths(CacheKey key, const Cache& cache,
// point.
class PointPtrRangeSet {
private:
const PointPtr m_start;
const PointPtr m_end;
PointPtr m_start;
PointPtr m_end;
PointPtr m_min_absent_ptr;
std::vector<PointPtr> m_abnormal_elements;

Expand Down Expand Up @@ -230,6 +230,7 @@ Optimiser::CacheValue Optimiser::find_best_subpaths(CacheKey key, Cache& cache,

std::vector<std::tuple<ProtoActivation, CacheKey>> acts;
PointPtrRangeSet attained_act_ends {key.point, m_song->points().cend()};
auto lower_bound_set = false;
auto best_score_boost = 0;

for (auto p = key.point; p < m_song->points().cend(); ++p) {
Expand Down Expand Up @@ -261,6 +262,20 @@ Optimiser::CacheValue Optimiser::find_best_subpaths(CacheKey key, Cache& cache,
}
break;
}
// This skips some points that are too early to be an act end for the
// earliest possible activation.
if (!lower_bound_set) {
const Measure act_length {8.0 * std::max(sp_bar.min(), 0.5)};
const auto earliest_act_end = starting_pos.measure + act_length;
auto earliest_pt_end = std::find_if_not(
std::next(p), m_song->points().cend(), [&](const auto& pt) {
return pt.hit_window_end.measure <= earliest_act_end;
});
--earliest_pt_end;
attained_act_ends
= PointPtrRangeSet {earliest_pt_end, m_song->points().cend()};
lower_bound_set = true;
}
for (auto q = attained_act_ends.lowest_absent_element();
q < m_song->points().cend();) {
if (attained_act_ends.contains(q)) {
Expand Down

0 comments on commit 6b7d976

Please sign in to comment.