C++ Reference

C++ Reference: Linear solver

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 
19 #include "ortools/linear_solver/linear_solver.pb.h"
20 
21 namespace operations_research {
31 std::string FindErrorInMPModelProto(const MPModelProto& model);
32 
39 std::string FindErrorInMPModelDeltaProto(const MPModelDeltaProto& delta,
40  const MPModelProto& model);
41 
47 bool MPRequestIsEmptyOrInvalid(const MPModelRequest& request,
48  MPSolutionResponse* response);
49 
60 std::string FindFeasibilityErrorInSolutionHint(const MPModelProto& model,
61  double tolerance);
62 
63 // PUBLIC ONLY FOR TESTING.
64 // Partially merges a MPConstraintProto onto another, skipping only the
65 // repeated fields "var_index" and "coefficients". This is used within
66 // FindErrorInMPModelDeltaProto.
67 // See the unit test MergeMPConstraintProtoExceptTermsTest that explains why we
68 // need this.
69 void MergeMPConstraintProtoExceptTerms(const MPConstraintProto& from,
70  MPConstraintProto* to);
71 
72 } // namespace operations_research
73 
74 #endif // OR_TOOLS_LINEAR_SOLVER_MODEL_VALIDATOR_H_
bool MPRequestIsEmptyOrInvalid(const MPModelRequest &request, MPSolutionResponse *response)
Updates response and returns true if errors, infeasibilities, or trivial optimals were found.
void MergeMPConstraintProtoExceptTerms(const MPConstraintProto &from, MPConstraintProto *to)
std::string FindErrorInMPModelDeltaProto(const MPModelDeltaProto &delta, const MPModelProto &model)
Like FindErrorInMPModelProto, but for a MPModelDeltaProto applied to a given baseline model (assumed ...
std::string FindFeasibilityErrorInSolutionHint(const MPModelProto &model, double tolerance)
Returns an empty std::string if the solution hint given in the model is a feasible solution.
std::string FindErrorInMPModelProto(const MPModelProto &model)
Returns an empty std::string iff the model is valid and not trivially infeasible.