Skip to content

Commit

Permalink
Minor changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Smoren committed May 31, 2024
1 parent 214903c commit 61d2108
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/lib/genetic/genetic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {
StrategyConfig,
GeneticSearchInterface,
GenerationCallback,
GenerationResult,
Genome,
Population,
} from '../types/genetic';
Expand Down Expand Up @@ -33,7 +34,7 @@ export class GeneticSearch implements GeneticSearchInterface {
}
}

public async runGenerationStep(): Promise<[number[], number[]]> {
public async runGenerationStep(): Promise<GenerationResult> {
const [countToSurvive, countToCross, countToClone] = this.getSizes();

const results = await this.strategy.runner.run(this.population);
Expand Down Expand Up @@ -172,7 +173,7 @@ export class ComposedGeneticSearch implements GeneticSearchInterface {
}
}

public async runGenerationStep(): Promise<[number[], number[]]> {
public async runGenerationStep(): Promise<GenerationResult> {
for (const eliminators of this.eliminators) {
await eliminators.runGenerationStep();
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/types/genetic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export type GenerationCallback = (generation: number, result: GenerationResult)

export interface GeneticSearchInterface {
run(generationsCount: number, afterStep: GenerationCallback): Promise<void>;
runGenerationStep(): Promise<[number[], number[]]>;
runGenerationStep(): Promise<GenerationResult>;
getBestGenome(): Genome;
getPopulation(): Population;
setPopulation(population: Population): void;
Expand Down

0 comments on commit 61d2108

Please sign in to comment.