summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Nusser <anusser@mpi-inf.mpg.de>2021-02-13 12:35:45 +0100
committerAndré Nusser <anusser@mpi-inf.mpg.de>2021-02-13 12:35:45 +0100
commit2721e1a0e391dd947df0cb9055f2e05012a62bb8 (patch)
tree6ec56743f4a047fc15f450713c1d621ade438907
parenta7bd23a0744def7d3dc34779a789591589561097 (diff)
Add position parameter of sample selection to settings.
-rw-r--r--src/sample_selection.cc6
-rw-r--r--src/settings.h6
2 files changed, 9 insertions, 3 deletions
diff --git a/src/sample_selection.cc b/src/sample_selection.cc
index cec90b1..0ff2c51 100644
--- a/src/sample_selection.cc
+++ b/src/sample_selection.cc
@@ -69,16 +69,16 @@ const Sample* SampleSelection::get(level_t level, float position, std::size_t po
float pos_opt{0.f};
float value_opt{std::numeric_limits<float>::max()};
// the following three values are mostly for debugging
- float random_opt = 0.;
float close_opt = 0.;
- float diverse_opt = 0.;
float closepos_opt = 0.;
+ float random_opt = 0.;
+ float diverse_opt = 0.;
// Note the magic values in front of the settings factors.
const float f_close = 4.*settings.sample_selection_f_close.load();
+ const float f_position = 1000.*settings.sample_selection_f_position.load(); // FIXME: huge factor for now
const float f_diverse = (1./2.)*settings.sample_selection_f_diverse.load();
const float f_random = (1./3.)*settings.sample_selection_f_random.load();
- const float f_position = 1000.; // FIXME: get from settings
float power_range = powerlist.getMaxPower() - powerlist.getMinPower();
// If all power values are the same then power_range is invalid but we want
diff --git a/src/settings.h b/src/settings.h
index 7507827..d4a2295 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -76,12 +76,14 @@ struct Settings
static float constexpr velocity_modifier_weight_default = 0.25f;
static float constexpr velocity_stddev_default = .45f;
static float constexpr sample_selection_f_close_default = .85f;
+ static float constexpr sample_selection_f_position_default = 1.f;
static float constexpr sample_selection_f_diverse_default = .16f;
static float constexpr sample_selection_f_random_default = .07f;
Atomic<float> velocity_modifier_falloff{velocity_modifier_falloff_default};
Atomic<float> velocity_modifier_weight{velocity_modifier_weight_default};
Atomic<float> velocity_stddev{velocity_stddev_default};
Atomic<float> sample_selection_f_close{sample_selection_f_close_default};
+ Atomic<float> sample_selection_f_position{sample_selection_f_position_default};
Atomic<float> sample_selection_f_diverse{sample_selection_f_diverse_default};
Atomic<float> sample_selection_f_random{sample_selection_f_random_default};
@@ -200,6 +202,7 @@ struct SettingsGetter
SettingRef<float> velocity_modifier_weight;
SettingRef<float> velocity_stddev;
SettingRef<float> sample_selection_f_close;
+ SettingRef<float> sample_selection_f_position;
SettingRef<float> sample_selection_f_diverse;
SettingRef<float> sample_selection_f_random;
@@ -275,6 +278,7 @@ struct SettingsGetter
, velocity_modifier_weight{settings.velocity_modifier_weight}
, velocity_stddev{settings.velocity_stddev}
, sample_selection_f_close{settings.sample_selection_f_close}
+ , sample_selection_f_position{settings.sample_selection_f_position}
, sample_selection_f_diverse{settings.sample_selection_f_diverse}
, sample_selection_f_random{settings.sample_selection_f_random}
, sample_selection_retry_count(settings.sample_selection_retry_count)
@@ -345,6 +349,7 @@ public:
Notifier<float> velocity_modifier_weight;
Notifier<float> velocity_stddev;
Notifier<float> sample_selection_f_close;
+ Notifier<float> sample_selection_f_position;
Notifier<float> sample_selection_f_diverse;
Notifier<float> sample_selection_f_random;
Notifier<std::size_t> sample_selection_retry_count;
@@ -424,6 +429,7 @@ public:
EVAL(velocity_modifier_weight);
EVAL(velocity_stddev);
EVAL(sample_selection_f_close);
+ EVAL(sample_selection_f_position);
EVAL(sample_selection_f_diverse);
EVAL(sample_selection_f_random);
EVAL(sample_selection_retry_count);