remove possibility to choose algorithm but only use brute force and farthest insertion
This commit is contained in:
parent
e6eea67eeb
commit
e773a80b06
@ -122,10 +122,6 @@ void RouteParameters::setLanguage(const std::string &language_string)
|
|||||||
language = 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; }
|
void RouteParameters::setGeometryFlag(const bool flag) { geometry = flag; }
|
||||||
|
|
||||||
|
@ -81,8 +81,6 @@ struct RouteParameters
|
|||||||
|
|
||||||
void getCoordinatesFromGeometry(const std::string geometry_string);
|
void getCoordinatesFromGeometry(const std::string geometry_string);
|
||||||
|
|
||||||
void setTripAlgo(const std::string &trip_algo);
|
|
||||||
|
|
||||||
short zoom_level;
|
short zoom_level;
|
||||||
bool print_instructions;
|
bool print_instructions;
|
||||||
bool alternate_route;
|
bool alternate_route;
|
||||||
@ -99,7 +97,6 @@ struct RouteParameters
|
|||||||
std::string output_format;
|
std::string output_format;
|
||||||
std::string jsonp_parameter;
|
std::string jsonp_parameter;
|
||||||
std::string language;
|
std::string language;
|
||||||
std::string trip_algo;
|
|
||||||
std::vector<std::string> hints;
|
std::vector<std::string> hints;
|
||||||
std::vector<unsigned> timestamps;
|
std::vector<unsigned> timestamps;
|
||||||
std::vector<bool> uturns;
|
std::vector<bool> uturns;
|
||||||
|
@ -270,21 +270,10 @@ template <class DataFacadeT> class RoundTripPlugin final : public BasePlugin
|
|||||||
NodeIDIterator start = std::begin(scc.component) + scc.range[k];
|
NodeIDIterator start = std::begin(scc.component) + scc.range[k];
|
||||||
NodeIDIterator end = std::begin(scc.component) + scc.range[k+1];
|
NodeIDIterator end = std::begin(scc.component) + scc.range[k+1];
|
||||||
|
|
||||||
// Compute the Trip with the given algorithm
|
if (component_size < BF_MAX_FEASABLE) {
|
||||||
if (route_parameters.trip_algo == "BF" && route_parameters.coordinates.size() < BF_MAX_FEASABLE) {
|
|
||||||
SimpleLogger().Write() << "Running brute force";
|
|
||||||
scc_route = osrm::trip::BruteForceTrip(start, end, number_of_locations, result_table);
|
scc_route = osrm::trip::BruteForceTrip(start, end, number_of_locations, result_table);
|
||||||
route_result.push_back(scc_route);
|
route_result.push_back(scc_route);
|
||||||
} else if (route_parameters.trip_algo == "NN") {
|
} else {
|
||||||
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";
|
|
||||||
scc_route = osrm::trip::FarthestInsertionTrip(start, end, number_of_locations, result_table);
|
scc_route = osrm::trip::FarthestInsertionTrip(start, end, number_of_locations, result_table);
|
||||||
route_result.push_back(scc_route);
|
route_result.push_back(scc_route);
|
||||||
}
|
}
|
||||||
|
@ -55,11 +55,11 @@ namespace trip
|
|||||||
// computes the distance of a given permutation
|
// computes the distance of a given permutation
|
||||||
EdgeWeight ReturnDistance(const DistTableWrapper<EdgeWeight> & dist_table,
|
EdgeWeight ReturnDistance(const DistTableWrapper<EdgeWeight> & dist_table,
|
||||||
const std::vector<NodeID> & location_order,
|
const std::vector<NodeID> & location_order,
|
||||||
const EdgeWeight min_route_dist,
|
const EdgeWeight & min_route_dist,
|
||||||
const std::size_t component_size) {
|
const std::size_t & component_size) {
|
||||||
EdgeWeight route_dist = 0;
|
EdgeWeight route_dist = 0;
|
||||||
std::size_t i = 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]);
|
route_dist += dist_table(location_order[i], location_order[(i+1) % component_size]);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ template <typename Iterator, class HandlerT> struct APIGrammar : qi::grammar<Ite
|
|||||||
*(query) >> -(uturns);
|
*(query) >> -(uturns);
|
||||||
query = ('?') >> (+(zoom | output | jsonp | checksum | location | hint | timestamp | u | cmp |
|
query = ('?') >> (+(zoom | output | jsonp | checksum | location | hint | timestamp | u | cmp |
|
||||||
language | instruction | geometry | alt_route | old_API | num_results |
|
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') >> '=' >>
|
zoom = (-qi::lit('&')) >> qi::lit('z') >> '=' >>
|
||||||
qi::short_[boost::bind(&HandlerT::setZoomLevel, handler, ::_1)];
|
qi::short_[boost::bind(&HandlerT::setZoomLevel, handler, ::_1)];
|
||||||
@ -85,8 +85,6 @@ template <typename Iterator, class HandlerT> struct APIGrammar : qi::grammar<Ite
|
|||||||
qi::bool_[boost::bind(&HandlerT::setClassify, handler, ::_1)];
|
qi::bool_[boost::bind(&HandlerT::setClassify, handler, ::_1)];
|
||||||
locs = (-qi::lit('&')) >> qi::lit("locs") >> '=' >>
|
locs = (-qi::lit('&')) >> qi::lit("locs") >> '=' >>
|
||||||
stringforPolyline[boost::bind(&HandlerT::getCoordinatesFromGeometry, handler, ::_1)];
|
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"));
|
string = +(qi::char_("a-zA-Z"));
|
||||||
stringwithDot = +(qi::char_("a-zA-Z0-9_.-"));
|
stringwithDot = +(qi::char_("a-zA-Z0-9_.-"));
|
||||||
@ -98,7 +96,7 @@ template <typename Iterator, class HandlerT> struct APIGrammar : qi::grammar<Ite
|
|||||||
qi::rule<Iterator> api_call, query;
|
qi::rule<Iterator> api_call, query;
|
||||||
qi::rule<Iterator, std::string()> service, zoom, output, string, jsonp, checksum, location,
|
qi::rule<Iterator, std::string()> service, zoom, output, string, jsonp, checksum, location,
|
||||||
hint, timestamp, stringwithDot, stringwithPercent, language, instruction, geometry, cmp, alt_route, u,
|
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;
|
HandlerT *handler;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user