OR-Tools  9.6
solve_stats_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_SOLVE_STATS_VALIDATOR_H_
15 #define OR_TOOLS_MATH_OPT_VALIDATORS_SOLVE_STATS_VALIDATOR_H_
16 
17 #include "absl/status/status.h"
18 #include "ortools/math_opt/result.pb.h"
19 
20 namespace operations_research {
21 namespace math_opt {
22 
23 absl::Status ValidateProblemStatus(const ProblemStatusProto& status);
24 absl::Status ValidateSolveStats(const SolveStatsProto& solve_stats);
25 
26 // Returns absl::Ok only if status.primal_status = required_status. Assumes
27 // validateProblemStatus(status) returns absl::Ok.
28 absl::Status CheckPrimalStatusIs(const ProblemStatusProto& status,
29  FeasibilityStatusProto required_status);
30 
31 // Returns absl::Ok only if status.primal_status != forbidden_status. Assumes
32 // validateProblemStatus(status) returns absl::Ok.
33 absl::Status CheckPrimalStatusIsNot(const ProblemStatusProto& status,
34  FeasibilityStatusProto forbidden_status);
35 
36 // If primal_or_dual_infeasible_also_ok is false, returns absl::Ok only if
37 // status.dual_status = required_status. If primal_or_dual_infeasible_also_ok
38 // is true, it returns absl::Ok when status.dual_status = required_status and
39 // when primal_or_dual_infeasible is true. Assumes validateProblemStatus(status)
40 // returns absl::Ok.
41 absl::Status CheckDualStatusIs(const ProblemStatusProto& status,
42  FeasibilityStatusProto required_status,
43  bool primal_or_dual_infeasible_also_ok = false);
44 
45 // Returns absl::Ok only if status.dual_status != forbidden_status. Assumes
46 // validateProblemStatus(status) returns absl::Ok.
47 absl::Status CheckDualStatusIsNot(const ProblemStatusProto& status,
48  FeasibilityStatusProto forbidden_status);
49 
50 } // namespace math_opt
51 } // namespace operations_research
52 
53 #endif // OR_TOOLS_MATH_OPT_VALIDATORS_SOLVE_STATS_VALIDATOR_H_
absl::Status status
Definition: g_gurobi.cc:41
absl::Status CheckPrimalStatusIs(const ProblemStatusProto &status, const FeasibilityStatusProto required_status)
absl::Status CheckDualStatusIs(const ProblemStatusProto &status, const FeasibilityStatusProto required_status, const bool primal_or_dual_infeasible_also_ok)
absl::Status ValidateProblemStatus(const ProblemStatusProto &status)
absl::Status CheckDualStatusIsNot(const ProblemStatusProto &status, const FeasibilityStatusProto forbidden_status)
absl::Status CheckPrimalStatusIsNot(const ProblemStatusProto &status, const FeasibilityStatusProto forbidden_status)
absl::Status ValidateSolveStats(const SolveStatsProto &solve_stats)
Collection of objects used to extend the Constraint Solver library.