Skip to content

Commit

Permalink
Fix for logic of BaseMetricsStrategy
Browse files Browse the repository at this point in the history
  • Loading branch information
Smoren committed Nov 14, 2024
1 parent 3d3d743 commit 55a0837
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "genetic-search",
"version": "4.2.1",
"version": "4.2.2",
"description": "Multiprocessing genetic algorithm implementation library",
"license": "MIT",
"repository": {
Expand Down
3 changes: 3 additions & 0 deletions src/strategies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ export abstract class BaseMetricsStrategy<

for (const [genome, result] of zip(genomesToRun, newResults)) {
cache.set(genome.id, result);
}

for (const [genome, result] of zip(genomesToRun, newResults)) {
resultsMap.set(genome.id, cache.get(genome.id, result));
}

Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export interface CrossoverStrategyInterface<TGenome extends BaseGenome> {
}

export interface MetricsStrategyInterface<TGenome extends BaseGenome> {
// TODO rename method
run(population: Population<TGenome>, cache: MetricsCacheInterface): Promise<GenerationMetricsMatrix>;
}

Expand Down

0 comments on commit 55a0837

Please sign in to comment.