8 #ifndef READUCT_ELEMENTARYSTEPOPTIMIZATION_COSTCALCULATORS_COSTCOMBINEREDITOR_H
9 #define READUCT_ELEMENTARYSTEPOPTIMIZATION_COSTCALCULATORS_COSTCOMBINEREDITOR_H
21 namespace ElementaryStepOptimization {
23 namespace CostBasedOptimization {
26 template<
typename E1,
typename E2>
27 using Combiner = CostCombiner<typename E1::InstanceClass, typename E2::InstanceClass>;
34 template<
typename E1,
typename E2>
36 static constexpr
const char* description =
"Combined cost calculator";
37 static constexpr
const char* factorKey =
"first_weight";
38 static constexpr
const char* factorDescription =
"Weight for first calculator (between 0 and 1)";
42 : calculator1Key_(std::move(key1)), calculator2Key_(std::move(key2)) {
53 auto descriptors1 = editor1_.getSettingDescriptors();
54 auto descriptors2 = editor2_.getSettingDescriptors();
56 descriptors.push_back(calculator1Key_, std::move(descriptors1));
57 descriptors.push_back(calculator2Key_, std::move(descriptors2));
58 descriptors.push_back(factorKey, std::move(weight));
64 editor1_.apply(instance.firstCalculator(), values.getCollection(calculator1Key_));
65 editor2_.apply(instance.secondCalculator(), values.getCollection(calculator2Key_));
72 auto firstCalculatorValues = editor1_.getAppliedSettings(instance.firstCalculator());
73 auto secondCalculatorValues = editor2_.getAppliedSettings(instance.secondCalculator());
75 values.addCollection(calculator1Key_, std::move(firstCalculatorValues));
76 values.addCollection(calculator2Key_, std::move(secondCalculatorValues));
77 values.addDouble(factorKey, instance.getFirstCalculatorContribution());
81 std::string calculator1Key_;
82 std::string calculator2Key_;
93 #endif // READUCT_ELEMENTARYSTEPOPTIMIZATION_COSTCALCULATORS_COSTCOMBINEREDITOR_H
void setDefaultValue(double def)
void setMinimum(double min)
Definition: CostCombinerEditor.h:35
void setFirstCalculatorContribution(double f)
Definition: CostCombiner.h:37
Definition: CostCombiner.h:29
void setMaximum(double max)