浏览代码

test new sampling method

/test-sampler
Andrew Cohen 5 年前
当前提交
a0dc8789
共有 2 个文件被更改,包括 70 次插入2 次删除
  1. 22
      Project/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DAgent.cs
  2. 50
      config/ppo/3DBall_randomize_exp.yaml

22
Project/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DAgent.cs


public GameObject ball;
Rigidbody m_BallRb;
EnvironmentParameters m_ResetParams;
float m_MinMass;
float m_MaxMass;
float m_MinScale;
float m_MaxScale;
m_MinMass = m_ResetParams.GetWithDefault("min_mass", -1.0f);
m_MaxMass = m_ResetParams.GetWithDefault("max_mass", -1.0f);
m_MinScale = m_ResetParams.GetWithDefault("min_scale", -1.0f);
m_MaxScale = m_ResetParams.GetWithDefault("max_scale", -1.0f);
SetResetParameters();
}

public void SetBall()
{
//Set the attributes of the ball by fetching the information from the academy
m_BallRb.mass = m_ResetParams.GetWithDefault("mass", 1.0f);
var scale = m_ResetParams.GetWithDefault("scale", 1.0f);
var scale = 0f;
if (m_MinMass > 0f)
{
m_BallRb.mass = Random.Range(m_MinMass, m_MaxMass);
scale = Random.Range(m_MinScale, m_MaxScale);
}
else
{
m_BallRb.mass = m_ResetParams.GetWithDefault("mass", 1.0f);
scale = m_ResetParams.GetWithDefault("scale", 1.0f);
}
ball.transform.localScale = new Vector3(scale, scale, scale);
}

50
config/ppo/3DBall_randomize_exp.yaml


behaviors:
3DBall:
trainer_type: ppo
hyperparameters:
batch_size: 64
buffer_size: 12000
learning_rate: 0.0003
beta: 0.001
epsilon: 0.2
lambd: 0.99
num_epoch: 3
learning_rate_schedule: linear
network_settings:
normalize: true
hidden_units: 128
num_layers: 2
vis_encode_type: simple
reward_signals:
extrinsic:
gamma: 0.99
strength: 1.0
output_path: default
keep_checkpoints: 5
max_steps: 500000
time_horizon: 1000
summary_freq: 12000
threaded: true
parameter_randomization:
resampling-interval: 5000000
min_mass:
sampler-type: uniform
min_value: 0.5
max_value: 0.5
max_mass:
sampler-type: uniform
min_value: 10
max_value: 10
min_scale:
sampler-type: uniform
min_value: 0.75
max_value: 0.75
max_scale:
sampler-type: uniform
min_value: 3
max_value: 3
gravity:
sampler-type: uniform
min_value: 7
max_value: 12
正在加载...
取消
保存