11 const CalcPatternMod _pmod = CJOHAnchor;
12 const std::string name =
"CJOHAnchorMod";
20 float len_scaler = 0.2F;
21 float anchor_len_weight = 1.F;
22 float swap_scaler = 0.10775F;
23 float not_swap_scaler = 0.019F;
25 const std::vector<std::pair<std::string, float*>> _params{
26 {
"min_mod", &min_mod },
27 {
"max_mod", &max_mod },
30 {
"len_scaler", &len_scaler },
31 {
"anchor_len_weight", &anchor_len_weight },
32 {
"swap_scaler", &swap_scaler },
33 {
"not_swap_scaler", ¬_swap_scaler },
35#pragma endregion params and param map
38 int max_chain_swaps = 0;
39 int max_not_swaps = 0;
40 int max_total_len = 0;
41 int max_anchor_len = 0;
45#pragma region generic functions
61 void advance_sequencing(
const col_type& ct,
const base_type& bt,
const col_type& last_ct,
const float& any_ms)
63 chain(ct, bt, last_ct, any_ms);
68 const auto& itvhi = mitvhi._itvhi;
69 const auto& base_types = mitvhi._base_types;
72 max_chain_swaps = chain.get_max_chain_swaps();
73 max_not_swaps = chain.get_max_not_swaps();
74 max_total_len = chain.get_max_total_len();
75 max_anchor_len = chain.get_max_anchor_len();
78 if (itvhi.get_taps_nowi() == 0) {
90 auto taps_in_any_sequence = std::clamp(base_types[base_single_single] +
91 base_types[base_single_jump] +
92 base_types[base_jump_single],
94 std::max(1, max_total_len));
95 auto tapsF =
static_cast<float>(taps_in_any_sequence);
98 auto csF =
static_cast<float>(max_chain_swaps);
102 auto clF =
static_cast<float>(max_total_len);
104 auto caF =
static_cast<float>(max_anchor_len);
109 auto anchor_len_worth =
110 weighted_average(clF, caF, anchor_len_weight, 1.F);
112 auto anchor_worth = fastsqrt(anchor_len_worth / tapsF) * len_scaler;
113 auto swap_worth = fastsqrt(csF / tapsF) * swap_scaler;
115 pmod = std::clamp(base + anchor_worth + swap_worth + not_swap_scaler, min_mod, max_mod);
129 chain.reset_max_seq();