GALib-Parallel
Header-only C++ library for parallel evolutionary algorithms
Loading...
Searching...
No Matches
MigrationBuffer.h
Go to the documentation of this file.
1#ifndef MIGRATION_BUFFER_H
2#define MIGRATION_BUFFER_H
3
4#pragma once
5
6#include "core/Individual.h"
7#include <vector>
8
9namespace galib::internal {
18 template <typename GeneType>
20 public:
21 virtual ~MigrationBuffer() = default;
22
27 virtual void push(std::vector<Individual<GeneType>>&& incoming_deme_batch) = 0;
28
33 virtual void popAll(std::vector<Individual<GeneType>>& target) = 0;
34
39 [[nodiscard]] virtual bool hasMigrants() const = 0;
40 };
41}
42
43#endif // MIGRATION_BUFFER_H
Represents a single candidate solution in the population.
Definition Individual.h:23
Interface for a thread-safe buffer that stores incoming migrants.
virtual void push(std::vector< Individual< GeneType > > &&incoming_deme_batch)=0
Adds a batch of individuals to the buffer.
virtual bool hasMigrants() const =0
Checks if there are any migrants waiting in the buffer.
virtual ~MigrationBuffer()=default
virtual void popAll(std::vector< Individual< GeneType > > &target)=0
Retrieves and removes all currently stored migrants.