20#include <learning/ANN.h>
21#include <learning/Distribution.h>
197 virtual void Reset();
int n_states
number of states
virtual void setPursuit(bool pursuit)
Use Pursuit for action selection.
int confSample(real *Qs, real *vQs)
Directly sample from action value distribution.
real ** vQ
variance estimate for Q
int softMax(real *Qs)
Softmax Gibbs sampling.
int argMax(real *Qs)
Get ID of maximum action.
real tdError
temporal difference error
real ** P
pursuit action probabilities
virtual void setQLearning()
Set the algorithm to QLearning mode.
virtual void setRandomness(real epsilon)
Set randomness for action selection. Does not affect confidence mode.
DiscretePolicy(int n_states, int n_actions, real alpha=0.1, real gamma=0.8, real lambda=0.8, bool softmax=false, real randomness=0.1, real init_eval=0.0)
Create a new discrete policy.
bool replacing_traces
Replacing instead of accumulating traces.
virtual void saveFile(char *f)
Save policy to a file.
int n_actions
number of actions
virtual void saveState(FILE *f)
Save the current evaluations in text format to a file.
virtual void setGamma(real gamma)
Set the gamma of the sum to be maximised.
virtual int SelectAction(int s, real r, int forced_a=-1)
Select an action a, given state s and reward from previous action.
virtual void loadFile(char *f)
Load policy from a file.
real zeta
Confidence smoothing.
virtual void useSoftmax(bool softmax)
Set action selection to softmax.
enum LearningMethod learning_method
learning method to use;
virtual real getLastActionValue()
Get the vale of the last action taken.
real expected_r
Expected reward.
virtual void Reset()
Use at the end of every episode, after agent has entered the absorbing state.
bool forced_learning
Force agent to take supplied action.
real * sample
sampling output
virtual void setForcedLearning(bool forced)
Set forced learning (force-feed actions)
int min_el_state
min state ID to search for eligibility
bool reliability_estimate
reliability estimates option
real lambda
Eligibility trace decay.
virtual void setReplacingTraces(bool replacing)
Use Pursuit for action selection.
virtual real getTDError()
Get the temporal difference error of the previous action.
real ** e
eligibility trace
int eGreedy(real *Qs)
e-greedy sampling
virtual void setSarsa()
Set the algorithm to SARSA mode.
virtual void setConfidenceDistribution(enum ConfidenceDistribution cd)
Set the distribution for direct action sampling.
bool confidence
Confidence estimates option.
bool pursuit
pursuit option
virtual bool useConfidenceEstimates(bool confidence, real zeta=0.01, bool confidence_eligibility=false)
Set to use confidence estimates for action selection, with variance smoothing zeta.
bool confidence_uses_gibbs
Additional gibbs sampling for confidence.
virtual ~DiscretePolicy()
Kill the agent and free everything.
real gamma
Future discount parameter.
real expected_V
Expected state return.
bool confidence_eligibility
Apply eligibility traces to confidence.
virtual void setLearningRate(real alpha)
Set the learning rate.
enum ConfidenceDistribution confidence_distribution
Distribution to use for confidence sampling.
virtual void useReliabilityEstimate(bool ri)
Use the reliability estimate method for action selection.
virtual void setELearning()
Set the algorithm to ELearning mode.
real ** Q
state-action evaluation
virtual void useGibbsConfidence(bool gibbs)
Add Gibbs sampling for confidences.
int confMax(real *Qs, real *vQs, real p=1.0)
Confidence-based Gibbs sampling.
int n_samples
number of samples for above expected r and V
int max_el_state
max state ID to search for eligibility
real * eval
evaluation of current aciton
ConfidenceDistribution
Types of confidence distributions.
LearningMethod
Types of learning methods.