Skip to content

Commit

Permalink
Do not apply diversification operators on exploitation phase
Browse files Browse the repository at this point in the history
  • Loading branch information
reinterpretcat committed Mar 22, 2023
1 parent 66cc778 commit 92ad353
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions rosomaxa/src/evolution/simulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,14 @@ where

let parents = heuristic_ctx.population().select().collect::<Vec<_>>();

let search_offspring = heuristic.search(&heuristic_ctx, parents.clone());
let diverse_offspring = heuristic.diversify(&heuristic_ctx, parents);
let diverse_offspring = if heuristic_ctx.population().selection_phase() == SelectionPhase::Exploitation {
Vec::default()
} else {
heuristic.diversify(&heuristic_ctx, parents.clone())
};

let search_offspring = heuristic.search(&heuristic_ctx, parents);

let offspring = search_offspring.into_iter().chain(diverse_offspring).collect::<Vec<_>>();

let termination_estimate = termination.estimate(&heuristic_ctx);
Expand Down

0 comments on commit 92ad353

Please sign in to comment.