{"id":17383818,"url":"https://github.com/numblr/drlnd-cocontrol","last_synced_at":"2026-01-07T16:02:01.918Z","repository":{"id":79291318,"uuid":"173271968","full_name":"numblr/drlnd-cocontrol","owner":"numblr","description":"RL with continuous action space","archived":false,"fork":false,"pushed_at":"2019-03-07T06:41:24.000Z","size":9082,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T23:36:11.590Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/numblr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-01T09:17:41.000Z","updated_at":"2019-03-07T06:41:26.000Z","dependencies_parsed_at":"2023-05-25T04:45:42.187Z","dependency_job_id":null,"html_url":"https://github.com/numblr/drlnd-cocontrol","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numblr%2Fdrlnd-cocontrol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numblr%2Fdrlnd-cocontrol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numblr%2Fdrlnd-cocontrol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numblr%2Fdrlnd-cocontrol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/numblr","download_url":"https://codeload.github.com/numblr/drlnd-cocontrol/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245924515,"owners_count":20694730,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-16T07:43:54.177Z","updated_at":"2026-01-07T16:01:56.862Z","avatar_url":"https://github.com/numblr.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Continuous Control in Reinforcement Learning\n\nThis repository is based on the continuous control problem studied in the Deep Reinforcement Learning Nanodegree program and demonstrates a variant of the PPO  algorithm in an environment with a continuous action space.\n\n### General Settings (see also the original [repo](https://github.com/udacity/deep-reinforcement-learning/tree/master/p2_continuous-control))\n\nIn this project we use the [Reacher](https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Learning-Environment-Examples.md#reacher) environment.\n\n![Trained Agent](resources/small_agent.gif)\n\nIn this environment, a double-jointed arm can move to target locations. A reward of +0.1 is provided for each step that the agent's hand is in the goal location. Thus, the goal of your agent is to maintain its position at the target location for as many time steps as possible.\n\nThe observation space consists of 33 variables corresponding to position, rotation, velocity, and angular velocities of the arm. Each action is a vector with four numbers, corresponding to torque applicable to two joints. Every entry in the action vector should be a number between -1 and 1.\n\n### Distributed Training\n\nThe environment is implemented as a predefined [*Unity* environment](https://github.com/Unity-Technologies/ml-agents), and two two separate versions of this environment are available:\n- The first version contains a single agent.\n- The second version contains 20 identical agents, each with its own copy of the environment.  \n\nYou can use the code in this repository with both versions. The presented results are obtained with the second version though.\n\n### Solving the Environment\n\nThe environment is considered solved if the  agents achieve an average score of +30 (over 100 consecutive episodes, and over all agents).  Specifically,\n- After each episode, we add up the rewards that each agent received (without discounting), to get a score for each agent.  This yields 20 (potentially different) scores.  We then take the average of these 20 scores.\n- This yields an **average score** for each episode (where the average is over all 20 agents).\n\nThe environment is considered solved, when the average (over 100 episodes) of those average scores is at least +30.\n\n### Getting started (see also the original [repo](https://github.com/udacity/deep-reinforcement-learning/tree/master/p2_continuous-control))\n\nTo set up your python environment to run the code in this repository, follow this steps:\n\n1. Create (and activate) a new environment with Python 3.6.\n\n\t- __Linux__ or __Mac__:\n\t```bash\n\tconda create --name cocontrol python=3.6\n\tsource activate cocontrol\n\t```\n\t- __Windows__:\n\t```bash\n\tconda create --name cocontrol python=3.6\n\tactivate cocontrol\n\t```\n\n3. Then install the dependencies from the requirements.txt file in this repository:\n```bash\npip install requirements.txt\n```\n\n4. Download the *Unity* environment from one of the links below. You must select **only** the environment that matches your operating system:\n  - **_Version 1: One (1) Agent_**\n      - Linux: [click here](https://s3-us-west-1.amazonaws.com/udacity-drlnd/P2/Reacher/one_agent/Reacher_Linux.zip)\n      - Mac OSX: [click here](https://s3-us-west-1.amazonaws.com/udacity-drlnd/P2/Reacher/one_agent/Reacher.app.zip)\n      - Windows (32-bit): [click here](https://s3-us-west-1.amazonaws.com/udacity-drlnd/P2/Reacher/one_agent/Reacher_Windows_x86.zip)\n      - Windows (64-bit): [click here](https://s3-us-west-1.amazonaws.com/udacity-drlnd/P2/Reacher/one_agent/Reacher_Windows_x86_64.zip)\n\n  - **_Version 2: Twenty (20) Agents_**\n      - Linux: [click here](https://s3-us-west-1.amazonaws.com/udacity-drlnd/P2/Reacher/Reacher_Linux.zip)\n      - Mac OSX: [click here](https://s3-us-west-1.amazonaws.com/udacity-drlnd/P2/Reacher/Reacher.app.zip)\n      - Windows (32-bit): [click here](https://s3-us-west-1.amazonaws.com/udacity-drlnd/P2/Reacher/Reacher_Windows_x86.zip)\n      - Windows (64-bit): [click here](https://s3-us-west-1.amazonaws.com/udacity-drlnd/P2/Reacher/Reacher_Windows_x86_64.zip)\n\n(_For Windows users_) Check out [this link](https://support.microsoft.com/en-us/help/827218/how-to-determine-whether-a-computer-is-running-a-32-bit-version-or-64) if you need help with determining if your computer is running a 32-bit version or 64-bit version of the Windows operating system.\n\n(_For AWS_) If you'd like to train the agent on AWS (and have not [enabled a virtual screen](https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Training-on-Amazon-Web-Service.md)), then please use [this link](https://s3-us-west-1.amazonaws.com/udacity-drlnd/P2/Reacher/one_agent/Reacher_Linux_NoVis.zip) (version 1) or [this link](https://s3-us-west-1.amazonaws.com/udacity-drlnd/P2/Reacher/Reacher_Linux_NoVis.zip) (version 2) to obtain the \"headless\" version of the environment.  You will **not** be able to watch the agent without enabling a virtual screen, but you will be able to train the agent.  (_To watch the agent, you should follow the instructions to [enable a virtual screen](https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Training-on-Amazon-Web-Service.md), and then download the environment for the **Linux** operating system above._)\n\n5. Place and unzip the downloaded file into one of the following locations corresponding to your operating system:\n  - **Mac**: `\"cocontrol/resources/Reacher.app\"`\n  - **Windows** (x86): `\"cocontrol/resources/Reacher_Windows_x86/Reacher.exe\"`\n  - **Windows** (x86_64): `\"cocontrol/resources/Reacher_Windows_x86_64/Reacher.exe\"`\n  - **Linux** (x86): `\"cocontrol/resources/Reacher_Linux/Reacher.x86\"`\n  - **Linux** (x86_64): `\"cocontrol/resources/Reacher_Linux/Reacher.x86_64\"`\n  - **Linux** (x86, headless): `\"cocontrol/resources/Reacher_Linux_NoVis/Reacher.x86\"`\n  - **Linux** (x86_64, headless): `\"cocontrol/resources/Reacher_Linux_NoVis/Reacher.x86_64\"`\n\nIt is important that the *cocontrol/resources* folder **_only contains the agent for your operating system_**!\n\n6. To be able to run the `Continuous_Control.ipynb` notebook, create an [IPython kernel](http://ipython.readthedocs.io/en/stable/install/kernel_install.html) for the `cocontrol` environment.  \n```bash\npython -m ipykernel install --user --name cocontrol --display-name \"cocontrol\"\n```\n\n7. Before running code in the notebook, change the kernel to match the `cocontrol` environment by using the drop-down `Kernel` menu.\n\n### Instructions\n\nThe main script in the repository is `cocontrol.py`, which can be invoked to train the agent and store the result, as well as to replay the agent on a single episode from the stored learning results.\n\nAfter all dependencies are set up as described in the [Getting started](#getting-started) section, the script can be invoked from the root directory of the repository as e.g.\n```bash\n\u003e python cocontrol.py --dummy\n```\nto show the untrained agent on a single episode,\n```bash\n\u003e python cocontrol.py --epochs 20\n```\nto execute learning on 20 epochs,\n```bash\n\u003e python cocontrol.py --show\n```\nto replay the trained agent on a single episode and\n```bash\n\u003e python cocontrol.py --replay\n```\nto run the trained agent on 100 episodes and print the obtained average score.\n\nWhen invoked without command line parameters, the script will execute learning on 16 epochs. For help on the possible command line options execute the script with the --help option.\n\n### Results\n\nThe parameters of the trained models can be found in the *actor_parameters.pt* and *critic_parameters.pt* files. The scores obtained during training are plotted in the *scores.png* file.\n\nThe included results are obtained using 20 parallel agents and achieve the target of an average score of +30 over 100 episodes in 128 episodes (per agent). They reach the target score of +30 in a single episode after 56 episodes and reach a top episode score close to 39 after.\n\n![Scores](scores.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumblr%2Fdrlnd-cocontrol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnumblr%2Fdrlnd-cocontrol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumblr%2Fdrlnd-cocontrol/lists"}