Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
model_validator.h
Go to the documentation of this file.
1// Copyright 2010-2024 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 <optional>
18#include <string>
19
20#include "absl/types/optional.h"
21#include "ortools/linear_solver/linear_solver.pb.h"
23
24namespace operations_research {
38std::string FindErrorInMPModelProto(
39 const MPModelProto& model, double abs_value_threshold = 0.0,
40 // If false, variable and constraint bounds like [lb=1.2, ub=0.7] yield an
41 // error, and also integer variable bounds like [0.7, 0.8].
42 bool accept_trivially_infeasible_bounds = false);
43
50std::string FindErrorInMPModelDeltaProto(const MPModelDeltaProto& delta,
51 const MPModelProto& model);
52
57std::optional<LazyMutableCopy<MPModelProto>>
58ExtractValidMPModelOrPopulateResponseStatus(const MPModelRequest& request,
59 MPSolutionResponse* response);
60
66std::optional<LazyMutableCopy<MPModelProto>> GetMPModelOrPopulateResponse(
67 LazyMutableCopy<MPModelRequest>& request, MPSolutionResponse* response);
68
79std::string FindFeasibilityErrorInSolutionHint(const MPModelProto& model,
80 double tolerance);
81
82// Partially merges a MPConstraintProto onto another, skipping only the
83// repeated fields "var_index" and "coefficients". This is used within
84// FindErrorInMPModelDeltaProto.
85// See the unit test MergeMPConstraintProtoExceptTermsTest that explains why we
86// need this.
87void MergeMPConstraintProtoExceptTerms(const MPConstraintProto& from,
88 MPConstraintProto* to);
89
90// Applies the given model_delta to "model". Assumes that
91// FindErrorInMPModelDeltaProto() found no error. For full error checking,
92// please use ExtractValidMPModelOrPopulateResponseStatus() instead.
93void ApplyVerifiedMPModelDelta(const MPModelDeltaProto& delta,
94 MPModelProto* model);
95
96} // namespace operations_research
97
98#endif // OR_TOOLS_LINEAR_SOLVER_MODEL_VALIDATOR_H_
GRBmodel * model
In SWIG mode, we don't want anything besides these top-level includes.
std::optional< LazyMutableCopy< MPModelProto > > ExtractValidMPModelOrPopulateResponseStatus(const MPModelRequest &request, MPSolutionResponse *response)
std::string FindErrorInMPModelDeltaProto(const MPModelDeltaProto &delta, const MPModelProto &model)
void ApplyVerifiedMPModelDelta(const MPModelDeltaProto &delta, MPModelProto *model)
std::optional< LazyMutableCopy< MPModelProto > > GetMPModelOrPopulateResponse(LazyMutableCopy< MPModelRequest > &request, MPSolutionResponse *response)
std::string FindErrorInMPModelProto(const MPModelProto &model, double abs_value_threshold, const bool accept_trivially_infeasible_bounds)
std::string FindFeasibilityErrorInSolutionHint(const MPModelProto &model, double tolerance)
void MergeMPConstraintProtoExceptTerms(const MPConstraintProto &from, MPConstraintProto *to)
trees with all degrees equal to
int64_t delta
Definition resource.cc:1709