10#ifndef STAMINA_BUILDER_THREADS_CONTROLTHREAD_H
11#define STAMINA_BUILDER_THREADS_CONTROLTHREAD_H
13#include "BaseThread.h"
15#include "storm/storage/BitVectorHashMap.h"
23 const uint8_t NO_THREAD = 0;
26 template <
typename StateType,
typename RewardModelType,
typename ValueType>
27 class ExplorationThread;
29 template <
typename StateType,
typename RewardModelType,
typename ValueType>
39 operator StateType()
const {
54 std::deque<typename StaminaModelBuilder<ValueType, RewardModelType, StateType>::TransitionInfo> queue;
55 std::shared_mutex lock;
68 , uint8_t numberExplorationThreads
87 std::pair<uint8_t, StateType>
requestOwnership(CompressedState & state, uint8_t threadIndex, StateType requestedId = 0);
96 uint8_t
whoOwns(CompressedState & state);
147 storm::storage::sparse::StateStorage<StateAndThreadIndex>& getStateStorage();
150 std::vector<LockableDeque> transitionQueues;
151 std::shared_mutex ownershipMutex;
152 const uint8_t numberExplorationThreads;
153 storm::storage::sparse::StateStorage<uint8_t>& stateThreadMap;
154 const std::vector<ExplorationThread<StateType, RewardModelType, ValueType>> explorationThreads;
Definition: BaseThread.h:28
Definition: ControlThread.h:43
void emplace_back(StateType from, StateType to, double rate)
Definition: ControlThread.h:30
StateType whatIsIndex(CompressedState &state)
Definition: ControlThread.cpp:60
virtual void mainLoop() override
Definition: ControlThread.cpp:90
ControlThread(StaminaModelBuilder< ValueType, RewardModelType, StateType > *parent, uint8_t numberExplorationThreads)
Definition: ControlThread.cpp:8
void requestCrossExplorationFromThread(StateAndProbability stateAndProbability, double threadIndex)
Definition: ControlThread.cpp:81
std::pair< uint8_t, StateType > requestOwnership(CompressedState &state, uint8_t threadIndex, StateType requestedId=0)
Definition: ControlThread.cpp:19
void requestInsertTransition(uint8_t thread, StateType from, StateType to, double rate)
Definition: ControlThread.cpp:70
uint8_t whoOwns(CompressedState &state)
Definition: ControlThread.cpp:50
Definition: ExplicitTruncatedModelBuilder.cpp:40
Definition: ControlThread.h:32
Definition: ExplorationThread.h:25