diff --git a/data_structures/route_parameters.cpp b/data_structures/route_parameters.cpp index e48d246eb..52e900ec6 100644 --- a/data_structures/route_parameters.cpp +++ b/data_structures/route_parameters.cpp @@ -122,10 +122,6 @@ void RouteParameters::setLanguage(const std::string &language_string) language = language_string; } -void RouteParameters::setTripAlgo(const std::string &trip_algo_string) -{ - trip_algo = trip_algo_string; -} void RouteParameters::setGeometryFlag(const bool flag) { geometry = flag; } diff --git a/include/osrm/route_parameters.hpp b/include/osrm/route_parameters.hpp index 5f5e09f80..5e16b919f 100644 --- a/include/osrm/route_parameters.hpp +++ b/include/osrm/route_parameters.hpp @@ -81,8 +81,6 @@ struct RouteParameters void getCoordinatesFromGeometry(const std::string geometry_string); - void setTripAlgo(const std::string &trip_algo); - short zoom_level; bool print_instructions; bool alternate_route; @@ -99,7 +97,6 @@ struct RouteParameters std::string output_format; std::string jsonp_parameter; std::string language; - std::string trip_algo; std::vector hints; std::vector timestamps; std::vector uturns; diff --git a/plugins/trip.hpp b/plugins/trip.hpp index f2cc89dca..1ae6bc57a 100644 --- a/plugins/trip.hpp +++ b/plugins/trip.hpp @@ -270,21 +270,10 @@ template class RoundTripPlugin final : public BasePlugin NodeIDIterator start = std::begin(scc.component) + scc.range[k]; NodeIDIterator end = std::begin(scc.component) + scc.range[k+1]; - // Compute the Trip with the given algorithm - if (route_parameters.trip_algo == "BF" && route_parameters.coordinates.size() < BF_MAX_FEASABLE) { - SimpleLogger().Write() << "Running brute force"; + if (component_size < BF_MAX_FEASABLE) { scc_route = osrm::trip::BruteForceTrip(start, end, number_of_locations, result_table); route_result.push_back(scc_route); - } else if (route_parameters.trip_algo == "NN") { - SimpleLogger().Write() << "Running nearest neighbour"; - scc_route = osrm::trip::NearestNeighbourTrip(start, end, number_of_locations, result_table); - route_result.push_back(scc_route); - } else if (route_parameters.trip_algo == "FI") { - SimpleLogger().Write() << "Running farthest insertion"; - scc_route = osrm::trip::FarthestInsertionTrip(start, end, number_of_locations, result_table); - route_result.push_back(scc_route); - } else{ - SimpleLogger().Write() << "Running farthest insertion"; + } else { scc_route = osrm::trip::FarthestInsertionTrip(start, end, number_of_locations, result_table); route_result.push_back(scc_route); } diff --git a/routing_algorithms/trip_brute_force.hpp b/routing_algorithms/trip_brute_force.hpp index 24319d583..0bd1c725c 100644 --- a/routing_algorithms/trip_brute_force.hpp +++ b/routing_algorithms/trip_brute_force.hpp @@ -55,11 +55,11 @@ namespace trip // computes the distance of a given permutation EdgeWeight ReturnDistance(const DistTableWrapper & dist_table, const std::vector & location_order, - const EdgeWeight min_route_dist, - const std::size_t component_size) { + const EdgeWeight & min_route_dist, + const std::size_t & component_size) { EdgeWeight route_dist = 0; std::size_t i = 0; - while (i < location_order.size()) { + while (i < location_order.size() && (route_dist < min_route_dist)) { route_dist += dist_table(location_order[i], location_order[(i+1) % component_size]); ++i; } diff --git a/server/api_grammar.hpp b/server/api_grammar.hpp index e775c2e88..325f4c356 100644 --- a/server/api_grammar.hpp +++ b/server/api_grammar.hpp @@ -42,7 +42,7 @@ template struct APIGrammar : qi::grammar> -(uturns); query = ('?') >> (+(zoom | output | jsonp | checksum | location | hint | timestamp | u | cmp | language | instruction | geometry | alt_route | old_API | num_results | - matching_beta | gps_precision | classify | trip_algo | locs)); + matching_beta | gps_precision | classify | locs)); zoom = (-qi::lit('&')) >> qi::lit('z') >> '=' >> qi::short_[boost::bind(&HandlerT::setZoomLevel, handler, ::_1)]; @@ -85,8 +85,6 @@ template struct APIGrammar : qi::grammar> qi::lit("locs") >> '=' >> stringforPolyline[boost::bind(&HandlerT::getCoordinatesFromGeometry, handler, ::_1)]; - trip_algo = (-qi::lit('&')) >> qi::lit("trip_algo") >> '=' >> - string[boost::bind(&HandlerT::setTripAlgo, handler, ::_1)]; string = +(qi::char_("a-zA-Z")); stringwithDot = +(qi::char_("a-zA-Z0-9_.-")); @@ -98,7 +96,7 @@ template struct APIGrammar : qi::grammar api_call, query; qi::rule service, zoom, output, string, jsonp, checksum, location, hint, timestamp, stringwithDot, stringwithPercent, language, instruction, geometry, cmp, alt_route, u, - uturns, old_API, num_results, matching_beta, gps_precision, classify, locs, stringforPolyline, trip_algo; + uturns, old_API, num_results, matching_beta, gps_precision, classify, locs, stringforPolyline; HandlerT *handler; };