model_validator.h
Go to the documentation of this file.
1 // Copyright 2010-2018 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_LINEAR_SOLVER_MODEL_VALIDATOR_H_
15 #define OR_TOOLS_LINEAR_SOLVER_MODEL_VALIDATOR_H_
16 
17 #include <string>
18 
20 
21 namespace operations_research {
22 // Returns an empty std::string iff the model is valid and not trivially
23 // infeasible. Otherwise, returns a description of the first error or trivial
24 // infeasibility encountered.
25 //
26 // NOTE(user): the code of this method (and the client code too!) is
27 // considerably simplified by this std::string-based, simple API. If clients
28 // require it, we could add a formal error status enum.
29 std::string FindErrorInMPModelProto(const MPModelProto& model);
30 
31 // Returns an empty std::string if the solution hint given in the model is a
32 // feasible solution. Otherwise, returns a description of the first reason for
33 // infeasibility.
34 //
35 // This function can be useful for debugging/checking that the given solution
36 // hint is feasible when it is expected to be the case. The feasibility is
37 // checked up to the given tolerance using the
38 // ::operations_research::IsLowerWithinTolerance() function.
39 std::string FindFeasibilityErrorInSolutionHint(const MPModelProto& model,
40  double tolerance);
41 
42 } // namespace operations_research
43 
44 #endif // OR_TOOLS_LINEAR_SOLVER_MODEL_VALIDATOR_H_
std::string FindFeasibilityErrorInSolutionHint(const MPModelProto &model, double tolerance)
std::string FindErrorInMPModelProto(const MPModelProto &model)