mirror of
https://github.com/wassname/rl_2d_walker.js.git
synced 2026-09-09 11:33:20 +08:00
tweak
This commit is contained in:
+6
-7
@@ -10,9 +10,9 @@ function Agent(opt, world) {
|
||||
this.infos = []
|
||||
this.maxInfos = 2000
|
||||
|
||||
this.steps = 0
|
||||
this.timer = 0
|
||||
this.timerFrequency = 60 / this.frequency
|
||||
this.resetFrequency = 30 / this.frequency
|
||||
|
||||
if (this.options.dynamicallyLoaded !== true) {
|
||||
this.init(world.brains.actor.newConfiguration(), null)
|
||||
@@ -39,19 +39,16 @@ Agent.prototype.init = function (actor, critic) {
|
||||
|
||||
temporalWindow: temporal,
|
||||
|
||||
discount: 0.97,
|
||||
rate: 0.002,
|
||||
discount: 0.97, // time discount
|
||||
rate: 0.001, // learning rate,
|
||||
theta: 0.05, // progressive copy
|
||||
alpha: 0.1, // advantage learning
|
||||
|
||||
experience: 75e3,
|
||||
// buffer: window.neurojs.Buffers.UniformReplayBuffer,
|
||||
experience: 3e3,
|
||||
|
||||
learningPerTick: 40,
|
||||
startLearningAt: 900,
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
// this.world.brains.shared.add('actor', this.brain.algorithm.actor)
|
||||
@@ -69,6 +66,7 @@ Agent.prototype.step = function () {
|
||||
this.timer++
|
||||
|
||||
if (this.timer % this.timerFrequency === 0) {
|
||||
this.steps++
|
||||
var [state, reward, done, info] = this.walker.simulationStep()
|
||||
|
||||
if (done) {
|
||||
@@ -80,6 +78,7 @@ Agent.prototype.step = function () {
|
||||
// train
|
||||
info.loss = this.brain.learn(reward)
|
||||
this.action = this.brain.policy(state)
|
||||
info.x = this.steps
|
||||
this.infos.push(info)
|
||||
}
|
||||
if (this.action) {
|
||||
|
||||
Reference in New Issue
Block a user