浏览代码

Updating getting-started notebook.

/develop-generalizationTraining-TrainerController
Deric Pang 6 年前
当前提交
d663c34f
共有 1 个文件被更改,包括 8 次插入11 次删除
  1. 19
      notebooks/getting-started.ipynb

19
notebooks/getting-started.ipynb


"source": [
"### 1. Set environment parameters\n",
"\n",
"Be sure to set `env_name` to the name of the Unity environment file you want to launch. Ensure that the environment build is in the `python/` directory."
"Be sure to set `env_name` to the name of the Unity environment file you want to launch. Ensure that the environment build is in the ML-Agents SDK directory."
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"env_name = \"../envs/3DBall\" # Name of the Unity environment binary to launch\n",

" done = False\n",
" episode_rewards = 0\n",
" while not done:\n",
" action_size = brain.vector_action_space_size\n",
" brain.vector_action_space_size))[default_brain]\n",
" action_size[0]))[default_brain]\n",
" env_info = env.step(np.random.randint(0, brain.vector_action_space_size, \n",
" size=(len(env_info.agents))))[default_brain]\n",
" action = np.column_stack([np.random.randint(0, action_size[i], size=(len(env_info.agents))) for i in range(len(action_size))])\n",
" env_info = env.step(action)[default_brain]\n",
" episode_rewards += env_info.rewards[0]\n",
" done = env_info.local_done[0]\n",
" print(\"Total reward this episode: {}\".format(episode_rewards))"

{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"env.close()"

"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.2"
"version": "3.6.6"
}
},
"nbformat": 4,
正在加载...
取消
保存