From 269f34e60732890dd5978685be57a3e705794fb4 Mon Sep 17 00:00:00 2001 From: Derick M <58572875+TurtIeSocks@users.noreply.github.com> Date: Wed, 22 Nov 2023 17:23:55 -0500 Subject: [PATCH] fix: slight adjustment to the time determination equation --- or-tools/tsp/tsp.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/or-tools/tsp/tsp.cc b/or-tools/tsp/tsp.cc index ca9ad5ea..cbb7af13 100644 --- a/or-tools/tsp/tsp.cc +++ b/or-tools/tsp/tsp.cc @@ -117,12 +117,13 @@ namespace operations_research searchParameters.set_first_solution_strategy( FirstSolutionStrategy::PATH_CHEAPEST_ARC); - if (locations.size() > 500) + if (locations.size() > 1000) { searchParameters.set_local_search_metaheuristic( LocalSearchMetaheuristic::GUIDED_LOCAL_SEARCH); - const int64_t time = floor(locations.size() / 100); + const int64_t time = std::min(pow(locations.size() / 1000, 2.75), 3600.0); searchParameters.mutable_time_limit()->set_seconds(time); + // LOG(INFO) << "Time limit: " << time; } // searchParameters.set_log_search(true);