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_ils.proto";
27import "ortools/constraint_solver/solver_parameters.proto";
28import "ortools/sat/sat_parameters.proto";
29import "ortools/util/optional_boolean.proto";
31package operations_research;
33// Parameters defining the search used to solve vehicle routing problems.
35// If a parameter is unset (or, equivalently, set to its default value),
36// then the routing library will pick its preferred value for that parameter
37// automatically: this should be the case for most parameters.
38// To see those "default" parameters, call GetDefaultRoutingSearchParameters().
40message RoutingSearchParameters {
43 // First solution strategies, used as starting point of local search.
44 FirstSolutionStrategy.Value first_solution_strategy = 1;
46 // --- Advanced first solutions strategy settings ---
47 // Don't touch these unless you know what you are doing.
49 // Use filtered version of first solution strategy if available.
50 bool use_unfiltered_first_solution_strategy = 2;
51 // Parameters specific to the Savings first solution heuristic.
52 // Ratio (in ]0, 1]) of neighbors to consider for each node when constructing
53 // the savings. If unspecified, its value is considered to be 1.0.
54 double savings_neighbors_ratio = 14;
55 // The number of neighbors considered for each node in the Savings heuristic
56 // is chosen so that the space used to store the savings doesn't exceed
57 // savings_max_memory_usage_bytes, which must be in ]0, 1e10].
58 // NOTE: If both savings_neighbors_ratio and savings_max_memory_usage_bytes
59 // are specified, the number of neighbors considered for each node will be the
60 // minimum of the two numbers determined by these parameters.
61 double savings_max_memory_usage_bytes = 23;
62 // Add savings related to reverse arcs when finding the nearest neighbors
64 bool savings_add_reverse_arcs = 15;
65 // Coefficient of the cost of the arc for which the saving value is being
67 // Saving(a-->b) = Cost(a-->end) + Cost(start-->b)
68 // - savings_arc_coefficient * Cost(a-->b)
69 // This parameter must be greater than 0, and its default value is 1.
70 double savings_arc_coefficient = 18;
72 // Ratio (between 0 and 1) of available vehicles in the model on which
73 // farthest nodes of the model are inserted as seeds in the
74 // GlobalCheapestInsertion first solution heuristic.
75 double cheapest_insertion_farthest_seeds_ratio = 16;
77 // Ratio (in ]0, 1]) of closest non start/end nodes to consider as neighbors
78 // for each node when creating new insertions in the parallel/sequential
79 // cheapest insertion heuristic.
80 // If not overridden, its default value is 1, meaning all neighbors will be
82 // The neighborhood ratio is coupled with the corresponding min_neighbors
83 // integer, indicating the minimum number of neighbors to consider for each
85 // num_closest_neighbors =
86 // max(min_neighbors, neighbors_ratio * NUM_NON_START_END_NODES)
87 // This minimum number of neighbors must be greater or equal to 1, its
90 // Neighbors ratio and minimum number of neighbors for the first solution
92 double cheapest_insertion_first_solution_neighbors_ratio = 21;
93 int32 cheapest_insertion_first_solution_min_neighbors = 44;
94 // Neighbors ratio and minimum number of neighbors for the heuristic when used
95 // in a local search operator (see
96 // local_search_operators.use_global_cheapest_insertion_path_lns and
97 // local_search_operators.use_global_cheapest_insertion_chain_lns below).
98 double cheapest_insertion_ls_operator_neighbors_ratio = 31;
99 int32 cheapest_insertion_ls_operator_min_neighbors = 45;
101 // Whether or not to only consider closest neighbors when initializing the
102 // assignment for the first solution.
104 cheapest_insertion_first_solution_use_neighbors_ratio_for_initialization =
106 // Whether or not to consider entries making the nodes/pairs unperformed in
107 // the GlobalCheapestInsertion heuristic.
108 bool cheapest_insertion_add_unperformed_entries = 40;
110 // In insertion-based heuristics, describes what positions must be considered
111 // when inserting a pickup/delivery pair, and in what order they are
113 enum PairInsertionStrategy {
114 // Let the solver decide the set of positions and its ordering.
116 // Consider all positions, by increasing (cost(pickup), cost(delivery)).
117 BEST_PICKUP_THEN_BEST_DELIVERY = 1;
118 // Consider all positions, by increasing by cost(pickup) + cost(delivery).
119 BEST_PICKUP_DELIVERY_PAIR = 2;
120 // Only consider insertion positions that are compatible with the multitour
121 // property, meaning a series of pickups may only start when the vehicle
122 // is not carrying any delivery. This setting is designed to explore much
123 // less possibilities than the full BEST_PICKUP_DELIVERY_PAIR.
124 // Order by increasing by cost(pickup) + cost(delivery).
125 BEST_PICKUP_DELIVERY_PAIR_MULTITOUR = 3;
127 // Choice of insertion strategy for pickup/delivery pairs, used in local
128 // cheapest insertion, both first solution heuristic and LNS.
129 PairInsertionStrategy local_cheapest_insertion_pickup_delivery_strategy = 49;
130 // Choice of insertion strategy for pickup/delivery pairs, used in local
131 // cheapest cost insertion, both first solution heuristic and LNS.
132 PairInsertionStrategy local_cheapest_cost_insertion_pickup_delivery_strategy =
135 // Properties used to select in which order nodes or node pairs are considered
136 // in insertion heuristics.
137 enum InsertionSortingProperty {
139 SORTING_PROPERTY_UNSPECIFIED = 0;
140 // Selects nodes with the least number of allowed vehicles.
141 SORTING_PROPERTY_ALLOWED_VEHICLES = 1;
142 // Selects nodes with the highest penalty.
143 SORTING_PROPERTY_PENALTY = 2;
144 // Selects nodes with the highest penalty / number of allowed vehicles
146 SORTING_PROPERTY_PENALTY_OVER_ALLOWED_VEHICLES_RATIO = 3;
147 // Selects nodes that are on average the farthest from vehicles.
148 SORTING_PROPERTY_HIGHEST_AVG_ARC_COST_TO_VEHICLE_START_ENDS = 4;
149 // Selects nodes that are on average the closest to vehicles.
150 SORTING_PROPERTY_LOWEST_AVG_ARC_COST_TO_VEHICLE_START_ENDS = 5;
151 // Select nodes with the smallest distance to the closest vehicle.
152 SORTING_PROPERTY_LOWEST_MIN_ARC_COST_TO_VEHICLE_START_ENDS = 6;
153 // Selects nodes that have a higher dimension usage on average, where the
154 // usage is determined as the ratio of node demand over vehicle capacity.
155 // Currently, this property only supports unary dimensions.
156 SORTING_PROPERTY_HIGHEST_DIMENSION_USAGE = 7;
157 // Selects nodes in random order.
158 // This property cannot be used in conjunction with other properties.
159 SORTING_PROPERTY_RANDOM = 8;
162 // The properties used to sort insertion entries in the local cheapest
163 // insertion heuristic, in *decreasing* order of priority. The properties
164 // listed here are applied hierarchically, from highest to lowest priority.
165 // When no properties are provided
166 // (SORTING_PROPERTY_ALLOWED_VEHICLES, SORTING_PROPERTY_PENALTY)
167 // is used by default.
168 repeated InsertionSortingProperty
169 local_cheapest_insertion_sorting_properties = 67;
171 // If true use minimum matching instead of minimal matching in the
172 // Christofides algorithm.
173 bool christofides_use_minimum_matching = 30;
175 // If non zero, a period p indicates that every p node insertions or additions
176 // to a path, an optimization of the current partial solution will be
177 // performed. As of 12/2023:
178 // - this requires that a secondary routing model has been passed to the main
180 // - this is only supported by LOCAL_CHEAPEST_INSERTION and
181 // LOCAL_CHEAPEST_COST_INSERTION.
182 int32 first_solution_optimization_period = 59;
184 // Local search neighborhood operators used to build a solutions neighborhood.
186 message LocalSearchNeighborhoodOperators {
187 // --- Inter-route operators ---
188 // Operator which moves a single node to another position.
189 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 -> 5
190 // (where (1, 5) are first and last nodes of the path and can therefore not
192 // 1 -> 3 -> [2] -> 4 -> 5
193 // 1 -> 3 -> 4 -> [2] -> 5
194 // 1 -> 2 -> 4 -> [3] -> 5
195 // 1 -> [4] -> 2 -> 3 -> 5
196 OptionalBoolean use_relocate = 1;
197 // Operator which moves a pair of pickup and delivery nodes to another
198 // position where the first node of the pair must be before the second node
199 // on the same path. Compared to the light_relocate_pair operator, tries all
200 // possible positions of insertion of a pair (not only after another pair).
201 // Possible neighbors for the path 1 -> A -> B -> 2 -> 3 (where (1, 3) are
202 // first and last nodes of the path and can therefore not be moved, and
203 // (A, B) is a pair of nodes):
204 // 1 -> [A] -> 2 -> [B] -> 3
205 // 1 -> 2 -> [A] -> [B] -> 3
206 OptionalBoolean use_relocate_pair = 2;
207 // Operator which moves a pair of pickup and delivery nodes after another
209 // Possible neighbors for paths 1 -> A -> B -> 2, 3 -> C -> D -> 4 (where
210 // (1, 2) and (3, 4) are first and last nodes of paths and can therefore not
211 // be moved, and (A, B) and (C, D) are pair of nodes):
212 // 1 -> 2, 3 -> C -> [A] -> D -> [B] -> 4
213 // 1 -> A -> [C] -> B -> [D] -> 2, 3 -> 4
214 OptionalBoolean use_light_relocate_pair = 24;
215 // Relocate neighborhood which moves chains of neighbors.
216 // The operator starts by relocating a node n after a node m, then continues
217 // moving nodes which were after n as long as the "cost" added is less than
218 // the "cost" of the arc (m, n). If the new chain doesn't respect the domain
219 // of next variables, it will try reordering the nodes until it finds a
221 // Possible neighbors for path 1 -> A -> B -> C -> D -> E -> 2 (where (1, 2)
222 // are first and last nodes of the path and can therefore not be moved, A
223 // must be performed before B, and A, D and E are located at the same
225 // 1 -> A -> C -> [B] -> D -> E -> 2
226 // 1 -> A -> C -> D -> [B] -> E -> 2
227 // 1 -> A -> C -> D -> E -> [B] -> 2
228 // 1 -> A -> B -> D -> [C] -> E -> 2
229 // 1 -> A -> B -> D -> E -> [C] -> 2
230 // 1 -> A -> [D] -> [E] -> B -> C -> 2
231 // 1 -> A -> B -> [D] -> [E] -> C -> 2
232 // 1 -> A -> [E] -> B -> C -> D -> 2
233 // 1 -> A -> B -> [E] -> C -> D -> 2
234 // 1 -> A -> B -> C -> [E] -> D -> 2
235 // This operator is extremely useful to move chains of nodes which are
236 // located at the same place (for instance nodes part of a same stop).
237 OptionalBoolean use_relocate_neighbors = 3;
238 // Relocate neighborhood that moves subpaths all pickup and delivery
239 // pairs have both pickup and delivery inside the subpath or both outside
240 // the subpath. For instance, for given paths:
241 // 0 -> A -> B -> A' -> B' -> 5 -> 6 -> 8
243 // Pairs (A,A') and (B,B') are interleaved, so the expected neighbors are:
244 // 0 -> 5 -> A -> B -> A' -> B' -> 6 -> 8
247 // 0 -> 5 -> 6 -> A -> B -> A' -> B' -> 8
251 // 7 -> A -> B -> A' -> B' -> 9
252 OptionalBoolean use_relocate_subtrip = 25;
253 // Operator which exchanges the positions of two nodes.
254 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 -> 5
255 // (where (1, 5) are first and last nodes of the path and can therefore not
257 // 1 -> [3] -> [2] -> 4 -> 5
258 // 1 -> [4] -> 3 -> [2] -> 5
259 // 1 -> 2 -> [4] -> [3] -> 5
260 OptionalBoolean use_exchange = 4;
261 // Operator which exchanges the positions of two pair of nodes. Pairs
262 // correspond to the pickup and delivery pairs defined in the routing model.
263 // Possible neighbor for the paths
264 // 1 -> A -> B -> 2 -> 3 and 4 -> C -> D -> 5
265 // (where (1, 3) and (4, 5) are first and last nodes of the paths and can
266 // therefore not be moved, and (A, B) and (C,D) are pairs of nodes):
267 // 1 -> [C] -> [D] -> 2 -> 3, 4 -> [A] -> [B] -> 5
268 OptionalBoolean use_exchange_pair = 22;
269 // Operator which exchanges subtrips associated to two pairs of nodes,
270 // see use_relocate_subtrip for a definition of subtrips.
271 OptionalBoolean use_exchange_subtrip = 26;
272 // Operator which cross exchanges the starting chains of 2 paths, including
273 // exchanging the whole paths.
274 // First and last nodes are not moved.
275 // Possible neighbors for the paths 1 -> 2 -> 3 -> 4 -> 5 and 6 -> 7 -> 8
276 // (where (1, 5) and (6, 8) are first and last nodes of the paths and can
277 // therefore not be moved):
278 // 1 -> [7] -> 3 -> 4 -> 5 6 -> [2] -> 8
279 // 1 -> [7] -> 4 -> 5 6 -> [2 -> 3] -> 8
280 // 1 -> [7] -> 5 6 -> [2 -> 3 -> 4] -> 8
281 OptionalBoolean use_cross = 5;
282 // Not implemented yet. TODO(b/68128619): Implement.
283 OptionalBoolean use_cross_exchange = 6;
284 // Operator which detects the relocate_expensive_chain_num_arcs_to_consider
285 // most expensive arcs on a path, and moves the chain resulting from cutting
286 // pairs of arcs among these to another position.
287 // Possible neighbors for paths 1 -> 2 (empty) and
288 // 3 -> A ------> B --> C -----> D -> 4 (where A -> B and C -> D are the 2
289 // most expensive arcs, and the chain resulting from breaking them is
291 // 1 -> [B -> C] -> 2 3 -> A -> D -> 4
292 // 1 -> 2 3 -> [B -> C] -> A -> D -> 4
293 // 1 -> 2 3 -> A -> D -> [B -> C] -> 4
294 OptionalBoolean use_relocate_expensive_chain = 23;
295 // --- Intra-route operators ---
296 // Operator which reverses a subchain of a path. It is called TwoOpt
297 // because it breaks two arcs on the path; resulting paths are called
299 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 -> 5
300 // (where (1, 5) are first and last nodes of the path and can therefore not
302 // 1 -> [3 -> 2] -> 4 -> 5
303 // 1 -> [4 -> 3 -> 2] -> 5
304 // 1 -> 2 -> [4 -> 3] -> 5
305 OptionalBoolean use_two_opt = 7;
306 // Operator which moves sub-chains of a path of length 1, 2 and 3 to another
307 // position in the same path.
308 // When the length of the sub-chain is 1, the operator simply moves a node
309 // to another position.
310 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 -> 5, for a sub-chain
311 // length of 2 (where (1, 5) are first and last nodes of the path and can
312 // therefore not be moved):
313 // 1 -> 4 -> [2 -> 3] -> 5
314 // 1 -> [3 -> 4] -> 2 -> 5
315 // The OR_OPT operator is a limited version of 3-Opt (breaks 3 arcs on a
317 OptionalBoolean use_or_opt = 8;
318 // Lin-Kernighan operator.
319 // While the accumulated local gain is positive, performs a 2-OPT or a 3-OPT
320 // move followed by a series of 2-OPT moves. Returns a neighbor for which
321 // the global gain is positive.
322 OptionalBoolean use_lin_kernighan = 9;
323 // Sliding TSP operator.
324 // Uses an exact dynamic programming algorithm to solve the TSP
325 // corresponding to path sub-chains.
326 // For a subchain 1 -> 2 -> 3 -> 4 -> 5 -> 6, solves the TSP on
327 // nodes A, 2, 3, 4, 5, where A is a merger of nodes 1 and 6 such that
328 // cost(A,i) = cost(1,i) and cost(i,A) = cost(i,6).
329 OptionalBoolean use_tsp_opt = 10;
330 // --- Operators on inactive nodes ---
331 // Operator which inserts an inactive node into a path.
332 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 with 5 inactive
333 // (where 1 and 4 are first and last nodes of the path) are:
334 // 1 -> [5] -> 2 -> 3 -> 4
335 // 1 -> 2 -> [5] -> 3 -> 4
336 // 1 -> 2 -> 3 -> [5] -> 4
337 OptionalBoolean use_make_active = 11;
338 // Operator which relocates a node while making an inactive one active.
339 // As of 3/2017, the operator is limited to two kinds of moves:
340 // - Relocating a node and replacing it by an inactive node.
341 // Possible neighbor for path 1 -> 5, 2 -> 3 -> 6 and 4 inactive
342 // (where 1,2 and 5,6 are first and last nodes of paths) is:
343 // 1 -> 3 -> 5, 2 -> 4 -> 6.
344 // - Relocating a node and inserting an inactive node next to it.
345 // Possible neighbor for path 1 -> 5, 2 -> 3 -> 6 and 4 inactive
346 // (where 1,2 and 5,6 are first and last nodes of paths) is:
347 // 1 -> 4 -> 3 -> 5, 2 -> 6.
348 OptionalBoolean use_relocate_and_make_active = 21;
349 // Operator which exchanges two nodes and inserts an inactive node.
350 // Possible neighbors for paths 0 -> 2 -> 4, 1 -> 3 -> 6 and 5 inactive are:
351 // 0 -> 3 -> 4, 1 -> 5 -> 2 -> 6
352 // 0 -> 3 -> 5 -> 4, 1 -> 2 -> 6
353 // 0 -> 5 -> 3 -> 4, 1 -> 2 -> 6
354 // 0 -> 3 -> 4, 1 -> 2 -> 5 -> 6
355 OptionalBoolean use_exchange_and_make_active = 37;
356 // Operator which exchanges the first and last nodes of two paths and makes
358 // Possible neighbors for paths 0 -> 1 -> 2 -> 7, 6 -> 3 -> 4 -> 8
359 // and 5 inactive are:
360 // 0 -> 5 -> 3 -> 4 -> 7, 6 -> 1 -> 2 -> 8
361 // 0 -> 3 -> 4 -> 7, 6 -> 1 -> 5 -> 2 -> 8
362 // 0 -> 3 -> 4 -> 7, 6 -> 1 -> 2 -> 5 -> 8
363 // 0 -> 3 -> 5 -> 4 -> 7, 6 -> 1 -> 2 -> 8
364 // 0 -> 3 -> 4 -> 5 -> 7, 6 -> 1 -> 2 -> 8
365 OptionalBoolean use_exchange_path_start_ends_and_make_active = 38;
366 // Operator which makes path nodes inactive.
367 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 (where 1 and 4 are first
368 // and last nodes of the path) are:
369 // 1 -> 3 -> 4 with 2 inactive
370 // 1 -> 2 -> 4 with 3 inactive
371 OptionalBoolean use_make_inactive = 12;
372 // Operator which makes a "chain" of path nodes inactive.
373 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 (where 1 and 4 are first
374 // and last nodes of the path) are:
375 // 1 -> 3 -> 4 with 2 inactive
376 // 1 -> 2 -> 4 with 3 inactive
377 // 1 -> 4 with 2 and 3 inactive
378 OptionalBoolean use_make_chain_inactive = 13;
379 // Operator which replaces an active node by an inactive one.
380 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 with 5 inactive
381 // (where 1 and 4 are first and last nodes of the path) are:
382 // 1 -> [5] -> 3 -> 4 with 2 inactive
383 // 1 -> 2 -> [5] -> 4 with 3 inactive
384 OptionalBoolean use_swap_active = 14;
385 // Operator which replaces a chain of active nodes by an inactive one.
386 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 with 5 inactive
387 // (where 1 and 4 are first and last nodes of the path) are:
388 // 1 -> [5] -> 3 -> 4 with 2 inactive
389 // 1 -> 2 -> [5] -> 4 with 3 inactive
390 // 1 -> [5] -> 4 with 2 and 3 inactive
391 OptionalBoolean use_swap_active_chain = 35;
392 // Operator which makes an inactive node active and an active one inactive.
393 // It is similar to SwapActiveOperator excepts that it tries to insert the
394 // inactive node in all possible positions instead of just the position of
395 // the node made inactive.
396 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 with 5 inactive
397 // (where 1 and 4 are first and last nodes of the path) are:
398 // 1 -> [5] -> 3 -> 4 with 2 inactive
399 // 1 -> 3 -> [5] -> 4 with 2 inactive
400 // 1 -> [5] -> 2 -> 4 with 3 inactive
401 // 1 -> 2 -> [5] -> 4 with 3 inactive
402 OptionalBoolean use_extended_swap_active = 15;
403 // Swaps active nodes from node alternatives in sequence. Considers chains
404 // of nodes with alternatives, builds a DAG from the chain, each "layer" of
405 // the DAG being composed of the set of alternatives of the node at a given
406 // rank in the chain, fully connected to the next layer. A neighbor is built
407 // from the shortest path starting from the node before the chain (source),
408 // through the DAG to the node following the chain.
409 OptionalBoolean use_shortest_path_swap_active = 34;
410 // Similar to use_two_opt but returns the shortest path on the DAG of node
411 // alternatives of the reversed chain (cf. use_shortest_path_swap_active).
412 OptionalBoolean use_shortest_path_two_opt = 36;
413 // Operator which makes an inactive node active and an active pair of nodes
414 // inactive OR makes an inactive pair of nodes active and an active node
416 // Possible neighbors for the path 1 -> 2 -> 3 -> 4 with 5 inactive
417 // (where 1 and 4 are first and last nodes of the path and (2,3) is a pair
419 // 1 -> [5] -> 4 with (2,3) inactive
420 // Possible neighbors for the path 1 -> 2 -> 3 with (4,5) inactive
421 // (where 1 and 3 are first and last nodes of the path and (4,5) is a pair
423 // 1 -> [4] -> [5] -> 3 with 2 inactive
424 OptionalBoolean use_node_pair_swap_active = 20;
425 // --- Large neighborhood search operators ---
426 // Operator which relaxes two sub-chains of three consecutive arcs each.
427 // Each sub-chain is defined by a start node and the next three arcs. Those
428 // six arcs are relaxed to build a new neighbor.
429 // PATH_LNS explores all possible pairs of starting nodes and so defines
430 // n^2 neighbors, n being the number of nodes.
431 // Note that the two sub-chains can be part of the same path; they even may
433 OptionalBoolean use_path_lns = 16;
434 // Operator which relaxes one entire path and all inactive nodes.
435 OptionalBoolean use_full_path_lns = 17;
437 // Randomly merges consecutive nodes until n "meta"-nodes remain and solves
438 // the corresponding TSP.
439 // This defines an "unlimited" neighborhood which must be stopped by search
440 // limits. To force diversification, the operator iteratively forces each
441 // node to serve as base of a meta-node.
442 OptionalBoolean use_tsp_lns = 18;
443 // Operator which relaxes all inactive nodes and one sub-chain of six
444 // consecutive arcs. That way the path can be improved by inserting inactive
445 // nodes or swapping arcs.
446 OptionalBoolean use_inactive_lns = 19;
447 // --- LNS-like large neighborhood search operators using heuristics ---
448 // Operator which makes all nodes on a route unperformed, and reinserts them
449 // using the GlobalCheapestInsertion heuristic.
450 OptionalBoolean use_global_cheapest_insertion_path_lns = 27;
451 // Same as above but using LocalCheapestInsertion as a heuristic.
452 OptionalBoolean use_local_cheapest_insertion_path_lns = 28;
453 // The following operator relocates an entire route to an empty path and
454 // then tries to insert the unperformed nodes using the global cheapest
455 // insertion heuristic.
457 use_relocate_path_global_cheapest_insertion_insert_unperformed = 33;
458 // This operator finds heuristic_expensive_chain_lns_num_arcs_to_consider
459 // most expensive arcs on a route, makes the nodes in between pairs of these
460 // expensive arcs unperformed, and reinserts them using the
461 // GlobalCheapestInsertion heuristic.
462 OptionalBoolean use_global_cheapest_insertion_expensive_chain_lns = 29;
463 // Same as above but using LocalCheapestInsertion as a heuristic for
465 OptionalBoolean use_local_cheapest_insertion_expensive_chain_lns = 30;
466 // The following operator makes a node and its
467 // heuristic_close_nodes_lns_num_nodes closest neighbors unperformed along
468 // with each of their corresponding performed pickup/delivery pairs, and
469 // then reinserts them using the GlobalCheapestInsertion heuristic.
470 OptionalBoolean use_global_cheapest_insertion_close_nodes_lns = 31;
471 // Same as above, but insertion positions for nodes are determined by the
472 // LocalCheapestInsertion heuristic.
473 OptionalBoolean use_local_cheapest_insertion_close_nodes_lns = 32;
475 LocalSearchNeighborhoodOperators local_search_operators = 3;
477 // Neighbors ratio and minimum number of neighbors considered in local
478 // search operators (see cheapest_insertion_first_solution_neighbors_ratio
479 // and cheapest_insertion_first_solution_min_neighbors for more information).
480 double ls_operator_neighbors_ratio = 53;
481 int32 ls_operator_min_neighbors = 54;
483 // If true, the solver will use multi-armed bandit concatenate operators. It
484 // dynamically chooses the next neighbor operator in order to get the best
485 // objective improvement.
486 bool use_multi_armed_bandit_concatenate_operators = 41;
488 // Memory coefficient related to the multi-armed bandit compound operator.
489 // Sets how much the objective improvement of previous accepted neighbors
490 // influence the current average improvement.
491 // This parameter should be between 0 and 1.
492 double multi_armed_bandit_compound_operator_memory_coefficient = 42;
494 // Positive parameter defining the exploration coefficient of the multi-armed
495 // bandit compound operator. Sets how often we explore rarely used and
496 // unsuccessful in the past operators
497 double multi_armed_bandit_compound_operator_exploration_coefficient = 43;
499 // Maximum size of the chain to make inactive in SwapActiveChainOperator.
500 int32 max_swap_active_chain_size = 66;
502 // Number of expensive arcs to consider cutting in the RelocateExpensiveChain
503 // neighborhood operator (see
504 // LocalSearchNeighborhoodOperators.use_relocate_expensive_chain()).
505 // This parameter must be greater than 2.
506 // NOTE(user): The number of neighbors generated by the operator for
507 // relocate_expensive_chain_num_arcs_to_consider = K is around
508 // K*(K-1)/2 * number_of_routes * number_of_nodes.
509 int32 relocate_expensive_chain_num_arcs_to_consider = 20;
511 // Number of expensive arcs to consider cutting in the
512 // FilteredHeuristicExpensiveChainLNSOperator operator.
513 int32 heuristic_expensive_chain_lns_num_arcs_to_consider = 32;
515 // Number of closest nodes to consider for each node during the destruction
516 // phase of the FilteredHeuristicCloseNodesLNSOperator.
517 int32 heuristic_close_nodes_lns_num_nodes = 35;
519 // Local search metaheuristics used to guide the search.
520 LocalSearchMetaheuristic.Value local_search_metaheuristic = 4;
521 // Local search metaheuristics alternatively used to guide the search. Every
522 // num_max_local_optima_before_metaheuristic_switch local minima found by a
523 // metaheurisitic, the solver will switch to the next metaheuristic. Cannot be
524 // defined if local_search_metaheuristic is different from UNSET or AUTOMATIC.
525 repeated LocalSearchMetaheuristic.Value local_search_metaheuristics = 63;
526 int32 num_max_local_optima_before_metaheuristic_switch = 64;
527 // These are advanced settings which should not be modified unless you know
528 // what you are doing.
529 // Lambda coefficient used to penalize arc costs when GUIDED_LOCAL_SEARCH is
530 // used. Must be positive.
531 double guided_local_search_lambda_coefficient = 5;
532 // Whether to reset penalties when a new best solution is found. The effect is
533 // that a greedy descent is started before the next penalization phase.
534 bool guided_local_search_reset_penalties_on_new_best_solution = 51;
535 // When an arc leaving a vehicle start or arriving at a vehicle end is
536 // penalized, this field controls whether to penalize all other equivalent
537 // arcs with starts or ends in the same vehicle class.
538 bool guided_local_search_penalize_with_vehicle_classes = 61;
539 // Whether to consider arc penalties in cost functions used in local search
540 // operators using arc costs.
541 bool use_guided_local_search_penalties_in_local_search_operators = 62;
543 // --- Search control ---
545 // If true, the solver should use depth-first search rather than local search
546 // to solve the problem.
547 bool use_depth_first_search = 6;
548 // If true, use the CP solver to find a solution. Either local or depth-first
549 // search will be used depending on the value of use_depth_first_search. Will
550 // be run before the CP-SAT solver (cf. use_cp_sat).
551 OptionalBoolean use_cp = 28;
552 // If true, use the CP-SAT solver to find a solution. If use_cp is also true,
553 // the CP-SAT solver will be run after the CP solver if there is time
554 // remaining and will use the CP solution as a hint for the CP-SAT search.
555 // As of 5/2019, only TSP models can be solved.
556 OptionalBoolean use_cp_sat = 27;
557 // If true, use the CP-SAT solver to find a solution on generalized routing
558 // model. If use_cp is also true, the CP-SAT solver will be run after the CP
559 // solver if there is time remaining and will use the CP solution as a hint
560 // for the CP-SAT search.
561 OptionalBoolean use_generalized_cp_sat = 47;
562 // If use_cp_sat or use_generalized_cp_sat is true, contains the SAT algorithm
563 // parameters which will be used.
564 sat.SatParameters sat_parameters = 48;
565 // If use_cp_sat or use_generalized_cp_sat is true, will report intermediate
566 // solutions found by CP-SAT to solution listeners.
567 bool report_intermediate_cp_sat_solutions = 56;
568 // If model.Size() is less than the threshold and that no solution has been
569 // found, attempt a pass with CP-SAT.
570 int32 fallback_to_cp_sat_size_threshold = 52;
571 // Underlying solver to use in dimension scheduling, respectively for
572 // continuous and mixed models.
573 enum SchedulingSolver {
574 SCHEDULING_UNSET = 0;
576 SCHEDULING_CP_SAT = 2;
578 SchedulingSolver continuous_scheduling_solver = 33;
579 SchedulingSolver mixed_integer_scheduling_solver = 34;
580 // Setting this to true completely disables the LP and MIP scheduling in the
581 // solver. This overrides the 2 SchedulingSolver options above.
582 optional bool disable_scheduling_beware_this_may_degrade_performance = 50;
583 // Minimum step by which the solution must be improved in local search. 0
584 // means "unspecified". If this value is fractional, it will get rounded to
585 // the nearest integer.
586 double optimization_step = 7;
587 // Number of solutions to collect during the search. Corresponds to the best
588 // solutions found during the search. 0 means "unspecified".
589 int32 number_of_solutions_to_collect = 17;
590 // -- Search limits --
591 // Limit to the number of solutions generated during the search. 0 means
593 int64 solution_limit = 8;
594 // Limit to the time spent in the search.
595 google.protobuf.Duration time_limit = 9;
596 // Limit to the time spent in the completion search for each local search
598 google.protobuf.Duration lns_time_limit = 10;
599 // Ratio of the overall time limit spent in a secondary LS phase with only
600 // intra-route and insertion operators, meant to "cleanup" the current
601 // solution before stopping the search.
602 // TODO(user): Since these operators are very fast, add a parameter to cap
603 // the max time allocated for this second phase (e.g.
604 // Duration max_secondary_ls_time_limit).
605 double secondary_ls_time_limit_ratio = 57;
607 // Parameters required for the improvement search limit.
608 message ImprovementSearchLimitParameters {
609 // Parameter that regulates exchange rate between objective improvement and
610 // number of neighbors spent. The smaller the value, the sooner the limit
611 // stops the search. Must be positive.
612 double improvement_rate_coefficient = 38;
613 // Parameter that specifies the distance between improvements taken into
614 // consideration for calculating the improvement rate.
615 // Example: For 5 objective improvements = (10, 8, 6, 4, 2), and the
616 // solutions_distance parameter of 2, then the improvement_rate will be
617 // computed for (10, 6), (8, 4), and (6, 2).
618 int32 improvement_rate_solutions_distance = 39;
620 // The improvement search limit is added to the solver if the following
621 // parameters are set.
622 ImprovementSearchLimitParameters improvement_limit_parameters = 37;
624 // --- Propagation control ---
625 // These are advanced settings which should not be modified unless you know
626 // what you are doing.
628 // Use constraints with full propagation in routing model (instead of 'light'
629 // propagation only). Full propagation is only necessary when using
630 // depth-first search or for models which require strong propagation to
631 // finalize the value of secondary variables.
632 // Changing this setting to true will slow down the search in most cases and
633 // increase memory consumption in all cases.
634 bool use_full_propagation = 11;
636 // --- Miscellaneous ---
637 // Some of these are advanced settings which should not be modified unless you
638 // know what you are doing.
640 // Activates search logging. For each solution found during the search, the
641 // following will be displayed: its objective value, the maximum objective
642 // value since the beginning of the search, the elapsed time since the
643 // beginning of the search, the number of branches explored in the search
644 // tree, the number of failures in the search tree, the depth of the search
645 // tree, the number of local search neighbors explored, the number of local
646 // search neighbors filtered by local search filters, the number of local
647 // search neighbors accepted, the total memory used and the percentage of the
649 bool log_search = 13;
650 // In logs, cost values will be scaled and offset by the given values in the
651 // following way: log_cost_scaling_factor * (cost + log_cost_offset)
652 double log_cost_scaling_factor = 22;
653 double log_cost_offset = 29;
654 // In logs, this tag will be appended to each line corresponding to a new
655 // solution. Useful to sort out logs when several solves are run in parallel.
658 // Whether the solver should use an Iterated Local Search approach to solve
660 bool use_iterated_local_search = 58;
662 // Iterated Local Search parameters.
663 IteratedLocalSearchParameters iterated_local_search_parameters = 60;
666// Parameters which have to be set when creating a RoutingModel.
667message RoutingModelParameters {
668 // Parameters to use in the underlying constraint solver.
669 ConstraintSolverParameters solver_parameters = 1;
670 // Advanced settings.
671 // If set to true reduction of the underlying constraint model will be
672 // attempted when all vehicles have exactly the same cost structure. This can
673 // result in significant speedups.
674 bool reduce_vehicle_cost_model = 2;
675 // Cache callback calls if the number of nodes in the model is less or equal
677 int32 max_callback_cache_size = 3;