Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
model_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// Solve parameters that are specific to the model.
15
16syntax = "proto3";
17
18package operations_research.service.v1.mathopt;
19
20import "ortools/service/v1/mathopt/solution.proto";
21import "ortools/service/v1/mathopt/sparse_containers.proto";
22
23option java_multiple_files = true;
24option java_package = "com.google.ortools.service.v1.mathopt";
25
26option csharp_namespace = "Google.OrTools.Service";
27
28// A suggested starting solution for the solver.
29//
30// MIP solvers generally only want primal information (`variable_values`), while
31// LP solvers want both primal and dual information (`dual_values`).
32//
33// Many MIP solvers can work with: (1) partial solutions that do not specify all
34// variables or (2) infeasible solutions. In these cases, solvers typically
35// solve a sub-MIP to complete/correct the hint.
36//
37// How the hint is used by the solver, if at all, is highly dependent on the
38// solver, the problem type, and the algorithm used. The most reliable way to
39// ensure your hint has an effect is to read the underlying solvers logs with
40// and without the hint.
41//
42// Simplex-based LP solvers typically prefer an initial basis to a solution hint
43// (they need to crossover to convert the hint to a basic feasible solution
44// otherwise).
45//
46// TODO(b/183616124): Add hint-priorities to variable_values.
47message SolutionHintProto {
48 // A possibly partial assignment of values to the primal variables of the
49 // problem. The solver-independent requirements for this sub-message are:
50 // * variable_values.ids are elements of VariablesProto.ids.
51 // * variable_values.values must all be finite.
52 SparseDoubleVectorProto variable_values = 1;
53
54 // A (potentially partial) assignment of values to the linear constraints of
55 // the problem.
56 //
57 // Requirements:
58 // * dual_values.ids are elements of LinearConstraintsProto.ids.
59 // * dual_values.values must all be finite.
60 SparseDoubleVectorProto dual_values = 2;
61}
62
63// TODO(b/183628247): follow naming convention in fields below.
64// Parameters to control a single solve that that are specific to the input
65// model (see SolveParametersProto for model independent parameters).
66message ModelSolveParametersProto {
67 // Filter that is applied to all returned sparse containers keyed by variables
68 // in PrimalSolutionProto and PrimalRayProto
69 // (PrimalSolutionProto.variable_values, PrimalRayProto.variable_values).
70 //
71 // Requirements:
72 // * filtered_ids are elements of VariablesProto.ids.
73 SparseVectorFilterProto variable_values_filter = 1;
74
75 // Filter that is applied to all returned sparse containers keyed by linear
76 // constraints in DualSolutionProto and DualRay
77 // (DualSolutionProto.dual_values, DualRay.dual_values).
78 //
79 // Requirements:
80 // * filtered_ids are elements of LinearConstraints.ids.
81 SparseVectorFilterProto dual_values_filter = 2;
82
83 // Filter that is applied to all returned sparse containers keyed by variables
84 // in DualSolutionProto and DualRay (DualSolutionProto.reduced_costs,
85 // DualRay.reduced_costs).
86 //
87 // Requirements:
88 // * filtered_ids are elements of VariablesProto.ids.
89 SparseVectorFilterProto reduced_costs_filter = 3;
90
91 // Optional initial basis for warm starting simplex LP solvers. If set, it is
92 // expected to be valid according to `ValidateBasis` in
93 // `validators/solution_validator.h` for the current `ModelSummary`.
94 BasisProto initial_basis = 4;
95
96 // Optional solution hints. If the underlying solver only accepts a single
97 // hint, the first hint is used.
98 repeated SolutionHintProto solution_hints = 5;
99
100 // Optional branching priorities. Variables with higher values will be
101 // branched on first. Variables for which priorities are not set get the
102 // solver's default priority (usually zero).
103 //
104 // Requirements:
105 // * branching_priorities.values must be finite.
106 // * branching_priorities.ids must be elements of VariablesProto.ids.
107 SparseInt32VectorProto branching_priorities = 6;
108}