A reinforcement learning system. */
| 14 | |
| 15 | /** A reinforcement learning system. */ |
| 16 | class Learner { |
| 17 | public: |
| 18 | /** |
| 19 | * \brief Gets the action that the network deems most beneficial for the currentState |
| 20 | * |
| 21 | * \param currentState the state for which to choose the action |
| 22 | */ |
| 23 | virtual Action chooseBestAction(State currentState) = 0; |
| 24 | |
| 25 | /** |
| 26 | * \brief Gets an action using the Boltzman softmax probability distribution |
| 27 | * |
| 28 | * A non-random search heuristic is used such that the neural network explores actions despite their reward value. |
| 29 | * The lower the exploration constant, the more likely it is to pick the best action for the current state. |
| 30 | * |
| 31 | * \param currentState the state for which to choose the action |
| 32 | * \param explorationConstant the Boltzmann temperature constant, determining "exploration" |
| 33 | */ |
| 34 | virtual Action chooseBoltzmanAction(State currentState, double explorationConstant) = 0; |
| 35 | |
| 36 | /** |
| 37 | * \brief Apply reinforcement to the last action |
| 38 | * |
| 39 | * Given the immediate reward from the last action taken and the new state, |
| 40 | * this function updates the correct value for the longterm reward of the lastAction and trains the network in charge of the lastAction to output the correct reward value |
| 41 | * |
| 42 | * \param reward the reward given for the last action taken |
| 43 | * \param newState the new state |
| 44 | */ |
| 45 | virtual void applyReinforcementToLastAction(double reward, State newState) = 0; |
| 46 | |
| 47 | /** Randomizes the leaner. */ |
| 48 | virtual void reset() = 0; |
| 49 | }; |
| 50 | }; |
| 51 | |
| 52 | #endif |
nothing calls this directly
no outgoing calls
no test coverage detected