38#ifndef PARALLEL_LEARNING_AGENT
39#define PARALLEL_LEARNING_AGENT
45#include "instructions/set.h"
46#include "tpg/tpgExecutionEngine.h"
48#include "learn/evaluationResult.h"
50#include "learn/learningAgent.h"
51#include "learn/learningEnvironment.h"
52#include "learn/learningParameters.h"
84 std::multimap<std::shared_ptr<EvaluationResult>,
103 std::map<uint64_t, std::pair<std::shared_ptr<EvaluationResult>,
104 std::shared_ptr<Job>>>&
106 std::map<uint64_t, Archive*>& archiveMap);
124 std::map<uint64_t, std::pair<std::shared_ptr<EvaluationResult>,
125 std::shared_ptr<Job>>>&
127 std::multimap<std::shared_ptr<EvaluationResult>,
129 std::map<uint64_t, Archive*>& archiveMap);
158 std::queue<std::shared_ptr<Learn::Job>>& jobsToProcess,
159 std::mutex& rootsToProcessMutex,
160 std::map<uint64_t, std::pair<std::shared_ptr<EvaluationResult>,
161 std::shared_ptr<Job>>>&
163 std::mutex& resultsPerRootMapMutex,
164 std::map<uint64_t, Archive*>& archiveMap,
165 std::mutex& archiveMapMutex,
bool useMainEnvironment);
221 std::multimap<std::shared_ptr<EvaluationResult>,
const TPG::TPGVertex*>
Class for storing a set of Instruction.
Definition set.h:55
Class used to control the learning steps of a TPGGraph within a given LearningEnvironment.
Definition learningAgent.h:67
uint64_t maxNbThreads
Control the maximum number of threads when running in parallel.
Definition learningAgent.h:91
Interface for creating a Learning Environment.
Definition learningEnvironment.h:81
Class used to control the learning steps of a TPGGraph within a given LearningEnvironment,...
Definition parallelLearningAgent.h:66
void slaveEvalJobThread(uint64_t generationNumber, LearningMode mode, std::queue< std::shared_ptr< Learn::Job > > &jobsToProcess, std::mutex &rootsToProcessMutex, std::map< uint64_t, std::pair< std::shared_ptr< EvaluationResult >, std::shared_ptr< Job > > > &resultsPerRootMap, std::mutex &resultsPerRootMapMutex, std::map< uint64_t, Archive * > &archiveMap, std::mutex &archiveMapMutex, bool useMainEnvironment)
Function implementing the behavior of slave threads during parallel evaluation of roots.
Definition parallelLearningAgent.cpp:88
virtual void evaluateAllRootsInParallelExecute(uint64_t generationNumber, LearningMode mode, std::map< uint64_t, std::pair< std::shared_ptr< EvaluationResult >, std::shared_ptr< Job > > > &resultsPerJobMap, std::map< uint64_t, Archive * > &archiveMap)
Subfunction of evaluateAllRootsInParallel which handles the creation of threads, their execution and ...
Definition parallelLearningAgent.cpp:243
virtual void evaluateAllRootsInParallelCompileResults(std::map< uint64_t, std::pair< std::shared_ptr< EvaluationResult >, std::shared_ptr< Job > > > &resultsPerJobMap, std::multimap< std::shared_ptr< EvaluationResult >, const TPG::TPGVertex * > &results, std::map< uint64_t, Archive * > &archiveMap)
Subfunction of evaluateAllRootsInParallel which handles the gathering of results and the merge of the...
Definition parallelLearningAgent.cpp:281
std::multimap< std::shared_ptr< EvaluationResult >, const TPG::TPGVertex * > evaluateAllRoots(uint64_t generationNumber, LearningMode mode) override
Evaluate all root TPGVertex of the TPGGraph.
Definition parallelLearningAgent.cpp:53
virtual void evaluateAllRootsInParallel(uint64_t generationNumber, LearningMode mode, std::multimap< std::shared_ptr< EvaluationResult >, const TPG::TPGVertex * > &results)
Method for evaluating all roots with parallelism.
Definition parallelLearningAgent.cpp:225
void mergeArchiveMap(std::map< uint64_t, Archive * > &archiveMap)
Method to merge several Archive created in parallel threads.
Definition parallelLearningAgent.cpp:175
ParallelLearningAgent(LearningEnvironment &le, const Instructions::Set &iSet, const LearningParameters &p, const TPG::TPGFactory &factory=TPG::TPGFactory())
Constructor for ParallelLearningAgent.
Definition parallelLearningAgent.h:193
Factory for creating all elements constituting a TPG.
Definition tpgFactory.h:71
Abstract class representing the vertices of a TPGGraph.
Definition tpgVertex.h:55
Definition classificationLearningEnvironment.h:44
LearningMode
Different modes in which the LearningEnvironment can be reset.
Definition learningEnvironment.h:59
Structure for simplifying the transmission of LearningParameters to functions.
Definition learningParameters.h:55
size_t nbThreads
Number of threads (ParallelLearningAgent only)
Definition learningParameters.h:163