Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
routing_heuristic_parameters.proto
Go to the documentation of this file.
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
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
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.
13
14// Protocol buffer used to parametrize the local cheapest insertion heuristics.
15
16syntax = "proto3";
17
18option java_package = "com.google.ortools.constraintsolver";
19option java_multiple_files = true;
20option csharp_namespace = "Google.OrTools.ConstraintSolver";
21
22package operations_research;
23
24// Parameters used to configure local cheapest insertion heuristics.
25message LocalCheapestInsertionParameters {
26 // In insertion-based heuristics, describes what positions must be considered
27 // when inserting a pickup/delivery pair, and in what order they are
28 // considered.
29 enum PairInsertionStrategy {
30 // Let the solver decide the set of positions and its ordering.
31 AUTOMATIC = 0;
32 // Consider all positions, by increasing (cost(pickup), cost(delivery)).
33 BEST_PICKUP_THEN_BEST_DELIVERY = 1;
34 // Consider all positions, by increasing by cost(pickup) + cost(delivery).
35 BEST_PICKUP_DELIVERY_PAIR = 2;
36 // Only consider insertion positions that are compatible with the multitour
37 // property, meaning a series of pickups may only start when the vehicle
38 // is not carrying any delivery. This setting is designed to explore much
39 // less possibilities than the full BEST_PICKUP_DELIVERY_PAIR.
40 // Order by increasing by cost(pickup) + cost(delivery).
41 BEST_PICKUP_DELIVERY_PAIR_MULTITOUR = 3;
42 }
43
44 // Choice of insertion strategy for pickup/delivery pairs, used in local
45 // cheapest insertion, both first solution heuristic and LNS.
46 PairInsertionStrategy pickup_delivery_strategy = 1;
47
48 // Properties used to select in which order nodes or node pairs are considered
49 // in insertion heuristics.
50 enum InsertionSortingProperty {
51 // Invalid property.
52 SORTING_PROPERTY_UNSPECIFIED = 0;
53 // Selects nodes with the least number of allowed vehicles.
54 SORTING_PROPERTY_ALLOWED_VEHICLES = 1;
55 // Selects nodes with the highest penalty.
56 SORTING_PROPERTY_PENALTY = 2;
57 // Selects nodes with the highest penalty / number of allowed vehicles
58 // ratio.
59 SORTING_PROPERTY_PENALTY_OVER_ALLOWED_VEHICLES_RATIO = 3;
60 // Selects nodes that are on average the farthest from vehicles.
61 SORTING_PROPERTY_HIGHEST_AVG_ARC_COST_TO_VEHICLE_START_ENDS = 4;
62 // Selects nodes that are on average the closest to vehicles.
63 SORTING_PROPERTY_LOWEST_AVG_ARC_COST_TO_VEHICLE_START_ENDS = 5;
64 // Select nodes with the smallest distance to the closest vehicle.
65 SORTING_PROPERTY_LOWEST_MIN_ARC_COST_TO_VEHICLE_START_ENDS = 6;
66 // Selects nodes that have a higher dimension usage on average, where the
67 // usage is determined as the ratio of node demand over vehicle capacity.
68 // Currently, this property only supports unary dimensions.
69 SORTING_PROPERTY_HIGHEST_DIMENSION_USAGE = 7;
70 // Selects nodes in random order.
71 // This property cannot be used in conjunction with other properties.
72 SORTING_PROPERTY_RANDOM = 8;
73 }
74
75 // The properties used to sort insertion entries in the local cheapest
76 // insertion heuristic, in *decreasing* order of priority. The properties
77 // listed here are applied hierarchically, from highest to lowest priority.
78 // When no properties are provided
79 // (SORTING_PROPERTY_ALLOWED_VEHICLES, SORTING_PROPERTY_PENALTY)
80 // is used by default.
81 repeated InsertionSortingProperty insertion_sorting_properties = 2;
82}
83
84// Parameters used to configure savings heuristics.
85message SavingsParameters {
86 // Ratio (in ]0, 1]) of neighbors to consider for each node when constructing
87 // the savings. If unspecified, its value is considered to be 1.0.
88 double neighbors_ratio = 1;
89 // The number of neighbors considered for each node in the Savings heuristic
90 // is chosen so that the space used to store the savings doesn't exceed
91 // max_memory_usage_bytes, which must be in ]0, 1e10].
92 // NOTE: If both neighbors_ratio and max_memory_usage_bytes
93 // are specified, the number of neighbors considered for each node will be the
94 // minimum of the two numbers determined by these parameters.
95 double max_memory_usage_bytes = 2;
96 // Add savings related to reverse arcs when finding the nearest neighbors
97 // of the nodes.
98 bool add_reverse_arcs = 3;
99 // Coefficient of the cost of the arc for which the saving value is being
100 // computed:
101 // Saving(a-->b) = Cost(a-->end) + Cost(start-->b)
102 // - arc_coefficient * Cost(a-->b)
103 // This parameter must be greater than 0, and its default value is 1.
104 double arc_coefficient = 4;
105}
106
107// Parameters used to configure global cheapest insertion heuristics.
108message GlobalCheapestInsertionParameters {
109 // Ratio (between 0 and 1) of available vehicles in the model on which
110 // farthest nodes of the model are inserted as seeds.
111 double farthest_seeds_ratio = 1;
112
113 // Ratio (in ]0, 1]) of closest non start/end nodes to consider as neighbors
114 // for each node when creating new insertions in the parallel/sequential
115 // cheapest insertion heuristic.
116 // If not overridden, its default value is 1, meaning all neighbors will be
117 // considered.
118 // The neighborhood ratio is coupled with the corresponding min_neighbors
119 // integer, indicating the minimum number of neighbors to consider for each
120 // node:
121 // num_closest_neighbors =
122 // max(min_neighbors, neighbors_ratio * NUM_NON_START_END_NODES)
123 // This minimum number of neighbors must be greater or equal to 1, its
124 // default value.
125 double neighbors_ratio = 2;
126 int32 min_neighbors = 3;
127
128 // Whether or not to only consider closest neighbors when initializing the
129 // assignment. More precisely, if true, only closest neighbors (see
130 // neighbors_ratio and min_neighbors) are considered as insertion positions
131 // during initialization. Otherwise, all possible insertion positions are
132 // considered.
133 bool use_neighbors_ratio_for_initialization = 6;
134
135 // Whether or not to consider entries making the nodes/pairs unperformed.
136 // More precisely, if true, entries are created for making the nodes/pairs
137 // unperformed, and when the cost of making a node unperformed is lower than
138 // all insertions, the node/pair will be made unperformed. If false, only
139 // entries making a node/pair performed are considered.
140 bool add_unperformed_entries = 7;
141}