1// Copyright 2010-2025 Google LLC
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
6// http://www.apache.org/licenses/LICENSE-2.0
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
14// Protocol buffer used to parametrize the routing library, in particular the
15// search parameters such as first solution heuristics and local search
20option java_package = "com.google.ortools.constraintsolver";
21option java_multiple_files = true;
22option csharp_namespace = "Google.OrTools.ConstraintSolver";
24import "google/protobuf/duration.proto";
25import "ortools/constraint_solver/routing_enums.proto";
26import "ortools/constraint_solver/routing_heuristic_parameters.proto";
27import "ortools/constraint_solver/routing_ils.proto";
28import "ortools/constraint_solver/solver_parameters.proto";
29import "ortools/sat/sat_parameters.proto";
30import "ortools/util/optional_boolean.proto";
32package operations_research;
34// Parameters defining the search used to solve vehicle routing problems.
36// If a parameter is unset (or, equivalently, set to its default value),
37// then the routing library will pick its preferred value for that parameter
38// automatically: this should be the case for most parameters.
39// To see those "default" parameters, call GetDefaultRoutingSearchParameters().
41message RoutingSearchParameters {
42 reserved 14, 15, 16, 18, 19, 21, 23, 31, 40, 44, 45, 46, 49, 55, 65, 67;
44 // First solution strategies, used as starting point of local search.
45 FirstSolutionStrategy.Value first_solution_strategy = 1;
47 // --- Advanced first solutions strategy settings ---
48 // Don't touch these unless you know what you are doing.
50 // Use filtered version of first solution strategy if available.
51 bool use_unfiltered_first_solution_strategy = 2;
53 // Parameters for the Savings heuristic.
54 SavingsParameters savings_parameters = 70;
56 // Parameters for the global cheapest insertion heuristic when used as first
57 // solution heuristic.
58 GlobalCheapestInsertionParameters
59 global_cheapest_insertion_first_solution_parameters = 71;
61 // Parameters for the global cheapest insertion heuristic when
62 // used in a local search operator (see
63 // local_search_operators.use_global_cheapest_insertion_path_lns and
64 // local_search_operators.use_global_cheapest_insertion_chain_lns below).
65 GlobalCheapestInsertionParameters
66 global_cheapest_insertion_ls_operator_parameters = 72;
68 // Parameters for the local cheapest insertion heuristic.
69 LocalCheapestInsertionParameters local_cheapest_insertion_parameters = 68;
71 // Parameters for the local cheapest cost insertion heuristic.
72 LocalCheapestInsertionParameters local_cheapest_cost_insertion_parameters =
75 // If true use minimum matching instead of minimal matching in the
76 // Christofides algorithm.
77 bool christofides_use_minimum_matching = 30;
79 // If non zero, a period p indicates that every p node insertions or additions
80 // to a path, an optimization of the current partial solution will be
81 // performed. As of 12/2023:
82 // - this requires that a secondary routing model has been passed to the main
84 // - this is only supported by LOCAL_CHEAPEST_INSERTION and
85 // LOCAL_CHEAPEST_COST_INSERTION.
86 int32 first_solution_optimization_period = 59;
88 // Local search neighborhood operators used to build a solutions neighborhood.
90 message LocalSearchNeighborhoodOperators {
91 // --- Inter-route operators ---
92 // Operator which moves a single node to another position.
93 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 -> 5
94 // (where (1, 5) are first and last nodes of the path and can therefore not
96 // 1 -> 3 -> [2] -> 4 -> 5
97 // 1 -> 3 -> 4 -> [2] -> 5
98 // 1 -> 2 -> 4 -> [3] -> 5
99 // 1 -> [4] -> 2 -> 3 -> 5
100 OptionalBoolean use_relocate = 1;
101 // Operator which moves a pair of pickup and delivery nodes to another
102 // position where the first node of the pair must be before the second node
103 // on the same path. Compared to the light_relocate_pair operator, tries all
104 // possible positions of insertion of a pair (not only after another pair).
105 // Possible neighbors for the path 1 -> A -> B -> 2 -> 3 (where (1, 3) are
106 // first and last nodes of the path and can therefore not be moved, and
107 // (A, B) is a pair of nodes):
108 // 1 -> [A] -> 2 -> [B] -> 3
109 // 1 -> 2 -> [A] -> [B] -> 3
110 OptionalBoolean use_relocate_pair = 2;
111 // Operator which moves a pair of pickup and delivery nodes after another
113 // Possible neighbors for paths 1 -> A -> B -> 2, 3 -> C -> D -> 4 (where
114 // (1, 2) and (3, 4) are first and last nodes of paths and can therefore not
115 // be moved, and (A, B) and (C, D) are pair of nodes):
116 // 1 -> 2, 3 -> C -> [A] -> D -> [B] -> 4
117 // 1 -> A -> [C] -> B -> [D] -> 2, 3 -> 4
118 OptionalBoolean use_light_relocate_pair = 24;
119 // Relocate neighborhood which moves chains of neighbors.
120 // The operator starts by relocating a node n after a node m, then continues
121 // moving nodes which were after n as long as the "cost" added is less than
122 // the "cost" of the arc (m, n). If the new chain doesn't respect the domain
123 // of next variables, it will try reordering the nodes until it finds a
125 // Possible neighbors for path 1 -> A -> B -> C -> D -> E -> 2 (where (1, 2)
126 // are first and last nodes of the path and can therefore not be moved, A
127 // must be performed before B, and A, D and E are located at the same
129 // 1 -> A -> C -> [B] -> D -> E -> 2
130 // 1 -> A -> C -> D -> [B] -> E -> 2
131 // 1 -> A -> C -> D -> E -> [B] -> 2
132 // 1 -> A -> B -> D -> [C] -> E -> 2
133 // 1 -> A -> B -> D -> E -> [C] -> 2
134 // 1 -> A -> [D] -> [E] -> B -> C -> 2
135 // 1 -> A -> B -> [D] -> [E] -> C -> 2
136 // 1 -> A -> [E] -> B -> C -> D -> 2
137 // 1 -> A -> B -> [E] -> C -> D -> 2
138 // 1 -> A -> B -> C -> [E] -> D -> 2
139 // This operator is extremely useful to move chains of nodes which are
140 // located at the same place (for instance nodes part of a same stop).
141 OptionalBoolean use_relocate_neighbors = 3;
142 // Relocate neighborhood that moves subpaths all pickup and delivery
143 // pairs have both pickup and delivery inside the subpath or both outside
144 // the subpath. For instance, for given paths:
145 // 0 -> A -> B -> A' -> B' -> 5 -> 6 -> 8
147 // Pairs (A,A') and (B,B') are interleaved, so the expected neighbors are:
148 // 0 -> 5 -> A -> B -> A' -> B' -> 6 -> 8
151 // 0 -> 5 -> 6 -> A -> B -> A' -> B' -> 8
155 // 7 -> A -> B -> A' -> B' -> 9
156 OptionalBoolean use_relocate_subtrip = 25;
157 // Operator which exchanges the positions of two nodes.
158 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 -> 5
159 // (where (1, 5) are first and last nodes of the path and can therefore not
161 // 1 -> [3] -> [2] -> 4 -> 5
162 // 1 -> [4] -> 3 -> [2] -> 5
163 // 1 -> 2 -> [4] -> [3] -> 5
164 OptionalBoolean use_exchange = 4;
165 // Operator which exchanges the positions of two pair of nodes. Pairs
166 // correspond to the pickup and delivery pairs defined in the routing model.
167 // Possible neighbor for the paths
168 // 1 -> A -> B -> 2 -> 3 and 4 -> C -> D -> 5
169 // (where (1, 3) and (4, 5) are first and last nodes of the paths and can
170 // therefore not be moved, and (A, B) and (C,D) are pairs of nodes):
171 // 1 -> [C] -> [D] -> 2 -> 3, 4 -> [A] -> [B] -> 5
172 OptionalBoolean use_exchange_pair = 22;
173 // Operator which exchanges subtrips associated to two pairs of nodes,
174 // see use_relocate_subtrip for a definition of subtrips.
175 OptionalBoolean use_exchange_subtrip = 26;
176 // Operator which cross exchanges the starting chains of 2 paths, including
177 // exchanging the whole paths.
178 // First and last nodes are not moved.
179 // Possible neighbors for the paths 1 -> 2 -> 3 -> 4 -> 5 and 6 -> 7 -> 8
180 // (where (1, 5) and (6, 8) are first and last nodes of the paths and can
181 // therefore not be moved):
182 // 1 -> [7] -> 3 -> 4 -> 5 6 -> [2] -> 8
183 // 1 -> [7] -> 4 -> 5 6 -> [2 -> 3] -> 8
184 // 1 -> [7] -> 5 6 -> [2 -> 3 -> 4] -> 8
185 OptionalBoolean use_cross = 5;
186 // Not implemented yet. TODO(b/68128619): Implement.
187 OptionalBoolean use_cross_exchange = 6;
188 // Operator which detects the relocate_expensive_chain_num_arcs_to_consider
189 // most expensive arcs on a path, and moves the chain resulting from cutting
190 // pairs of arcs among these to another position.
191 // Possible neighbors for paths 1 -> 2 (empty) and
192 // 3 -> A ------> B --> C -----> D -> 4 (where A -> B and C -> D are the 2
193 // most expensive arcs, and the chain resulting from breaking them is
195 // 1 -> [B -> C] -> 2 3 -> A -> D -> 4
196 // 1 -> 2 3 -> [B -> C] -> A -> D -> 4
197 // 1 -> 2 3 -> A -> D -> [B -> C] -> 4
198 OptionalBoolean use_relocate_expensive_chain = 23;
199 // --- Intra-route operators ---
200 // Operator which reverses a subchain of a path. It is called TwoOpt
201 // because it breaks two arcs on the path; resulting paths are called
203 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 -> 5
204 // (where (1, 5) are first and last nodes of the path and can therefore not
206 // 1 -> [3 -> 2] -> 4 -> 5
207 // 1 -> [4 -> 3 -> 2] -> 5
208 // 1 -> 2 -> [4 -> 3] -> 5
209 OptionalBoolean use_two_opt = 7;
210 // Operator which moves sub-chains of a path of length 1, 2 and 3 to another
211 // position in the same path.
212 // When the length of the sub-chain is 1, the operator simply moves a node
213 // to another position.
214 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 -> 5, for a sub-chain
215 // length of 2 (where (1, 5) are first and last nodes of the path and can
216 // therefore not be moved):
217 // 1 -> 4 -> [2 -> 3] -> 5
218 // 1 -> [3 -> 4] -> 2 -> 5
219 // The OR_OPT operator is a limited version of 3-Opt (breaks 3 arcs on a
221 OptionalBoolean use_or_opt = 8;
222 // Lin-Kernighan operator.
223 // While the accumulated local gain is positive, performs a 2-OPT or a 3-OPT
224 // move followed by a series of 2-OPT moves. Returns a neighbor for which
225 // the global gain is positive.
226 OptionalBoolean use_lin_kernighan = 9;
227 // Sliding TSP operator.
228 // Uses an exact dynamic programming algorithm to solve the TSP
229 // corresponding to path sub-chains.
230 // For a subchain 1 -> 2 -> 3 -> 4 -> 5 -> 6, solves the TSP on
231 // nodes A, 2, 3, 4, 5, where A is a merger of nodes 1 and 6 such that
232 // cost(A,i) = cost(1,i) and cost(i,A) = cost(i,6).
233 OptionalBoolean use_tsp_opt = 10;
234 // --- Operators on inactive nodes ---
235 // Operator which inserts an inactive node into a path.
236 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 with 5 inactive
237 // (where 1 and 4 are first and last nodes of the path) are:
238 // 1 -> [5] -> 2 -> 3 -> 4
239 // 1 -> 2 -> [5] -> 3 -> 4
240 // 1 -> 2 -> 3 -> [5] -> 4
241 OptionalBoolean use_make_active = 11;
242 // Operator which relocates a node while making an inactive one active.
243 // As of 3/2017, the operator is limited to two kinds of moves:
244 // - Relocating a node and replacing it by an inactive node.
245 // Possible neighbor for path 1 -> 5, 2 -> 3 -> 6 and 4 inactive
246 // (where 1,2 and 5,6 are first and last nodes of paths) is:
247 // 1 -> 3 -> 5, 2 -> 4 -> 6.
248 // - Relocating a node and inserting an inactive node next to it.
249 // Possible neighbor for path 1 -> 5, 2 -> 3 -> 6 and 4 inactive
250 // (where 1,2 and 5,6 are first and last nodes of paths) is:
251 // 1 -> 4 -> 3 -> 5, 2 -> 6.
252 OptionalBoolean use_relocate_and_make_active = 21;
253 // Operator which exchanges two nodes and inserts an inactive node.
254 // Possible neighbors for paths 0 -> 2 -> 4, 1 -> 3 -> 6 and 5 inactive are:
255 // 0 -> 3 -> 4, 1 -> 5 -> 2 -> 6
256 // 0 -> 3 -> 5 -> 4, 1 -> 2 -> 6
257 // 0 -> 5 -> 3 -> 4, 1 -> 2 -> 6
258 // 0 -> 3 -> 4, 1 -> 2 -> 5 -> 6
259 OptionalBoolean use_exchange_and_make_active = 37;
260 // Operator which exchanges the first and last nodes of two paths and makes
262 // Possible neighbors for paths 0 -> 1 -> 2 -> 7, 6 -> 3 -> 4 -> 8
263 // and 5 inactive are:
264 // 0 -> 5 -> 3 -> 4 -> 7, 6 -> 1 -> 2 -> 8
265 // 0 -> 3 -> 4 -> 7, 6 -> 1 -> 5 -> 2 -> 8
266 // 0 -> 3 -> 4 -> 7, 6 -> 1 -> 2 -> 5 -> 8
267 // 0 -> 3 -> 5 -> 4 -> 7, 6 -> 1 -> 2 -> 8
268 // 0 -> 3 -> 4 -> 5 -> 7, 6 -> 1 -> 2 -> 8
269 OptionalBoolean use_exchange_path_start_ends_and_make_active = 38;
270 // Operator which makes path nodes inactive.
271 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 (where 1 and 4 are first
272 // and last nodes of the path) are:
273 // 1 -> 3 -> 4 with 2 inactive
274 // 1 -> 2 -> 4 with 3 inactive
275 OptionalBoolean use_make_inactive = 12;
276 // Operator which makes a "chain" of path nodes inactive.
277 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 (where 1 and 4 are first
278 // and last nodes of the path) are:
279 // 1 -> 3 -> 4 with 2 inactive
280 // 1 -> 2 -> 4 with 3 inactive
281 // 1 -> 4 with 2 and 3 inactive
282 OptionalBoolean use_make_chain_inactive = 13;
283 // Operator which replaces an active node by an inactive one.
284 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 with 5 inactive
285 // (where 1 and 4 are first and last nodes of the path) are:
286 // 1 -> [5] -> 3 -> 4 with 2 inactive
287 // 1 -> 2 -> [5] -> 4 with 3 inactive
288 OptionalBoolean use_swap_active = 14;
289 // Operator which replaces a chain of active nodes by an inactive one.
290 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 with 5 inactive
291 // (where 1 and 4 are first and last nodes of the path) are:
292 // 1 -> [5] -> 3 -> 4 with 2 inactive
293 // 1 -> 2 -> [5] -> 4 with 3 inactive
294 // 1 -> [5] -> 4 with 2 and 3 inactive
295 OptionalBoolean use_swap_active_chain = 35;
296 // Operator which makes an inactive node active and an active one inactive.
297 // It is similar to SwapActiveOperator excepts that it tries to insert the
298 // inactive node in all possible positions instead of just the position of
299 // the node made inactive.
300 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 with 5 inactive
301 // (where 1 and 4 are first and last nodes of the path) are:
302 // 1 -> [5] -> 3 -> 4 with 2 inactive
303 // 1 -> 3 -> [5] -> 4 with 2 inactive
304 // 1 -> [5] -> 2 -> 4 with 3 inactive
305 // 1 -> 2 -> [5] -> 4 with 3 inactive
306 OptionalBoolean use_extended_swap_active = 15;
307 // Swaps active nodes from node alternatives in sequence. Considers chains
308 // of nodes with alternatives, builds a DAG from the chain, each "layer" of
309 // the DAG being composed of the set of alternatives of the node at a given
310 // rank in the chain, fully connected to the next layer. A neighbor is built
311 // from the shortest path starting from the node before the chain (source),
312 // through the DAG to the node following the chain.
313 OptionalBoolean use_shortest_path_swap_active = 34;
314 // Similar to use_two_opt but returns the shortest path on the DAG of node
315 // alternatives of the reversed chain (cf. use_shortest_path_swap_active).
316 OptionalBoolean use_shortest_path_two_opt = 36;
317 // Operator which makes an inactive node active and an active pair of nodes
318 // inactive OR makes an inactive pair of nodes active and an active node
320 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 with 5 inactive
321 // (where 1 and 4 are first and last nodes of the path and (2,3) is a pair
323 // 1 -> [5] -> 4 with (2,3) inactive
324 // Possible neighbors for the path 1 -> 2 -> 3 with (4,5) inactive
325 // (where 1 and 3 are first and last nodes of the path and (4,5) is a pair
327 // 1 -> [4] -> [5] -> 3 with 2 inactive
328 OptionalBoolean use_node_pair_swap_active = 20;
329 // --- Large neighborhood search operators ---
330 // Operator which relaxes two sub-chains of three consecutive arcs each.
331 // Each sub-chain is defined by a start node and the next three arcs. Those
332 // six arcs are relaxed to build a new neighbor.
333 // PATH_LNS explores all possible pairs of starting nodes and so defines
334 // n^2 neighbors, n being the number of nodes.
335 // Note that the two sub-chains can be part of the same path; they even may
337 OptionalBoolean use_path_lns = 16;
338 // Operator which relaxes one entire path and all inactive nodes.
339 OptionalBoolean use_full_path_lns = 17;
341 // Randomly merges consecutive nodes until n "meta"-nodes remain and solves
342 // the corresponding TSP.
343 // This defines an "unlimited" neighborhood which must be stopped by search
344 // limits. To force diversification, the operator iteratively forces each
345 // node to serve as base of a meta-node.
346 OptionalBoolean use_tsp_lns = 18;
347 // Operator which relaxes all inactive nodes and one sub-chain of six
348 // consecutive arcs. That way the path can be improved by inserting inactive
349 // nodes or swapping arcs.
350 OptionalBoolean use_inactive_lns = 19;
351 // --- LNS-like large neighborhood search operators using heuristics ---
352 // Operator which makes all nodes on a route unperformed, and reinserts them
353 // using the GlobalCheapestInsertion heuristic.
354 OptionalBoolean use_global_cheapest_insertion_path_lns = 27;
355 // Same as above but using LocalCheapestInsertion as a heuristic.
356 OptionalBoolean use_local_cheapest_insertion_path_lns = 28;
357 // The following operator relocates an entire route to an empty path and
358 // then tries to insert the unperformed nodes using the global cheapest
359 // insertion heuristic.
361 use_relocate_path_global_cheapest_insertion_insert_unperformed = 33;
362 // This operator finds heuristic_expensive_chain_lns_num_arcs_to_consider
363 // most expensive arcs on a route, makes the nodes in between pairs of these
364 // expensive arcs unperformed, and reinserts them using the
365 // GlobalCheapestInsertion heuristic.
366 OptionalBoolean use_global_cheapest_insertion_expensive_chain_lns = 29;
367 // Same as above but using LocalCheapestInsertion as a heuristic for
369 OptionalBoolean use_local_cheapest_insertion_expensive_chain_lns = 30;
370 // The following operator makes a node and its
371 // heuristic_close_nodes_lns_num_nodes closest neighbors unperformed along
372 // with each of their corresponding performed pickup/delivery pairs, and
373 // then reinserts them using the GlobalCheapestInsertion heuristic.
374 OptionalBoolean use_global_cheapest_insertion_close_nodes_lns = 31;
375 // Same as above, but insertion positions for nodes are determined by the
376 // LocalCheapestInsertion heuristic.
377 OptionalBoolean use_local_cheapest_insertion_close_nodes_lns = 32;
378 // The following operator removes all nodes of a visit type connected
379 // component from their current route and reinserts them to an empty route
380 // using the GlobalCheapestInsertion heuristic.
381 OptionalBoolean use_global_cheapest_insertion_visit_types_lns = 39;
382 // Same as above, but insertion positions for nodes are determined by the
383 // LocalCheapestInsertion heuristic.
384 OptionalBoolean use_local_cheapest_insertion_visit_types_lns = 40;
386 LocalSearchNeighborhoodOperators local_search_operators = 3;
388 // Neighbors ratio and minimum number of neighbors considered in local
389 // search operators (see
390 // GlobalCheapestInsertionParameters.neighbors_ratio and
391 // GlobalCheapestInsertionParameters.min_neighbors for more
393 double ls_operator_neighbors_ratio = 53;
394 int32 ls_operator_min_neighbors = 54;
396 // If true, the solver will use multi-armed bandit concatenate operators. It
397 // dynamically chooses the next neighbor operator in order to get the best
398 // objective improvement.
399 bool use_multi_armed_bandit_concatenate_operators = 41;
401 // Memory coefficient related to the multi-armed bandit compound operator.
402 // Sets how much the objective improvement of previous accepted neighbors
403 // influence the current average improvement.
404 // This parameter should be between 0 and 1.
405 double multi_armed_bandit_compound_operator_memory_coefficient = 42;
407 // Positive parameter defining the exploration coefficient of the multi-armed
408 // bandit compound operator. Sets how often we explore rarely used and
409 // unsuccessful in the past operators
410 double multi_armed_bandit_compound_operator_exploration_coefficient = 43;
412 // Maximum size of the chain to make inactive in SwapActiveChainOperator.
413 int32 max_swap_active_chain_size = 66;
415 // Number of expensive arcs to consider cutting in the RelocateExpensiveChain
416 // neighborhood operator (see
417 // LocalSearchNeighborhoodOperators.use_relocate_expensive_chain()).
418 // This parameter must be greater than 2.
419 // NOTE(user): The number of neighbors generated by the operator for
420 // relocate_expensive_chain_num_arcs_to_consider = K is around
421 // K*(K-1)/2 * number_of_routes * number_of_nodes.
422 int32 relocate_expensive_chain_num_arcs_to_consider = 20;
424 // Number of expensive arcs to consider cutting in the
425 // FilteredHeuristicExpensiveChainLNSOperator operator.
426 int32 heuristic_expensive_chain_lns_num_arcs_to_consider = 32;
428 // Number of closest nodes to consider for each node during the destruction
429 // phase of the FilteredHeuristicCloseNodesLNSOperator.
430 int32 heuristic_close_nodes_lns_num_nodes = 35;
432 // Local search metaheuristics used to guide the search.
433 LocalSearchMetaheuristic.Value local_search_metaheuristic = 4;
434 // Local search metaheuristics alternatively used to guide the search. Every
435 // num_max_local_optima_before_metaheuristic_switch local minima found by a
436 // metaheurisitic, the solver will switch to the next metaheuristic. Cannot be
437 // defined if local_search_metaheuristic is different from UNSET or AUTOMATIC.
438 repeated LocalSearchMetaheuristic.Value local_search_metaheuristics = 63;
439 int32 num_max_local_optima_before_metaheuristic_switch = 64;
440 // These are advanced settings which should not be modified unless you know
441 // what you are doing.
442 // Lambda coefficient used to penalize arc costs when GUIDED_LOCAL_SEARCH is
443 // used. Must be positive.
444 double guided_local_search_lambda_coefficient = 5;
445 // Whether to reset penalties when a new best solution is found. The effect is
446 // that a greedy descent is started before the next penalization phase.
447 bool guided_local_search_reset_penalties_on_new_best_solution = 51;
448 // When an arc leaving a vehicle start or arriving at a vehicle end is
449 // penalized, this field controls whether to penalize all other equivalent
450 // arcs with starts or ends in the same vehicle class.
451 bool guided_local_search_penalize_with_vehicle_classes = 61;
452 // Whether to consider arc penalties in cost functions used in local search
453 // operators using arc costs.
454 bool use_guided_local_search_penalties_in_local_search_operators = 62;
456 // --- Search control ---
458 // If true, the solver should use depth-first search rather than local search
459 // to solve the problem.
460 bool use_depth_first_search = 6;
461 // If true, use the CP solver to find a solution. Either local or depth-first
462 // search will be used depending on the value of use_depth_first_search. Will
463 // be run before the CP-SAT solver (cf. use_cp_sat).
464 OptionalBoolean use_cp = 28;
465 // If true, use the CP-SAT solver to find a solution. If use_cp is also true,
466 // the CP-SAT solver will be run after the CP solver if there is time
467 // remaining and will use the CP solution as a hint for the CP-SAT search.
468 // As of 5/2019, only TSP models can be solved.
469 OptionalBoolean use_cp_sat = 27;
470 // If true, use the CP-SAT solver to find a solution on generalized routing
471 // model. If use_cp is also true, the CP-SAT solver will be run after the CP
472 // solver if there is time remaining and will use the CP solution as a hint
473 // for the CP-SAT search.
474 OptionalBoolean use_generalized_cp_sat = 47;
475 // If use_cp_sat or use_generalized_cp_sat is true, contains the SAT algorithm
476 // parameters which will be used.
477 sat.SatParameters sat_parameters = 48;
478 // If use_cp_sat or use_generalized_cp_sat is true, will report intermediate
479 // solutions found by CP-SAT to solution listeners.
480 bool report_intermediate_cp_sat_solutions = 56;
481 // If model.Size() is less than the threshold and that no solution has been
482 // found, attempt a pass with CP-SAT.
483 int32 fallback_to_cp_sat_size_threshold = 52;
484 // Underlying solver to use in dimension scheduling, respectively for
485 // continuous and mixed models.
486 enum SchedulingSolver {
487 SCHEDULING_UNSET = 0;
489 SCHEDULING_CP_SAT = 2;
491 SchedulingSolver continuous_scheduling_solver = 33;
492 SchedulingSolver mixed_integer_scheduling_solver = 34;
493 // Setting this to true completely disables the LP and MIP scheduling in the
494 // solver. This overrides the 2 SchedulingSolver options above.
495 optional bool disable_scheduling_beware_this_may_degrade_performance = 50;
496 // Minimum step by which the solution must be improved in local search. 0
497 // means "unspecified". If this value is fractional, it will get rounded to
498 // the nearest integer.
499 double optimization_step = 7;
500 // Number of solutions to collect during the search. Corresponds to the best
501 // solutions found during the search. 0 means "unspecified".
502 int32 number_of_solutions_to_collect = 17;
503 // -- Search limits --
504 // Limit to the number of solutions generated during the search. 0 means
506 int64 solution_limit = 8;
507 // Limit to the time spent in the search.
508 google.protobuf.Duration time_limit = 9;
509 // Limit to the time spent in the completion search for each local search
511 google.protobuf.Duration lns_time_limit = 10;
512 // Ratio of the overall time limit spent in a secondary LS phase with only
513 // intra-route and insertion operators, meant to "cleanup" the current
514 // solution before stopping the search.
515 // TODO(user): Since these operators are very fast, add a parameter to cap
516 // the max time allocated for this second phase (e.g.
517 // Duration max_secondary_ls_time_limit).
518 double secondary_ls_time_limit_ratio = 57;
520 // Parameters required for the improvement search limit.
521 message ImprovementSearchLimitParameters {
522 // Parameter that regulates exchange rate between objective improvement and
523 // number of neighbors spent. The smaller the value, the sooner the limit
524 // stops the search. Must be positive.
525 double improvement_rate_coefficient = 38;
526 // Parameter that specifies the distance between improvements taken into
527 // consideration for calculating the improvement rate.
528 // Example: For 5 objective improvements = (10, 8, 6, 4, 2), and the
529 // solutions_distance parameter of 2, then the improvement_rate will be
530 // computed for (10, 6), (8, 4), and (6, 2).
531 int32 improvement_rate_solutions_distance = 39;
533 // The improvement search limit is added to the solver if the following
534 // parameters are set.
535 ImprovementSearchLimitParameters improvement_limit_parameters = 37;
537 // --- Propagation control ---
538 // These are advanced settings which should not be modified unless you know
539 // what you are doing.
541 // Use constraints with full propagation in routing model (instead of 'light'
542 // propagation only). Full propagation is only necessary when using
543 // depth-first search or for models which require strong propagation to
544 // finalize the value of secondary variables.
545 // Changing this setting to true will slow down the search in most cases and
546 // increase memory consumption in all cases.
547 bool use_full_propagation = 11;
549 // --- Miscellaneous ---
550 // Some of these are advanced settings which should not be modified unless you
551 // know what you are doing.
553 // Activates search logging. For each solution found during the search, the
554 // following will be displayed: its objective value, the maximum objective
555 // value since the beginning of the search, the elapsed time since the
556 // beginning of the search, the number of branches explored in the search
557 // tree, the number of failures in the search tree, the depth of the search
558 // tree, the number of local search neighbors explored, the number of local
559 // search neighbors filtered by local search filters, the number of local
560 // search neighbors accepted, the total memory used and the percentage of the
562 bool log_search = 13;
563 // In logs, cost values will be scaled and offset by the given values in the
564 // following way: log_cost_scaling_factor * (cost + log_cost_offset)
565 double log_cost_scaling_factor = 22;
566 double log_cost_offset = 29;
567 // In logs, this tag will be appended to each line corresponding to a new
568 // solution. Useful to sort out logs when several solves are run in parallel.
571 // Whether the solver should use an Iterated Local Search approach to solve
573 bool use_iterated_local_search = 58;
575 // Iterated Local Search parameters.
576 IteratedLocalSearchParameters iterated_local_search_parameters = 60;
579// Parameters which have to be set when creating a RoutingModel.
580message RoutingModelParameters {
581 // Parameters to use in the underlying constraint solver.
582 ConstraintSolverParameters solver_parameters = 1;
583 // Advanced settings.
584 // If set to true reduction of the underlying constraint model will be
585 // attempted when all vehicles have exactly the same cost structure. This can
586 // result in significant speedups.
587 bool reduce_vehicle_cost_model = 2;
588 // Cache callback calls if the number of nodes in the model is less or equal
590 int32 max_callback_cache_size = 3;