Skip to content

Commit

Permalink
perf(jssp): represent delay_feasibles as vec instead of hash set (#447)
Browse files Browse the repository at this point in the history
<!-- If applicable - remember to add the PR to the EA Rust project (ONLY
IF THERE IS NO LINKED ISSUE) -->

## 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.
  • Loading branch information
kkafar authored Oct 22, 2023
1 parent 0cbd1d8 commit 1a31d11
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/jssp/problem/fitness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<usize>,
delay_feasibles: Vec<usize>,
}

impl JsspFitness {
pub fn new() -> Self {
Self {
scheduled: HashSet::new(),
delay_feasibles: HashSet::new(),
delay_feasibles: Vec::new(),
}
}

Expand Down Expand Up @@ -169,7 +169,7 @@ impl JsspFitness {
true
})
.for_each(|op| {
self.delay_feasibles.insert(op.id);
self.delay_feasibles.push(op.id);
})
}

Expand Down

0 comments on commit 1a31d11

Please sign in to comment.