Google OR-Tools v9.11
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-2024 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.math_opt;
19
20import "ortools/math_opt/solution.proto";
21import "ortools/math_opt/sparse_containers.proto";
22
23option java_package = "com.google.ortools.mathopt";
24option java_multiple_files = true;
25
26// A suggested starting solution for the solver.
27//
28// MIP solvers generally only want primal information (`variable_values`), while
29// LP solvers want both primal and dual information (`dual_values`).
30//
31// Many MIP solvers can work with: (1) partial solutions that do not specify all
32// variables or (2) infeasible solutions. In these cases, solvers typically
33// solve a sub-MIP to complete/correct the hint.
34//
35// How the hint is used by the solver, if at all, is highly dependent on the
36// solver, the problem type, and the algorithm used. The most reliable way to
37// ensure your hint has an effect is to read the underlying solvers logs with
38// and without the hint.
39//
40// Simplex-based LP solvers typically prefer an initial basis to a solution hint
41// (they need to crossover to convert the hint to a basic feasible solution
42// otherwise).
43//
44// TODO(b/183616124): Add hint-priorities to variable_values.
45message SolutionHintProto {
46 // A possibly partial assignment of values to the primal variables of the
47 // problem. The solver-independent requirements for this sub-message are:
48 // * variable_values.ids are elements of VariablesProto.ids.
49 // * variable_values.values must all be finite.
50 SparseDoubleVectorProto variable_values = 1;
51
52 // A (potentially partial) assignment of values to the linear constraints of
53 // the problem.
54 //
55 // Requirements:
56 // * dual_values.ids are elements of LinearConstraintsProto.ids.
57 // * dual_values.values must all be finite.
58 SparseDoubleVectorProto dual_values = 2;
59}
60
61// Parameters for an individual objective in a multi-objective model.
62message ObjectiveParametersProto {
63 // Optional objective degradation absolute tolerance. For a hierarchical
64 // multi-objective solver, each objective fⁱ is processed in priority order:
65 // the solver determines the optimal objective value Γⁱ, if it exists, subject
66 // to all constraints in the model and the additional constraints that
67 // fᵏ(x) = Γᵏ (within tolerances) for each k < i. If set, a solution is
68 // considered to be "within tolerances" for this objective fᵏ if
69 // |fᵏ(x) - Γᵏ| ≤ `objective_degradation_absolute_tolerance`.
70 //
71 // See also `objective_degradation_relative_tolerance`; if both parameters are
72 // set for a given objective, the solver need only satisfy one to be
73 // considered "within tolerances".
74 //
75 // If set, must be nonnegative.
76 optional double objective_degradation_absolute_tolerance = 7;
77
78 // Optional objective degradation relative tolerance. For a hierarchical
79 // multi-objective solver, each objective fⁱ is processed in priority order:
80 // the solver determines the optimal objective value Γⁱ, if it exists, subject
81 // to all constraints in the model and the additional constraints that
82 // fᵏ(x) = Γᵏ (within tolerances) for each k < i. If set, a solution is
83 // considered to be "within tolerances" for this objective fᵏ if
84 // |fᵏ(x) - Γᵏ| ≤ `objective_degradation_relative_tolerance` * |Γᵏ|.
85 //
86 // See also `objective_degradation_absolute_tolerance`; if both parameters are
87 // set for a given objective, the solver need only satisfy one to be
88 // considered "within tolerances".
89 //
90 // If set, must be nonnegative.
91 optional double objective_degradation_relative_tolerance = 8;
92}
93
94// TODO(b/183628247): follow naming convention in fields below.
95// Parameters to control a single solve that are specific to the input model
96// (see SolveParametersProto for model independent parameters).
97message ModelSolveParametersProto {
98 // Filter that is applied to all returned sparse containers keyed by variables
99 // in PrimalSolutionProto and PrimalRayProto
100 // (PrimalSolutionProto.variable_values, PrimalRayProto.variable_values).
101 //
102 // Requirements:
103 // * filtered_ids are elements of VariablesProto.ids.
104 SparseVectorFilterProto variable_values_filter = 1;
105
106 // Filter that is applied to all returned sparse containers keyed by linear
107 // constraints in DualSolutionProto and DualRay
108 // (DualSolutionProto.dual_values, DualRay.dual_values).
109 //
110 // Requirements:
111 // * filtered_ids are elements of LinearConstraints.ids.
112 SparseVectorFilterProto dual_values_filter = 2;
113
114 // Filter that is applied to all returned sparse containers keyed by quadratic
115 // constraints in DualSolutionProto and DualRay
116 // (DualSolutionProto.quadratic_dual_values, DualRay.quadratic_dual_values).
117 //
118 // Requirements:
119 // * filtered_ids are keys of ModelProto.quadratic_constraints.
120 SparseVectorFilterProto quadratic_dual_values_filter = 10;
121
122 // Filter that is applied to all returned sparse containers keyed by variables
123 // in DualSolutionProto and DualRay (DualSolutionProto.reduced_costs,
124 // DualRay.reduced_costs).
125 //
126 // Requirements:
127 // * filtered_ids are elements of VariablesProto.ids.
128 SparseVectorFilterProto reduced_costs_filter = 3;
129
130 // Optional initial basis for warm starting simplex LP solvers. If set, it is
131 // expected to be valid according to `ValidateBasis` in
132 // `validators/solution_validator.h` for the current `ModelSummary`.
133 BasisProto initial_basis = 4;
134
135 // Optional solution hints. If the underlying solver only accepts a single
136 // hint, the first hint is used.
137 repeated SolutionHintProto solution_hints = 5;
138
139 // Optional branching priorities. Variables with higher values will be
140 // branched on first. Variables for which priorities are not set get the
141 // solver's default priority (usually zero).
142 //
143 // Requirements:
144 // * branching_priorities.values must be finite.
145 // * branching_priorities.ids must be elements of VariablesProto.ids.
146 SparseInt32VectorProto branching_priorities = 6;
147
148 // Optional parameters for the primary objective in a multi-objective model.
149 ObjectiveParametersProto primary_objective_parameters = 7;
150
151 // Optional parameters for the auxiliary objectives in a multi-objective
152 // model.
153 //
154 // Requirements:
155 // * Map keys must also be map keys of ModelProto.auxiliary_objectives.
156 map<int64, ObjectiveParametersProto> auxiliary_objective_parameters = 8;
157
158 // Optional lazy constraint annotations. Included linear constraints will be
159 // marked as "lazy" with supporting solvers, meaning that they will only be
160 // added to the working model as-needed as the solver runs.
161 //
162 // Note that this an algorithmic hint that does not affect the model's
163 // feasible region; solvers not supporting these annotations will simply
164 // ignore it.
165 //
166 // Requirements:
167 // * Each entry must be an element of VariablesProto.ids.
168 // * Entries must be in strictly increasing order (i.e., sorted, no repeats).
169 repeated int64 lazy_linear_constraint_ids = 9;
170}