SARSA constructor
SARSA({})
Implementation
SARSA({
required this.nStates,
required this.nActions,
this.alpha = 0.1,
this.gamma = 0.99,
this.epsilon = 0.1,
int? seed,
this.epsilonMin,
this.epsilonDecay,
this.alphaMin,
this.alphaDecay,
this.lambda = 0.0,
}) : _rand = seed != null ? Random(seed) : Random() {
if (nStates <= 0 || nActions <= 0) {
throw ArgumentError('nStates and nActions must be > 0');
}
qTable = List.generate(nStates, (_) => List<double>.filled(nActions, 0.0));
if (lambda > 0.0) {
_eTrace = List.generate(
nStates,
(_) => List<double>.filled(nActions, 0.0),
);
}
}