From 1a31d1121c586047e38068012560503384cbf88d Mon Sep 17 00:00:00 2001 From: Kacper Kafara Date: Sun, 22 Oct 2023 07:49:36 +0200 Subject: [PATCH] perf(jssp): represent delay_feasibles as vec instead of hash set (#447) ## Description We do not need set capabilities for `delay_feasibles`. All we do is to iterate over the whole collection to find a maximum. We could consider using binary heap here instead, but it might be done in next step. --- examples/jssp/problem/fitness.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/jssp/problem/fitness.rs b/examples/jssp/problem/fitness.rs index 7d02026..b54388d 100644 --- a/examples/jssp/problem/fitness.rs +++ b/examples/jssp/problem/fitness.rs @@ -16,14 +16,14 @@ pub struct JsspFitness { // delay_g (also defined below) // To put this in other way: all jobs that can be scheduled in time window considered in // given iteration g. - delay_feasibles: HashSet, + delay_feasibles: Vec, } impl JsspFitness { pub fn new() -> Self { Self { scheduled: HashSet::new(), - delay_feasibles: HashSet::new(), + delay_feasibles: Vec::new(), } } @@ -169,7 +169,7 @@ impl JsspFitness { true }) .for_each(|op| { - self.delay_feasibles.insert(op.id); + self.delay_feasibles.push(op.id); }) }