SARSA class

SARSA (on-policy TD control) with optional schedules and helpers

Enhancements over the minimal SARSA:

  • decaying epsilon and alpha schedules
  • optional eligibility traces (lambda) for SARSA(lambda)
  • helpers: bestAction, maxQ, reset, clone
  • serialization to/from Map/JSON

Constructors

SARSA({required int nStates, required int nActions, double alpha = 0.1, double gamma = 0.99, double epsilon = 0.1, int? seed, double? epsilonMin, double? epsilonDecay, double? alphaMin, double? alphaDecay, double lambda = 0.0})

Properties

alpha double
getter/setter pair
alphaDecay double?
final
alphaMin double?
final
epsilon double
getter/setter pair
epsilonDecay double?
final
epsilonMin double?
final
gamma double
final
hashCode int
The hash code for this object.
no setterinherited
lambda double
final
nActions int
final
nStates int
final
qTable List<List<double>>
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

bestAction(int state) int
chooseAction(int state) int
clone() SARSA
maxQ(int state) double
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset({double defaultValue = 0.0}) → void
toJson() String
toMap() Map<String, dynamic>
toString() String
A string representation of this object.
inherited
update(int state, int action, double reward, int nextState, int nextAction) → void

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

fromJson(String s, {int? seed}) SARSA
fromMap(Map<String, dynamic> m, {int? seed}) SARSA