{"action":"created","comment":{"url":"https://api.github.com/repos/valhalla/valhalla/pulls/comments/181924312","pull_request_review_id":112634241,"id":181924312,"diff_hunk":"@@ -0,0 +1,285 @@\n+#include <iostream> // TODO remove if not needed\n+#include <map>\n+#include <algorithm>\n+#include \"baldr/datetime.h\"\n+#include \"midgard/logging.h\"\n+#include \"thor/timedep.h\"\n+\n+using namespace valhalla::baldr;\n+using namespace valhalla::sif;\n+\n+namespace valhalla {\n+namespace thor {\n+\n+constexpr uint64_t kInitialEdgeLabelCount = 500000;\n+\n+// Default constructor\n+TimeDepForward::TimeDepForward()\n+    : AStarPathAlgorithm() {\n+  mode_ = TravelMode::kDrive;\n+  travel_type_ = 0;\n+  adjacencylist_ = nullptr;\n+  max_label_count_ = std::numeric_limits<uint32_t>::max();\n+}\n+\n+// Destructor\n+TimeDepForward::~TimeDepForward() {\n+  Clear();\n+}\n+\n+// Expand from the node along the forward search path. Immediately expands\n+// from the end node of any transition edge (so no transition edges are added\n+// to the adjacency list or EdgeLabel list). Does not expand transition\n+// edges if from_transition is false.\n+void TimeDepForward::ExpandForward(GraphReader& graphreader,\n+                   const GraphId& node, const EdgeLabel& pred,\n+                   const uint32_t pred_idx, const bool from_transition,\n+                   const uint32_t localtime,\n+                   const odin::Location& destination,\n+                   std::pair<int32_t, float>& best_path) {\n+  // Get the tile and the node info. Skip if tile is null (can happen\n+  // with regional data sets) or if no access at the node.\n+  const GraphTile* tile = graphreader.GetGraphTile(node);\n+  if (tile == nullptr) {\n+    return;\n+  }\n+  const NodeInfo* nodeinfo = tile->node(node);\n+  if (!costing_->Allowed(nodeinfo)) {\n+    return;\n+  }\n+\n+  // Expand from end node.\n+  uint32_t shortcuts = 0;\n+  uint32_t max_shortcut_length = static_cast<uint32_t>(pred.distance() * 0.5f);\n+  GraphId edgeid(node.tileid(), node.level(), nodeinfo->edge_index());\n+  EdgeStatusInfo* es = edgestatus_.GetPtr(edgeid, tile);\n+  const DirectedEdge* directededge = tile->directededge(nodeinfo->edge_index());\n+  for (uint32_t i = 0; i < nodeinfo->edge_count(); ++i, ++directededge, ++edgeid, ++es) {\n+    // Handle transition edges - expand from the end node of the transition\n+    // (unless this is called from a transition).\n+    if (directededge->trans_up()) {\n+      if (!from_transition) {\n+        hierarchy_limits_[node.level()].up_transition_count++;\n+        ExpandForward(graphreader, directededge->endnode(), pred, pred_idx,\n+                      true, localtime, destination, best_path);\n+      }\n+      continue;\n+    } else if (directededge->trans_down()) {\n+      if (!from_transition &&\n+          !hierarchy_limits_[directededge->endnode().level()].StopExpanding(pred.distance())) {\n+        ExpandForward(graphreader, directededge->endnode(), pred, pred_idx,\n+                      true, localtime, destination, best_path);\n+      }\n+      continue;\n+    }\n+\n+    // Skip this edge if permanently labeled (best path already found to this\n+    // directed edge), if edge is superseded by a shortcut edge that was taken,\n+    // or if no access is allowed to this edge (based on costing method), or if\n+    // a complex restriction exists.\n+    if (es->set() == EdgeSet::kPermanent ||\n+        (shortcuts & directededge->superseded()) ||\n+       !costing_->Allowed(directededge, pred, tile, edgeid, localtime) ||\n+        costing_->Restricted(directededge, pred, edgelabels_, tile,\n+                                     edgeid, true, localtime)) {\n+      continue;\n+    }\n+\n+    // Skip shortcut edges when near the destination. Always skip within\n+    // 10km but also reject long shortcut edges outside this distance.\n+    // TODO - configure this distance based on density?\n+    if (directededge->is_shortcut() && (pred.distance() < 10000.0f ||\n+        directededge->length() > max_shortcut_length)) {\n+      continue;\n+    }\n+\n+    // Update the_shortcuts mask\n+    shortcuts |= directededge->shortcut();\n+\n+    // Compute the cost to the end of this edge\n+    Cost newcost = pred.cost() + costing_->EdgeCost(directededge) +","path":"src/thor/timedep_forward.cc","position":100,"original_position":100,"commit_id":"d4f384d0a1e82ecc52c1f47a9b5789168db6c87c","original_commit_id":"d4f384d0a1e82ecc52c1f47a9b5789168db6c87c","user":{"login":"dnesbitt61","id":1838768,"avatar_url":"https://avatars1.githubusercontent.com/u/1838768?v=4","gravatar_id":"","url":"https://api.github.com/users/dnesbitt61","html_url":"https://github.com/dnesbitt61","followers_url":"https://api.github.com/users/dnesbitt61/followers","following_url":"https://api.github.com/users/dnesbitt61/following{/other_user}","gists_url":"https://api.github.com/users/dnesbitt61/gists{/gist_id}","starred_url":"https://api.github.com/users/dnesbitt61/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnesbitt61/subscriptions","organizations_url":"https://api.github.com/users/dnesbitt61/orgs","repos_url":"https://api.github.com/users/dnesbitt61/repos","events_url":"https://api.github.com/users/dnesbitt61/events{/privacy}","received_events_url":"https://api.github.com/users/dnesbitt61/received_events","type":"User","site_admin":false},"body":"yes, but will likely have to pass in either the GraphTile and edge Id or other information to access any predictive speed / duration data (and real-time in the future). So waiting until we have more info until that interface gets defined.","created_at":"2018-04-17T00:37:38Z","updated_at":"2018-04-17T00:37:38Z","html_url":"https://github.com/valhalla/valhalla/pull/1216#discussion_r181924312","pull_request_url":"https://api.github.com/repos/valhalla/valhalla/pulls/1216","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/valhalla/valhalla/pulls/comments/181924312"},"html":{"href":"https://github.com/valhalla/valhalla/pull/1216#discussion_r181924312"},"pull_request":{"href":"https://api.github.com/repos/valhalla/valhalla/pulls/1216"}},"in_reply_to_id":181916394},"pull_request":{"url":"https://api.github.com/repos/valhalla/valhalla/pulls/1216","id":181906860,"html_url":"https://github.com/valhalla/valhalla/pull/1216","diff_url":"https://github.com/valhalla/valhalla/pull/1216.diff","patch_url":"https://github.com/valhalla/valhalla/pull/1216.patch","issue_url":"https://api.github.com/repos/valhalla/valhalla/issues/1216","number":1216,"state":"open","locked":false,"title":"Add time dependent forward and reverse A* methods","user":{"login":"dnesbitt61","id":1838768,"avatar_url":"https://avatars1.githubusercontent.com/u/1838768?v=4","gravatar_id":"","url":"https://api.github.com/users/dnesbitt61","html_url":"https://github.com/dnesbitt61","followers_url":"https://api.github.com/users/dnesbitt61/followers","following_url":"https://api.github.com/users/dnesbitt61/following{/other_user}","gists_url":"https://api.github.com/users/dnesbitt61/gists{/gist_id}","starred_url":"https://api.github.com/users/dnesbitt61/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnesbitt61/subscriptions","organizations_url":"https://api.github.com/users/dnesbitt61/orgs","repos_url":"https://api.github.com/users/dnesbitt61/repos","events_url":"https://api.github.com/users/dnesbitt61/events{/privacy}","received_events_url":"https://api.github.com/users/dnesbitt61/received_events","type":"User","site_admin":false},"body":"These are not yet selected but are ready to start further integration and testing. This PR also adds the current local time to the costing Restricted method interface (though it does not yet use it in the method internals - this is waiting on having time dependent conditional restrictions).","created_at":"2018-04-16T15:37:18Z","updated_at":"2018-04-17T00:37:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"88999b569c19e00eb067f53f9a4b04b47c4bfcfa","assignee":null,"assignees":[],"requested_reviewers":[{"login":"gknisely","id":2676277,"avatar_url":"https://avatars2.githubusercontent.com/u/2676277?v=4","gravatar_id":"","url":"https://api.github.com/users/gknisely","html_url":"https://github.com/gknisely","followers_url":"https://api.github.com/users/gknisely/followers","following_url":"https://api.github.com/users/gknisely/following{/other_user}","gists_url":"https://api.github.com/users/gknisely/gists{/gist_id}","starred_url":"https://api.github.com/users/gknisely/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gknisely/subscriptions","organizations_url":"https://api.github.com/users/gknisely/orgs","repos_url":"https://api.github.com/users/gknisely/repos","events_url":"https://api.github.com/users/gknisely/events{/privacy}","received_events_url":"https://api.github.com/users/gknisely/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/valhalla/valhalla/pulls/1216/commits","review_comments_url":"https://api.github.com/repos/valhalla/valhalla/pulls/1216/comments","review_comment_url":"https://api.github.com/repos/valhalla/valhalla/pulls/comments{/number}","comments_url":"https://api.github.com/repos/valhalla/valhalla/issues/1216/comments","statuses_url":"https://api.github.com/repos/valhalla/valhalla/statuses/d4f384d0a1e82ecc52c1f47a9b5789168db6c87c","head":{"label":"valhalla:time_dep","ref":"time_dep","sha":"d4f384d0a1e82ecc52c1f47a9b5789168db6c87c","user":{"login":"valhalla","id":10232331,"avatar_url":"https://avatars1.githubusercontent.com/u/10232331?v=4","gravatar_id":"","url":"https://api.github.com/users/valhalla","html_url":"https://github.com/valhalla","followers_url":"https://api.github.com/users/valhalla/followers","following_url":"https://api.github.com/users/valhalla/following{/other_user}","gists_url":"https://api.github.com/users/valhalla/gists{/gist_id}","starred_url":"https://api.github.com/users/valhalla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/valhalla/subscriptions","organizations_url":"https://api.github.com/users/valhalla/orgs","repos_url":"https://api.github.com/users/valhalla/repos","events_url":"https://api.github.com/users/valhalla/events{/privacy}","received_events_url":"https://api.github.com/users/valhalla/received_events","type":"Organization","site_admin":false},"repo":{"id":49978193,"name":"valhalla","full_name":"valhalla/valhalla","owner":{"login":"valhalla","id":10232331,"avatar_url":"https://avatars1.githubusercontent.com/u/10232331?v=4","gravatar_id":"","url":"https://api.github.com/users/valhalla","html_url":"https://github.com/valhalla","followers_url":"https://api.github.com/users/valhalla/followers","following_url":"https://api.github.com/users/valhalla/following{/other_user}","gists_url":"https://api.github.com/users/valhalla/gists{/gist_id}","starred_url":"https://api.github.com/users/valhalla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/valhalla/subscriptions","organizations_url":"https://api.github.com/users/valhalla/orgs","repos_url":"https://api.github.com/users/valhalla/repos","events_url":"https://api.github.com/users/valhalla/events{/privacy}","received_events_url":"https://api.github.com/users/valhalla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/valhalla/valhalla","description":"Open Source Routing Engine for OpenStreetMap","fork":false,"url":"https://api.github.com/repos/valhalla/valhalla","forks_url":"https://api.github.com/repos/valhalla/valhalla/forks","keys_url":"https://api.github.com/repos/valhalla/valhalla/keys{/key_id}","collaborators_url":"https://api.github.com/repos/valhalla/valhalla/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/valhalla/valhalla/teams","hooks_url":"https://api.github.com/repos/valhalla/valhalla/hooks","issue_events_url":"https://api.github.com/repos/valhalla/valhalla/issues/events{/number}","events_url":"https://api.github.com/repos/valhalla/valhalla/events","assignees_url":"https://api.github.com/repos/valhalla/valhalla/assignees{/user}","branches_url":"https://api.github.com/repos/valhalla/valhalla/branches{/branch}","tags_url":"https://api.github.com/repos/valhalla/valhalla/tags","blobs_url":"https://api.github.com/repos/valhalla/valhalla/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/valhalla/valhalla/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/valhalla/valhalla/git/refs{/sha}","trees_url":"https://api.github.com/repos/valhalla/valhalla/git/trees{/sha}","statuses_url":"https://api.github.com/repos/valhalla/valhalla/statuses/{sha}","languages_url":"https://api.github.com/repos/valhalla/valhalla/languages","stargazers_url":"https://api.github.com/repos/valhalla/valhalla/stargazers","contributors_url":"https://api.github.com/repos/valhalla/valhalla/contributors","subscribers_url":"https://api.github.com/repos/valhalla/valhalla/subscribers","subscription_url":"https://api.github.com/repos/valhalla/valhalla/subscription","commits_url":"https://api.github.com/repos/valhalla/valhalla/commits{/sha}","git_commits_url":"https://api.github.com/repos/valhalla/valhalla/git/commits{/sha}","comments_url":"https://api.github.com/repos/valhalla/valhalla/comments{/number}","issue_comment_url":"https://api.github.com/repos/valhalla/valhalla/issues/comments{/number}","contents_url":"https://api.github.com/repos/valhalla/valhalla/contents/{+path}","compare_url":"https://api.github.com/repos/valhalla/valhalla/compare/{base}...{head}","merges_url":"https://api.github.com/repos/valhalla/valhalla/merges","archive_url":"https://api.github.com/repos/valhalla/valhalla/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/valhalla/valhalla/downloads","issues_url":"https://api.github.com/repos/valhalla/valhalla/issues{/number}","pulls_url":"https://api.github.com/repos/valhalla/valhalla/pulls{/number}","milestones_url":"https://api.github.com/repos/valhalla/valhalla/milestones{/number}","notifications_url":"https://api.github.com/repos/valhalla/valhalla/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/valhalla/valhalla/labels{/name}","releases_url":"https://api.github.com/repos/valhalla/valhalla/releases{/id}","deployments_url":"https://api.github.com/repos/valhalla/valhalla/deployments","created_at":"2016-01-19T19:42:29Z","updated_at":"2018-04-16T13:20:11Z","pushed_at":"2018-04-16T19:06:14Z","git_url":"git://github.com/valhalla/valhalla.git","ssh_url":"git@github.com:valhalla/valhalla.git","clone_url":"https://github.com/valhalla/valhalla.git","svn_url":"https://github.com/valhalla/valhalla","homepage":"","size":86566,"stargazers_count":447,"watchers_count":447,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":97,"mirror_url":null,"archived":false,"open_issues_count":218,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":97,"open_issues":218,"watchers":447,"default_branch":"master"}},"base":{"label":"valhalla:master","ref":"master","sha":"3968383a055f0f3ce3b1080262eba1ae1982cfe1","user":{"login":"valhalla","id":10232331,"avatar_url":"https://avatars1.githubusercontent.com/u/10232331?v=4","gravatar_id":"","url":"https://api.github.com/users/valhalla","html_url":"https://github.com/valhalla","followers_url":"https://api.github.com/users/valhalla/followers","following_url":"https://api.github.com/users/valhalla/following{/other_user}","gists_url":"https://api.github.com/users/valhalla/gists{/gist_id}","starred_url":"https://api.github.com/users/valhalla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/valhalla/subscriptions","organizations_url":"https://api.github.com/users/valhalla/orgs","repos_url":"https://api.github.com/users/valhalla/repos","events_url":"https://api.github.com/users/valhalla/events{/privacy}","received_events_url":"https://api.github.com/users/valhalla/received_events","type":"Organization","site_admin":false},"repo":{"id":49978193,"name":"valhalla","full_name":"valhalla/valhalla","owner":{"login":"valhalla","id":10232331,"avatar_url":"https://avatars1.githubusercontent.com/u/10232331?v=4","gravatar_id":"","url":"https://api.github.com/users/valhalla","html_url":"https://github.com/valhalla","followers_url":"https://api.github.com/users/valhalla/followers","following_url":"https://api.github.com/users/valhalla/following{/other_user}","gists_url":"https://api.github.com/users/valhalla/gists{/gist_id}","starred_url":"https://api.github.com/users/valhalla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/valhalla/subscriptions","organizations_url":"https://api.github.com/users/valhalla/orgs","repos_url":"https://api.github.com/users/valhalla/repos","events_url":"https://api.github.com/users/valhalla/events{/privacy}","received_events_url":"https://api.github.com/users/valhalla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/valhalla/valhalla","description":"Open Source Routing Engine for OpenStreetMap","fork":false,"url":"https://api.github.com/repos/valhalla/valhalla","forks_url":"https://api.github.com/repos/valhalla/valhalla/forks","keys_url":"https://api.github.com/repos/valhalla/valhalla/keys{/key_id}","collaborators_url":"https://api.github.com/repos/valhalla/valhalla/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/valhalla/valhalla/teams","hooks_url":"https://api.github.com/repos/valhalla/valhalla/hooks","issue_events_url":"https://api.github.com/repos/valhalla/valhalla/issues/events{/number}","events_url":"https://api.github.com/repos/valhalla/valhalla/events","assignees_url":"https://api.github.com/repos/valhalla/valhalla/assignees{/user}","branches_url":"https://api.github.com/repos/valhalla/valhalla/branches{/branch}","tags_url":"https://api.github.com/repos/valhalla/valhalla/tags","blobs_url":"https://api.github.com/repos/valhalla/valhalla/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/valhalla/valhalla/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/valhalla/valhalla/git/refs{/sha}","trees_url":"https://api.github.com/repos/valhalla/valhalla/git/trees{/sha}","statuses_url":"https://api.github.com/repos/valhalla/valhalla/statuses/{sha}","languages_url":"https://api.github.com/repos/valhalla/valhalla/languages","stargazers_url":"https://api.github.com/repos/valhalla/valhalla/stargazers","contributors_url":"https://api.github.com/repos/valhalla/valhalla/contributors","subscribers_url":"https://api.github.com/repos/valhalla/valhalla/subscribers","subscription_url":"https://api.github.com/repos/valhalla/valhalla/subscription","commits_url":"https://api.github.com/repos/valhalla/valhalla/commits{/sha}","git_commits_url":"https://api.github.com/repos/valhalla/valhalla/git/commits{/sha}","comments_url":"https://api.github.com/repos/valhalla/valhalla/comments{/number}","issue_comment_url":"https://api.github.com/repos/valhalla/valhalla/issues/comments{/number}","contents_url":"https://api.github.com/repos/valhalla/valhalla/contents/{+path}","compare_url":"https://api.github.com/repos/valhalla/valhalla/compare/{base}...{head}","merges_url":"https://api.github.com/repos/valhalla/valhalla/merges","archive_url":"https://api.github.com/repos/valhalla/valhalla/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/valhalla/valhalla/downloads","issues_url":"https://api.github.com/repos/valhalla/valhalla/issues{/number}","pulls_url":"https://api.github.com/repos/valhalla/valhalla/pulls{/number}","milestones_url":"https://api.github.com/repos/valhalla/valhalla/milestones{/number}","notifications_url":"https://api.github.com/repos/valhalla/valhalla/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/valhalla/valhalla/labels{/name}","releases_url":"https://api.github.com/repos/valhalla/valhalla/releases{/id}","deployments_url":"https://api.github.com/repos/valhalla/valhalla/deployments","created_at":"2016-01-19T19:42:29Z","updated_at":"2018-04-16T13:20:11Z","pushed_at":"2018-04-16T19:06:14Z","git_url":"git://github.com/valhalla/valhalla.git","ssh_url":"git@github.com:valhalla/valhalla.git","clone_url":"https://github.com/valhalla/valhalla.git","svn_url":"https://github.com/valhalla/valhalla","homepage":"","size":86566,"stargazers_count":447,"watchers_count":447,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":97,"mirror_url":null,"archived":false,"open_issues_count":218,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":97,"open_issues":218,"watchers":447,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/valhalla/valhalla/pulls/1216"},"html":{"href":"https://github.com/valhalla/valhalla/pull/1216"},"issue":{"href":"https://api.github.com/repos/valhalla/valhalla/issues/1216"},"comments":{"href":"https://api.github.com/repos/valhalla/valhalla/issues/1216/comments"},"review_comments":{"href":"https://api.github.com/repos/valhalla/valhalla/pulls/1216/comments"},"review_comment":{"href":"https://api.github.com/repos/valhalla/valhalla/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/valhalla/valhalla/pulls/1216/commits"},"statuses":{"href":"https://api.github.com/repos/valhalla/valhalla/statuses/d4f384d0a1e82ecc52c1f47a9b5789168db6c87c"}},"author_association":"OWNER"}}
{"actor":{"display_login":"dnesbitt61"}}