From 84a9c6cfe80b9bab0a1957a5e9c6892459c0aedb Mon Sep 17 00:00:00 2001 From: reinterpretcat Date: Tue, 4 Jun 2024 23:05:49 +0200 Subject: [PATCH] Apply minor cleanup --- CHANGELOG.md | 1 + vrp-core/src/models/goal.rs | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74eb0af71..0ca63807e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ are already published. So, I stick to it for now. * tweak job index * tweak infeasible search heuristic * refactor route intervals and multi trip enablers +* refactor feature objective ## [v1.23.0]- 2023-12-22 diff --git a/vrp-core/src/models/goal.rs b/vrp-core/src/models/goal.rs index 1cb39d49e..4486c52b5 100644 --- a/vrp-core/src/models/goal.rs +++ b/vrp-core/src/models/goal.rs @@ -79,12 +79,9 @@ pub struct GoalContextBuilder { impl GoalContextBuilder { /// Creates a `GoalBuilder` with the given list of features. pub fn with_features(features: Vec) -> GenericResult { - let ids_all = features - .iter() - .filter_map(|feature| feature.objective.as_ref().map(|_| feature.name.clone())) - .collect::>(); - + let ids_all = features.iter().map(|feature| feature.name.clone()).collect::>(); let ids_unique = ids_all.iter().collect::>(); + if ids_unique.len() != ids_all.len() { return Err(format!( "some of the features are defined more than once, check ids list: {}",