Skip to content

Commit

Permalink
TournamentSelectionStrategy added.
Browse files Browse the repository at this point in the history
  • Loading branch information
Smoren committed Jan 26, 2025
1 parent 98d9508 commit 4cfa03a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions tests/parabola/multiprocess.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Parabola Multiprocessing', () => {
}),
fitness: new ParabolaMaxValueFitnessStrategy(),
sorting: new DescendingSortingStrategy(),
selection: new RandomSelectionStrategy(2),
selection: new RandomSelectionStrategy<ParabolaArgumentGenome>(2),
mutation: new ParabolaMutationStrategy(),
crossover: new ParabolaCrossoverStrategy(),
cache: new DummyPhenomeCache(),
Expand Down Expand Up @@ -86,7 +86,7 @@ describe('Parabola Multiprocessing', () => {
}),
fitness: new ParabolaMaxValueFitnessStrategy(),
sorting: new DescendingSortingStrategy(),
selection: new RandomSelectionStrategy(2),
selection: new RandomSelectionStrategy<ParabolaArgumentGenome>(2),
mutation: new ParabolaMutationStrategy(),
crossover: new ParabolaCrossoverStrategy(),
cache: new SimplePhenomeCache(),
Expand Down Expand Up @@ -136,7 +136,7 @@ describe('Parabola Multiprocessing', () => {
}),
fitness: new ParabolaMaxValueFitnessStrategy(),
sorting: new DescendingSortingStrategy(),
selection: new RandomSelectionStrategy(2),
selection: new RandomSelectionStrategy<ParabolaArgumentGenome>(2),
mutation: new ParabolaMutationStrategy(),
crossover: new ParabolaCrossoverStrategy(),
cache: new DummyPhenomeCache(),
Expand Down Expand Up @@ -186,7 +186,7 @@ describe('Parabola Multiprocessing', () => {
}),
fitness: new ParabolaMaxValueFitnessStrategy(),
sorting: new DescendingSortingStrategy(),
selection: new RandomSelectionStrategy(2),
selection: new RandomSelectionStrategy<ParabolaArgumentGenome>(2),
mutation: new ParabolaMutationStrategy(),
crossover: new ParabolaCrossoverStrategy(),
cache: new SimplePhenomeCache(),
Expand Down
9 changes: 5 additions & 4 deletions tests/traveling/multiprocess.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
SimplePhenomeCache,
DescendingSortingStrategy,
RandomSelectionStrategy,
TournamentSelectionStrategy,
} from "genetic-search";
import {
calcPathDistance,
Expand Down Expand Up @@ -57,7 +58,7 @@ describe.each([
}),
fitness: new TravelingFitnessStrategy(),
sorting: new DescendingSortingStrategy(),
selection: new RandomSelectionStrategy(2),
selection: new TournamentSelectionStrategy<TravelingGenome>(2, 5),
mutation: new TravelingMutationStrategy(),
crossover: new TravelingCrossoverStrategy(),
cache: new DummyPhenomeCache(),
Expand Down Expand Up @@ -110,7 +111,7 @@ describe.each([
fitness: new TravelingFitnessStrategy(),
sorting: new DescendingSortingStrategy(),
mutation: new TravelingMutationStrategy(),
selection: new RandomSelectionStrategy(2),
selection: new RandomSelectionStrategy<TravelingGenome>(2),
crossover: new TravelingCrossoverStrategy(),
cache: new SimplePhenomeCache(),
}
Expand Down Expand Up @@ -168,7 +169,7 @@ describe.each([
}),
fitness: new TravelingFitnessStrategy(),
sorting: new DescendingSortingStrategy(),
selection: new RandomSelectionStrategy(2),
selection: new TournamentSelectionStrategy<TravelingGenome>(2, 5),
mutation: new TravelingMutationStrategy(),
crossover: new TravelingCrossoverStrategy(),
cache: new DummyPhenomeCache(),
Expand Down Expand Up @@ -228,7 +229,7 @@ describe.each([
fitness: new TravelingFitnessStrategy(),
sorting: new DescendingSortingStrategy(),
mutation: new TravelingMutationStrategy(),
selection: new RandomSelectionStrategy(2),
selection: new RandomSelectionStrategy<TravelingGenome>(2),
crossover: new TravelingCrossoverStrategy(),
cache: new AveragePhenomeCache(),
}
Expand Down

0 comments on commit 4cfa03a

Please sign in to comment.