Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
inverted_bounds.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_MATH_OPT_CORE_INVERTED_BOUNDS_H_
15#define OR_TOOLS_MATH_OPT_CORE_INVERTED_BOUNDS_H_
16
17#include <cstdint>
18#include <vector>
19
20#include "absl/status/status.h"
21
23
24// The maximum number of variables/constraints with inverted bounds to report.
25constexpr std::size_t kMaxInvertedBounds = 10;
26
27// The ids of the variables and linear constraints with inverted bounds
28// (lower_bounds > upper_bounds).
29//
30// This is used internally by solvers to return an error on Solve() when bounds
31// are inverted.
33 // Returns true if this object contains no variable/constraint ids.
34 bool empty() const { return variables.empty() && linear_constraints.empty(); }
35
36 // Returns an error listing at most kMaxInvertedBounds variables and linear
37 // constraints ids (kMaxInvertedBounds of each). Returns OK status if this
38 // object is empty.
39 absl::Status ToStatus() const;
40
41 // Ids of the variables with inverted bounds.
42 std::vector<int64_t> variables;
43
44 // Ids of the linear constraints with inverted bounds.
45 std::vector<int64_t> linear_constraints;
46};
47
48} // namespace operations_research::math_opt
49
50#endif // OR_TOOLS_MATH_OPT_CORE_INVERTED_BOUNDS_H_
An object oriented wrapper for quadratic constraints in ModelStorage.
Definition gurobi_isv.cc:28
constexpr std::size_t kMaxInvertedBounds
The maximum number of variables/constraints with inverted bounds to report.
std::vector< int64_t > linear_constraints
Ids of the linear constraints with inverted bounds.
bool empty() const
Returns true if this object contains no variable/constraint ids.
std::vector< int64_t > variables
Ids of the variables with inverted bounds.