{"action":"created","comment":{"url":"https://api.github.com/repos/mlpack/mlpack/pulls/comments/287085760","pull_request_review_id":241385652,"id":287085760,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI4NzA4NTc2MA==","diff_hunk":"@@ -0,0 +1,269 @@\n+/**\n+ * @file multiple_pole_cart.hpp\n+ * @author Rahul Ganesh Prabhu\n+ *\n+ * This file is an implementation of Multiple Pole Cart Balancing Task.\n+ *\n+ * mlpack is free software; you may redistribute it and/or modify it under the\n+ * terms of the 3-clause BSD license.  You should have received a copy of the\n+ * 3-clause BSD license along with mlpack.  If not, see\n+ * http://www.opensource.org/licenses/BSD-3-Clause for more information.\n+ */\n+#ifndef MLPACK_METHODS_RL_ENVIRONMENT_MULTIPE_POLE_CART_HPP\n+#define MLPACK_METHODS_RL_ENVIRONMENT_MULTIPE_POLE_CART_HPP\n+\n+#include <mlpack/prereqs.hpp>\n+\n+namespace mlpack {\n+namespace rl {\n+\n+/**\n+ * Implementation of Multiple Pole Cart Balancing task.\n+ */\n+class MultiplePoleCart\n+{\n+ public:\n+  /**\n+   * Implementation of the state of Multiple Pole Cart. The state is expressed as\n+   * a matrix where the $0^{th}$ column is the state of the cart, represented by a tuple\n+   * (position, velocity) and the $i^{th}$ column is the state of the $i^{th}$ pole, represented\n+   * by a tuple (angle, angular velocity).\n+   */\n+  class State\n+  {\n+   public:\n+    /**\n+     * Construct a state instance.\n+     * \n+     * @param numPoles The number of poles.\n+     */\n+    State(size_t numPoles)\n+    {\n+      data = arma::mat(dimension, numPoles, arma::fill::zeros);\n+    }\n+\n+    /**\n+     * Construct a state instance from given data.\n+     *\n+     * @param data Data for the position, velocity, angle and angular velocity.\n+     */\n+    State(const arma::mat& data) : data(data)\n+    { /* Nothing to do here */ }\n+\n+    //! Modify the internal representation of the state.\n+    arma::mat& Data() { return data; }\n+\n+    //! Get the position of the cart.\n+    double Position() const { return data(0, 0); }\n+    //! Modify the position of the cart.\n+    double& Position() { return data(0, 0); }\n+\n+    //! Get the velocity of the cart.\n+    double Velocity() const { return data(1, 0); }\n+    //! Modify the velocity of the cart.\n+    double& Velocity() { return data(1, 0); }\n+\n+    //! Get the angle of the $i^{th}$ pole with the vertical.\n+    double Angle(size_t i) const { return data(0, i); }\n+    //! Modify the angle of the $i^{th}$ pole with the vertical.\n+    double& Angle(size_t i) { return data(0, i); }\n+\n+    //! Get the angular velocity of the $i^{th}$ pole.\n+    double AngularVelocity(size_t i) const { return data(1, i); }\n+    //! Modify the angular velocity of the $i^{th}$ pole.\n+    double& AngularVelocity(size_t i) { return data(1, i); }\n+\n+    //! Encode the state to a matrix.\n+    const arma::mat& Encode() const { return data; }\n+\n+    //! Dimension of the encoded state.\n+    const size_t dimension = 2;\n+\n+   private:\n+    //! Locally-stored state data.\n+    arma::mat data;\n+  };\n+\n+  /**\n+   * Implementation of action of Cart Pole.\n+   */\n+  enum Action\n+  {\n+    backward,\n+    forward,\n+\n+    // Track the size of the action space.\n+    size\n+  };\n+\n+  /**\n+   * Construct a Multiple Pole Cart instance using the given constants.\n+   *\n+   * @param poleNum The number of poles\n+   * @param gravity The gravity constant.\n+   * @param massCart The mass of the cart.\n+   * @param massPole The mass of the pole.\n+   * @param length The length of the pole.\n+   * @param forceMag The magnitude of the applied force.\n+   * @param tau The time interval.\n+   * @param thetaThresholdRadians The maximum angle.\n+   * @param xThreshold The maximum position.","path":"src/mlpack/methods/reinforcement_learning/environment/multiple_pole_cart.hpp","position":110,"original_position":110,"commit_id":"55814d3ca3f0c3a5ff22268b8735192bb1f0c556","original_commit_id":"55814d3ca3f0c3a5ff22268b8735192bb1f0c556","user":{"login":"zoq","id":4209744,"node_id":"MDQ6VXNlcjQyMDk3NDQ=","avatar_url":"https://avatars3.githubusercontent.com/u/4209744?v=4","gravatar_id":"","url":"https://api.github.com/users/zoq","html_url":"https://github.com/zoq","followers_url":"https://api.github.com/users/zoq/followers","following_url":"https://api.github.com/users/zoq/following{/other_user}","gists_url":"https://api.github.com/users/zoq/gists{/gist_id}","starred_url":"https://api.github.com/users/zoq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zoq/subscriptions","organizations_url":"https://api.github.com/users/zoq/orgs","repos_url":"https://api.github.com/users/zoq/repos","events_url":"https://api.github.com/users/zoq/events{/privacy}","received_events_url":"https://api.github.com/users/zoq/received_events","type":"User","site_admin":false},"body":"The ``doneReward`` parameter is missing.","created_at":"2019-05-23T18:51:42Z","updated_at":"2019-05-23T18:56:21Z","html_url":"https://github.com/mlpack/mlpack/pull/1901#discussion_r287085760","pull_request_url":"https://api.github.com/repos/mlpack/mlpack/pulls/1901","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/comments/287085760"},"html":{"href":"https://github.com/mlpack/mlpack/pull/1901#discussion_r287085760"},"pull_request":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/1901"}}},"pull_request":{"url":"https://api.github.com/repos/mlpack/mlpack/pulls/1901","id":281593228,"node_id":"MDExOlB1bGxSZXF1ZXN0MjgxNTkzMjI4","html_url":"https://github.com/mlpack/mlpack/pull/1901","diff_url":"https://github.com/mlpack/mlpack/pull/1901.diff","patch_url":"https://github.com/mlpack/mlpack/pull/1901.patch","issue_url":"https://api.github.com/repos/mlpack/mlpack/issues/1901","number":1901,"state":"open","locked":false,"title":"Multiple Pole Balancing Environment","user":{"login":"favre49","id":40389657,"node_id":"MDQ6VXNlcjQwMzg5NjU3","avatar_url":"https://avatars2.githubusercontent.com/u/40389657?v=4","gravatar_id":"","url":"https://api.github.com/users/favre49","html_url":"https://github.com/favre49","followers_url":"https://api.github.com/users/favre49/followers","following_url":"https://api.github.com/users/favre49/following{/other_user}","gists_url":"https://api.github.com/users/favre49/gists{/gist_id}","starred_url":"https://api.github.com/users/favre49/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/favre49/subscriptions","organizations_url":"https://api.github.com/users/favre49/orgs","repos_url":"https://api.github.com/users/favre49/repos","events_url":"https://api.github.com/users/favre49/events{/privacy}","received_events_url":"https://api.github.com/users/favre49/received_events","type":"User","site_admin":false},"body":"","created_at":"2019-05-23T12:40:36Z","updated_at":"2019-05-23T18:56:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c692f8d8ab2dffe577f8230ad6b7bd61df5d9b49","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1200134486,"node_id":"MDU6TGFiZWwxMjAwMTM0NDg2","url":"https://api.github.com/repos/mlpack/mlpack/labels/s:%20needs%20review","name":"s: needs review","color":"ffff55","default":false},{"id":1200136603,"node_id":"MDU6TGFiZWwxMjAwMTM2NjAz","url":"https://api.github.com/repos/mlpack/mlpack/labels/s:%20unanswered","name":"s: unanswered","color":"ffff55","default":false},{"id":1200223274,"node_id":"MDU6TGFiZWwxMjAwMjIzMjc0","url":"https://api.github.com/repos/mlpack/mlpack/labels/s:%20unlabeled","name":"s: unlabeled","color":"ffff55","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/mlpack/mlpack/pulls/1901/commits","review_comments_url":"https://api.github.com/repos/mlpack/mlpack/pulls/1901/comments","review_comment_url":"https://api.github.com/repos/mlpack/mlpack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mlpack/mlpack/issues/1901/comments","statuses_url":"https://api.github.com/repos/mlpack/mlpack/statuses/55814d3ca3f0c3a5ff22268b8735192bb1f0c556","head":{"label":"favre49:multiplePoleBalancing","ref":"multiplePoleBalancing","sha":"55814d3ca3f0c3a5ff22268b8735192bb1f0c556","user":{"login":"favre49","id":40389657,"node_id":"MDQ6VXNlcjQwMzg5NjU3","avatar_url":"https://avatars2.githubusercontent.com/u/40389657?v=4","gravatar_id":"","url":"https://api.github.com/users/favre49","html_url":"https://github.com/favre49","followers_url":"https://api.github.com/users/favre49/followers","following_url":"https://api.github.com/users/favre49/following{/other_user}","gists_url":"https://api.github.com/users/favre49/gists{/gist_id}","starred_url":"https://api.github.com/users/favre49/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/favre49/subscriptions","organizations_url":"https://api.github.com/users/favre49/orgs","repos_url":"https://api.github.com/users/favre49/repos","events_url":"https://api.github.com/users/favre49/events{/privacy}","received_events_url":"https://api.github.com/users/favre49/received_events","type":"User","site_admin":false},"repo":{"id":188164588,"node_id":"MDEwOlJlcG9zaXRvcnkxODgxNjQ1ODg=","name":"mlpack","full_name":"favre49/mlpack","private":false,"owner":{"login":"favre49","id":40389657,"node_id":"MDQ6VXNlcjQwMzg5NjU3","avatar_url":"https://avatars2.githubusercontent.com/u/40389657?v=4","gravatar_id":"","url":"https://api.github.com/users/favre49","html_url":"https://github.com/favre49","followers_url":"https://api.github.com/users/favre49/followers","following_url":"https://api.github.com/users/favre49/following{/other_user}","gists_url":"https://api.github.com/users/favre49/gists{/gist_id}","starred_url":"https://api.github.com/users/favre49/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/favre49/subscriptions","organizations_url":"https://api.github.com/users/favre49/orgs","repos_url":"https://api.github.com/users/favre49/repos","events_url":"https://api.github.com/users/favre49/events{/privacy}","received_events_url":"https://api.github.com/users/favre49/received_events","type":"User","site_admin":false},"html_url":"https://github.com/favre49/mlpack","description":"mlpack: a scalable C++ machine learning library -- ","fork":true,"url":"https://api.github.com/repos/favre49/mlpack","forks_url":"https://api.github.com/repos/favre49/mlpack/forks","keys_url":"https://api.github.com/repos/favre49/mlpack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/favre49/mlpack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/favre49/mlpack/teams","hooks_url":"https://api.github.com/repos/favre49/mlpack/hooks","issue_events_url":"https://api.github.com/repos/favre49/mlpack/issues/events{/number}","events_url":"https://api.github.com/repos/favre49/mlpack/events","assignees_url":"https://api.github.com/repos/favre49/mlpack/assignees{/user}","branches_url":"https://api.github.com/repos/favre49/mlpack/branches{/branch}","tags_url":"https://api.github.com/repos/favre49/mlpack/tags","blobs_url":"https://api.github.com/repos/favre49/mlpack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/favre49/mlpack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/favre49/mlpack/git/refs{/sha}","trees_url":"https://api.github.com/repos/favre49/mlpack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/favre49/mlpack/statuses/{sha}","languages_url":"https://api.github.com/repos/favre49/mlpack/languages","stargazers_url":"https://api.github.com/repos/favre49/mlpack/stargazers","contributors_url":"https://api.github.com/repos/favre49/mlpack/contributors","subscribers_url":"https://api.github.com/repos/favre49/mlpack/subscribers","subscription_url":"https://api.github.com/repos/favre49/mlpack/subscription","commits_url":"https://api.github.com/repos/favre49/mlpack/commits{/sha}","git_commits_url":"https://api.github.com/repos/favre49/mlpack/git/commits{/sha}","comments_url":"https://api.github.com/repos/favre49/mlpack/comments{/number}","issue_comment_url":"https://api.github.com/repos/favre49/mlpack/issues/comments{/number}","contents_url":"https://api.github.com/repos/favre49/mlpack/contents/{+path}","compare_url":"https://api.github.com/repos/favre49/mlpack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/favre49/mlpack/merges","archive_url":"https://api.github.com/repos/favre49/mlpack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/favre49/mlpack/downloads","issues_url":"https://api.github.com/repos/favre49/mlpack/issues{/number}","pulls_url":"https://api.github.com/repos/favre49/mlpack/pulls{/number}","milestones_url":"https://api.github.com/repos/favre49/mlpack/milestones{/number}","notifications_url":"https://api.github.com/repos/favre49/mlpack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/favre49/mlpack/labels{/name}","releases_url":"https://api.github.com/repos/favre49/mlpack/releases{/id}","deployments_url":"https://api.github.com/repos/favre49/mlpack/deployments","created_at":"2019-05-23T05:02:47Z","updated_at":"2019-05-23T05:02:54Z","pushed_at":"2019-05-23T16:57:02Z","git_url":"git://github.com/favre49/mlpack.git","ssh_url":"git@github.com:favre49/mlpack.git","clone_url":"https://github.com/favre49/mlpack.git","svn_url":"https://github.com/favre49/mlpack","homepage":"http://www.mlpack.org/","size":247065,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mlpack:master","ref":"master","sha":"bb0787de7d0da748065360ab2f65b18e4986db6e","user":{"login":"mlpack","id":10216045,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwMjE2MDQ1","avatar_url":"https://avatars0.githubusercontent.com/u/10216045?v=4","gravatar_id":"","url":"https://api.github.com/users/mlpack","html_url":"https://github.com/mlpack","followers_url":"https://api.github.com/users/mlpack/followers","following_url":"https://api.github.com/users/mlpack/following{/other_user}","gists_url":"https://api.github.com/users/mlpack/gists{/gist_id}","starred_url":"https://api.github.com/users/mlpack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlpack/subscriptions","organizations_url":"https://api.github.com/users/mlpack/orgs","repos_url":"https://api.github.com/users/mlpack/repos","events_url":"https://api.github.com/users/mlpack/events{/privacy}","received_events_url":"https://api.github.com/users/mlpack/received_events","type":"Organization","site_admin":false},"repo":{"id":28149409,"node_id":"MDEwOlJlcG9zaXRvcnkyODE0OTQwOQ==","name":"mlpack","full_name":"mlpack/mlpack","private":false,"owner":{"login":"mlpack","id":10216045,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwMjE2MDQ1","avatar_url":"https://avatars0.githubusercontent.com/u/10216045?v=4","gravatar_id":"","url":"https://api.github.com/users/mlpack","html_url":"https://github.com/mlpack","followers_url":"https://api.github.com/users/mlpack/followers","following_url":"https://api.github.com/users/mlpack/following{/other_user}","gists_url":"https://api.github.com/users/mlpack/gists{/gist_id}","starred_url":"https://api.github.com/users/mlpack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlpack/subscriptions","organizations_url":"https://api.github.com/users/mlpack/orgs","repos_url":"https://api.github.com/users/mlpack/repos","events_url":"https://api.github.com/users/mlpack/events{/privacy}","received_events_url":"https://api.github.com/users/mlpack/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/mlpack/mlpack","description":"mlpack: a scalable C++ machine learning library -- ","fork":false,"url":"https://api.github.com/repos/mlpack/mlpack","forks_url":"https://api.github.com/repos/mlpack/mlpack/forks","keys_url":"https://api.github.com/repos/mlpack/mlpack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mlpack/mlpack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mlpack/mlpack/teams","hooks_url":"https://api.github.com/repos/mlpack/mlpack/hooks","issue_events_url":"https://api.github.com/repos/mlpack/mlpack/issues/events{/number}","events_url":"https://api.github.com/repos/mlpack/mlpack/events","assignees_url":"https://api.github.com/repos/mlpack/mlpack/assignees{/user}","branches_url":"https://api.github.com/repos/mlpack/mlpack/branches{/branch}","tags_url":"https://api.github.com/repos/mlpack/mlpack/tags","blobs_url":"https://api.github.com/repos/mlpack/mlpack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mlpack/mlpack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mlpack/mlpack/git/refs{/sha}","trees_url":"https://api.github.com/repos/mlpack/mlpack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mlpack/mlpack/statuses/{sha}","languages_url":"https://api.github.com/repos/mlpack/mlpack/languages","stargazers_url":"https://api.github.com/repos/mlpack/mlpack/stargazers","contributors_url":"https://api.github.com/repos/mlpack/mlpack/contributors","subscribers_url":"https://api.github.com/repos/mlpack/mlpack/subscribers","subscription_url":"https://api.github.com/repos/mlpack/mlpack/subscription","commits_url":"https://api.github.com/repos/mlpack/mlpack/commits{/sha}","git_commits_url":"https://api.github.com/repos/mlpack/mlpack/git/commits{/sha}","comments_url":"https://api.github.com/repos/mlpack/mlpack/comments{/number}","issue_comment_url":"https://api.github.com/repos/mlpack/mlpack/issues/comments{/number}","contents_url":"https://api.github.com/repos/mlpack/mlpack/contents/{+path}","compare_url":"https://api.github.com/repos/mlpack/mlpack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mlpack/mlpack/merges","archive_url":"https://api.github.com/repos/mlpack/mlpack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mlpack/mlpack/downloads","issues_url":"https://api.github.com/repos/mlpack/mlpack/issues{/number}","pulls_url":"https://api.github.com/repos/mlpack/mlpack/pulls{/number}","milestones_url":"https://api.github.com/repos/mlpack/mlpack/milestones{/number}","notifications_url":"https://api.github.com/repos/mlpack/mlpack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mlpack/mlpack/labels{/name}","releases_url":"https://api.github.com/repos/mlpack/mlpack/releases{/id}","deployments_url":"https://api.github.com/repos/mlpack/mlpack/deployments","created_at":"2014-12-17T18:16:59Z","updated_at":"2019-05-23T14:08:53Z","pushed_at":"2019-05-23T16:57:05Z","git_url":"git://github.com/mlpack/mlpack.git","ssh_url":"git@github.com:mlpack/mlpack.git","clone_url":"https://github.com/mlpack/mlpack.git","svn_url":"https://github.com/mlpack/mlpack","homepage":"http://www.mlpack.org/","size":246996,"stargazers_count":2820,"watchers_count":2820,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1022,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":118,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1022,"open_issues":118,"watchers":2820,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/1901"},"html":{"href":"https://github.com/mlpack/mlpack/pull/1901"},"issue":{"href":"https://api.github.com/repos/mlpack/mlpack/issues/1901"},"comments":{"href":"https://api.github.com/repos/mlpack/mlpack/issues/1901/comments"},"review_comments":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/1901/comments"},"review_comment":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/1901/commits"},"statuses":{"href":"https://api.github.com/repos/mlpack/mlpack/statuses/55814d3ca3f0c3a5ff22268b8735192bb1f0c556"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"zoq"}}