From 17a1ecfb66a1c1e8b26a5f8a70bd515a5d4d68d3 Mon Sep 17 00:00:00 2001 From: wassname Date: Tue, 15 Jan 2019 08:20:23 +0800 Subject: [PATCH] faster control --- src/js/config.js | 16 +++++----------- src/js/game.js | 8 ++++---- src/js/walker.js | 19 ++++++++++--------- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/src/js/config.js b/src/js/config.js index 104b333..f510569 100644 --- a/src/js/config.js +++ b/src/js/config.js @@ -1,17 +1,11 @@ module.exports = { - time_step: 60, - simulation_fps: 60, - draw_fps: 30, - velocity_iterations: 8, - position_iterations: 3, + time_step: 120, + draw_fps: 60, + velocity_iterations: 10, + position_iterations: 6, max_zoom_factor: 130, - min_motor_speed: -2, - max_motor_speed: 2, population_size: 1, walker_health: 100, max_floor_tiles: 50, - round_length: 1000, - min_body_delta: 0, - min_leg_delta: 0, - action_repeat: 4 + action_repeat: 1 }; diff --git a/src/js/game.js b/src/js/game.js index 832fcce..faeb523 100644 --- a/src/js/game.js +++ b/src/js/game.js @@ -68,16 +68,16 @@ class HeadlessGame { nbActions, resetEpisode: true, batchSize: 8*1024, - actorLr: 0.0001/4, + actorLr: 0.0001, criticLr: 0.001, memorySize: 10000, gamma: 0.99, - desiredActionStddev: 0.05, + desiredActionStddev: 0.4, minActionStddev: 0.0001, - initialStddev: 0.2, + initialStddev: 0.8, adoptionCoefficient: 1.01, - noiseDecay: 0.96, + noiseDecay: 0.94, actorFirstLayerSize: 128, actorSecondLayerSize: 64, diff --git a/src/js/walker.js b/src/js/walker.js index c5d1f7c..9788263 100644 --- a/src/js/walker.js +++ b/src/js/walker.js @@ -10,8 +10,8 @@ const { Renderer } = require('./renderer') -const STRENGTH = 2.2 -const SPEED = 15 +const STRENGTH = 2.6 +const SPEED = 30 class Walker { constructor(world, floor, config) { @@ -632,15 +632,16 @@ class Walker { // reward for moving right var position = this.torso.upper_torso.GetPosition().x if (this.last_position === undefined) this.last_position = position - var velocity = (position - this.last_position) * 100 + var velocity = (position - this.last_position) * 300 this.last_position = position var lin_vel_reward = 2 * velocity // punish for using energy, squared - var quad_power_cost = -0.05 * this.joints.map(j => j.GetJointSpeed()).reduce((sum, speed) => sum + speed ** 2) - quad_power_cost = Math.max(quad_power_cost, -10) + var quad_power_cost = -0.1 * this.joints.map(j => j.GetJointSpeed()).reduce((sum, speed) => sum + speed ** 2) + quad_power_cost = Math.max(quad_power_cost, -30) - // Lets be nice, all entities should find overall happiness in what they do + // Lets be nice, all entities should find + // overall happiness in what they do? var bonus_happiness = 40 var contacts = this.bodies.map(b => b.GetContactList()).filter(b => b).length @@ -648,10 +649,10 @@ class Walker { this.rewards = { lin_vel_reward, - quad_power_cost, - quad_contact_cost, + // quad_power_cost, + // quad_contact_cost, quad_joint_angle_cost, - bonus_happiness, + // bonus_happiness, head_height_reward, // leg_switch_reward }