{"action":"created","comment":{"url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/comments/38210263","id":38210263,"diff_hunk":"@@ -0,0 +1,104 @@\n+/*\n+\n+Copyright (c) 2015, Project OSRM contributors\n+All rights reserved.\n+\n+Redistribution and use in source and binary forms, with or without modification,\n+are permitted provided that the following conditions are met:\n+\n+Redistributions of source code must retain the above copyright notice, this list\n+of conditions and the following disclaimer.\n+Redistributions in binary form must reproduce the above copyright notice, this\n+list of conditions and the following disclaimer in the documentation and/or\n+other materials provided with the distribution.\n+\n+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\n+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\n+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+\n+*/\n+\n+#ifndef Trip_BRUTE_FORCE_HPP\n+#define Trip_BRUTE_FORCE_HPP\n+\n+\n+#include \"../data_structures/search_engine.hpp\"\n+#include \"../util/string_util.hpp\"\n+#include \"../util/dist_table_wrapper.hpp\"\n+\n+#include <osrm/json_container.hpp>\n+\n+#include <cstdlib>\n+\n+#include <algorithm>\n+#include <string>\n+#include <vector>\n+#include <limits>\n+#include <iostream>\n+#include \"../util/simple_logger.hpp\"\n+\n+\n+\n+\n+namespace osrm\n+{\n+namespace trip\n+{\n+\n+// computes the distance of a given permutation\n+EdgeWeight ReturnDistance(const DistTableWrapper<EdgeWeight> & dist_table,\n+                          const std::vector<NodeID> & location_order,\n+                          const EdgeWeight & min_route_dist,\n+                          const std::size_t & component_size) {\n+    EdgeWeight route_dist = 0;\n+    std::size_t i = 0;\n+    while (i < location_order.size() && (route_dist < min_route_dist)) {\n+        route_dist += dist_table(location_order[i], location_order[(i+1) % component_size]);\n+        ++i;\n+    }\n+\n+    BOOST_ASSERT_MSG(route_dist != INVALID_EDGE_WEIGHT, \"invalid route found\");","path":"routing_algorithms/trip_brute_force.hpp","position":67,"original_position":67,"commit_id":"af5bf3a4b2b01e08c6ec9c741936bfeaa3f8d241","original_commit_id":"af5bf3a4b2b01e08c6ec9c741936bfeaa3f8d241","user":{"login":"daniel-j-h","id":527241,"avatar_url":"https://avatars.githubusercontent.com/u/527241?v=3","gravatar_id":"","url":"https://api.github.com/users/daniel-j-h","html_url":"https://github.com/daniel-j-h","followers_url":"https://api.github.com/users/daniel-j-h/followers","following_url":"https://api.github.com/users/daniel-j-h/following{/other_user}","gists_url":"https://api.github.com/users/daniel-j-h/gists{/gist_id}","starred_url":"https://api.github.com/users/daniel-j-h/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daniel-j-h/subscriptions","organizations_url":"https://api.github.com/users/daniel-j-h/orgs","repos_url":"https://api.github.com/users/daniel-j-h/repos","events_url":"https://api.github.com/users/daniel-j-h/events{/privacy}","received_events_url":"https://api.github.com/users/daniel-j-h/received_events","type":"User","site_admin":false},"body":"I think what you want to check is this condition, but in every iteration. That is, in case a single distance table entry is invalid, you want the assert to trigger. If you don't check this inside the loop, then adding a valid edge weight to an invalid one does not result in an invalid edge weight, but in a valid one that is way off (because of wrap around).","created_at":"2015-08-28T15:13:43Z","updated_at":"2015-08-28T15:13:43Z","html_url":"https://github.com/Project-OSRM/osrm-backend/pull/1610#discussion_r38210263","pull_request_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/1610","_links":{"self":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/comments/38210263"},"html":{"href":"https://github.com/Project-OSRM/osrm-backend/pull/1610#discussion_r38210263"},"pull_request":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/1610"}}},"pull_request":{"url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/1610","id":42824943,"html_url":"https://github.com/Project-OSRM/osrm-backend/pull/1610","diff_url":"https://github.com/Project-OSRM/osrm-backend/pull/1610.diff","patch_url":"https://github.com/Project-OSRM/osrm-backend/pull/1610.patch","issue_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/1610","number":1610,"state":"open","locked":false,"title":"[NOT READY] Add roundtrip/TSP plugin to OSRM","user":{"login":"chaupow","id":804027,"avatar_url":"https://avatars.githubusercontent.com/u/804027?v=3","gravatar_id":"","url":"https://api.github.com/users/chaupow","html_url":"https://github.com/chaupow","followers_url":"https://api.github.com/users/chaupow/followers","following_url":"https://api.github.com/users/chaupow/following{/other_user}","gists_url":"https://api.github.com/users/chaupow/gists{/gist_id}","starred_url":"https://api.github.com/users/chaupow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chaupow/subscriptions","organizations_url":"https://api.github.com/users/chaupow/orgs","repos_url":"https://api.github.com/users/chaupow/repos","events_url":"https://api.github.com/users/chaupow/events{/privacy}","received_events_url":"https://api.github.com/users/chaupow/received_events","type":"User","site_admin":false},"body":"This PR is not ready yet. But soon. Stay tuned.","created_at":"2015-08-19T15:01:57Z","updated_at":"2015-08-28T15:13:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b8a1085a3fec260b1f6dd21b053adb44d7f5a7df","assignee":null,"milestone":{"url":"https://api.github.com/repos/Project-OSRM/osrm-backend/milestones/6","html_url":"https://github.com/Project-OSRM/osrm-backend/milestones/4.8.0","labels_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/milestones/6/labels","id":1083870,"number":6,"title":"4.8.0","description":null,"creator":{"login":"TheMarex","id":606968,"avatar_url":"https://avatars.githubusercontent.com/u/606968?v=3","gravatar_id":"","url":"https://api.github.com/users/TheMarex","html_url":"https://github.com/TheMarex","followers_url":"https://api.github.com/users/TheMarex/followers","following_url":"https://api.github.com/users/TheMarex/following{/other_user}","gists_url":"https://api.github.com/users/TheMarex/gists{/gist_id}","starred_url":"https://api.github.com/users/TheMarex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheMarex/subscriptions","organizations_url":"https://api.github.com/users/TheMarex/orgs","repos_url":"https://api.github.com/users/TheMarex/repos","events_url":"https://api.github.com/users/TheMarex/events{/privacy}","received_events_url":"https://api.github.com/users/TheMarex/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":4,"state":"open","created_at":"2015-04-26T10:45:25Z","updated_at":"2015-08-26T22:37:59Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/1610/commits","review_comments_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/1610/comments","review_comment_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/1610/comments","statuses_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/statuses/af5bf3a4b2b01e08c6ec9c741936bfeaa3f8d241","head":{"label":"Project-OSRM:feature/round_trip","ref":"feature/round_trip","sha":"af5bf3a4b2b01e08c6ec9c741936bfeaa3f8d241","user":{"login":"Project-OSRM","id":8207060,"avatar_url":"https://avatars.githubusercontent.com/u/8207060?v=3","gravatar_id":"","url":"https://api.github.com/users/Project-OSRM","html_url":"https://github.com/Project-OSRM","followers_url":"https://api.github.com/users/Project-OSRM/followers","following_url":"https://api.github.com/users/Project-OSRM/following{/other_user}","gists_url":"https://api.github.com/users/Project-OSRM/gists{/gist_id}","starred_url":"https://api.github.com/users/Project-OSRM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Project-OSRM/subscriptions","organizations_url":"https://api.github.com/users/Project-OSRM/orgs","repos_url":"https://api.github.com/users/Project-OSRM/repos","events_url":"https://api.github.com/users/Project-OSRM/events{/privacy}","received_events_url":"https://api.github.com/users/Project-OSRM/received_events","type":"Organization","site_admin":false},"repo":{"id":2436255,"name":"osrm-backend","full_name":"Project-OSRM/osrm-backend","owner":{"login":"Project-OSRM","id":8207060,"avatar_url":"https://avatars.githubusercontent.com/u/8207060?v=3","gravatar_id":"","url":"https://api.github.com/users/Project-OSRM","html_url":"https://github.com/Project-OSRM","followers_url":"https://api.github.com/users/Project-OSRM/followers","following_url":"https://api.github.com/users/Project-OSRM/following{/other_user}","gists_url":"https://api.github.com/users/Project-OSRM/gists{/gist_id}","starred_url":"https://api.github.com/users/Project-OSRM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Project-OSRM/subscriptions","organizations_url":"https://api.github.com/users/Project-OSRM/orgs","repos_url":"https://api.github.com/users/Project-OSRM/repos","events_url":"https://api.github.com/users/Project-OSRM/events{/privacy}","received_events_url":"https://api.github.com/users/Project-OSRM/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Project-OSRM/osrm-backend","description":"Project OSRM: C++ backend","fork":false,"url":"https://api.github.com/repos/Project-OSRM/osrm-backend","forks_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/forks","keys_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/teams","hooks_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/hooks","issue_events_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/events{/number}","events_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/events","assignees_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/assignees{/user}","branches_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/branches{/branch}","tags_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/tags","blobs_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/languages","stargazers_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/stargazers","contributors_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/contributors","subscribers_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/subscribers","subscription_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/subscription","commits_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/contents/{+path}","compare_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/merges","archive_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/downloads","issues_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues{/number}","pulls_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/labels{/name}","releases_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/releases{/id}","created_at":"2011-09-22T10:05:08Z","updated_at":"2015-08-28T13:00:36Z","pushed_at":"2015-08-28T10:42:29Z","git_url":"git://github.com/Project-OSRM/osrm-backend.git","ssh_url":"git@github.com:Project-OSRM/osrm-backend.git","clone_url":"https://github.com/Project-OSRM/osrm-backend.git","svn_url":"https://github.com/Project-OSRM/osrm-backend","homepage":"http://map.project-osrm.org","size":23798,"stargazers_count":871,"watchers_count":871,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":325,"mirror_url":null,"open_issues_count":216,"forks":325,"open_issues":216,"watchers":871,"default_branch":"master"}},"base":{"label":"Project-OSRM:develop","ref":"develop","sha":"92956f2b455febba157758e707e4a0bb1aa9e9c9","user":{"login":"Project-OSRM","id":8207060,"avatar_url":"https://avatars.githubusercontent.com/u/8207060?v=3","gravatar_id":"","url":"https://api.github.com/users/Project-OSRM","html_url":"https://github.com/Project-OSRM","followers_url":"https://api.github.com/users/Project-OSRM/followers","following_url":"https://api.github.com/users/Project-OSRM/following{/other_user}","gists_url":"https://api.github.com/users/Project-OSRM/gists{/gist_id}","starred_url":"https://api.github.com/users/Project-OSRM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Project-OSRM/subscriptions","organizations_url":"https://api.github.com/users/Project-OSRM/orgs","repos_url":"https://api.github.com/users/Project-OSRM/repos","events_url":"https://api.github.com/users/Project-OSRM/events{/privacy}","received_events_url":"https://api.github.com/users/Project-OSRM/received_events","type":"Organization","site_admin":false},"repo":{"id":2436255,"name":"osrm-backend","full_name":"Project-OSRM/osrm-backend","owner":{"login":"Project-OSRM","id":8207060,"avatar_url":"https://avatars.githubusercontent.com/u/8207060?v=3","gravatar_id":"","url":"https://api.github.com/users/Project-OSRM","html_url":"https://github.com/Project-OSRM","followers_url":"https://api.github.com/users/Project-OSRM/followers","following_url":"https://api.github.com/users/Project-OSRM/following{/other_user}","gists_url":"https://api.github.com/users/Project-OSRM/gists{/gist_id}","starred_url":"https://api.github.com/users/Project-OSRM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Project-OSRM/subscriptions","organizations_url":"https://api.github.com/users/Project-OSRM/orgs","repos_url":"https://api.github.com/users/Project-OSRM/repos","events_url":"https://api.github.com/users/Project-OSRM/events{/privacy}","received_events_url":"https://api.github.com/users/Project-OSRM/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Project-OSRM/osrm-backend","description":"Project OSRM: C++ backend","fork":false,"url":"https://api.github.com/repos/Project-OSRM/osrm-backend","forks_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/forks","keys_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/teams","hooks_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/hooks","issue_events_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/events{/number}","events_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/events","assignees_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/assignees{/user}","branches_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/branches{/branch}","tags_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/tags","blobs_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/languages","stargazers_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/stargazers","contributors_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/contributors","subscribers_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/subscribers","subscription_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/subscription","commits_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/contents/{+path}","compare_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/merges","archive_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/downloads","issues_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues{/number}","pulls_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/labels{/name}","releases_url":"https://api.github.com/repos/Project-OSRM/osrm-backend/releases{/id}","created_at":"2011-09-22T10:05:08Z","updated_at":"2015-08-28T13:00:36Z","pushed_at":"2015-08-28T10:42:29Z","git_url":"git://github.com/Project-OSRM/osrm-backend.git","ssh_url":"git@github.com:Project-OSRM/osrm-backend.git","clone_url":"https://github.com/Project-OSRM/osrm-backend.git","svn_url":"https://github.com/Project-OSRM/osrm-backend","homepage":"http://map.project-osrm.org","size":23798,"stargazers_count":871,"watchers_count":871,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":325,"mirror_url":null,"open_issues_count":216,"forks":325,"open_issues":216,"watchers":871,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/1610"},"html":{"href":"https://github.com/Project-OSRM/osrm-backend/pull/1610"},"issue":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/1610"},"comments":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/issues/1610/comments"},"review_comments":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/1610/comments"},"review_comment":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/pulls/1610/commits"},"statuses":{"href":"https://api.github.com/repos/Project-OSRM/osrm-backend/statuses/af5bf3a4b2b01e08c6ec9c741936bfeaa3f8d241"}}}}