OR-Tools  9.2
solve_stats_validator.h
Go to the documentation of this file.
1// Copyright 2010-2021 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
20namespace operations_research {
21namespace math_opt {
22
23absl::Status ValidateProblemStatus(const ProblemStatusProto& status);
24absl::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.
28absl::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.
33absl::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.
41absl::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.
47absl::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:35
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.