|
typedef ExplorationThread< StateType, RewardModelType, ValueType >::StateAndProbability | StateAndProbability |
|
|
| ControlThread (StaminaModelBuilder< ValueType, RewardModelType, StateType > *parent, uint8_t numberExplorationThreads) |
|
std::pair< uint8_t, StateType > | requestOwnership (CompressedState &state, uint8_t threadIndex, StateType requestedId=0) |
|
uint8_t | whoOwns (CompressedState &state) |
|
StateType | whatIsIndex (CompressedState &state) |
|
void | requestInsertTransition (uint8_t thread, StateType from, StateType to, double rate) |
|
void | requestCrossExplorationFromThread (StateAndProbability stateAndProbability, double threadIndex) |
|
virtual void | mainLoop () override |
|
storm::storage::sparse::StateStorage< StateAndThreadIndex > & | getStateStorage () |
|
void | terminate () |
|
| BaseThread (StaminaModelBuilder< ValueType, RewardModelType, StateType > *parent) |
|
virtual void | mainLoop ()=0 |
|
void | startThread () |
|
const StaminaModelBuilder< ValueType, RewardModelType, StateType > * | getParent () |
|
void | join () |
|
void | terminate () |
|
◆ ControlThread()
template<typename StateType , typename RewardModelType , typename ValueType >
Constructor for ControlThread. Primarily just calls super class constructor
- Parameters
-
parent | The model builder who owns this thread |
numberExplorationThreads | The number of exploration threads who will be using this worker thread. |
◆ mainLoop()
template<typename StateType , typename RewardModelType , typename ValueType >
This thread lives for the duration of all exploration threads. It waits for the exploration threads to all emit a "finished" signal, and then tells each exploration thread to die.
The main loop for this thread also flushes things to the parents' transitionsToAdd, which is not locked or mutex'ed because there is only one worker thread to do that.
Implements stamina::builder::threads::BaseThread< StateType, RewardModelType, ValueType >.
◆ requestCrossExplorationFromThread()
template<typename StateType , typename RewardModelType , typename ValueType >
Requests cross exploration from a
- Parameters
-
stateAndProbability | A datastructure containing: state The state to cross explore deltaPi The difference in probability to add stateIndex The state index we found |
threadIndex | Thread index to request cross exploration from |
◆ requestInsertTransition()
template<typename StateType , typename RewardModelType , typename ValueType >
Requests a transition to be inserted (not necessarily in order). These transitions are requested by the exploration threads and are flushed to the model builder's data structure on a "when available" basis, meaning that when this thread idles, it transfers these transitions. Additionally, it maintains mutexes for each thread and only locks the mutex for that particular thread to prevent mutex collisions on the different threads requesting transition insertion.
- Parameters
-
thread | The index of the thread making the request |
from | The index of the state we are transitioning from |
to | The index of the state we are transitioning to |
rate | The transition rate (if CTMC) or transition probability (if DTMC) |
◆ requestOwnership()
template<typename StateType , typename RewardModelType , typename ValueType >
std::pair< uint8_t, StateType > stamina::builder::threads::ControlThread< StateType, RewardModelType, ValueType >::requestOwnership |
( |
CompressedState & |
state, |
|
|
uint8_t |
threadIndex, |
|
|
StateType |
requestedId = 0 |
|
) |
| |
Requests ownership of a state for a particular thread. This is intended to be called by the thread whose index matches the second parameter in this function. This function locks the mutex and so it should not be used if we just wish to ask who owns a particular state.
If request ownership is successful, the return value is equal to the index of the state requesting ownership of the state. However, if it is not successful, then the return value gives the thread which potentially locked the mutex and got ownership first.
- Parameters
-
state | The state to request ownership for |
threadIndex | The thread who wants ownership of the state. |
requestedId | The (new) stateId that a thread can request we assign a state to |
- Returns
- The thread who owns the state and the new state index
◆ whatIsIndex()
template<typename StateType , typename RewardModelType , typename ValueType >
Gets the index of a state which already exists. If the state does not exist, returns 0.
- Parameters
-
state | The state to look up |
- Returns
- The state index
◆ whoOwns()
template<typename StateType , typename RewardModelType , typename ValueType >
Gets the owning thread of a particular state without locking the mutex. This allows for threads to use the many-read, one-write idea put forth in the paper.
- Parameters
-
state | The state who we wonder if owns |
- Returns
- The thread who owns
state
The documentation for this class was generated from the following files:
- /home/josh/Documents/Work/stamina-cplusplus/src/stamina/builder/threads/ControlThread.h
- /home/josh/Documents/Work/stamina-cplusplus/src/stamina/builder/threads/ControlThread.cpp