Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
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// Configures the behavior of a MathOpt solver.
15
16syntax = "proto3";
17
18package operations_research.service.v1.mathopt;
19
20import "google/protobuf/duration.proto";
21
22option java_multiple_files = true;
23option java_package = "com.google.ortools.service.v1.mathopt";
24
25option csharp_namespace = "Google.OrTools.Service";
26
27// The solvers supported by MathOpt.
28enum SolverTypeProto {
29 SOLVER_TYPE_UNSPECIFIED = 0;
30
31 // Solving Constraint Integer Programs (SCIP) solver (third party).
32 //
33 // Supports LP, MIP, and nonconvex integer quadratic problems. No dual data
34 // for LPs is returned though. Prefer GLOP for LPs.
35 SOLVER_TYPE_GSCIP = 1;
36
37 // Gurobi solver (third party).
38 //
39 // Supports LP, MIP, and nonconvex integer quadratic problems. Generally the
40 // fastest option, but has special licensing.
41 SOLVER_TYPE_GUROBI = 2;
42
43 // Google's Glop solver.
44 //
45 // Supports LP with primal and dual simplex methods.
46 SOLVER_TYPE_GLOP = 3;
47
48 // Google's CP-SAT solver.
49 //
50 // Supports problems where all variables are integer and bounded (or implied
51 // to be after presolve). Experimental support to rescale and discretize
52 // problems with continuous variables.
53 SOLVER_TYPE_CP_SAT = 4;
54
55 // Google's PDLP solver.
56 //
57 // Supports LP and convex diagonal quadratic objectives. Uses first order
58 // methods rather than simplex. Can solve very large problems.
59 SOLVER_TYPE_PDLP = 5;
60
61 // GNU Linear Programming Kit (GLPK) (third party).
62 //
63 // Supports MIP and LP.
64 //
65 // Thread-safety: GLPK use thread-local storage for memory allocations. As a
66 // consequence Solver instances must be destroyed on the same thread as they
67 // are created or GLPK will crash. It seems OK to call Solver::Solve() from
68 // another thread than the one used to create the Solver but it is not
69 // documented by GLPK and should be avoided.
70 //
71 // When solving a LP with the presolver, a solution (and the unbound rays) are
72 // only returned if an optimal solution has been found. Else nothing is
73 // returned. See glpk-5.0/doc/glpk.pdf page #40 available from glpk-5.0.tar.gz
74 // for details.
75 SOLVER_TYPE_GLPK = 6;
76
77 // The Operator Splitting Quadratic Program (OSQP) solver (third party).
78 //
79 // Supports continuous problems with linear constraints and linear or convex
80 // quadratic objectives. Uses a first-order method.
81 SOLVER_TYPE_OSQP = 7;
82
83 // The Embedded Conic Solver (ECOS) (third party).
84 //
85 // Supports LP and SOCP problems. Uses interior point methods (barrier).
86 SOLVER_TYPE_ECOS = 8;
87
88 // The Splitting Conic Solver (SCS) (third party).
89 //
90 // Supports LP and SOCP problems. Uses a first-order method.
91 SOLVER_TYPE_SCS = 9;
92
93 // The HiGHS Solver (third party).
94 //
95 // Supports LP and MIP problems (convex QPs are unimplemented).
96 SOLVER_TYPE_HIGHS = 10;
97
98 // MathOpt's reference implementation of a MIP solver.
99 //
100 // Slow/not recommended for production. Not an LP solver (no dual information
101 // returned).
102 SOLVER_TYPE_SANTORINI = 11;
103
104 // Fico XPRESS solver (third party).
105 //
106 // Supports LP, MIP, and nonconvex integer quadratic problems.
107 // A fast option, but has special licensing.
108 SOLVER_TYPE_XPRESS = 12;
109}
110
111// Selects an algorithm for solving linear programs.
112enum LPAlgorithmProto {
113 LP_ALGORITHM_UNSPECIFIED = 0;
114
115 // The (primal) simplex method. Typically can provide primal and dual
116 // solutions, primal/dual rays on primal/dual unbounded problems, and a basis.
117 LP_ALGORITHM_PRIMAL_SIMPLEX = 1;
118
119 // The dual simplex method. Typically can provide primal and dual
120 // solutions, primal/dual rays on primal/dual unbounded problems, and a basis.
121 LP_ALGORITHM_DUAL_SIMPLEX = 2;
122
123 // The barrier method, also commonly called an interior point method (IPM).
124 // Can typically give both primal and dual solutions. Some implementations can
125 // also produce rays on unbounded/infeasible problems. A basis is not given
126 // unless the underlying solver does "crossover" and finishes with simplex.
127 LP_ALGORITHM_BARRIER = 3;
128
129 // An algorithm based around a first-order method. These will typically
130 // produce both primal and dual solutions, and potentially also certificates
131 // of primal and/or dual infeasibility. First-order methods typically will
132 // provide solutions with lower accuracy, so users should take care to set
133 // solution quality parameters (e.g., tolerances) and to validate solutions.
134 LP_ALGORITHM_FIRST_ORDER = 4;
135}
136
137// Effort level applied to an optional task while solving (see
138// SolveParametersProto for use).
139//
140// Emphasis is used to configure a solver feature as follows:
141// * If a solver doesn't support the feature, only UNSPECIFIED will always be
142// valid, any other setting will typically an invalid argument error (some
143// solvers may also accept OFF).
144// * If the solver supports the feature:
145// - When set to UNSPECIFIED, the underlying default is used.
146// - When the feature cannot be turned off, OFF will return an error.
147// - If the feature is enabled by default, the solver default is typically
148// mapped to MEDIUM.
149// - If the feature is supported, LOW, MEDIUM, HIGH, and VERY HIGH will never
150// give an error, and will map onto their best match.
151enum EmphasisProto {
152 EMPHASIS_UNSPECIFIED = 0;
153 EMPHASIS_OFF = 1;
154 EMPHASIS_LOW = 2;
155 EMPHASIS_MEDIUM = 3;
156 EMPHASIS_HIGH = 4;
157 EMPHASIS_VERY_HIGH = 5;
158}
159
160// Parameters to control a single solve.
161//
162// Contains both parameters common to all solvers e.g. time_limit, and
163// parameters for a specific solver, e.g. gscip. If a value is set in both
164// common and solver specific field, the solver specific setting is used.
165//
166// The common parameters that are optional and unset or an enum with value
167// unspecified indicate that the solver default is used.
168//
169// Solver specific parameters for solvers other than the one in use are ignored.
170//
171// Parameters that depends on the model (e.g. branching priority is set for
172// each variable) are passed in ModelSolveParametersProto.
173message SolveParametersProto {
174 // Maximum time a solver should spend on the problem (or infinite if not set).
175 //
176 // This value is not a hard limit, solve time may slightly exceed this value.
177 // This parameter is always passed to the underlying solver, the solver
178 // default is not used.
179 google.protobuf.Duration time_limit = 1;
180
181 // Limit on the iterations of the underlying algorithm (e.g. simplex pivots).
182 // The specific behavior is dependent on the solver and algorithm used, but
183 // often can give a deterministic solve limit (further configuration may be
184 // needed, e.g. one thread).
185 //
186 // Typically supported by LP, QP, and MIP solvers, but for MIP solvers see
187 // also node_limit.
188 optional int64 iteration_limit = 2;
189
190 // Limit on the number of subproblems solved in enumerative search (e.g.
191 // branch and bound). For many solvers this can be used to deterministically
192 // limit computation (further configuration may be needed, e.g. one thread).
193 //
194 // Typically for MIP solvers, see also iteration_limit.
195 optional int64 node_limit = 24;
196
197 // The solver stops early if it can prove there are no primal solutions at
198 // least as good as cutoff.
199 //
200 // On an early stop, the solver returns termination reason NO_SOLUTION_FOUND
201 // and with limit CUTOFF and is not required to give any extra solution
202 // information. Has no effect on the return value if there is no early stop.
203 //
204 // It is recommended that you use a tolerance if you want solutions with
205 // objective exactly equal to cutoff to be returned.
206 //
207 // See the user guide for more details and a comparison with best_bound_limit.
208 optional double cutoff_limit = 20;
209
210 // The solver stops early as soon as it finds a solution at least this good,
211 // with termination reason FEASIBLE and limit OBJECTIVE.
212 optional double objective_limit = 21;
213
214 // The solver stops early as soon as it proves the best bound is at least this
215 // good, with termination reason FEASIBLE or NO_SOLUTION_FOUND and limit
216 // OBJECTIVE.
217 //
218 // See the user guide for more details and a comparison with cutoff_limit.
219 optional double best_bound_limit = 22;
220
221 // The solver stops early after finding this many feasible solutions, with
222 // termination reason FEASIBLE and limit SOLUTION. Must be greater than zero
223 // if set. It is often used get the solver to stop on the first feasible
224 // solution found. Note that there is no guarantee on the objective value for
225 // any of the returned solutions.
226 //
227 // Solvers will typically not return more solutions than the solution limit,
228 // but this is not enforced by MathOpt, see also b/214041169.
229 //
230 // Currently supported for Gurobi and SCIP, and for CP-SAT only with value 1.
231 optional int32 solution_limit = 23;
232
233 // Enables printing the solver implementation traces. The location of those
234 // traces depend on the solver. For SCIP and Gurobi this will be the standard
235 // output streams. For Glop and CP-SAT this will LOG(INFO).
236 //
237 // Note that if the solver supports message callback and the user registers a
238 // callback for it, then this parameter value is ignored and no traces are
239 // printed.
240 bool enable_output = 3;
241
242 // If set, it must be >= 1.
243 optional int32 threads = 4;
244
245 // Seed for the pseudo-random number generator in the underlying
246 // solver. Note that all solvers use pseudo-random numbers to select things
247 // such as perturbation in the LP algorithm, for tie-break-up rules, and for
248 // heuristic fixings. Varying this can have a noticeable impact on solver
249 // behavior.
250 //
251 // Although all solvers have a concept of seeds, note that valid values
252 // depend on the actual solver.
253 // - Gurobi: [0:GRB_MAXINT] (which as of Gurobi 9.0 is 2x10^9).
254 // - GSCIP: [0:2147483647] (which is MAX_INT or kint32max or 2^31-1).
255 // - GLOP: [0:2147483647] (same as above)
256 // In all cases, the solver will receive a value equal to:
257 // MAX(0, MIN(MAX_VALID_VALUE_FOR_SOLVER, random_seed)).
258 optional int32 random_seed = 5;
259
260 // An absolute optimality tolerance (primarily) for MIP solvers.
261 //
262 // The absolute GAP is the absolute value of the difference between:
263 // * the objective value of the best feasible solution found,
264 // * the dual bound produced by the search.
265 // The solver can stop once the absolute GAP is at most absolute_gap_tolerance
266 // (when set), and return TERMINATION_REASON_OPTIMAL.
267 //
268 // Must be >= 0 if set.
269 //
270 // See also relative_gap_tolerance.
271 optional double absolute_gap_tolerance = 18;
272
273 // A relative optimality tolerance (primarily) for MIP solvers.
274 //
275 // The relative GAP is a normalized version of the absolute GAP (defined on
276 // absolute_gap_tolerance), where the normalization is solver-dependent, e.g.
277 // the absolute GAP divided by the objective value of the best feasible
278 // solution found.
279 //
280 // The solver can stop once the relative GAP is at most relative_gap_tolerance
281 // (when set), and return TERMINATION_REASON_OPTIMAL.
282 //
283 // Must be >= 0 if set.
284 //
285 // See also absolute_gap_tolerance.
286 optional double relative_gap_tolerance = 17;
287
288 // Maintain up to `solution_pool_size` solutions while searching. The solution
289 // pool generally has two functions:
290 // (1) For solvers that can return more than one solution, this limits how
291 // many solutions will be returned.
292 // (2) Some solvers may run heuristics using solutions from the solution
293 // pool, so changing this value may affect the algorithm's path.
294 // To force the solver to fill the solution pool, e.g. with the n best
295 // solutions, requires further, solver specific configuration.
296 optional int32 solution_pool_size = 25;
297
298 // The algorithm for solving a linear program. If LP_ALGORITHM_UNSPECIFIED,
299 // use the solver default algorithm.
300 //
301 // For problems that are not linear programs but where linear programming is
302 // a subroutine, solvers may use this value. E.g. MIP solvers will typically
303 // use this for the root LP solve only (and use dual simplex otherwise).
304 LPAlgorithmProto lp_algorithm = 6;
305
306 // Effort on simplifying the problem before starting the main algorithm, or
307 // the solver default effort level if EMPHASIS_UNSPECIFIED.
308 EmphasisProto presolve = 7;
309
310 // Effort on getting a stronger LP relaxation (MIP only), or the solver
311 // default effort level if EMPHASIS_UNSPECIFIED.
312 //
313 // NOTE: disabling cuts may prevent callbacks from having a chance to add cuts
314 // at MIP_NODE, this behavior is solver specific.
315 EmphasisProto cuts = 8;
316
317 // Effort in finding feasible solutions beyond those encountered in the
318 // complete search procedure (MIP only), or the solver default effort level if
319 // EMPHASIS_UNSPECIFIED.
320 EmphasisProto heuristics = 9;
321
322 // Effort in rescaling the problem to improve numerical stability, or the
323 // solver default effort level if EMPHASIS_UNSPECIFIED.
324 EmphasisProto scaling = 10;
325
326 reserved 12, 13, 14, 15, 16, 19, 26, 27;
327
328 reserved 11; // Deleted
329}