tune routing ls
This commit is contained in:
@@ -456,6 +456,9 @@ class RoutingCPSatWrapper : public RoutingLinearSolverWrapper {
|
||||
// significantly faster than both full presolve and no presolve.
|
||||
parameters_.set_cp_model_presolve(true);
|
||||
parameters_.set_max_presolve_iterations(1);
|
||||
parameters_.set_cp_model_probing_level(0);
|
||||
parameters_.set_use_sat_inprocessing(false);
|
||||
parameters_.set_symmetry_level(0);
|
||||
parameters_.set_catch_sigint_signal(false);
|
||||
parameters_.set_mip_max_bound(1e8);
|
||||
parameters_.set_search_branching(sat::SatParameters::LP_SEARCH);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
@@ -4770,10 +4771,13 @@ void RoutingModel::CreateNeighborhoodOperators(
|
||||
CreateCPOperator<ExtendedSwapActiveOperator>();
|
||||
std::vector<std::vector<int64_t>> alternative_sets(disjunctions_.size());
|
||||
for (const RoutingModel::Disjunction& disjunction : disjunctions_) {
|
||||
// Only add disjunctions of cardinality 1, as
|
||||
// Only add disjunctions of cardinality 1 and of size > 1, as
|
||||
// SwapActiveToShortestPathOperator and TwoOptWithShortestPathOperator only
|
||||
// support DAGs.
|
||||
if (disjunction.value.max_cardinality == 1) {
|
||||
// support DAGs, and don't care about chain-DAGS.
|
||||
// TODO(user): Optimize TwoOptWithShortestPathOperator to skip DAG-less
|
||||
// chains.
|
||||
if (disjunction.value.max_cardinality == 1 &&
|
||||
disjunction.indices.size() > 1) {
|
||||
alternative_sets.push_back(disjunction.indices);
|
||||
}
|
||||
}
|
||||
@@ -4992,6 +4996,11 @@ LocalSearchOperator* RoutingModel::GetNeighborhoodOperators(
|
||||
CP_ROUTING_PUSH_OPERATOR(TWO_OPT, two_opt);
|
||||
CP_ROUTING_PUSH_OPERATOR(OR_OPT, or_opt);
|
||||
CP_ROUTING_PUSH_OPERATOR(RELOCATE_EXPENSIVE_CHAIN, relocate_expensive_chain);
|
||||
size_t max_alternative_set_size = 0;
|
||||
for (const RoutingModel::Disjunction& disjunction : disjunctions_) {
|
||||
max_alternative_set_size =
|
||||
std::max(max_alternative_set_size, disjunction.indices.size());
|
||||
}
|
||||
if (!disjunctions_.empty()) {
|
||||
CP_ROUTING_PUSH_OPERATOR(MAKE_INACTIVE, make_inactive);
|
||||
CP_ROUTING_PUSH_OPERATOR(MAKE_CHAIN_INACTIVE, make_chain_inactive);
|
||||
@@ -5007,9 +5016,11 @@ LocalSearchOperator* RoutingModel::GetNeighborhoodOperators(
|
||||
CP_ROUTING_PUSH_OPERATOR(SWAP_ACTIVE, swap_active);
|
||||
CP_ROUTING_PUSH_OPERATOR(SWAP_ACTIVE_CHAIN, swap_active_chain);
|
||||
CP_ROUTING_PUSH_OPERATOR(EXTENDED_SWAP_ACTIVE, extended_swap_active);
|
||||
CP_ROUTING_PUSH_OPERATOR(SHORTEST_PATH_SWAP_ACTIVE,
|
||||
shortest_path_swap_active);
|
||||
CP_ROUTING_PUSH_OPERATOR(SHORTEST_PATH_TWO_OPT, shortest_path_two_opt);
|
||||
if (max_alternative_set_size > 1) {
|
||||
CP_ROUTING_PUSH_OPERATOR(SHORTEST_PATH_SWAP_ACTIVE,
|
||||
shortest_path_swap_active);
|
||||
CP_ROUTING_PUSH_OPERATOR(SHORTEST_PATH_TWO_OPT, shortest_path_two_opt);
|
||||
}
|
||||
}
|
||||
LocalSearchOperator* main_operator_group =
|
||||
ConcatenateOperators(search_parameters, operators);
|
||||
|
||||
Reference in New Issue
Block a user