summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2019-03-22 01:09:15 +0100
committerAndré Nusser <andre.nusser@googlemail.com>2019-05-11 14:58:45 +0200
commit9c5efc23764522597a53a8745860cec54ea55d69 (patch)
treed672afdf2e11553d36370cc1abbef5033557f85e /src
parent50b011c4740a5ec5338903b1d8b5fbb4b42f3df3 (diff)
Add settings and GUI for new sampling algorithm.
Diffstat (limited to 'src')
-rw-r--r--src/powerlist.cc2
-rw-r--r--src/sample_selection.cc7
-rw-r--r--src/settings.h21
3 files changed, 26 insertions, 4 deletions
diff --git a/src/powerlist.cc b/src/powerlist.cc
index a0510ad..c78b071 100644
--- a/src/powerlist.cc
+++ b/src/powerlist.cc
@@ -65,6 +65,7 @@ void PowerList::add(Sample* sample)
samples.push_back(item);
}
+// FIXME: remove all?
const Channel* PowerList::getMasterChannel()
{
std::map<const Channel*, int> count;
@@ -129,6 +130,7 @@ const Channel* PowerList::getMasterChannel()
return master;
}
+// FIXME: clean up significantly!
void PowerList::finalise()
{
#ifdef AUTO_CALCULATE_POWER
diff --git a/src/sample_selection.cc b/src/sample_selection.cc
index 6e956df..92c4efc 100644
--- a/src/sample_selection.cc
+++ b/src/sample_selection.cc
@@ -79,6 +79,7 @@ const Sample* SampleSelection::get(level_t level, std::size_t pos)
}
}
+// FIXME: remove before release and adapt everything
const Sample* SampleSelection::getOld(level_t level, std::size_t pos)
{
auto velocity_stddev = settings.velocity_stddev.load();
@@ -176,9 +177,9 @@ const Sample* SampleSelection::getObjective(level_t level, std::size_t pos)
DEBUG(rand, "level: %f, lvl: %f (mean: %.2f, stddev: %.2f,"
"power_min: %f, power_max: %f)\n", level, lvl, mean, stddev, power_min, power_max);
- const float f_distance = 2.0;
- const float f_recent = 1.0;
- const float f_random = .05;
+ const float f_distance = settings.sample_selection_f_distance.load();
+ const float f_recent = settings.sample_selection_f_recent.load();
+ const float f_random = settings.sample_selection_f_random.load();
// start with most promising power value and then stop when reaching far values
// which cannot become opt anymore
diff --git a/src/settings.h b/src/settings.h
index 4a7d904..6abbc72 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -75,13 +75,20 @@ struct Settings
static float constexpr velocity_modifier_falloff_default = 0.5f;
static float constexpr velocity_modifier_weight_default = 0.25f;
static float constexpr velocity_stddev_default = 1.0f;
+ static float constexpr sample_selection_f_distance_default = 2.f;
+ static float constexpr sample_selection_f_recent_default = .3f;
+ static float constexpr sample_selection_f_random_default = 0.05f;
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}; // [0.5; 3.0]
+ Atomic<float> velocity_stddev{velocity_stddev_default};
+ Atomic<float> sample_selection_f_distance{sample_selection_f_distance_default};
+ Atomic<float> sample_selection_f_recent{sample_selection_f_recent_default};
+ Atomic<float> sample_selection_f_random{sample_selection_f_random_default};
//! Control number of times to retry sample selection as long as the sample
//! is the same one as the last one.
//! 0: will do no retries, ie. just use the first sample found.
+ // FIXME: remove when new sample algorithm is introduced and also remove other occurences
static std::size_t constexpr sample_selection_retry_count_default = 3;
Atomic<std::size_t> sample_selection_retry_count{sample_selection_retry_count_default};
@@ -163,6 +170,9 @@ struct SettingsGetter
SettingRef<float> velocity_modifier_falloff;
SettingRef<float> velocity_modifier_weight;
SettingRef<float> velocity_stddev;
+ SettingRef<float> sample_selection_f_distance;
+ SettingRef<float> sample_selection_f_recent;
+ SettingRef<float> sample_selection_f_random;
SettingRef<std::size_t> sample_selection_retry_count;
@@ -214,6 +224,9 @@ struct SettingsGetter
, velocity_modifier_falloff{settings.velocity_modifier_falloff}
, velocity_modifier_weight{settings.velocity_modifier_weight}
, velocity_stddev{settings.velocity_stddev}
+ , sample_selection_f_distance{settings.sample_selection_f_distance}
+ , sample_selection_f_recent{settings.sample_selection_f_recent}
+ , sample_selection_f_random{settings.sample_selection_f_random}
, sample_selection_retry_count(settings.sample_selection_retry_count)
, velocity_modifier_current{settings.velocity_modifier_current}
, enable_velocity_randomiser{settings.enable_velocity_randomiser}
@@ -265,6 +278,9 @@ public:
Notifier<float> velocity_modifier_falloff;
Notifier<float> velocity_modifier_weight;
Notifier<float> velocity_stddev;
+ Notifier<float> sample_selection_f_distance;
+ Notifier<float> sample_selection_f_recent;
+ Notifier<float> sample_selection_f_random;
Notifier<std::size_t> sample_selection_retry_count;
Notifier<float> velocity_modifier_current;
@@ -320,6 +336,9 @@ public:
EVAL(velocity_modifier_falloff);
EVAL(velocity_modifier_weight);
EVAL(velocity_stddev);
+ EVAL(sample_selection_f_distance);
+ EVAL(sample_selection_f_recent);
+ EVAL(sample_selection_f_random);
EVAL(sample_selection_retry_count);
EVAL(velocity_modifier_current);