@@ -50,32 +50,31 @@ using SoftConstraintsFunctionVector = std::vector<std::function<double(
50
50
using HardConstraintsFunctionVector = std::vector<std::function<bool (
51
51
sampler_common::Path &, const sampler_common::Constraints &, const MultiPoint2d &)>>;
52
52
53
- inline void evaluateSoftConstraints (
53
+ inline std::vector< double > evaluateSoftConstraints (
54
54
sampler_common::Path & path, const sampler_common::Constraints & constraints,
55
55
const SoftConstraintsFunctionVector & soft_constraints_functions,
56
- const SoftConstraintsInputs & input_data, std::vector< double > & constraints_results )
56
+ const SoftConstraintsInputs & input_data)
57
57
{
58
- constraints_results. clear () ;
58
+ std::vector< double > constraints_results;
59
59
for (const auto & f : soft_constraints_functions) {
60
60
const auto cost = f (path, constraints, input_data);
61
61
constraints_results.push_back (cost);
62
62
}
63
63
if (constraints.soft .weights .size () != constraints_results.size ()) {
64
64
path.cost = std::accumulate (constraints_results.begin (), constraints_results.end (), 0.0 );
65
- return ;
65
+ return constraints_results ;
66
66
}
67
67
68
68
path.cost = std::inner_product (
69
69
constraints_results.begin (), constraints_results.end (), constraints.soft .weights .begin (), 0.0 );
70
- return ;
70
+ return constraints_results ;
71
71
}
72
72
73
- inline void evaluateHardConstraints (
73
+ inline std::vector< bool > evaluateHardConstraints (
74
74
sampler_common::Path & path, const sampler_common::Constraints & constraints,
75
- const MultiPoint2d & footprint, const HardConstraintsFunctionVector & hard_constraints,
76
- std::vector<bool > & constraints_results)
75
+ const MultiPoint2d & footprint, const HardConstraintsFunctionVector & hard_constraints)
77
76
{
78
- constraints_results. clear () ;
77
+ std::vector< bool > constraints_results;
79
78
bool constraints_passed = true ;
80
79
int idx = 0 ;
81
80
for (const auto & f : hard_constraints) {
@@ -86,7 +85,7 @@ inline void evaluateHardConstraints(
86
85
}
87
86
88
87
path.constraints_satisfied = constraints_passed;
89
- return ;
88
+ return constraints_results ;
90
89
}
91
90
92
91
inline sampler_common::State getInitialState (
0 commit comments