OR-Tools  9.6
update_result.h
Go to the documentation of this file.
1 // Copyright 2010-2022 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 #ifndef OR_TOOLS_MATH_OPT_CPP_UPDATE_RESULT_H_
15 #define OR_TOOLS_MATH_OPT_CPP_UPDATE_RESULT_H_
16 
17 #include <optional>
18 #include <utility>
19 
20 #include "ortools/math_opt/model_update.pb.h"
21 
23 
24 // Result of the Update() on an incremental solver.
25 struct UpdateResult {
26  UpdateResult(const bool did_update, std::optional<ModelUpdateProto> update)
27  : did_update(did_update), update(std::move(update)) {}
28 
29  // True if the solver has been successfully updated or if no update was
30  // necessary (in which case `update` will be nullopt). False if the solver
31  // had to be recreated.
32  bool did_update;
33 
34  // The update that was attempted on the solver. Can be nullopt when no
35  // update was needed (the model was not changed).
36  std::optional<ModelUpdateProto> update;
37 };
38 
39 } // namespace operations_research::math_opt
40 
41 #endif // OR_TOOLS_MATH_OPT_CPP_UPDATE_RESULT_H_
std::optional< ModelUpdateProto > update
Definition: update_result.h:36
UpdateResult(const bool did_update, std::optional< ModelUpdateProto > update)
Definition: update_result.h:26