OR-Tools  9.6
solution_validator.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_VALIDATORS_SOLUTION_VALIDATOR_H_
15 #define OR_TOOLS_MATH_OPT_VALIDATORS_SOLUTION_VALIDATOR_H_
16 
17 #include "absl/status/status.h"
19 #include "ortools/math_opt/model_parameters.pb.h"
20 #include "ortools/math_opt/solution.pb.h"
21 #include "ortools/math_opt/sparse_containers.pb.h"
22 
23 namespace operations_research {
24 namespace math_opt {
25 
26 absl::Status ValidateSolution(const SolutionProto& solution,
27  const ModelSolveParametersProto& parameters,
28  const ModelSummary& model_summary);
29 
30 absl::Status ValidatePrimalSolution(const PrimalSolutionProto& primal_solution,
31  const SparseVectorFilterProto& filter,
32  const ModelSummary& model_summary);
33 
34 // Used to validate callback solutions, which are represented by a
35 // SparseDoubleVectorProto and not the full PrimalSolutionProto message. Does
36 // the same checks on a SparseDoubleVectorProto that ValidatePrimalSolution does
37 // on the variable_values sub-message of a PrimalSolutionProto.
38 absl::Status ValidatePrimalSolutionVector(const SparseDoubleVectorProto& vector,
39  const SparseVectorFilterProto& filter,
40  const ModelSummary& model_summary);
41 
42 absl::Status ValidatePrimalRay(const PrimalRayProto& primal_ray,
43  const SparseVectorFilterProto& filter,
44  const ModelSummary& model_summary);
45 
46 absl::Status ValidateDualSolution(const DualSolutionProto& dual_solution,
47  const ModelSolveParametersProto& parameters,
48  const ModelSummary& model_summary);
49 
50 absl::Status ValidateDualRay(const DualRayProto& dual_ray,
51  const ModelSolveParametersProto& parameters,
52  const ModelSummary& model_summary);
53 
54 absl::Status ValidateBasis(const BasisProto& basis,
55  const ModelSummary& model_summary,
56  bool check_dual_feasibility = true);
57 
58 } // namespace math_opt
59 } // namespace operations_research
60 
61 #endif // OR_TOOLS_MATH_OPT_VALIDATORS_SOLUTION_VALIDATOR_H_
SatParameters parameters
absl::Status ValidateBasis(const BasisProto &basis, const ModelSummary &model_summary, const bool check_dual_feasibility)
absl::Status ValidatePrimalSolution(const PrimalSolutionProto &primal_solution, const SparseVectorFilterProto &filter, const ModelSummary &model_summary)
absl::Status ValidatePrimalSolutionVector(const SparseDoubleVectorProto &vector, const SparseVectorFilterProto &filter, const ModelSummary &model_summary)
absl::Status ValidatePrimalRay(const PrimalRayProto &primal_ray, const SparseVectorFilterProto &filter, const ModelSummary &model_summary)
absl::Status ValidateDualRay(const DualRayProto &dual_ray, const ModelSolveParametersProto &parameters, const ModelSummary &model_summary)
absl::Status ValidateSolution(const SolutionProto &solution, const ModelSolveParametersProto &parameters, const ModelSummary &model_summary)
absl::Status ValidateDualSolution(const DualSolutionProto &dual_solution, const ModelSolveParametersProto &parameters, const ModelSummary &model_summary)
Collection of objects used to extend the Constraint Solver library.