{"id":20556117,"url":"https://github.com/antoinebrl/rl-mars-lander","last_synced_at":"2025-10-04T13:29:59.076Z","repository":{"id":79447089,"uuid":"436770975","full_name":"antoinebrl/rl-mars-lander","owner":"antoinebrl","description":"Using reinforcement learning to minimize fuel consuption when landing a rover on Mars","archived":false,"fork":false,"pushed_at":"2022-03-21T10:22:38.000Z","size":5062,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T02:11:46.801Z","etag":null,"topics":["ai","codingame","machine-learning","ppo","reinforcement-learning","reinforcement-learning-environments","rl"],"latest_commit_sha":null,"homepage":"https://antoinebrl.github.io/blog/rl-mars-lander/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antoinebrl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-12-09T21:48:58.000Z","updated_at":"2025-03-05T02:47:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"8113c8da-3b15-4176-81c7-682d07295ca0","html_url":"https://github.com/antoinebrl/rl-mars-lander","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/antoinebrl%2Frl-mars-lander","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoinebrl%2Frl-mars-lander/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoinebrl%2Frl-mars-lander/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoinebrl%2Frl-mars-lander/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antoinebrl","download_url":"https://codeload.github.com/antoinebrl/rl-mars-lander/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248886314,"owners_count":21177643,"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":["ai","codingame","machine-learning","ppo","reinforcement-learning","reinforcement-learning-environments","rl"],"created_at":"2024-11-16T03:25:04.249Z","updated_at":"2025-10-04T13:29:54.025Z","avatar_url":"https://github.com/antoinebrl.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mars Lander with Reinforcement Learning\n\nEnvironment for landing a rover on Mars. \n\nhttps://user-images.githubusercontent.com/17803473/159241507-2fe92a89-91c3-4f3e-aa34-8d2da1f6e567.mov\n\nRead the game [instructions on CodinGame](https://www.codingame.com/multiplayer/optimization/mars-lander).\n\nA complete write-up of this project is available on my blog:\n[antoinebrl.github.io/blog/rl-mars-lander/](https://antoinebrl.github.io/blog/rl-mars-lander/)\n\n# Usage\n\n## Play the game yourself\n\nYou think the game is easy? Try it yourself!\n\n```shell\npython play.py\n```\n\nAt each step, the program is expected two values separated by a space:\n - the change in rotation as an integer between -15 and 15\n - the change in thrust can take value -1, 0 and 1\n\nA valid input would be `12 1`.\n\n## Visualize environment\n\nThe command below will open a graphical window. It might not work if you use\na remote device or an online notebook (Google Colab, etc). The agent will\ntake random action.\n\n```shell\nPYTHONPATH=$PYTHONPATH:$(pwd) python lander/environment.py\n```\n\n## Visualize a trained agent\n\nOnce you have trained an agent you can see how it behaves. \n\n```shell\npython enjoy.py logs/20220203-015918\n```\n\n## Export\n\nUse the command below to generate a self-contained code made of pure python and numpy.\nThis is key to submit a solution to CodinGame. The generated code will be placed under `exported/`.\n\n```shell\npython export.py logs/20220203-015918\n```\n\n# Training\n\nThis is the command used to launch a training:\n\n```shell\npython train.py -params n_steps:8192 max_grad_norm:0.2 ent_coef:0.0005 vf_coef:0.25 gamma:0.995 policy_kwargs:\"dict(log_std_init=-2, ortho_init=False, activation_fn=torch.nn.ReLU, net_arch=[dict(pi=[128, 128], vf=[128, 128])])\" learning_rate:0.000005 use_sde:1 sde_sample_freq:4 --steps 100000000 --output logs\n```\n\n# Contributing\n\n- Coding style:\n    ```shell\n    pip install pre-commit\n    pre-commit install\n    ```\n- Run tests:\n    ```shell\n    python -m unittest discover --pattern \"*test.py\"\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoinebrl%2Frl-mars-lander","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantoinebrl%2Frl-mars-lander","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoinebrl%2Frl-mars-lander/lists"}